rj_schema 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (614) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rj_schema/rapidjson/CHANGELOG.md +158 -0
  3. data/ext/rj_schema/rapidjson/CMakeLists.txt +226 -0
  4. data/ext/rj_schema/rapidjson/CMakeModules/FindGTestSrc.cmake +30 -0
  5. data/ext/rj_schema/rapidjson/RapidJSON.pc.in +7 -0
  6. data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +25 -0
  7. data/ext/rj_schema/rapidjson/RapidJSONConfigVersion.cmake.in +10 -0
  8. data/ext/rj_schema/rapidjson/appveyor.yml +54 -0
  9. data/ext/rj_schema/rapidjson/bin/data/abcde.txt +1 -0
  10. data/ext/rj_schema/rapidjson/bin/data/glossary.json +22 -0
  11. data/ext/rj_schema/rapidjson/bin/data/menu.json +27 -0
  12. data/ext/rj_schema/rapidjson/bin/data/readme.txt +1 -0
  13. data/ext/rj_schema/rapidjson/bin/data/sample.json +3315 -0
  14. data/ext/rj_schema/rapidjson/bin/data/webapp.json +88 -0
  15. data/ext/rj_schema/rapidjson/bin/data/widget.json +26 -0
  16. data/ext/rj_schema/rapidjson/bin/draft-04/schema +150 -0
  17. data/ext/rj_schema/rapidjson/bin/encodings/utf16be.json +0 -0
  18. data/ext/rj_schema/rapidjson/bin/encodings/utf16bebom.json +0 -0
  19. data/ext/rj_schema/rapidjson/bin/encodings/utf16le.json +0 -0
  20. data/ext/rj_schema/rapidjson/bin/encodings/utf16lebom.json +0 -0
  21. data/ext/rj_schema/rapidjson/bin/encodings/utf32be.json +0 -0
  22. data/ext/rj_schema/rapidjson/bin/encodings/utf32bebom.json +0 -0
  23. data/ext/rj_schema/rapidjson/bin/encodings/utf32le.json +0 -0
  24. data/ext/rj_schema/rapidjson/bin/encodings/utf32lebom.json +0 -0
  25. data/ext/rj_schema/rapidjson/bin/encodings/utf8.json +7 -0
  26. data/ext/rj_schema/rapidjson/bin/encodings/utf8bom.json +7 -0
  27. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail1.json +1 -0
  28. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail10.json +1 -0
  29. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail11.json +1 -0
  30. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail12.json +1 -0
  31. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail13.json +1 -0
  32. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail14.json +1 -0
  33. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail15.json +1 -0
  34. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail16.json +1 -0
  35. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail17.json +1 -0
  36. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail18.json +1 -0
  37. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail19.json +1 -0
  38. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail2.json +1 -0
  39. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail20.json +1 -0
  40. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail21.json +1 -0
  41. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail22.json +1 -0
  42. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail23.json +1 -0
  43. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail24.json +1 -0
  44. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail25.json +1 -0
  45. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail26.json +1 -0
  46. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail27.json +2 -0
  47. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail28.json +2 -0
  48. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail29.json +1 -0
  49. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail3.json +1 -0
  50. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail30.json +1 -0
  51. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail31.json +1 -0
  52. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail32.json +1 -0
  53. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail33.json +1 -0
  54. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail4.json +1 -0
  55. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail5.json +1 -0
  56. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail6.json +1 -0
  57. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail7.json +1 -0
  58. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail8.json +1 -0
  59. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail9.json +1 -0
  60. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass1.json +58 -0
  61. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass2.json +1 -0
  62. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass3.json +6 -0
  63. data/ext/rj_schema/rapidjson/bin/jsonchecker/readme.txt +3 -0
  64. data/ext/rj_schema/rapidjson/bin/jsonschema/LICENSE +19 -0
  65. data/ext/rj_schema/rapidjson/bin/jsonschema/README.md +148 -0
  66. data/ext/rj_schema/rapidjson/bin/jsonschema/bin/jsonschema_suite +283 -0
  67. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json +3 -0
  68. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/integer.json +3 -0
  69. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/subSchemas.json +8 -0
  70. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json +82 -0
  71. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json +88 -0
  72. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/default.json +49 -0
  73. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/dependencies.json +108 -0
  74. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/disallow.json +80 -0
  75. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json +60 -0
  76. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/enum.json +71 -0
  77. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/extends.json +94 -0
  78. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/items.json +46 -0
  79. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxItems.json +28 -0
  80. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxLength.json +33 -0
  81. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maximum.json +42 -0
  82. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minItems.json +28 -0
  83. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minLength.json +33 -0
  84. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minimum.json +42 -0
  85. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json +107 -0
  86. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/format.json +222 -0
  87. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json +18 -0
  88. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json +15 -0
  89. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/pattern.json +34 -0
  90. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json +110 -0
  91. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/properties.json +92 -0
  92. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/ref.json +159 -0
  93. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/refRemote.json +74 -0
  94. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/required.json +53 -0
  95. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/type.json +474 -0
  96. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json +79 -0
  97. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json +82 -0
  98. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json +88 -0
  99. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/allOf.json +112 -0
  100. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/anyOf.json +68 -0
  101. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/default.json +49 -0
  102. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/definitions.json +32 -0
  103. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/dependencies.json +113 -0
  104. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/enum.json +72 -0
  105. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/items.json +46 -0
  106. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxItems.json +28 -0
  107. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxLength.json +33 -0
  108. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json +28 -0
  109. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maximum.json +42 -0
  110. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minItems.json +28 -0
  111. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minLength.json +33 -0
  112. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minProperties.json +28 -0
  113. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minimum.json +42 -0
  114. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json +60 -0
  115. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/not.json +96 -0
  116. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/oneOf.json +68 -0
  117. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json +107 -0
  118. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/format.json +148 -0
  119. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json +15 -0
  120. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/pattern.json +34 -0
  121. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json +110 -0
  122. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/properties.json +92 -0
  123. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/ref.json +159 -0
  124. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/refRemote.json +74 -0
  125. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/required.json +39 -0
  126. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/type.json +330 -0
  127. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json +79 -0
  128. data/ext/rj_schema/rapidjson/bin/jsonschema/tox.ini +8 -0
  129. data/ext/rj_schema/rapidjson/bin/types/booleans.json +102 -0
  130. data/ext/rj_schema/rapidjson/bin/types/floats.json +102 -0
  131. data/ext/rj_schema/rapidjson/bin/types/guids.json +102 -0
  132. data/ext/rj_schema/rapidjson/bin/types/integers.json +102 -0
  133. data/ext/rj_schema/rapidjson/bin/types/mixed.json +592 -0
  134. data/ext/rj_schema/rapidjson/bin/types/nulls.json +102 -0
  135. data/ext/rj_schema/rapidjson/bin/types/paragraphs.json +102 -0
  136. data/ext/rj_schema/rapidjson/bin/types/readme.txt +1 -0
  137. data/ext/rj_schema/rapidjson/contrib/natvis/LICENSE +45 -0
  138. data/ext/rj_schema/rapidjson/contrib/natvis/README.md +7 -0
  139. data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +38 -0
  140. data/ext/rj_schema/rapidjson/doc/CMakeLists.txt +27 -0
  141. data/ext/rj_schema/rapidjson/doc/Doxyfile.in +2369 -0
  142. data/ext/rj_schema/rapidjson/doc/Doxyfile.zh-cn.in +2369 -0
  143. data/ext/rj_schema/rapidjson/doc/diagram/architecture.dot +50 -0
  144. data/ext/rj_schema/rapidjson/doc/diagram/architecture.png +0 -0
  145. data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.dot +65 -0
  146. data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.png +0 -0
  147. data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.dot +62 -0
  148. data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.png +0 -0
  149. data/ext/rj_schema/rapidjson/doc/diagram/makefile +8 -0
  150. data/ext/rj_schema/rapidjson/doc/diagram/move1.dot +47 -0
  151. data/ext/rj_schema/rapidjson/doc/diagram/move1.png +0 -0
  152. data/ext/rj_schema/rapidjson/doc/diagram/move2.dot +62 -0
  153. data/ext/rj_schema/rapidjson/doc/diagram/move2.png +0 -0
  154. data/ext/rj_schema/rapidjson/doc/diagram/move3.dot +60 -0
  155. data/ext/rj_schema/rapidjson/doc/diagram/move3.png +0 -0
  156. data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.dot +56 -0
  157. data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.png +0 -0
  158. data/ext/rj_schema/rapidjson/doc/diagram/simpledom.dot +54 -0
  159. data/ext/rj_schema/rapidjson/doc/diagram/simpledom.png +0 -0
  160. data/ext/rj_schema/rapidjson/doc/diagram/tutorial.dot +58 -0
  161. data/ext/rj_schema/rapidjson/doc/diagram/tutorial.png +0 -0
  162. data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.dot +73 -0
  163. data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.png +0 -0
  164. data/ext/rj_schema/rapidjson/doc/dom.md +281 -0
  165. data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +285 -0
  166. data/ext/rj_schema/rapidjson/doc/encoding.md +146 -0
  167. data/ext/rj_schema/rapidjson/doc/encoding.zh-cn.md +152 -0
  168. data/ext/rj_schema/rapidjson/doc/faq.md +289 -0
  169. data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +290 -0
  170. data/ext/rj_schema/rapidjson/doc/features.md +104 -0
  171. data/ext/rj_schema/rapidjson/doc/features.zh-cn.md +103 -0
  172. data/ext/rj_schema/rapidjson/doc/internals.md +368 -0
  173. data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +363 -0
  174. data/ext/rj_schema/rapidjson/doc/logo/rapidjson.png +0 -0
  175. data/ext/rj_schema/rapidjson/doc/logo/rapidjson.svg +119 -0
  176. data/ext/rj_schema/rapidjson/doc/misc/DoxygenLayout.xml +194 -0
  177. data/ext/rj_schema/rapidjson/doc/misc/doxygenextra.css +274 -0
  178. data/ext/rj_schema/rapidjson/doc/misc/footer.html +11 -0
  179. data/ext/rj_schema/rapidjson/doc/misc/header.html +24 -0
  180. data/ext/rj_schema/rapidjson/doc/npm.md +31 -0
  181. data/ext/rj_schema/rapidjson/doc/performance.md +26 -0
  182. data/ext/rj_schema/rapidjson/doc/performance.zh-cn.md +26 -0
  183. data/ext/rj_schema/rapidjson/doc/pointer.md +234 -0
  184. data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +234 -0
  185. data/ext/rj_schema/rapidjson/doc/sax.md +509 -0
  186. data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +487 -0
  187. data/ext/rj_schema/rapidjson/doc/schema.md +505 -0
  188. data/ext/rj_schema/rapidjson/doc/schema.zh-cn.md +237 -0
  189. data/ext/rj_schema/rapidjson/doc/stream.md +429 -0
  190. data/ext/rj_schema/rapidjson/doc/stream.zh-cn.md +429 -0
  191. data/ext/rj_schema/rapidjson/doc/tutorial.md +536 -0
  192. data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +535 -0
  193. data/ext/rj_schema/rapidjson/docker/debian/Dockerfile +8 -0
  194. data/ext/rj_schema/rapidjson/example/CMakeLists.txt +46 -0
  195. data/ext/rj_schema/rapidjson/example/archiver/archiver.cpp +292 -0
  196. data/ext/rj_schema/rapidjson/example/archiver/archiver.h +145 -0
  197. data/ext/rj_schema/rapidjson/example/archiver/archivertest.cpp +287 -0
  198. data/ext/rj_schema/rapidjson/example/capitalize/capitalize.cpp +67 -0
  199. data/ext/rj_schema/rapidjson/example/condense/condense.cpp +32 -0
  200. data/ext/rj_schema/rapidjson/example/filterkey/filterkey.cpp +135 -0
  201. data/ext/rj_schema/rapidjson/example/filterkeydom/filterkeydom.cpp +170 -0
  202. data/ext/rj_schema/rapidjson/example/jsonx/jsonx.cpp +207 -0
  203. data/ext/rj_schema/rapidjson/example/lookaheadparser/lookaheadparser.cpp +350 -0
  204. data/ext/rj_schema/rapidjson/example/messagereader/messagereader.cpp +105 -0
  205. data/ext/rj_schema/rapidjson/example/parsebyparts/parsebyparts.cpp +176 -0
  206. data/ext/rj_schema/rapidjson/example/pretty/pretty.cpp +30 -0
  207. data/ext/rj_schema/rapidjson/example/prettyauto/prettyauto.cpp +56 -0
  208. data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +78 -0
  209. data/ext/rj_schema/rapidjson/example/serialize/serialize.cpp +173 -0
  210. data/ext/rj_schema/rapidjson/example/simpledom/simpledom.cpp +29 -0
  211. data/ext/rj_schema/rapidjson/example/simplepullreader/simplepullreader.cpp +53 -0
  212. data/ext/rj_schema/rapidjson/example/simplereader/simplereader.cpp +42 -0
  213. data/ext/rj_schema/rapidjson/example/simplewriter/simplewriter.cpp +36 -0
  214. data/ext/rj_schema/rapidjson/example/sortkeys/sortkeys.cpp +62 -0
  215. data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +151 -0
  216. data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +284 -0
  217. data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +78 -0
  218. data/ext/rj_schema/rapidjson/include/rapidjson/document.h +2732 -0
  219. data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +299 -0
  220. data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +716 -0
  221. data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +74 -0
  222. data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +161 -0
  223. data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +99 -0
  224. data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +104 -0
  225. data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +151 -0
  226. data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +290 -0
  227. data/ext/rj_schema/rapidjson/include/rapidjson/internal/clzll.h +71 -0
  228. data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +257 -0
  229. data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +245 -0
  230. data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +78 -0
  231. data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +308 -0
  232. data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +186 -0
  233. data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +55 -0
  234. data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +739 -0
  235. data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +232 -0
  236. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +69 -0
  237. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +290 -0
  238. data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +46 -0
  239. data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +128 -0
  240. data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +70 -0
  241. data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +71 -0
  242. data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/inttypes.h +316 -0
  243. data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/stdint.h +300 -0
  244. data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +81 -0
  245. data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +1415 -0
  246. data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +277 -0
  247. data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +676 -0
  248. data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +2236 -0
  249. data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +2496 -0
  250. data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +223 -0
  251. data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +121 -0
  252. data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +710 -0
  253. data/ext/rj_schema/rapidjson/include_dirs.js +2 -0
  254. data/ext/rj_schema/rapidjson/library.json +15 -0
  255. data/ext/rj_schema/rapidjson/license.txt +57 -0
  256. data/ext/rj_schema/rapidjson/package.json +24 -0
  257. data/ext/rj_schema/rapidjson/rapidjson.autopkg +77 -0
  258. data/ext/rj_schema/rapidjson/readme.md +210 -0
  259. data/ext/rj_schema/rapidjson/readme.zh-cn.md +152 -0
  260. data/ext/rj_schema/rapidjson/test/CMakeLists.txt +20 -0
  261. data/ext/rj_schema/rapidjson/test/perftest/CMakeLists.txt +28 -0
  262. data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +974 -0
  263. data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +24 -0
  264. data/ext/rj_schema/rapidjson/test/perftest/perftest.h +185 -0
  265. data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +166 -0
  266. data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +546 -0
  267. data/ext/rj_schema/rapidjson/test/perftest/schematest.cpp +223 -0
  268. data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +92 -0
  269. data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +100 -0
  270. data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +138 -0
  271. data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +115 -0
  272. data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +672 -0
  273. data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +98 -0
  274. data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +313 -0
  275. data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +451 -0
  276. data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +155 -0
  277. data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +230 -0
  278. data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +181 -0
  279. data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +160 -0
  280. data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +143 -0
  281. data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +70 -0
  282. data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +92 -0
  283. data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +1638 -0
  284. data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +373 -0
  285. data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +2225 -0
  286. data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +639 -0
  287. data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +2072 -0
  288. data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +219 -0
  289. data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +30 -0
  290. data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +192 -0
  291. data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +132 -0
  292. data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +51 -0
  293. data/ext/rj_schema/rapidjson/test/unittest/unittest.h +143 -0
  294. data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +1851 -0
  295. data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +598 -0
  296. data/ext/rj_schema/rapidjson/test/valgrind.supp +17 -0
  297. data/ext/rj_schema/rapidjson/thirdparty/gtest/BUILD.bazel +175 -0
  298. data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +33 -0
  299. data/ext/rj_schema/rapidjson/thirdparty/gtest/CONTRIBUTING.md +160 -0
  300. data/ext/rj_schema/rapidjson/thirdparty/gtest/LICENSE +28 -0
  301. data/ext/rj_schema/rapidjson/thirdparty/gtest/Makefile.am +14 -0
  302. data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +122 -0
  303. data/ext/rj_schema/rapidjson/thirdparty/gtest/WORKSPACE +8 -0
  304. data/ext/rj_schema/rapidjson/thirdparty/gtest/appveyor.yml +104 -0
  305. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +44 -0
  306. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +36 -0
  307. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-linux.sh +41 -0
  308. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-osx.sh +40 -0
  309. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +48 -0
  310. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-linux.sh +49 -0
  311. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-osx.sh +39 -0
  312. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/log-config.sh +51 -0
  313. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/travis.sh +44 -0
  314. data/ext/rj_schema/rapidjson/thirdparty/gtest/configure.ac +16 -0
  315. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +126 -0
  316. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +242 -0
  317. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +40 -0
  318. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/LICENSE +28 -0
  319. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/Makefile.am +224 -0
  320. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +344 -0
  321. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +9 -0
  322. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +9 -0
  323. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +146 -0
  324. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +564 -0
  325. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +3660 -0
  326. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +280 -0
  327. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +15 -0
  328. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +447 -0
  329. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +627 -0
  330. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +19 -0
  331. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +1262 -0
  332. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +147 -0
  333. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +2571 -0
  334. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +833 -0
  335. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +1379 -0
  336. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +347 -0
  337. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +2258 -0
  338. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +675 -0
  339. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +458 -0
  340. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +178 -0
  341. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +5255 -0
  342. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +246 -0
  343. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +91 -0
  344. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +1918 -0
  345. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +95 -0
  346. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +8 -0
  347. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +10 -0
  348. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +38 -0
  349. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +46 -0
  350. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +286 -0
  351. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +136 -0
  352. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +574 -0
  353. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +87 -0
  354. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/make/Makefile +101 -0
  355. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +32 -0
  356. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +191 -0
  357. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +15 -0
  358. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +187 -0
  359. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +201 -0
  360. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +46 -0
  361. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +145 -0
  362. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +19 -0
  363. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +151 -0
  364. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +176 -0
  365. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +46 -0
  366. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +145 -0
  367. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +19 -0
  368. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +151 -0
  369. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +176 -0
  370. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +240 -0
  371. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +203 -0
  372. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +34 -0
  373. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +115 -0
  374. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
  375. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +1733 -0
  376. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +227 -0
  377. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +448 -0
  378. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +59 -0
  379. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +287 -0
  380. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +41 -0
  381. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +31 -0
  382. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +303 -0
  383. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +640 -0
  384. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +1387 -0
  385. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +78 -0
  386. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +47 -0
  387. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +156 -0
  388. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +204 -0
  389. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +573 -0
  390. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +883 -0
  391. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +205 -0
  392. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +54 -0
  393. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +123 -0
  394. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +1575 -0
  395. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +428 -0
  396. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +1230 -0
  397. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +647 -0
  398. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +129 -0
  399. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +1341 -0
  400. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +718 -0
  401. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +6767 -0
  402. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +710 -0
  403. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +511 -0
  404. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +43 -0
  405. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +2771 -0
  406. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +51 -0
  407. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +81 -0
  408. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +108 -0
  409. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +100 -0
  410. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +40 -0
  411. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +40 -0
  412. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +691 -0
  413. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +183 -0
  414. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +310 -0
  415. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +317 -0
  416. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +323 -0
  417. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +262 -0
  418. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +110 -0
  419. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CHANGES +157 -0
  420. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +312 -0
  421. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +37 -0
  422. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/LICENSE +28 -0
  423. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +339 -0
  424. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +341 -0
  425. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +9 -0
  426. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +10 -0
  427. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +280 -0
  428. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +138 -0
  429. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +54 -0
  430. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +38 -0
  431. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +40 -0
  432. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +82 -0
  433. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +88 -0
  434. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +68 -0
  435. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +146 -0
  436. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +177 -0
  437. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +93 -0
  438. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/advanced.md +2416 -0
  439. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/faq.md +1092 -0
  440. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/primer.md +536 -0
  441. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/samples.md +14 -0
  442. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +342 -0
  443. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +249 -0
  444. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +1438 -0
  445. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +501 -0
  446. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +1082 -0
  447. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +231 -0
  448. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +179 -0
  449. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +264 -0
  450. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +2332 -0
  451. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +357 -0
  452. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +61 -0
  453. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +70 -0
  454. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
  455. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +45 -0
  456. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +275 -0
  457. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +205 -0
  458. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +1277 -0
  459. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
  460. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +5139 -0
  461. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +279 -0
  462. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +723 -0
  463. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +100 -0
  464. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +2687 -0
  465. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +167 -0
  466. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
  467. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
  468. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +3347 -0
  469. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +313 -0
  470. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +363 -0
  471. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +74 -0
  472. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/make/Makefile +82 -0
  473. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +55 -0
  474. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +149 -0
  475. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +18 -0
  476. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +55 -0
  477. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +149 -0
  478. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +18 -0
  479. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +154 -0
  480. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +18 -0
  481. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +162 -0
  482. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +18 -0
  483. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +199 -0
  484. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +26 -0
  485. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +191 -0
  486. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +26 -0
  487. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +188 -0
  488. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +18 -0
  489. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +180 -0
  490. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +18 -0
  491. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +127 -0
  492. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +68 -0
  493. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +43 -0
  494. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +140 -0
  495. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +154 -0
  496. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +56 -0
  497. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +85 -0
  498. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +110 -0
  499. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +172 -0
  500. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +152 -0
  501. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +46 -0
  502. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +53 -0
  503. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +49 -0
  504. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +199 -0
  505. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +225 -0
  506. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +118 -0
  507. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +174 -0
  508. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +157 -0
  509. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/common.py +83 -0
  510. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +253 -0
  511. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +730 -0
  512. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +274 -0
  513. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +855 -0
  514. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +158 -0
  515. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/test/Makefile +59 -0
  516. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1387 -0
  517. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +78 -0
  518. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +48 -0
  519. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +1536 -0
  520. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +385 -0
  521. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +1175 -0
  522. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +1277 -0
  523. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +458 -0
  524. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +102 -0
  525. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +119 -0
  526. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +5846 -0
  527. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +38 -0
  528. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +396 -0
  529. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +93 -0
  530. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +1424 -0
  531. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +652 -0
  532. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +154 -0
  533. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +311 -0
  534. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +159 -0
  535. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +213 -0
  536. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +61 -0
  537. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +1110 -0
  538. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +53 -0
  539. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +1303 -0
  540. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +1737 -0
  541. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +208 -0
  542. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +320 -0
  543. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +45 -0
  544. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +380 -0
  545. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +66 -0
  546. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +341 -0
  547. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +47 -0
  548. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +119 -0
  549. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +210 -0
  550. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +87 -0
  551. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +235 -0
  552. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +311 -0
  553. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +129 -0
  554. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +63 -0
  555. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +119 -0
  556. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +124 -0
  557. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +189 -0
  558. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +638 -0
  559. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +138 -0
  560. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +172 -0
  561. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +46 -0
  562. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +162 -0
  563. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +611 -0
  564. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +60 -0
  565. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +207 -0
  566. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +157 -0
  567. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +45 -0
  568. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +56 -0
  569. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +344 -0
  570. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +1067 -0
  571. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +781 -0
  572. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
  573. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +127 -0
  574. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +57 -0
  575. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +236 -0
  576. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +325 -0
  577. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +103 -0
  578. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +57 -0
  579. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +250 -0
  580. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +318 -0
  581. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +65 -0
  582. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +44 -0
  583. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +92 -0
  584. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +171 -0
  585. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +72 -0
  586. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +69 -0
  587. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +43 -0
  588. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +7797 -0
  589. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +48 -0
  590. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +48 -0
  591. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +140 -0
  592. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +378 -0
  593. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +179 -0
  594. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +196 -0
  595. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +36 -0
  596. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +55 -0
  597. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +30 -0
  598. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +17 -0
  599. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +41 -0
  600. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +32 -0
  601. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +18 -0
  602. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +8 -0
  603. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +30 -0
  604. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +28 -0
  605. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +457 -0
  606. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +62 -0
  607. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +63 -0
  608. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +59 -0
  609. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +68 -0
  610. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +65 -0
  611. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +100 -0
  612. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +1182 -0
  613. data/ext/rj_schema/rapidjson/travis-doxygen.sh +128 -0
  614. metadata +613 -1
@@ -0,0 +1,299 @@
1
+ // Tencent is pleased to support the open source community by making RapidJSON available.
2
+ //
3
+ // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
4
+ //
5
+ // Licensed under the MIT License (the "License"); you may not use this file except
6
+ // in compliance with the License. You may obtain a copy of the License at
7
+ //
8
+ // http://opensource.org/licenses/MIT
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software distributed
11
+ // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
+ // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13
+ // specific language governing permissions and limitations under the License.
14
+
15
+ #ifndef RAPIDJSON_ENCODEDSTREAM_H_
16
+ #define RAPIDJSON_ENCODEDSTREAM_H_
17
+
18
+ #include "stream.h"
19
+ #include "memorystream.h"
20
+
21
+ #ifdef __GNUC__
22
+ RAPIDJSON_DIAG_PUSH
23
+ RAPIDJSON_DIAG_OFF(effc++)
24
+ #endif
25
+
26
+ #ifdef __clang__
27
+ RAPIDJSON_DIAG_PUSH
28
+ RAPIDJSON_DIAG_OFF(padded)
29
+ #endif
30
+
31
+ RAPIDJSON_NAMESPACE_BEGIN
32
+
33
+ //! Input byte stream wrapper with a statically bound encoding.
34
+ /*!
35
+ \tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
36
+ \tparam InputByteStream Type of input byte stream. For example, FileReadStream.
37
+ */
38
+ template <typename Encoding, typename InputByteStream>
39
+ class EncodedInputStream {
40
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
41
+ public:
42
+ typedef typename Encoding::Ch Ch;
43
+
44
+ EncodedInputStream(InputByteStream& is) : is_(is) {
45
+ current_ = Encoding::TakeBOM(is_);
46
+ }
47
+
48
+ Ch Peek() const { return current_; }
49
+ Ch Take() { Ch c = current_; current_ = Encoding::Take(is_); return c; }
50
+ size_t Tell() const { return is_.Tell(); }
51
+
52
+ // Not implemented
53
+ void Put(Ch) { RAPIDJSON_ASSERT(false); }
54
+ void Flush() { RAPIDJSON_ASSERT(false); }
55
+ Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
56
+ size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
57
+
58
+ private:
59
+ EncodedInputStream(const EncodedInputStream&);
60
+ EncodedInputStream& operator=(const EncodedInputStream&);
61
+
62
+ InputByteStream& is_;
63
+ Ch current_;
64
+ };
65
+
66
+ //! Specialized for UTF8 MemoryStream.
67
+ template <>
68
+ class EncodedInputStream<UTF8<>, MemoryStream> {
69
+ public:
70
+ typedef UTF8<>::Ch Ch;
71
+
72
+ EncodedInputStream(MemoryStream& is) : is_(is) {
73
+ if (static_cast<unsigned char>(is_.Peek()) == 0xEFu) is_.Take();
74
+ if (static_cast<unsigned char>(is_.Peek()) == 0xBBu) is_.Take();
75
+ if (static_cast<unsigned char>(is_.Peek()) == 0xBFu) is_.Take();
76
+ }
77
+ Ch Peek() const { return is_.Peek(); }
78
+ Ch Take() { return is_.Take(); }
79
+ size_t Tell() const { return is_.Tell(); }
80
+
81
+ // Not implemented
82
+ void Put(Ch) {}
83
+ void Flush() {}
84
+ Ch* PutBegin() { return 0; }
85
+ size_t PutEnd(Ch*) { return 0; }
86
+
87
+ MemoryStream& is_;
88
+
89
+ private:
90
+ EncodedInputStream(const EncodedInputStream&);
91
+ EncodedInputStream& operator=(const EncodedInputStream&);
92
+ };
93
+
94
+ //! Output byte stream wrapper with statically bound encoding.
95
+ /*!
96
+ \tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
97
+ \tparam OutputByteStream Type of input byte stream. For example, FileWriteStream.
98
+ */
99
+ template <typename Encoding, typename OutputByteStream>
100
+ class EncodedOutputStream {
101
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
102
+ public:
103
+ typedef typename Encoding::Ch Ch;
104
+
105
+ EncodedOutputStream(OutputByteStream& os, bool putBOM = true) : os_(os) {
106
+ if (putBOM)
107
+ Encoding::PutBOM(os_);
108
+ }
109
+
110
+ void Put(Ch c) { Encoding::Put(os_, c); }
111
+ void Flush() { os_.Flush(); }
112
+
113
+ // Not implemented
114
+ Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;}
115
+ Ch Take() { RAPIDJSON_ASSERT(false); return 0;}
116
+ size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
117
+ Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
118
+ size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
119
+
120
+ private:
121
+ EncodedOutputStream(const EncodedOutputStream&);
122
+ EncodedOutputStream& operator=(const EncodedOutputStream&);
123
+
124
+ OutputByteStream& os_;
125
+ };
126
+
127
+ #define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
128
+
129
+ //! Input stream wrapper with dynamically bound encoding and automatic encoding detection.
130
+ /*!
131
+ \tparam CharType Type of character for reading.
132
+ \tparam InputByteStream type of input byte stream to be wrapped.
133
+ */
134
+ template <typename CharType, typename InputByteStream>
135
+ class AutoUTFInputStream {
136
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
137
+ public:
138
+ typedef CharType Ch;
139
+
140
+ //! Constructor.
141
+ /*!
142
+ \param is input stream to be wrapped.
143
+ \param type UTF encoding type if it is not detected from the stream.
144
+ */
145
+ AutoUTFInputStream(InputByteStream& is, UTFType type = kUTF8) : is_(&is), type_(type), hasBOM_(false) {
146
+ RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
147
+ DetectType();
148
+ static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) };
149
+ takeFunc_ = f[type_];
150
+ current_ = takeFunc_(*is_);
151
+ }
152
+
153
+ UTFType GetType() const { return type_; }
154
+ bool HasBOM() const { return hasBOM_; }
155
+
156
+ Ch Peek() const { return current_; }
157
+ Ch Take() { Ch c = current_; current_ = takeFunc_(*is_); return c; }
158
+ size_t Tell() const { return is_->Tell(); }
159
+
160
+ // Not implemented
161
+ void Put(Ch) { RAPIDJSON_ASSERT(false); }
162
+ void Flush() { RAPIDJSON_ASSERT(false); }
163
+ Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
164
+ size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
165
+
166
+ private:
167
+ AutoUTFInputStream(const AutoUTFInputStream&);
168
+ AutoUTFInputStream& operator=(const AutoUTFInputStream&);
169
+
170
+ // Detect encoding type with BOM or RFC 4627
171
+ void DetectType() {
172
+ // BOM (Byte Order Mark):
173
+ // 00 00 FE FF UTF-32BE
174
+ // FF FE 00 00 UTF-32LE
175
+ // FE FF UTF-16BE
176
+ // FF FE UTF-16LE
177
+ // EF BB BF UTF-8
178
+
179
+ const unsigned char* c = reinterpret_cast<const unsigned char *>(is_->Peek4());
180
+ if (!c)
181
+ return;
182
+
183
+ unsigned bom = static_cast<unsigned>(c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24));
184
+ hasBOM_ = false;
185
+ if (bom == 0xFFFE0000) { type_ = kUTF32BE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
186
+ else if (bom == 0x0000FEFF) { type_ = kUTF32LE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
187
+ else if ((bom & 0xFFFF) == 0xFFFE) { type_ = kUTF16BE; hasBOM_ = true; is_->Take(); is_->Take(); }
188
+ else if ((bom & 0xFFFF) == 0xFEFF) { type_ = kUTF16LE; hasBOM_ = true; is_->Take(); is_->Take(); }
189
+ else if ((bom & 0xFFFFFF) == 0xBFBBEF) { type_ = kUTF8; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); }
190
+
191
+ // RFC 4627: Section 3
192
+ // "Since the first two characters of a JSON text will always be ASCII
193
+ // characters [RFC0020], it is possible to determine whether an octet
194
+ // stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking
195
+ // at the pattern of nulls in the first four octets."
196
+ // 00 00 00 xx UTF-32BE
197
+ // 00 xx 00 xx UTF-16BE
198
+ // xx 00 00 00 UTF-32LE
199
+ // xx 00 xx 00 UTF-16LE
200
+ // xx xx xx xx UTF-8
201
+
202
+ if (!hasBOM_) {
203
+ int pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0);
204
+ switch (pattern) {
205
+ case 0x08: type_ = kUTF32BE; break;
206
+ case 0x0A: type_ = kUTF16BE; break;
207
+ case 0x01: type_ = kUTF32LE; break;
208
+ case 0x05: type_ = kUTF16LE; break;
209
+ case 0x0F: type_ = kUTF8; break;
210
+ default: break; // Use type defined by user.
211
+ }
212
+ }
213
+
214
+ // Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
215
+ if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
216
+ if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
217
+ }
218
+
219
+ typedef Ch (*TakeFunc)(InputByteStream& is);
220
+ InputByteStream* is_;
221
+ UTFType type_;
222
+ Ch current_;
223
+ TakeFunc takeFunc_;
224
+ bool hasBOM_;
225
+ };
226
+
227
+ //! Output stream wrapper with dynamically bound encoding and automatic encoding detection.
228
+ /*!
229
+ \tparam CharType Type of character for writing.
230
+ \tparam OutputByteStream type of output byte stream to be wrapped.
231
+ */
232
+ template <typename CharType, typename OutputByteStream>
233
+ class AutoUTFOutputStream {
234
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
235
+ public:
236
+ typedef CharType Ch;
237
+
238
+ //! Constructor.
239
+ /*!
240
+ \param os output stream to be wrapped.
241
+ \param type UTF encoding type.
242
+ \param putBOM Whether to write BOM at the beginning of the stream.
243
+ */
244
+ AutoUTFOutputStream(OutputByteStream& os, UTFType type, bool putBOM) : os_(&os), type_(type) {
245
+ RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
246
+
247
+ // Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
248
+ if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
249
+ if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
250
+
251
+ static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) };
252
+ putFunc_ = f[type_];
253
+
254
+ if (putBOM)
255
+ PutBOM();
256
+ }
257
+
258
+ UTFType GetType() const { return type_; }
259
+
260
+ void Put(Ch c) { putFunc_(*os_, c); }
261
+ void Flush() { os_->Flush(); }
262
+
263
+ // Not implemented
264
+ Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;}
265
+ Ch Take() { RAPIDJSON_ASSERT(false); return 0;}
266
+ size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
267
+ Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
268
+ size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
269
+
270
+ private:
271
+ AutoUTFOutputStream(const AutoUTFOutputStream&);
272
+ AutoUTFOutputStream& operator=(const AutoUTFOutputStream&);
273
+
274
+ void PutBOM() {
275
+ typedef void (*PutBOMFunc)(OutputByteStream&);
276
+ static const PutBOMFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(PutBOM) };
277
+ f[type_](*os_);
278
+ }
279
+
280
+ typedef void (*PutFunc)(OutputByteStream&, Ch);
281
+
282
+ OutputByteStream* os_;
283
+ UTFType type_;
284
+ PutFunc putFunc_;
285
+ };
286
+
287
+ #undef RAPIDJSON_ENCODINGS_FUNC
288
+
289
+ RAPIDJSON_NAMESPACE_END
290
+
291
+ #ifdef __clang__
292
+ RAPIDJSON_DIAG_POP
293
+ #endif
294
+
295
+ #ifdef __GNUC__
296
+ RAPIDJSON_DIAG_POP
297
+ #endif
298
+
299
+ #endif // RAPIDJSON_FILESTREAM_H_
@@ -0,0 +1,716 @@
1
+ // Tencent is pleased to support the open source community by making RapidJSON available.
2
+ //
3
+ // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
4
+ //
5
+ // Licensed under the MIT License (the "License"); you may not use this file except
6
+ // in compliance with the License. You may obtain a copy of the License at
7
+ //
8
+ // http://opensource.org/licenses/MIT
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software distributed
11
+ // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
+ // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13
+ // specific language governing permissions and limitations under the License.
14
+
15
+ #ifndef RAPIDJSON_ENCODINGS_H_
16
+ #define RAPIDJSON_ENCODINGS_H_
17
+
18
+ #include "rapidjson.h"
19
+
20
+ #if defined(_MSC_VER) && !defined(__clang__)
21
+ RAPIDJSON_DIAG_PUSH
22
+ RAPIDJSON_DIAG_OFF(4244) // conversion from 'type1' to 'type2', possible loss of data
23
+ RAPIDJSON_DIAG_OFF(4702) // unreachable code
24
+ #elif defined(__GNUC__)
25
+ RAPIDJSON_DIAG_PUSH
26
+ RAPIDJSON_DIAG_OFF(effc++)
27
+ RAPIDJSON_DIAG_OFF(overflow)
28
+ #endif
29
+
30
+ RAPIDJSON_NAMESPACE_BEGIN
31
+
32
+ ///////////////////////////////////////////////////////////////////////////////
33
+ // Encoding
34
+
35
+ /*! \class rapidjson::Encoding
36
+ \brief Concept for encoding of Unicode characters.
37
+
38
+ \code
39
+ concept Encoding {
40
+ typename Ch; //! Type of character. A "character" is actually a code unit in unicode's definition.
41
+
42
+ enum { supportUnicode = 1 }; // or 0 if not supporting unicode
43
+
44
+ //! \brief Encode a Unicode codepoint to an output stream.
45
+ //! \param os Output stream.
46
+ //! \param codepoint An unicode codepoint, ranging from 0x0 to 0x10FFFF inclusively.
47
+ template<typename OutputStream>
48
+ static void Encode(OutputStream& os, unsigned codepoint);
49
+
50
+ //! \brief Decode a Unicode codepoint from an input stream.
51
+ //! \param is Input stream.
52
+ //! \param codepoint Output of the unicode codepoint.
53
+ //! \return true if a valid codepoint can be decoded from the stream.
54
+ template <typename InputStream>
55
+ static bool Decode(InputStream& is, unsigned* codepoint);
56
+
57
+ //! \brief Validate one Unicode codepoint from an encoded stream.
58
+ //! \param is Input stream to obtain codepoint.
59
+ //! \param os Output for copying one codepoint.
60
+ //! \return true if it is valid.
61
+ //! \note This function just validating and copying the codepoint without actually decode it.
62
+ template <typename InputStream, typename OutputStream>
63
+ static bool Validate(InputStream& is, OutputStream& os);
64
+
65
+ // The following functions are deal with byte streams.
66
+
67
+ //! Take a character from input byte stream, skip BOM if exist.
68
+ template <typename InputByteStream>
69
+ static CharType TakeBOM(InputByteStream& is);
70
+
71
+ //! Take a character from input byte stream.
72
+ template <typename InputByteStream>
73
+ static Ch Take(InputByteStream& is);
74
+
75
+ //! Put BOM to output byte stream.
76
+ template <typename OutputByteStream>
77
+ static void PutBOM(OutputByteStream& os);
78
+
79
+ //! Put a character to output byte stream.
80
+ template <typename OutputByteStream>
81
+ static void Put(OutputByteStream& os, Ch c);
82
+ };
83
+ \endcode
84
+ */
85
+
86
+ ///////////////////////////////////////////////////////////////////////////////
87
+ // UTF8
88
+
89
+ //! UTF-8 encoding.
90
+ /*! http://en.wikipedia.org/wiki/UTF-8
91
+ http://tools.ietf.org/html/rfc3629
92
+ \tparam CharType Code unit for storing 8-bit UTF-8 data. Default is char.
93
+ \note implements Encoding concept
94
+ */
95
+ template<typename CharType = char>
96
+ struct UTF8 {
97
+ typedef CharType Ch;
98
+
99
+ enum { supportUnicode = 1 };
100
+
101
+ template<typename OutputStream>
102
+ static void Encode(OutputStream& os, unsigned codepoint) {
103
+ if (codepoint <= 0x7F)
104
+ os.Put(static_cast<Ch>(codepoint & 0xFF));
105
+ else if (codepoint <= 0x7FF) {
106
+ os.Put(static_cast<Ch>(0xC0 | ((codepoint >> 6) & 0xFF)));
107
+ os.Put(static_cast<Ch>(0x80 | ((codepoint & 0x3F))));
108
+ }
109
+ else if (codepoint <= 0xFFFF) {
110
+ os.Put(static_cast<Ch>(0xE0 | ((codepoint >> 12) & 0xFF)));
111
+ os.Put(static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
112
+ os.Put(static_cast<Ch>(0x80 | (codepoint & 0x3F)));
113
+ }
114
+ else {
115
+ RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
116
+ os.Put(static_cast<Ch>(0xF0 | ((codepoint >> 18) & 0xFF)));
117
+ os.Put(static_cast<Ch>(0x80 | ((codepoint >> 12) & 0x3F)));
118
+ os.Put(static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
119
+ os.Put(static_cast<Ch>(0x80 | (codepoint & 0x3F)));
120
+ }
121
+ }
122
+
123
+ template<typename OutputStream>
124
+ static void EncodeUnsafe(OutputStream& os, unsigned codepoint) {
125
+ if (codepoint <= 0x7F)
126
+ PutUnsafe(os, static_cast<Ch>(codepoint & 0xFF));
127
+ else if (codepoint <= 0x7FF) {
128
+ PutUnsafe(os, static_cast<Ch>(0xC0 | ((codepoint >> 6) & 0xFF)));
129
+ PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint & 0x3F))));
130
+ }
131
+ else if (codepoint <= 0xFFFF) {
132
+ PutUnsafe(os, static_cast<Ch>(0xE0 | ((codepoint >> 12) & 0xFF)));
133
+ PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
134
+ PutUnsafe(os, static_cast<Ch>(0x80 | (codepoint & 0x3F)));
135
+ }
136
+ else {
137
+ RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
138
+ PutUnsafe(os, static_cast<Ch>(0xF0 | ((codepoint >> 18) & 0xFF)));
139
+ PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint >> 12) & 0x3F)));
140
+ PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
141
+ PutUnsafe(os, static_cast<Ch>(0x80 | (codepoint & 0x3F)));
142
+ }
143
+ }
144
+
145
+ template <typename InputStream>
146
+ static bool Decode(InputStream& is, unsigned* codepoint) {
147
+ #define RAPIDJSON_COPY() c = is.Take(); *codepoint = (*codepoint << 6) | (static_cast<unsigned char>(c) & 0x3Fu)
148
+ #define RAPIDJSON_TRANS(mask) result &= ((GetRange(static_cast<unsigned char>(c)) & mask) != 0)
149
+ #define RAPIDJSON_TAIL() RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x70)
150
+ typename InputStream::Ch c = is.Take();
151
+ if (!(c & 0x80)) {
152
+ *codepoint = static_cast<unsigned char>(c);
153
+ return true;
154
+ }
155
+
156
+ unsigned char type = GetRange(static_cast<unsigned char>(c));
157
+ if (type >= 32) {
158
+ *codepoint = 0;
159
+ } else {
160
+ *codepoint = (0xFFu >> type) & static_cast<unsigned char>(c);
161
+ }
162
+ bool result = true;
163
+ switch (type) {
164
+ case 2: RAPIDJSON_TAIL(); return result;
165
+ case 3: RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
166
+ case 4: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x50); RAPIDJSON_TAIL(); return result;
167
+ case 5: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x10); RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
168
+ case 6: RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
169
+ case 10: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x20); RAPIDJSON_TAIL(); return result;
170
+ case 11: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x60); RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
171
+ default: return false;
172
+ }
173
+ #undef RAPIDJSON_COPY
174
+ #undef RAPIDJSON_TRANS
175
+ #undef RAPIDJSON_TAIL
176
+ }
177
+
178
+ template <typename InputStream, typename OutputStream>
179
+ static bool Validate(InputStream& is, OutputStream& os) {
180
+ #define RAPIDJSON_COPY() os.Put(c = is.Take())
181
+ #define RAPIDJSON_TRANS(mask) result &= ((GetRange(static_cast<unsigned char>(c)) & mask) != 0)
182
+ #define RAPIDJSON_TAIL() RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x70)
183
+ Ch c;
184
+ RAPIDJSON_COPY();
185
+ if (!(c & 0x80))
186
+ return true;
187
+
188
+ bool result = true;
189
+ switch (GetRange(static_cast<unsigned char>(c))) {
190
+ case 2: RAPIDJSON_TAIL(); return result;
191
+ case 3: RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
192
+ case 4: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x50); RAPIDJSON_TAIL(); return result;
193
+ case 5: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x10); RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
194
+ case 6: RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
195
+ case 10: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x20); RAPIDJSON_TAIL(); return result;
196
+ case 11: RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x60); RAPIDJSON_TAIL(); RAPIDJSON_TAIL(); return result;
197
+ default: return false;
198
+ }
199
+ #undef RAPIDJSON_COPY
200
+ #undef RAPIDJSON_TRANS
201
+ #undef RAPIDJSON_TAIL
202
+ }
203
+
204
+ static unsigned char GetRange(unsigned char c) {
205
+ // Referring to DFA of http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
206
+ // With new mapping 1 -> 0x10, 7 -> 0x20, 9 -> 0x40, such that AND operation can test multiple types.
207
+ static const unsigned char type[] = {
208
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
209
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
211
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
212
+ 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
213
+ 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
214
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
215
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
216
+ 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
217
+ 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,
218
+ };
219
+ return type[c];
220
+ }
221
+
222
+ template <typename InputByteStream>
223
+ static CharType TakeBOM(InputByteStream& is) {
224
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
225
+ typename InputByteStream::Ch c = Take(is);
226
+ if (static_cast<unsigned char>(c) != 0xEFu) return c;
227
+ c = is.Take();
228
+ if (static_cast<unsigned char>(c) != 0xBBu) return c;
229
+ c = is.Take();
230
+ if (static_cast<unsigned char>(c) != 0xBFu) return c;
231
+ c = is.Take();
232
+ return c;
233
+ }
234
+
235
+ template <typename InputByteStream>
236
+ static Ch Take(InputByteStream& is) {
237
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
238
+ return static_cast<Ch>(is.Take());
239
+ }
240
+
241
+ template <typename OutputByteStream>
242
+ static void PutBOM(OutputByteStream& os) {
243
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
244
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xEFu));
245
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xBBu));
246
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xBFu));
247
+ }
248
+
249
+ template <typename OutputByteStream>
250
+ static void Put(OutputByteStream& os, Ch c) {
251
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
252
+ os.Put(static_cast<typename OutputByteStream::Ch>(c));
253
+ }
254
+ };
255
+
256
+ ///////////////////////////////////////////////////////////////////////////////
257
+ // UTF16
258
+
259
+ //! UTF-16 encoding.
260
+ /*! http://en.wikipedia.org/wiki/UTF-16
261
+ http://tools.ietf.org/html/rfc2781
262
+ \tparam CharType Type for storing 16-bit UTF-16 data. Default is wchar_t. C++11 may use char16_t instead.
263
+ \note implements Encoding concept
264
+
265
+ \note For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness.
266
+ For streaming, use UTF16LE and UTF16BE, which handle endianness.
267
+ */
268
+ template<typename CharType = wchar_t>
269
+ struct UTF16 {
270
+ typedef CharType Ch;
271
+ RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >= 2);
272
+
273
+ enum { supportUnicode = 1 };
274
+
275
+ template<typename OutputStream>
276
+ static void Encode(OutputStream& os, unsigned codepoint) {
277
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2);
278
+ if (codepoint <= 0xFFFF) {
279
+ RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair
280
+ os.Put(static_cast<typename OutputStream::Ch>(codepoint));
281
+ }
282
+ else {
283
+ RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
284
+ unsigned v = codepoint - 0x10000;
285
+ os.Put(static_cast<typename OutputStream::Ch>((v >> 10) | 0xD800));
286
+ os.Put(static_cast<typename OutputStream::Ch>((v & 0x3FF) | 0xDC00));
287
+ }
288
+ }
289
+
290
+
291
+ template<typename OutputStream>
292
+ static void EncodeUnsafe(OutputStream& os, unsigned codepoint) {
293
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2);
294
+ if (codepoint <= 0xFFFF) {
295
+ RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair
296
+ PutUnsafe(os, static_cast<typename OutputStream::Ch>(codepoint));
297
+ }
298
+ else {
299
+ RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
300
+ unsigned v = codepoint - 0x10000;
301
+ PutUnsafe(os, static_cast<typename OutputStream::Ch>((v >> 10) | 0xD800));
302
+ PutUnsafe(os, static_cast<typename OutputStream::Ch>((v & 0x3FF) | 0xDC00));
303
+ }
304
+ }
305
+
306
+ template <typename InputStream>
307
+ static bool Decode(InputStream& is, unsigned* codepoint) {
308
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 2);
309
+ typename InputStream::Ch c = is.Take();
310
+ if (c < 0xD800 || c > 0xDFFF) {
311
+ *codepoint = static_cast<unsigned>(c);
312
+ return true;
313
+ }
314
+ else if (c <= 0xDBFF) {
315
+ *codepoint = (static_cast<unsigned>(c) & 0x3FF) << 10;
316
+ c = is.Take();
317
+ *codepoint |= (static_cast<unsigned>(c) & 0x3FF);
318
+ *codepoint += 0x10000;
319
+ return c >= 0xDC00 && c <= 0xDFFF;
320
+ }
321
+ return false;
322
+ }
323
+
324
+ template <typename InputStream, typename OutputStream>
325
+ static bool Validate(InputStream& is, OutputStream& os) {
326
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 2);
327
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2);
328
+ typename InputStream::Ch c;
329
+ os.Put(static_cast<typename OutputStream::Ch>(c = is.Take()));
330
+ if (c < 0xD800 || c > 0xDFFF)
331
+ return true;
332
+ else if (c <= 0xDBFF) {
333
+ os.Put(c = is.Take());
334
+ return c >= 0xDC00 && c <= 0xDFFF;
335
+ }
336
+ return false;
337
+ }
338
+ };
339
+
340
+ //! UTF-16 little endian encoding.
341
+ template<typename CharType = wchar_t>
342
+ struct UTF16LE : UTF16<CharType> {
343
+ template <typename InputByteStream>
344
+ static CharType TakeBOM(InputByteStream& is) {
345
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
346
+ CharType c = Take(is);
347
+ return static_cast<uint16_t>(c) == 0xFEFFu ? Take(is) : c;
348
+ }
349
+
350
+ template <typename InputByteStream>
351
+ static CharType Take(InputByteStream& is) {
352
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
353
+ unsigned c = static_cast<uint8_t>(is.Take());
354
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 8;
355
+ return static_cast<CharType>(c);
356
+ }
357
+
358
+ template <typename OutputByteStream>
359
+ static void PutBOM(OutputByteStream& os) {
360
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
361
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFFu));
362
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFEu));
363
+ }
364
+
365
+ template <typename OutputByteStream>
366
+ static void Put(OutputByteStream& os, CharType c) {
367
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
368
+ os.Put(static_cast<typename OutputByteStream::Ch>(static_cast<unsigned>(c) & 0xFFu));
369
+ os.Put(static_cast<typename OutputByteStream::Ch>((static_cast<unsigned>(c) >> 8) & 0xFFu));
370
+ }
371
+ };
372
+
373
+ //! UTF-16 big endian encoding.
374
+ template<typename CharType = wchar_t>
375
+ struct UTF16BE : UTF16<CharType> {
376
+ template <typename InputByteStream>
377
+ static CharType TakeBOM(InputByteStream& is) {
378
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
379
+ CharType c = Take(is);
380
+ return static_cast<uint16_t>(c) == 0xFEFFu ? Take(is) : c;
381
+ }
382
+
383
+ template <typename InputByteStream>
384
+ static CharType Take(InputByteStream& is) {
385
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
386
+ unsigned c = static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 8;
387
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take()));
388
+ return static_cast<CharType>(c);
389
+ }
390
+
391
+ template <typename OutputByteStream>
392
+ static void PutBOM(OutputByteStream& os) {
393
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
394
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFEu));
395
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFFu));
396
+ }
397
+
398
+ template <typename OutputByteStream>
399
+ static void Put(OutputByteStream& os, CharType c) {
400
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
401
+ os.Put(static_cast<typename OutputByteStream::Ch>((static_cast<unsigned>(c) >> 8) & 0xFFu));
402
+ os.Put(static_cast<typename OutputByteStream::Ch>(static_cast<unsigned>(c) & 0xFFu));
403
+ }
404
+ };
405
+
406
+ ///////////////////////////////////////////////////////////////////////////////
407
+ // UTF32
408
+
409
+ //! UTF-32 encoding.
410
+ /*! http://en.wikipedia.org/wiki/UTF-32
411
+ \tparam CharType Type for storing 32-bit UTF-32 data. Default is unsigned. C++11 may use char32_t instead.
412
+ \note implements Encoding concept
413
+
414
+ \note For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness.
415
+ For streaming, use UTF32LE and UTF32BE, which handle endianness.
416
+ */
417
+ template<typename CharType = unsigned>
418
+ struct UTF32 {
419
+ typedef CharType Ch;
420
+ RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >= 4);
421
+
422
+ enum { supportUnicode = 1 };
423
+
424
+ template<typename OutputStream>
425
+ static void Encode(OutputStream& os, unsigned codepoint) {
426
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4);
427
+ RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
428
+ os.Put(codepoint);
429
+ }
430
+
431
+ template<typename OutputStream>
432
+ static void EncodeUnsafe(OutputStream& os, unsigned codepoint) {
433
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4);
434
+ RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
435
+ PutUnsafe(os, codepoint);
436
+ }
437
+
438
+ template <typename InputStream>
439
+ static bool Decode(InputStream& is, unsigned* codepoint) {
440
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4);
441
+ Ch c = is.Take();
442
+ *codepoint = c;
443
+ return c <= 0x10FFFF;
444
+ }
445
+
446
+ template <typename InputStream, typename OutputStream>
447
+ static bool Validate(InputStream& is, OutputStream& os) {
448
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4);
449
+ Ch c;
450
+ os.Put(c = is.Take());
451
+ return c <= 0x10FFFF;
452
+ }
453
+ };
454
+
455
+ //! UTF-32 little endian enocoding.
456
+ template<typename CharType = unsigned>
457
+ struct UTF32LE : UTF32<CharType> {
458
+ template <typename InputByteStream>
459
+ static CharType TakeBOM(InputByteStream& is) {
460
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
461
+ CharType c = Take(is);
462
+ return static_cast<uint32_t>(c) == 0x0000FEFFu ? Take(is) : c;
463
+ }
464
+
465
+ template <typename InputByteStream>
466
+ static CharType Take(InputByteStream& is) {
467
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
468
+ unsigned c = static_cast<uint8_t>(is.Take());
469
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 8;
470
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 16;
471
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 24;
472
+ return static_cast<CharType>(c);
473
+ }
474
+
475
+ template <typename OutputByteStream>
476
+ static void PutBOM(OutputByteStream& os) {
477
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
478
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFFu));
479
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFEu));
480
+ os.Put(static_cast<typename OutputByteStream::Ch>(0x00u));
481
+ os.Put(static_cast<typename OutputByteStream::Ch>(0x00u));
482
+ }
483
+
484
+ template <typename OutputByteStream>
485
+ static void Put(OutputByteStream& os, CharType c) {
486
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
487
+ os.Put(static_cast<typename OutputByteStream::Ch>(c & 0xFFu));
488
+ os.Put(static_cast<typename OutputByteStream::Ch>((c >> 8) & 0xFFu));
489
+ os.Put(static_cast<typename OutputByteStream::Ch>((c >> 16) & 0xFFu));
490
+ os.Put(static_cast<typename OutputByteStream::Ch>((c >> 24) & 0xFFu));
491
+ }
492
+ };
493
+
494
+ //! UTF-32 big endian encoding.
495
+ template<typename CharType = unsigned>
496
+ struct UTF32BE : UTF32<CharType> {
497
+ template <typename InputByteStream>
498
+ static CharType TakeBOM(InputByteStream& is) {
499
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
500
+ CharType c = Take(is);
501
+ return static_cast<uint32_t>(c) == 0x0000FEFFu ? Take(is) : c;
502
+ }
503
+
504
+ template <typename InputByteStream>
505
+ static CharType Take(InputByteStream& is) {
506
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
507
+ unsigned c = static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 24;
508
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 16;
509
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take())) << 8;
510
+ c |= static_cast<unsigned>(static_cast<uint8_t>(is.Take()));
511
+ return static_cast<CharType>(c);
512
+ }
513
+
514
+ template <typename OutputByteStream>
515
+ static void PutBOM(OutputByteStream& os) {
516
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
517
+ os.Put(static_cast<typename OutputByteStream::Ch>(0x00u));
518
+ os.Put(static_cast<typename OutputByteStream::Ch>(0x00u));
519
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFEu));
520
+ os.Put(static_cast<typename OutputByteStream::Ch>(0xFFu));
521
+ }
522
+
523
+ template <typename OutputByteStream>
524
+ static void Put(OutputByteStream& os, CharType c) {
525
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
526
+ os.Put(static_cast<typename OutputByteStream::Ch>((c >> 24) & 0xFFu));
527
+ os.Put(static_cast<typename OutputByteStream::Ch>((c >> 16) & 0xFFu));
528
+ os.Put(static_cast<typename OutputByteStream::Ch>((c >> 8) & 0xFFu));
529
+ os.Put(static_cast<typename OutputByteStream::Ch>(c & 0xFFu));
530
+ }
531
+ };
532
+
533
+ ///////////////////////////////////////////////////////////////////////////////
534
+ // ASCII
535
+
536
+ //! ASCII encoding.
537
+ /*! http://en.wikipedia.org/wiki/ASCII
538
+ \tparam CharType Code unit for storing 7-bit ASCII data. Default is char.
539
+ \note implements Encoding concept
540
+ */
541
+ template<typename CharType = char>
542
+ struct ASCII {
543
+ typedef CharType Ch;
544
+
545
+ enum { supportUnicode = 0 };
546
+
547
+ template<typename OutputStream>
548
+ static void Encode(OutputStream& os, unsigned codepoint) {
549
+ RAPIDJSON_ASSERT(codepoint <= 0x7F);
550
+ os.Put(static_cast<Ch>(codepoint & 0xFF));
551
+ }
552
+
553
+ template<typename OutputStream>
554
+ static void EncodeUnsafe(OutputStream& os, unsigned codepoint) {
555
+ RAPIDJSON_ASSERT(codepoint <= 0x7F);
556
+ PutUnsafe(os, static_cast<Ch>(codepoint & 0xFF));
557
+ }
558
+
559
+ template <typename InputStream>
560
+ static bool Decode(InputStream& is, unsigned* codepoint) {
561
+ uint8_t c = static_cast<uint8_t>(is.Take());
562
+ *codepoint = c;
563
+ return c <= 0X7F;
564
+ }
565
+
566
+ template <typename InputStream, typename OutputStream>
567
+ static bool Validate(InputStream& is, OutputStream& os) {
568
+ uint8_t c = static_cast<uint8_t>(is.Take());
569
+ os.Put(static_cast<typename OutputStream::Ch>(c));
570
+ return c <= 0x7F;
571
+ }
572
+
573
+ template <typename InputByteStream>
574
+ static CharType TakeBOM(InputByteStream& is) {
575
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
576
+ uint8_t c = static_cast<uint8_t>(Take(is));
577
+ return static_cast<Ch>(c);
578
+ }
579
+
580
+ template <typename InputByteStream>
581
+ static Ch Take(InputByteStream& is) {
582
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
583
+ return static_cast<Ch>(is.Take());
584
+ }
585
+
586
+ template <typename OutputByteStream>
587
+ static void PutBOM(OutputByteStream& os) {
588
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
589
+ (void)os;
590
+ }
591
+
592
+ template <typename OutputByteStream>
593
+ static void Put(OutputByteStream& os, Ch c) {
594
+ RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
595
+ os.Put(static_cast<typename OutputByteStream::Ch>(c));
596
+ }
597
+ };
598
+
599
+ ///////////////////////////////////////////////////////////////////////////////
600
+ // AutoUTF
601
+
602
+ //! Runtime-specified UTF encoding type of a stream.
603
+ enum UTFType {
604
+ kUTF8 = 0, //!< UTF-8.
605
+ kUTF16LE = 1, //!< UTF-16 little endian.
606
+ kUTF16BE = 2, //!< UTF-16 big endian.
607
+ kUTF32LE = 3, //!< UTF-32 little endian.
608
+ kUTF32BE = 4 //!< UTF-32 big endian.
609
+ };
610
+
611
+ //! Dynamically select encoding according to stream's runtime-specified UTF encoding type.
612
+ /*! \note This class can be used with AutoUTFInputtStream and AutoUTFOutputStream, which provides GetType().
613
+ */
614
+ template<typename CharType>
615
+ struct AutoUTF {
616
+ typedef CharType Ch;
617
+
618
+ enum { supportUnicode = 1 };
619
+
620
+ #define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
621
+
622
+ template<typename OutputStream>
623
+ static RAPIDJSON_FORCEINLINE void Encode(OutputStream& os, unsigned codepoint) {
624
+ typedef void (*EncodeFunc)(OutputStream&, unsigned);
625
+ static const EncodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Encode) };
626
+ (*f[os.GetType()])(os, codepoint);
627
+ }
628
+
629
+ template<typename OutputStream>
630
+ static RAPIDJSON_FORCEINLINE void EncodeUnsafe(OutputStream& os, unsigned codepoint) {
631
+ typedef void (*EncodeFunc)(OutputStream&, unsigned);
632
+ static const EncodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(EncodeUnsafe) };
633
+ (*f[os.GetType()])(os, codepoint);
634
+ }
635
+
636
+ template <typename InputStream>
637
+ static RAPIDJSON_FORCEINLINE bool Decode(InputStream& is, unsigned* codepoint) {
638
+ typedef bool (*DecodeFunc)(InputStream&, unsigned*);
639
+ static const DecodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Decode) };
640
+ return (*f[is.GetType()])(is, codepoint);
641
+ }
642
+
643
+ template <typename InputStream, typename OutputStream>
644
+ static RAPIDJSON_FORCEINLINE bool Validate(InputStream& is, OutputStream& os) {
645
+ typedef bool (*ValidateFunc)(InputStream&, OutputStream&);
646
+ static const ValidateFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Validate) };
647
+ return (*f[is.GetType()])(is, os);
648
+ }
649
+
650
+ #undef RAPIDJSON_ENCODINGS_FUNC
651
+ };
652
+
653
+ ///////////////////////////////////////////////////////////////////////////////
654
+ // Transcoder
655
+
656
+ //! Encoding conversion.
657
+ template<typename SourceEncoding, typename TargetEncoding>
658
+ struct Transcoder {
659
+ //! Take one Unicode codepoint from source encoding, convert it to target encoding and put it to the output stream.
660
+ template<typename InputStream, typename OutputStream>
661
+ static RAPIDJSON_FORCEINLINE bool Transcode(InputStream& is, OutputStream& os) {
662
+ unsigned codepoint;
663
+ if (!SourceEncoding::Decode(is, &codepoint))
664
+ return false;
665
+ TargetEncoding::Encode(os, codepoint);
666
+ return true;
667
+ }
668
+
669
+ template<typename InputStream, typename OutputStream>
670
+ static RAPIDJSON_FORCEINLINE bool TranscodeUnsafe(InputStream& is, OutputStream& os) {
671
+ unsigned codepoint;
672
+ if (!SourceEncoding::Decode(is, &codepoint))
673
+ return false;
674
+ TargetEncoding::EncodeUnsafe(os, codepoint);
675
+ return true;
676
+ }
677
+
678
+ //! Validate one Unicode codepoint from an encoded stream.
679
+ template<typename InputStream, typename OutputStream>
680
+ static RAPIDJSON_FORCEINLINE bool Validate(InputStream& is, OutputStream& os) {
681
+ return Transcode(is, os); // Since source/target encoding is different, must transcode.
682
+ }
683
+ };
684
+
685
+ // Forward declaration.
686
+ template<typename Stream>
687
+ inline void PutUnsafe(Stream& stream, typename Stream::Ch c);
688
+
689
+ //! Specialization of Transcoder with same source and target encoding.
690
+ template<typename Encoding>
691
+ struct Transcoder<Encoding, Encoding> {
692
+ template<typename InputStream, typename OutputStream>
693
+ static RAPIDJSON_FORCEINLINE bool Transcode(InputStream& is, OutputStream& os) {
694
+ os.Put(is.Take()); // Just copy one code unit. This semantic is different from primary template class.
695
+ return true;
696
+ }
697
+
698
+ template<typename InputStream, typename OutputStream>
699
+ static RAPIDJSON_FORCEINLINE bool TranscodeUnsafe(InputStream& is, OutputStream& os) {
700
+ PutUnsafe(os, is.Take()); // Just copy one code unit. This semantic is different from primary template class.
701
+ return true;
702
+ }
703
+
704
+ template<typename InputStream, typename OutputStream>
705
+ static RAPIDJSON_FORCEINLINE bool Validate(InputStream& is, OutputStream& os) {
706
+ return Encoding::Validate(is, os); // source/target encoding are the same
707
+ }
708
+ };
709
+
710
+ RAPIDJSON_NAMESPACE_END
711
+
712
+ #if defined(__GNUC__) || (defined(_MSC_VER) && !defined(__clang__))
713
+ RAPIDJSON_DIAG_POP
714
+ #endif
715
+
716
+ #endif // RAPIDJSON_ENCODINGS_H_