rj_schema 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rj_schema/rapidjson/CMakeLists.txt +9 -4
  3. data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +10 -0
  4. data/ext/rj_schema/rapidjson/appveyor.yml +22 -9
  5. data/ext/rj_schema/rapidjson/bin/data/abcde.txt +1 -0
  6. data/ext/rj_schema/rapidjson/bin/unittestschema/address.json +139 -0
  7. data/ext/rj_schema/rapidjson/bin/unittestschema/allOf_address.json +7 -0
  8. data/ext/rj_schema/rapidjson/bin/unittestschema/anyOf_address.json +7 -0
  9. data/ext/rj_schema/rapidjson/bin/unittestschema/oneOf_address.json +7 -0
  10. data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +2 -2
  11. data/ext/rj_schema/rapidjson/doc/dom.md +1 -0
  12. data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +1 -0
  13. data/ext/rj_schema/rapidjson/doc/faq.md +3 -3
  14. data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +8 -8
  15. data/ext/rj_schema/rapidjson/doc/internals.md +1 -1
  16. data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +2 -2
  17. data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +1 -1
  18. data/ext/rj_schema/rapidjson/doc/sax.md +1 -1
  19. data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +2 -2
  20. data/ext/rj_schema/rapidjson/doc/stream.md +1 -1
  21. data/ext/rj_schema/rapidjson/doc/tutorial.md +1 -1
  22. data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +7 -6
  23. data/ext/rj_schema/rapidjson/example/CMakeLists.txt +1 -0
  24. data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +118 -0
  25. data/ext/rj_schema/rapidjson/example/sortkeys/sortkeys.cpp +62 -0
  26. data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +1 -1
  27. data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +6 -6
  28. data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +1 -1
  29. data/ext/rj_schema/rapidjson/include/rapidjson/document.h +124 -35
  30. data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +1 -1
  31. data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +1 -1
  32. data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +49 -1
  33. data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +56 -1
  34. data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +2 -2
  35. data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +1 -1
  36. data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +2 -2
  37. data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +2 -2
  38. data/ext/rj_schema/rapidjson/include/rapidjson/internal/clzll.h +71 -0
  39. data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +3 -17
  40. data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +1 -1
  41. data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +1 -1
  42. data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +1 -1
  43. data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +1 -1
  44. data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +1 -1
  45. data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +20 -13
  46. data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +4 -3
  47. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +1 -1
  48. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +1 -1
  49. data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +1 -1
  50. data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +50 -35
  51. data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +1 -1
  52. data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +1 -1
  53. data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +1 -1
  54. data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +63 -5
  55. data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +2 -2
  56. data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +63 -1
  57. data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +67 -53
  58. data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +318 -164
  59. data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +1 -1
  60. data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +1 -1
  61. data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +10 -10
  62. data/ext/rj_schema/rapidjson/readme.md +51 -1
  63. data/ext/rj_schema/rapidjson/readme.zh-cn.md +2 -2
  64. data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +1 -1
  65. data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +1 -1
  66. data/ext/rj_schema/rapidjson/test/perftest/perftest.h +1 -1
  67. data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +2 -2
  68. data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +75 -1
  69. data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +1 -0
  70. data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +1 -1
  71. data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +1 -1
  72. data/ext/rj_schema/rapidjson/test/unittest/clzlltest.cpp +34 -0
  73. data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +19 -19
  74. data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +1 -1
  75. data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +1 -1
  76. data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +1 -1
  77. data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +1 -1
  78. data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +45 -2
  79. data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +1 -1
  80. data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +10 -10
  81. data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +8 -8
  82. data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +1 -1
  83. data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +1 -1
  84. data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +1 -1
  85. data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +157 -16
  86. data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +1 -1
  87. data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +113 -75
  88. data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +2 -1
  89. data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +593 -78
  90. data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +1 -1
  91. data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +1 -1
  92. data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +5 -5
  93. data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +1 -1
  94. data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +1 -1
  95. data/ext/rj_schema/rapidjson/test/unittest/unittest.h +4 -1
  96. data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +12 -12
  97. data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +1 -1
  98. data/ext/rj_schema/rapidjson/thirdparty/gtest/BUILD.bazel +175 -0
  99. data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +18 -1
  100. data/ext/rj_schema/rapidjson/thirdparty/gtest/CONTRIBUTING.md +160 -0
  101. data/ext/rj_schema/rapidjson/thirdparty/gtest/LICENSE +28 -0
  102. data/ext/rj_schema/rapidjson/thirdparty/gtest/Makefile.am +14 -0
  103. data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +16 -35
  104. data/ext/rj_schema/rapidjson/thirdparty/gtest/WORKSPACE +8 -0
  105. data/ext/rj_schema/rapidjson/thirdparty/gtest/appveyor.yml +104 -0
  106. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +44 -0
  107. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +36 -0
  108. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-linux.sh +41 -0
  109. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-osx.sh +40 -0
  110. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +48 -0
  111. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-linux.sh +49 -0
  112. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-osx.sh +39 -0
  113. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/log-config.sh +51 -0
  114. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/travis.sh +44 -0
  115. data/ext/rj_schema/rapidjson/thirdparty/gtest/configure.ac +16 -0
  116. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +1 -1
  117. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +72 -32
  118. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +53 -42
  119. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +9 -0
  120. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +9 -0
  121. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +4 -4
  122. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +6 -4
  123. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +117 -132
  124. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +7 -4
  125. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +20 -12
  126. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +1 -2
  127. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +83 -26
  128. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +262 -68
  129. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +45 -6
  130. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +650 -366
  131. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +76 -20
  132. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +308 -229
  133. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +18 -15
  134. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +87 -26
  135. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +33 -16
  136. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +1209 -353
  137. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +33 -0
  138. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +159 -88
  139. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +2 -1
  140. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +1 -1
  141. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +3 -4
  142. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +16 -9
  143. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +71 -8
  144. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +7 -11
  145. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +14 -0
  146. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +69 -6
  147. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +2 -2
  148. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +69 -6
  149. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +83 -8
  150. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +14 -0
  151. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +63 -2
  152. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +63 -2
  153. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +76 -3
  154. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +1 -1
  155. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +4 -5
  156. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +3 -3
  157. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +1 -1
  158. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +36 -6
  159. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +210 -135
  160. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +108 -48
  161. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +23 -1
  162. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +123 -0
  163. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +166 -2
  164. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +1 -1
  165. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +64 -62
  166. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +43 -18
  167. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +11 -9
  168. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +91 -36
  169. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +33 -14
  170. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +1286 -167
  171. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +85 -83
  172. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +102 -15
  173. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +136 -9
  174. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +1 -1
  175. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +1 -1
  176. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +24 -2
  177. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +8 -5
  178. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +20 -1
  179. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +8 -1
  180. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +3 -2
  181. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +44 -2
  182. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +5 -7
  183. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +40 -14
  184. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +60 -31
  185. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +232 -171
  186. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +9 -0
  187. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +10 -0
  188. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +54 -16
  189. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +1 -1
  190. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +146 -0
  191. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +2 -2
  192. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +6 -6
  193. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{AdvancedGuide.md → advanced.md} +260 -26
  194. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{FAQ.md → faq.md} +62 -57
  195. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{Primer.md → primer.md} +43 -9
  196. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{Samples.md → samples.md} +0 -0
  197. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +53 -5
  198. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +1 -2
  199. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +30 -36
  200. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +8 -17
  201. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +140 -51
  202. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +2 -3
  203. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +4 -3
  204. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +126 -30
  205. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +6 -7
  206. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +8 -5
  207. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +6 -5
  208. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +4 -0
  209. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +13 -57
  210. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +1 -2
  211. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +98 -59
  212. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +34 -41
  213. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +3 -10
  214. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +9 -17
  215. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +8 -1
  216. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +232 -99
  217. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +3 -3
  218. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +17 -1
  219. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +17 -1
  220. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +55 -0
  221. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +149 -0
  222. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +18 -0
  223. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +55 -0
  224. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +149 -0
  225. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +18 -0
  226. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +154 -0
  227. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +18 -0
  228. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +162 -0
  229. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +18 -0
  230. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +199 -0
  231. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +26 -0
  232. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +191 -0
  233. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +26 -0
  234. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +188 -0
  235. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +18 -0
  236. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +180 -0
  237. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +18 -0
  238. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +6 -2
  239. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +1 -1
  240. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +0 -4
  241. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +2 -1
  242. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +2 -1
  243. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +7 -6
  244. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +5 -1
  245. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +3 -3
  246. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +2 -1
  247. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +10 -22
  248. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +2 -1
  249. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +0 -3
  250. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +1 -1
  251. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +10 -10
  252. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1 -1
  253. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +1 -1
  254. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +226 -32
  255. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +5 -7
  256. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +21 -29
  257. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +85 -67
  258. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +93 -8
  259. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +1 -9
  260. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +1 -0
  261. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +622 -164
  262. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +1 -1
  263. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +396 -0
  264. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +12 -15
  265. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +2 -12
  266. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +1 -1
  267. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +6 -8
  268. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +1 -5
  269. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +84 -29
  270. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +1 -5
  271. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +11 -12
  272. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +165 -63
  273. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +1 -1
  274. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +1 -1
  275. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +1 -1
  276. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +13 -13
  277. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +119 -0
  278. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +1 -3
  279. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +1 -2
  280. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +0 -2
  281. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +1 -1
  282. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +1 -2
  283. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +0 -8
  284. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +6 -4
  285. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +0 -2
  286. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +0 -3
  287. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +20 -18
  288. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +0 -2
  289. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +1 -1
  290. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +162 -0
  291. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +611 -0
  292. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +60 -0
  293. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +4 -4
  294. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +2 -2
  295. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +11 -7
  296. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +17 -12
  297. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +104 -66
  298. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +1 -1
  299. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +2 -2
  300. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +2 -19
  301. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +0 -6
  302. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +12 -14
  303. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +65 -0
  304. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +44 -0
  305. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +1 -1
  306. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +4 -5
  307. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +2 -2
  308. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +240 -149
  309. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +0 -1
  310. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +0 -1
  311. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +15 -7
  312. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +100 -30
  313. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +0 -2
  314. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +25 -23
  315. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +1 -1
  316. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +1 -1
  317. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +4 -4
  318. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +47 -0
  319. data/ext/rj_schema/rapidjson/travis-doxygen.sh +13 -6
  320. data/ext/rj_schema/rj_schema.cpp +161 -17
  321. data/lib/rj_schema.rb +1 -1
  322. metadata +63 -58
  323. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DevGuide.md +0 -132
  324. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CheatSheet.md +0 -525
  325. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CookBook.md +0 -3250
  326. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/Documentation.md +0 -11
  327. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/ForDummies.md +0 -439
  328. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md +0 -624
  329. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CheatSheet.md +0 -534
  330. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CookBook.md +0 -3342
  331. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/Documentation.md +0 -12
  332. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/ForDummies.md +0 -439
  333. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md +0 -628
  334. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CheatSheet.md +0 -556
  335. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CookBook.md +0 -3432
  336. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/Documentation.md +0 -12
  337. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/ForDummies.md +0 -439
  338. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md +0 -628
  339. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/DevGuide.md +0 -126
  340. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Documentation.md +0 -14
  341. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_AdvancedGuide.md +0 -2096
  342. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Documentation.md +0 -12
  343. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_FAQ.md +0 -886
  344. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Primer.md +0 -497
  345. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_PumpManual.md +0 -177
  346. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_XcodeGuide.md +0 -93
  347. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_AdvancedGuide.md +0 -2178
  348. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Documentation.md +0 -14
  349. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_FAQ.md +0 -1038
  350. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Primer.md +0 -501
  351. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_PumpManual.md +0 -177
  352. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Samples.md +0 -14
  353. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_XcodeGuide.md +0 -93
  354. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_AdvancedGuide.md +0 -2181
  355. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Documentation.md +0 -14
  356. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_FAQ.md +0 -1082
  357. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Primer.md +0 -501
  358. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_PumpManual.md +0 -177
  359. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Samples.md +0 -14
  360. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_XcodeGuide.md +0 -93
  361. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.sln +0 -45
  362. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.vcproj +0 -126
  363. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.sln +0 -45
  364. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.vcproj +0 -126
  365. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main-md.vcproj +0 -129
  366. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main.vcproj +0 -129
  367. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test-md.vcproj +0 -164
  368. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test.vcproj +0 -164
  369. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest-md.vcproj +0 -147
  370. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest.vcproj +0 -147
  371. data/ext/rj_schema/rapidjson/thirdparty/gtest/travis.sh +0 -15
@@ -127,7 +127,7 @@ Due to users' requests, RapidJSON provided official wrappers for `std::basic_ist
127
127
 
128
128
  ## IStreamWrapper {#IStreamWrapper}
129
129
 
130
- `IStreamWrapper` wraps any class drived from `std::istream`, such as `std::istringstream`, `std::stringstream`, `std::ifstream`, `std::fstream`, into RapidJSON's input stream.
130
+ `IStreamWrapper` wraps any class derived from `std::istream`, such as `std::istringstream`, `std::stringstream`, `std::ifstream`, `std::fstream`, into RapidJSON's input stream.
131
131
 
132
132
  ~~~cpp
133
133
  #include <rapidjson/document.h>
@@ -82,7 +82,7 @@ JSON number type represents all numeric values. However, C++ needs more specific
82
82
  ~~~~~~~~~~cpp
83
83
  assert(document["i"].IsNumber());
84
84
 
85
- // In this case, IsUint()/IsInt64()/IsUInt64() also return true.
85
+ // In this case, IsUint()/IsInt64()/IsUint64() also return true.
86
86
  assert(document["i"].IsInt());
87
87
  printf("i = %d\n", document["i"].GetInt());
88
88
  // Alternative (int)document["i"]
@@ -82,7 +82,7 @@ JSON Number 类型表示所有数值。然而,C++ 需要使用更专门的类
82
82
  ~~~~~~~~~~cpp
83
83
  assert(document["i"].IsNumber());
84
84
 
85
- // 在此情况下,IsUint()/IsInt64()/IsUInt64() 也会返回 true
85
+ // 在此情况下,IsUint()/IsInt64()/IsUint64() 也会返回 true
86
86
  assert(document["i"].IsInt());
87
87
  printf("i = %d\n", document["i"].GetInt());
88
88
  // 另一种用法: (int)document["i"]
@@ -250,7 +250,7 @@ string(const char* s, size_t count);
250
250
 
251
251
  ~~~~~~~~~~cpp
252
252
  if (document["hello"] == document["n"]) /*...*/; // 比较两个值
253
- if (document["hello"] == "world") /*...*/; // 与字符串家面量作比较
253
+ if (document["hello"] == "world") /*...*/; // 与字符串字面量作比较
254
254
  if (document["i"] != 123) /*...*/; // 与整数作比较
255
255
  if (document["pi"] != 3.14) /*...*/; // 与 double 作比较
256
256
  ~~~~~~~~~~
@@ -294,7 +294,7 @@ Value a(kArrayType);
294
294
 
295
295
  ## 转移语义(Move Semantics) {#MoveSemantics}
296
296
 
297
- 在设计 RapidJSON 时有一个非常特别的决定,就是 Value 赋值并不是把来源 Value 复制至目的 Value,而是把把来源 Value 转移(move)至目的 Value。例如:
297
+ 在设计 RapidJSON 时有一个非常特别的决定,就是 Value 赋值并不是把来源 Value 复制至目的 Value,而是把来源 Value 转移(move)至目的 Value。例如:
298
298
 
299
299
  ~~~~~~~~~~cpp
300
300
  Value a(123);
@@ -383,11 +383,12 @@ memset(buffer, 0, sizeof(buffer));
383
383
 
384
384
  另外,上面的 `SetString()` 需要长度参数。这个 API 能处理含有空字符的字符串。另一个 `SetString()` 重载函数没有长度参数,它假设输入是空字符结尾的,并会调用类似 `strlen()` 的函数去获取长度。
385
385
 
386
- 最后,对于字符串字面量或有安全生命周期的字符串,可以使用 const-string 版本的 `SetString()`,它没有 allocator 参数。对于字符串家面量(或字符数组常量),只需简单地传递字面量,又安全又高效:
386
+ 最后,对于字符串字面量或有安全生命周期的字符串,可以使用 const-string 版本的 `SetString()`,它没有
387
+ allocator 参数。对于字符串字面量(或字符数组常量),只需简单地传递字面量,又安全又高效:
387
388
 
388
389
  ~~~~~~~~~~cpp
389
390
  Value s;
390
- s.SetString("rapidjson"); // 可包含空字符,长度在编译萁推导
391
+ s.SetString("rapidjson"); // 可包含空字符,长度在编译期推导
391
392
  s = "rapidjson"; // 上行的缩写
392
393
  ~~~~~~~~~~
393
394
 
@@ -446,7 +447,7 @@ contact.PushBack(val, document.GetAllocator());
446
447
  ~~~~~~~~~~
447
448
 
448
449
  ## 修改 Object {#ModifyObject}
449
- Object 是键值对的集合。每个键必须为 String。要修改 Object,方法是增加或移除成员。以下的 API 用来增加城员:
450
+ Object 是键值对的集合。每个键必须为 String。要修改 Object,方法是增加或移除成员。以下的 API 用来增加成员:
450
451
 
451
452
  * `Value& AddMember(Value&, Value&, Allocator& allocator)`
452
453
  * `Value& AddMember(StringRefType, Value&, Allocator&)`
@@ -21,6 +21,7 @@ set(EXAMPLES
21
21
  simplereader
22
22
  simplepullreader
23
23
  simplewriter
24
+ sortkeys
24
25
  tutorial)
25
26
 
26
27
  include_directories("../include/")
@@ -7,9 +7,124 @@
7
7
  #include "rapidjson/schema.h"
8
8
  #include "rapidjson/stringbuffer.h"
9
9
  #include "rapidjson/prettywriter.h"
10
+ #include <string>
11
+ #include <iostream>
12
+ #include <sstream>
10
13
 
11
14
  using namespace rapidjson;
12
15
 
16
+ typedef GenericValue<UTF8<>, CrtAllocator > ValueType;
17
+
18
+ // Forward ref
19
+ static void CreateErrorMessages(const ValueType& errors, size_t depth, const char* context);
20
+
21
+ // Convert GenericValue to std::string
22
+ static std::string GetString(const ValueType& val) {
23
+ std::ostringstream s;
24
+ if (val.IsString())
25
+ s << val.GetString();
26
+ else if (val.IsDouble())
27
+ s << val.GetDouble();
28
+ else if (val.IsUint())
29
+ s << val.GetUint();
30
+ else if (val.IsInt())
31
+ s << val.GetInt();
32
+ else if (val.IsUint64())
33
+ s << val.GetUint64();
34
+ else if (val.IsInt64())
35
+ s << val.GetInt64();
36
+ else if (val.IsBool() && val.GetBool())
37
+ s << "true";
38
+ else if (val.IsBool())
39
+ s << "false";
40
+ else if (val.IsFloat())
41
+ s << val.GetFloat();
42
+ return s.str();}
43
+
44
+ // Create the error message for a named error
45
+ // The error object can either be empty or contain at least member properties:
46
+ // {"errorCode": <code>, "instanceRef": "<pointer>", "schemaRef": "<pointer>" }
47
+ // Additional properties may be present for use as inserts.
48
+ // An "errors" property may be present if there are child errors.
49
+ static void HandleError(const char* errorName, const ValueType& error, size_t depth, const char* context) {
50
+ if (!error.ObjectEmpty()) {
51
+ // Get error code and look up error message text (English)
52
+ int code = error["errorCode"].GetInt();
53
+ std::string message(GetValidateError_En(static_cast<ValidateErrorCode>(code)));
54
+ // For each member property in the error, see if its name exists as an insert in the error message and if so replace with the stringified property value
55
+ // So for example - "Number '%actual' is not a multiple of the 'multipleOf' value '%expected'." - we would expect "actual" and "expected" members.
56
+ for (ValueType::ConstMemberIterator insertsItr = error.MemberBegin();
57
+ insertsItr != error.MemberEnd(); ++insertsItr) {
58
+ std::string insertName("%");
59
+ insertName += insertsItr->name.GetString(); // eg "%actual"
60
+ size_t insertPos = message.find(insertName);
61
+ if (insertPos != std::string::npos) {
62
+ std::string insertString("");
63
+ const ValueType &insert = insertsItr->value;
64
+ if (insert.IsArray()) {
65
+ // Member is an array so create comma-separated list of items for the insert string
66
+ for (ValueType::ConstValueIterator itemsItr = insert.Begin(); itemsItr != insert.End(); ++itemsItr) {
67
+ if (itemsItr != insert.Begin()) insertString += ",";
68
+ insertString += GetString(*itemsItr);
69
+ }
70
+ } else {
71
+ insertString += GetString(insert);
72
+ }
73
+ message.replace(insertPos, insertName.length(), insertString);
74
+ }
75
+ }
76
+ // Output error message, references, context
77
+ std::string indent(depth * 2, ' ');
78
+ std::cout << indent << "Error Name: " << errorName << std::endl;
79
+ std::cout << indent << "Message: " << message.c_str() << std::endl;
80
+ std::cout << indent << "Instance: " << error["instanceRef"].GetString() << std::endl;
81
+ std::cout << indent << "Schema: " << error["schemaRef"].GetString() << std::endl;
82
+ if (depth > 0) std::cout << indent << "Context: " << context << std::endl;
83
+ std::cout << std::endl;
84
+
85
+ // If child errors exist, apply the process recursively to each error structure.
86
+ // This occurs for "oneOf", "allOf", "anyOf" and "dependencies" errors, so pass the error name as context.
87
+ if (error.HasMember("errors")) {
88
+ depth++;
89
+ const ValueType &childErrors = error["errors"];
90
+ if (childErrors.IsArray()) {
91
+ // Array - each item is an error structure - example
92
+ // "anyOf": {"errorCode": ..., "errors":[{"pattern": {"errorCode\": ...\"}}, {"pattern": {"errorCode\": ...}}]
93
+ for (ValueType::ConstValueIterator errorsItr = childErrors.Begin();
94
+ errorsItr != childErrors.End(); ++errorsItr) {
95
+ CreateErrorMessages(*errorsItr, depth, errorName);
96
+ }
97
+ } else if (childErrors.IsObject()) {
98
+ // Object - each member is an error structure - example
99
+ // "dependencies": {"errorCode": ..., "errors": {"address": {"required": {"errorCode": ...}}, "name": {"required": {"errorCode": ...}}}
100
+ for (ValueType::ConstMemberIterator propsItr = childErrors.MemberBegin();
101
+ propsItr != childErrors.MemberEnd(); ++propsItr) {
102
+ CreateErrorMessages(propsItr->value, depth, errorName);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ // Create error message for all errors in an error structure
110
+ // Context is used to indicate whether the error structure has a parent 'dependencies', 'allOf', 'anyOf' or 'oneOf' error
111
+ static void CreateErrorMessages(const ValueType& errors, size_t depth = 0, const char* context = 0) {
112
+ // Each member property contains one or more errors of a given type
113
+ for (ValueType::ConstMemberIterator errorTypeItr = errors.MemberBegin(); errorTypeItr != errors.MemberEnd(); ++errorTypeItr) {
114
+ const char* errorName = errorTypeItr->name.GetString();
115
+ const ValueType& errorContent = errorTypeItr->value;
116
+ if (errorContent.IsArray()) {
117
+ // Member is an array where each item is an error - eg "type": [{"errorCode": ...}, {"errorCode": ...}]
118
+ for (ValueType::ConstValueIterator contentItr = errorContent.Begin(); contentItr != errorContent.End(); ++contentItr) {
119
+ HandleError(errorName, *contentItr, depth, context);
120
+ }
121
+ } else if (errorContent.IsObject()) {
122
+ // Member is an object which is a single error - eg "type": {"errorCode": ... }
123
+ HandleError(errorName, errorContent, depth, context);
124
+ }
125
+ }
126
+ }
127
+
13
128
  int main(int argc, char *argv[]) {
14
129
  if (argc != 2) {
15
130
  fprintf(stderr, "Usage: schemavalidator schema.json < input.json\n");
@@ -65,6 +180,8 @@ int main(int argc, char *argv[]) {
65
180
  validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
66
181
  fprintf(stderr, "Invalid schema: %s\n", sb.GetString());
67
182
  fprintf(stderr, "Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword());
183
+ fprintf(stderr, "Invalid code: %d\n", validator.GetInvalidSchemaCode());
184
+ fprintf(stderr, "Invalid message: %s\n", GetValidateError_En(validator.GetInvalidSchemaCode()));
68
185
  sb.Clear();
69
186
  validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
70
187
  fprintf(stderr, "Invalid document: %s\n", sb.GetString());
@@ -73,6 +190,7 @@ int main(int argc, char *argv[]) {
73
190
  PrettyWriter<StringBuffer> w(sb);
74
191
  validator.GetError().Accept(w);
75
192
  fprintf(stderr, "Error report:\n%s\n", sb.GetString());
193
+ CreateErrorMessages(validator.GetError());
76
194
  return EXIT_FAILURE;
77
195
  }
78
196
  }
@@ -0,0 +1,62 @@
1
+ #include "rapidjson/document.h"
2
+ #include "rapidjson/filewritestream.h"
3
+ #include <rapidjson/prettywriter.h>
4
+
5
+ #include <algorithm>
6
+ #include <iostream>
7
+
8
+ using namespace rapidjson;
9
+ using namespace std;
10
+
11
+ static void printIt(const Value &doc) {
12
+ char writeBuffer[65536];
13
+ FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
14
+ PrettyWriter<FileWriteStream> writer(os);
15
+ doc.Accept(writer);
16
+ cout << endl;
17
+ }
18
+
19
+ struct NameComparator {
20
+ bool operator()(const Value::Member &lhs, const Value::Member &rhs) const {
21
+ return (strcmp(lhs.name.GetString(), rhs.name.GetString()) < 0);
22
+ }
23
+ };
24
+
25
+ int main() {
26
+ Document d(kObjectType);
27
+ Document::AllocatorType &allocator = d.GetAllocator();
28
+
29
+ d.AddMember("zeta", Value().SetBool(false), allocator);
30
+ d.AddMember("gama", Value().SetString("test string", allocator), allocator);
31
+ d.AddMember("delta", Value().SetInt(123), allocator);
32
+ d.AddMember("alpha", Value(kArrayType).Move(), allocator);
33
+
34
+ printIt(d);
35
+
36
+ /*
37
+ {
38
+ "zeta": false,
39
+ "gama": "test string",
40
+ "delta": 123,
41
+ "alpha": []
42
+ }
43
+ */
44
+
45
+ // C++11 supports std::move() of Value so it always have no problem for std::sort().
46
+ // Some C++03 implementations of std::sort() requires copy constructor which causes compilation error.
47
+ // Needs a sorting function only depends on std::swap() instead.
48
+ #if __cplusplus >= 201103L || (!defined(__GLIBCXX__) && (!defined(_MSC_VER) || _MSC_VER >= 1900))
49
+ std::sort(d.MemberBegin(), d.MemberEnd(), NameComparator());
50
+
51
+ printIt(d);
52
+
53
+ /*
54
+ {
55
+ "alpha": [],
56
+ "delta": 123,
57
+ "gama": "test string",
58
+ "zeta": false
59
+ }
60
+ */
61
+ #endif
62
+ }
@@ -57,7 +57,7 @@ int main(int, char*[]) {
57
57
  printf("n = %s\n", document["n"].IsNull() ? "null" : "?");
58
58
 
59
59
  assert(document["i"].IsNumber()); // Number is a JSON type, but C++ needs more specific type.
60
- assert(document["i"].IsInt()); // In this case, IsUint()/IsInt64()/IsUInt64() also return true.
60
+ assert(document["i"].IsInt()); // In this case, IsUint()/IsInt64()/IsUint64() also return true.
61
61
  printf("i = %d\n", document["i"].GetInt()); // Alternative (int)document["i"]
62
62
 
63
63
  assert(document["pi"].IsNumber());
@@ -1,6 +1,6 @@
1
1
  // Tencent is pleased to support the open source community by making RapidJSON available.
2
2
  //
3
- // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
3
+ // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
4
4
  //
5
5
  // Licensed under the MIT License (the "License"); you may not use this file except
6
6
  // in compliance with the License. You may obtain a copy of the License at
@@ -53,7 +53,7 @@ concept Allocator {
53
53
  */
54
54
 
55
55
 
56
- /*! \def RAPIDJSON_ALLOCATOR_DEFUALT_CHUNK_CAPACITY
56
+ /*! \def RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY
57
57
  \ingroup RAPIDJSON_CONFIG
58
58
  \brief User-defined kDefaultChunkCapacity definition.
59
59
 
@@ -77,19 +77,19 @@ public:
77
77
  static const bool kNeedFree = true;
78
78
  void* Malloc(size_t size) {
79
79
  if (size) // behavior of malloc(0) is implementation defined.
80
- return std::malloc(size);
80
+ return RAPIDJSON_MALLOC(size);
81
81
  else
82
82
  return NULL; // standardize to returning NULL.
83
83
  }
84
84
  void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) {
85
85
  (void)originalSize;
86
86
  if (newSize == 0) {
87
- std::free(originalPtr);
87
+ RAPIDJSON_FREE(originalPtr);
88
88
  return NULL;
89
89
  }
90
- return std::realloc(originalPtr, newSize);
90
+ return RAPIDJSON_REALLOC(originalPtr, newSize);
91
91
  }
92
- static void Free(void *ptr) { std::free(ptr); }
92
+ static void Free(void *ptr) { RAPIDJSON_FREE(ptr); }
93
93
  };
94
94
 
95
95
  ///////////////////////////////////////////////////////////////////////////////
@@ -1,6 +1,6 @@
1
1
  // Tencent is pleased to support the open source community by making RapidJSON available.
2
2
  //
3
- // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
3
+ // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
4
4
  //
5
5
  // Licensed under the MIT License (the "License"); you may not use this file except
6
6
  // in compliance with the License. You may obtain a copy of the License at
@@ -1,6 +1,6 @@
1
1
  // Tencent is pleased to support the open source community by making RapidJSON available.
2
2
  //
3
- // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
3
+ // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
4
4
  //
5
5
  // Licensed under the MIT License (the "License"); you may not use this file except
6
6
  // in compliance with the License. You may obtain a copy of the License at
@@ -24,6 +24,9 @@
24
24
  #include "encodedstream.h"
25
25
  #include <new> // placement new
26
26
  #include <limits>
27
+ #ifdef __cpp_lib_three_way_comparison
28
+ #include <compare>
29
+ #endif
27
30
 
28
31
  RAPIDJSON_DIAG_PUSH
29
32
  #ifdef __clang__
@@ -37,9 +40,6 @@ RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible lo
37
40
 
38
41
  #ifdef __GNUC__
39
42
  RAPIDJSON_DIAG_OFF(effc++)
40
- #if __GNUC__ >= 6
41
- RAPIDJSON_DIAG_OFF(terminate) // ignore throwing RAPIDJSON_ASSERT in RAPIDJSON_NOEXCEPT functions
42
- #endif
43
43
  #endif // __GNUC__
44
44
 
45
45
  #ifndef RAPIDJSON_NOMEMBERITERATORCLASS
@@ -59,6 +59,48 @@ class GenericValue;
59
59
  template <typename Encoding, typename Allocator, typename StackAllocator>
60
60
  class GenericDocument;
61
61
 
62
+ /*! \def RAPIDJSON_DEFAULT_ALLOCATOR
63
+ \ingroup RAPIDJSON_CONFIG
64
+ \brief Allows to choose default allocator.
65
+
66
+ User can define this to use CrtAllocator or MemoryPoolAllocator.
67
+ */
68
+ #ifndef RAPIDJSON_DEFAULT_ALLOCATOR
69
+ #define RAPIDJSON_DEFAULT_ALLOCATOR MemoryPoolAllocator<CrtAllocator>
70
+ #endif
71
+
72
+ /*! \def RAPIDJSON_DEFAULT_STACK_ALLOCATOR
73
+ \ingroup RAPIDJSON_CONFIG
74
+ \brief Allows to choose default stack allocator for Document.
75
+
76
+ User can define this to use CrtAllocator or MemoryPoolAllocator.
77
+ */
78
+ #ifndef RAPIDJSON_DEFAULT_STACK_ALLOCATOR
79
+ #define RAPIDJSON_DEFAULT_STACK_ALLOCATOR CrtAllocator
80
+ #endif
81
+
82
+ /*! \def RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY
83
+ \ingroup RAPIDJSON_CONFIG
84
+ \brief User defined kDefaultObjectCapacity value.
85
+
86
+ User can define this as any natural number.
87
+ */
88
+ #ifndef RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY
89
+ // number of objects that rapidjson::Value allocates memory for by default
90
+ #define RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY 16
91
+ #endif
92
+
93
+ /*! \def RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY
94
+ \ingroup RAPIDJSON_CONFIG
95
+ \brief User defined kDefaultArrayCapacity value.
96
+
97
+ User can define this as any natural number.
98
+ */
99
+ #ifndef RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY
100
+ // number of array elements that rapidjson::Value allocates memory for by default
101
+ #define RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY 16
102
+ #endif
103
+
62
104
  //! Name-value pair in a JSON object value.
63
105
  /*!
64
106
  This class was internal to GenericValue. It used to be a inner struct.
@@ -66,9 +108,45 @@ class GenericDocument;
66
108
  https://code.google.com/p/rapidjson/issues/detail?id=64
67
109
  */
68
110
  template <typename Encoding, typename Allocator>
69
- struct GenericMember {
111
+ class GenericMember {
112
+ public:
70
113
  GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
71
114
  GenericValue<Encoding, Allocator> value; //!< value of member.
115
+
116
+ #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
117
+ //! Move constructor in C++11
118
+ GenericMember(GenericMember&& rhs) RAPIDJSON_NOEXCEPT
119
+ : name(std::move(rhs.name)),
120
+ value(std::move(rhs.value))
121
+ {
122
+ }
123
+
124
+ //! Move assignment in C++11
125
+ GenericMember& operator=(GenericMember&& rhs) RAPIDJSON_NOEXCEPT {
126
+ return *this = static_cast<GenericMember&>(rhs);
127
+ }
128
+ #endif
129
+
130
+ //! Assignment with move semantics.
131
+ /*! \param rhs Source of the assignment. Its name and value will become a null value after assignment.
132
+ */
133
+ GenericMember& operator=(GenericMember& rhs) RAPIDJSON_NOEXCEPT {
134
+ if (RAPIDJSON_LIKELY(this != &rhs)) {
135
+ name = rhs.name;
136
+ value = rhs.value;
137
+ }
138
+ return *this;
139
+ }
140
+
141
+ // swap() for std::sort() and other potential use in STL.
142
+ friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT {
143
+ a.name.Swap(b.name);
144
+ a.value.Swap(b.value);
145
+ }
146
+
147
+ private:
148
+ //! Copy constructor is not permitted.
149
+ GenericMember(const GenericMember& rhs);
72
150
  };
73
151
 
74
152
  ///////////////////////////////////////////////////////////////////////////////
@@ -172,12 +250,16 @@ public:
172
250
 
173
251
  //! @name relations
174
252
  //@{
175
- bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; }
176
- bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; }
177
- bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; }
178
- bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; }
179
- bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; }
180
- bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; }
253
+ template <bool Const_> bool operator==(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ == that.ptr_; }
254
+ template <bool Const_> bool operator!=(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ != that.ptr_; }
255
+ template <bool Const_> bool operator<=(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ <= that.ptr_; }
256
+ template <bool Const_> bool operator>=(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ >= that.ptr_; }
257
+ template <bool Const_> bool operator< (const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ < that.ptr_; }
258
+ template <bool Const_> bool operator> (const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ > that.ptr_; }
259
+
260
+ #ifdef __cpp_lib_three_way_comparison
261
+ template <bool Const_> std::strong_ordering operator<=>(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ <=> that.ptr_; }
262
+ #endif
181
263
  //@}
182
264
 
183
265
  //! @name dereference
@@ -202,17 +284,19 @@ private:
202
284
  // class-based member iterator implementation disabled, use plain pointers
203
285
 
204
286
  template <bool Const, typename Encoding, typename Allocator>
205
- struct GenericMemberIterator;
287
+ class GenericMemberIterator;
206
288
 
207
289
  //! non-const GenericMemberIterator
208
290
  template <typename Encoding, typename Allocator>
209
- struct GenericMemberIterator<false,Encoding,Allocator> {
291
+ class GenericMemberIterator<false,Encoding,Allocator> {
292
+ public:
210
293
  //! use plain pointer as iterator type
211
294
  typedef GenericMember<Encoding,Allocator>* Iterator;
212
295
  };
213
296
  //! const GenericMemberIterator
214
297
  template <typename Encoding, typename Allocator>
215
- struct GenericMemberIterator<true,Encoding,Allocator> {
298
+ class GenericMemberIterator<true,Encoding,Allocator> {
299
+ public:
216
300
  //! use plain const pointer as iterator type
217
301
  typedef const GenericMember<Encoding,Allocator>* Iterator;
218
302
  };
@@ -571,7 +655,7 @@ template <bool, typename> class GenericObject;
571
655
  \tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document)
572
656
  \tparam Allocator Allocator type for allocating memory of object, array and string.
573
657
  */
574
- template <typename Encoding, typename Allocator = MemoryPoolAllocator<> >
658
+ template <typename Encoding, typename Allocator = RAPIDJSON_DEFAULT_ALLOCATOR >
575
659
  class GenericValue {
576
660
  public:
577
661
  //! Name-value pair in an object.
@@ -625,11 +709,11 @@ public:
625
709
  \note Default content for number is zero.
626
710
  */
627
711
  explicit GenericValue(Type type) RAPIDJSON_NOEXCEPT : data_() {
628
- static const uint16_t defaultFlags[7] = {
712
+ static const uint16_t defaultFlags[] = {
629
713
  kNullFlag, kFalseFlag, kTrueFlag, kObjectFlag, kArrayFlag, kShortStringFlag,
630
714
  kNumberAnyFlag
631
715
  };
632
- RAPIDJSON_ASSERT(type >= kNullType && type <= kNumberType);
716
+ RAPIDJSON_NOEXCEPT_ASSERT(type >= kNullType && type <= kNumberType);
633
717
  data_.f.flags = defaultFlags[type];
634
718
 
635
719
  // Use ShortString to store empty string.
@@ -831,9 +915,10 @@ public:
831
915
  /*! \param rhs Source of the assignment. It will become a null value after assignment.
832
916
  */
833
917
  GenericValue& operator=(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
834
- RAPIDJSON_ASSERT(this != &rhs);
835
- this->~GenericValue();
836
- RawAssign(rhs);
918
+ if (RAPIDJSON_LIKELY(this != &rhs)) {
919
+ this->~GenericValue();
920
+ RawAssign(rhs);
921
+ }
837
922
  return *this;
838
923
  }
839
924
 
@@ -925,7 +1010,7 @@ public:
925
1010
  //! Equal-to operator
926
1011
  /*!
927
1012
  \note If an object contains duplicated named member, comparing equality with any object is always \c false.
928
- \note Linear time complexity (number of all values in the subtree and total lengths of all strings).
1013
+ \note Complexity is quadratic in Object's member number and linear for the rest (number of all values in the subtree and total lengths of all strings).
929
1014
  */
930
1015
  template <typename SourceAllocator>
931
1016
  bool operator==(const GenericValue<Encoding, SourceAllocator>& rhs) const {
@@ -1918,25 +2003,26 @@ private:
1918
2003
 
1919
2004
  // Initial flags of different types.
1920
2005
  kNullFlag = kNullType,
1921
- kTrueFlag = kTrueType | kBoolFlag,
1922
- kFalseFlag = kFalseType | kBoolFlag,
1923
- kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag,
1924
- kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag,
1925
- kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag,
1926
- kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag,
1927
- kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag,
1928
- kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag,
1929
- kConstStringFlag = kStringType | kStringFlag,
1930
- kCopyStringFlag = kStringType | kStringFlag | kCopyFlag,
1931
- kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag,
2006
+ // These casts are added to suppress the warning on MSVC about bitwise operations between enums of different types.
2007
+ kTrueFlag = static_cast<int>(kTrueType) | static_cast<int>(kBoolFlag),
2008
+ kFalseFlag = static_cast<int>(kFalseType) | static_cast<int>(kBoolFlag),
2009
+ kNumberIntFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kIntFlag | kInt64Flag),
2010
+ kNumberUintFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag),
2011
+ kNumberInt64Flag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kInt64Flag),
2012
+ kNumberUint64Flag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kUint64Flag),
2013
+ kNumberDoubleFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kDoubleFlag),
2014
+ kNumberAnyFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag),
2015
+ kConstStringFlag = static_cast<int>(kStringType) | static_cast<int>(kStringFlag),
2016
+ kCopyStringFlag = static_cast<int>(kStringType) | static_cast<int>(kStringFlag | kCopyFlag),
2017
+ kShortStringFlag = static_cast<int>(kStringType) | static_cast<int>(kStringFlag | kCopyFlag | kInlineStrFlag),
1932
2018
  kObjectFlag = kObjectType,
1933
2019
  kArrayFlag = kArrayType,
1934
2020
 
1935
2021
  kTypeMask = 0x07
1936
2022
  };
1937
2023
 
1938
- static const SizeType kDefaultArrayCapacity = 16;
1939
- static const SizeType kDefaultObjectCapacity = 16;
2024
+ static const SizeType kDefaultArrayCapacity = RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY;
2025
+ static const SizeType kDefaultObjectCapacity = RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY;
1940
2026
 
1941
2027
  struct Flag {
1942
2028
  #if RAPIDJSON_48BITPOINTER_OPTIMIZATION
@@ -2116,7 +2202,7 @@ typedef GenericValue<UTF8<> > Value;
2116
2202
  \tparam StackAllocator Allocator for allocating memory for stack during parsing.
2117
2203
  \warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue.
2118
2204
  */
2119
- template <typename Encoding, typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
2205
+ template <typename Encoding, typename Allocator = RAPIDJSON_DEFAULT_ALLOCATOR, typename StackAllocator = RAPIDJSON_DEFAULT_STACK_ALLOCATOR >
2120
2206
  class GenericDocument : public GenericValue<Encoding, Allocator> {
2121
2207
  public:
2122
2208
  typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
@@ -2501,6 +2587,7 @@ private:
2501
2587
  //! GenericDocument with UTF8 encoding
2502
2588
  typedef GenericDocument<UTF8<> > Document;
2503
2589
 
2590
+
2504
2591
  //! Helper class for accessing Value of array type.
2505
2592
  /*!
2506
2593
  Instance of this helper class is obtained by \c GenericValue::GetArray().
@@ -2525,6 +2612,7 @@ public:
2525
2612
  GenericArray& operator=(const GenericArray& rhs) { value_ = rhs.value_; return *this; }
2526
2613
  ~GenericArray() {}
2527
2614
 
2615
+ operator ValueType&() const { return value_; }
2528
2616
  SizeType Size() const { return value_.Size(); }
2529
2617
  SizeType Capacity() const { return value_.Capacity(); }
2530
2618
  bool Empty() const { return value_.Empty(); }
@@ -2580,6 +2668,7 @@ public:
2580
2668
  GenericObject& operator=(const GenericObject& rhs) { value_ = rhs.value_; return *this; }
2581
2669
  ~GenericObject() {}
2582
2670
 
2671
+ operator ValueType&() const { return value_; }
2583
2672
  SizeType MemberCount() const { return value_.MemberCount(); }
2584
2673
  SizeType MemberCapacity() const { return value_.MemberCapacity(); }
2585
2674
  bool ObjectEmpty() const { return value_.ObjectEmpty(); }