redsnow 0.3.7 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (302) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/Rakefile +4 -4
  4. data/ext/drafter/Makefile +54 -0
  5. data/ext/drafter/appveyor.yml +10 -0
  6. data/ext/drafter/bin/drafter +0 -0
  7. data/ext/{snowcrash → drafter}/build/Makefile +29 -14
  8. data/ext/{snowcrash/build/snowcrash.Makefile → drafter/build/drafter.Makefile} +1 -1
  9. data/ext/{snowcrash/build/snowcrash.target.mk → drafter/build/drafter.target.mk} +25 -23
  10. data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libmarkdownparser.target.mk +7 -7
  11. data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +152 -0
  12. data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libsundown.target.mk +13 -13
  13. data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/perf-libsnowcrash.target.mk +14 -20
  14. data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
  15. data/ext/{snowcrash → drafter}/build/gyp-mac-tool +0 -0
  16. data/ext/{snowcrash/build/libsnowcrash.target.mk → drafter/build/libdrafter.target.mk} +29 -36
  17. data/ext/drafter/build/libsos.target.mk +133 -0
  18. data/ext/drafter/build/out/Release/drafter +0 -0
  19. data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
  20. data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
  21. data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
  22. data/ext/drafter/build/out/Release/libsos.a +0 -0
  23. data/ext/{snowcrash → drafter}/build/out/Release/libsundown.a +0 -0
  24. data/ext/{snowcrash → drafter}/build/out/Release/linker.lock +0 -0
  25. data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
  26. data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
  27. data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
  28. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
  29. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
  30. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
  31. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
  32. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/cdrafter.o +0 -0
  33. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
  34. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
  35. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
  36. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
  37. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
  38. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
  39. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
  40. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
  41. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
  42. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
  43. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
  44. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
  45. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
  46. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
  47. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
  48. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
  49. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
  50. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
  51. data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
  52. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
  53. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
  54. data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.o +0 -0
  55. data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
  56. data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
  57. data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
  58. data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
  59. data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.o +0 -0
  60. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
  61. data/ext/drafter/circle.yml +12 -0
  62. data/ext/{snowcrash → drafter}/config.gypi +1 -1
  63. data/ext/{snowcrash → drafter}/config.mk +0 -0
  64. data/ext/{snowcrash → drafter}/configure +16 -5
  65. data/ext/drafter/drafter.gyp +118 -0
  66. data/ext/{snowcrash → drafter/ext/snowcrash}/Makefile +4 -12
  67. data/ext/{snowcrash → drafter/ext/snowcrash}/Vagrantfile +14 -4
  68. data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
  69. data/ext/{snowcrash → drafter/ext/snowcrash}/common.gypi +0 -0
  70. data/ext/drafter/ext/snowcrash/configure +197 -0
  71. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/Makefile +0 -0
  72. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +0 -0
  73. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile +0 -0
  74. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile.win +0 -0
  75. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/smartypants.c +0 -0
  76. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/sundown.c +0 -0
  77. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini.h +0 -0
  78. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +0 -0
  79. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +0 -0
  80. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.c +0 -0
  81. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.h +0 -0
  82. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.c +0 -0
  83. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html_block_names.txt +0 -0
  84. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.c +0 -0
  85. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.h +0 -0
  86. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.c +0 -0
  87. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.h +0 -0
  88. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/html_blocks.h +0 -0
  89. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.c +0 -0
  90. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.h +0 -0
  91. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.c +0 -0
  92. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.h +0 -0
  93. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.c +0 -0
  94. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.h +0 -0
  95. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/sundown.def +0 -0
  96. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/markdown/markdown.vcproj +0 -0
  97. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/msvc.sln +0 -0
  98. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/sundown/sundown.vcproj +0 -0
  99. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.cc +0 -0
  100. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.h +0 -0
  101. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.cc +0 -0
  102. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.h +0 -0
  103. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.cc +0 -0
  104. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.h +10 -2
  105. data/ext/{snowcrash → drafter/ext/snowcrash}/provisioning.sh +0 -0
  106. data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.gyp +41 -39
  107. data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.xcworkspace/contents.xcworkspacedata +0 -0
  108. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ActionParser.h +50 -6
  109. data/ext/{snowcrash → drafter/ext/snowcrash}/src/AssetParser.h +1 -12
  110. data/ext/drafter/ext/snowcrash/src/AttributesParser.h +121 -0
  111. data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
  112. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Blueprint.h +169 -33
  113. data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintParser.h +305 -48
  114. data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
  115. data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintSourcemap.h +130 -39
  116. data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintUtility.h +10 -4
  117. data/ext/{snowcrash → drafter/ext/snowcrash}/src/CodeBlockUtility.h +1 -1
  118. data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +154 -0
  119. data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.cc +0 -0
  120. data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.h +0 -0
  121. data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +110 -0
  122. data/ext/{snowcrash → drafter/ext/snowcrash}/src/HeadersParser.h +123 -54
  123. data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
  124. data/ext/drafter/ext/snowcrash/src/MSON.h +399 -0
  125. data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +95 -0
  126. data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +108 -0
  127. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
  128. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
  129. data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +232 -0
  130. data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +91 -0
  131. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
  132. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
  133. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
  134. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
  135. data/ext/drafter/ext/snowcrash/src/MSONUtility.h +423 -0
  136. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +179 -0
  137. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +346 -0
  138. data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
  139. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParameterParser.h +120 -61
  140. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParametersParser.h +17 -18
  141. data/ext/{snowcrash → drafter/ext/snowcrash}/src/PayloadParser.h +36 -18
  142. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Platform.h +0 -0
  143. data/ext/{snowcrash → drafter/ext/snowcrash}/src/RegexMatch.h +0 -0
  144. data/ext/drafter/ext/snowcrash/src/RelationParser.h +75 -0
  145. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceGroupParser.h +127 -33
  146. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceParser.h +126 -33
  147. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.cc +6 -0
  148. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.h +15 -2
  149. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParser.h +3 -1
  150. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParserData.h +15 -5
  151. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionProcessor.h +24 -0
  152. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Signature.cc +14 -0
  153. data/ext/drafter/ext/snowcrash/src/Signature.h +80 -0
  154. data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +439 -0
  155. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SourceAnnotation.h +3 -2
  156. data/ext/{snowcrash → drafter/ext/snowcrash}/src/StringUtility.h +103 -6
  157. data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.cc +0 -0
  158. data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.h +0 -0
  159. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ValuesParser.h +1 -13
  160. data/ext/{snowcrash → drafter/ext/snowcrash}/src/posix/RegexMatch.cc +0 -0
  161. data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.cc +0 -0
  162. data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.h +0 -0
  163. data/ext/{snowcrash → drafter/ext/snowcrash}/src/win/RegexMatch.cc +0 -0
  164. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/AUTHORS +0 -0
  165. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/DEPS +0 -0
  166. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/OWNERS +0 -0
  167. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/PRESUBMIT.py +0 -0
  168. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/buildbot/buildbot_run.py +0 -0
  169. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/codereview.settings +0 -0
  170. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/data/win/large-pdb-shim.cc +0 -0
  171. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp +0 -0
  172. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp.bat +0 -0
  173. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp_main.py +0 -0
  174. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSNew.py +0 -0
  175. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSProject.py +0 -0
  176. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSSettings.py +0 -0
  177. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSToolFile.py +0 -0
  178. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUserFile.py +0 -0
  179. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUtil.py +0 -0
  180. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSVersion.py +0 -0
  181. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.py +0 -0
  182. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.pyc +0 -0
  183. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/common.py +0 -0
  184. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  185. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/easy_xml.py +0 -0
  186. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/flock_tool.py +0 -0
  187. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
  188. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  189. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/android.py +0 -0
  190. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/cmake.py +0 -0
  191. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -0
  192. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/eclipse.py +0 -0
  193. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypd.py +0 -0
  194. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypsh.py +0 -0
  195. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.py +0 -0
  196. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
  197. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/msvs.py +0 -0
  198. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/ninja.py +0 -0
  199. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.py +0 -0
  200. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  201. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.py +0 -0
  202. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.pyc +0 -0
  203. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/mac_tool.py +0 -0
  204. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/msvs_emulation.py +0 -0
  205. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ninja_syntax.py +0 -0
  206. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ordered_dict.py +0 -0
  207. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/win_tool.py +0 -0
  208. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.py +0 -0
  209. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  210. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.py +0 -0
  211. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  212. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xml_fix.py +0 -0
  213. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylintrc +0 -0
  214. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples +0 -0
  215. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples.bat +0 -0
  216. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/setup.py +0 -0
  217. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +0 -0
  218. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +0 -0
  219. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/emacs/gyp.el +0 -0
  220. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/graphviz.py +0 -0
  221. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_gyp.py +0 -0
  222. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_sln.py +0 -0
  223. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_vcproj.py +0 -0
  224. data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
  225. data/ext/drafter/ext/sos/Makefile +57 -0
  226. data/ext/drafter/ext/sos/src/sos.cc +200 -0
  227. data/ext/drafter/ext/sos/src/sos.h +179 -0
  228. data/ext/drafter/ext/sos/src/sosJSON.h +105 -0
  229. data/ext/drafter/ext/sos/src/sosYAML.h +104 -0
  230. data/ext/{snowcrash → drafter}/src/Serialize.cc +30 -15
  231. data/ext/drafter/src/Serialize.h +135 -0
  232. data/ext/drafter/src/SerializeAST.cc +775 -0
  233. data/ext/drafter/src/SerializeAST.h +19 -0
  234. data/ext/drafter/src/SerializeResult.cc +67 -0
  235. data/ext/drafter/src/SerializeResult.h +26 -0
  236. data/ext/drafter/src/SerializeSourcemap.cc +446 -0
  237. data/ext/drafter/src/SerializeSourcemap.h +19 -0
  238. data/ext/drafter/src/Version.h +38 -0
  239. data/ext/drafter/src/cdrafter.cc +44 -0
  240. data/ext/drafter/src/cdrafter.h +55 -0
  241. data/ext/drafter/src/config.cc +80 -0
  242. data/ext/drafter/src/config.h +35 -0
  243. data/ext/drafter/src/drafter.cc +22 -0
  244. data/ext/drafter/src/drafter.h +38 -0
  245. data/ext/drafter/src/main.cc +91 -0
  246. data/ext/drafter/src/reporting.cc +162 -0
  247. data/ext/drafter/src/reporting.h +28 -0
  248. data/ext/drafter/src/stream.h +146 -0
  249. data/ext/drafter/tools/homebrew/drafter.rb +12 -0
  250. data/ext/{snowcrash → drafter}/vcbuild.bat +3 -3
  251. data/lib/redsnow.rb +6 -11
  252. data/lib/redsnow/binding.rb +11 -201
  253. data/lib/redsnow/blueprint.rb +104 -169
  254. data/lib/redsnow/parseresult.rb +28 -42
  255. data/lib/redsnow/sourcemap.rb +92 -177
  256. data/lib/redsnow/version.rb +1 -1
  257. data/redsnow.gemspec +1 -1
  258. metadata +249 -197
  259. data/ext/snowcrash/bin/snowcrash +0 -0
  260. data/ext/snowcrash/build/out/Release/libmarkdownparser.a +0 -0
  261. data/ext/snowcrash/build/out/Release/libsnowcrash.dylib +0 -0
  262. data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/ByteBuffer.o +0 -0
  263. data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownNode.o +0 -0
  264. data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownParser.o +0 -0
  265. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprint.o +0 -0
  266. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprintSourcemap.o +0 -0
  267. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o +0 -0
  268. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o +0 -0
  269. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o +0 -0
  270. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o +0 -0
  271. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o +0 -0
  272. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeYAML.o +0 -0
  273. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Signature.o +0 -0
  274. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/UriTemplateParser.o +0 -0
  275. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/csnowcrash.o +0 -0
  276. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/posix/RegexMatch.o +0 -0
  277. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/snowcrash.o +0 -0
  278. data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
  279. data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
  280. data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
  281. data/ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o +0 -0
  282. data/ext/snowcrash/build/out/Release/snowcrash +0 -0
  283. data/ext/snowcrash/src/CBlueprint.cc +0 -628
  284. data/ext/snowcrash/src/CBlueprint.h +0 -366
  285. data/ext/snowcrash/src/CBlueprintSourcemap.cc +0 -630
  286. data/ext/snowcrash/src/CBlueprintSourcemap.h +0 -351
  287. data/ext/snowcrash/src/CSourceAnnotation.cc +0 -154
  288. data/ext/snowcrash/src/CSourceAnnotation.h +0 -106
  289. data/ext/snowcrash/src/Serialize.h +0 -71
  290. data/ext/snowcrash/src/SerializeJSON.cc +0 -1221
  291. data/ext/snowcrash/src/SerializeJSON.h +0 -24
  292. data/ext/snowcrash/src/SerializeYAML.cc +0 -702
  293. data/ext/snowcrash/src/SerializeYAML.h +0 -24
  294. data/ext/snowcrash/src/Signature.h +0 -32
  295. data/ext/snowcrash/src/SymbolTable.h +0 -94
  296. data/ext/snowcrash/src/Version.h +0 -39
  297. data/ext/snowcrash/src/csnowcrash.cc +0 -29
  298. data/ext/snowcrash/src/csnowcrash.h +0 -40
  299. data/ext/snowcrash/src/snowcrash/snowcrash.cc +0 -200
  300. data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  301. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  302. data/ext/snowcrash/tools/homebrew/snowcrash.rb +0 -12
@@ -1,106 +0,0 @@
1
- //
2
- // CSourceAnnotation.h
3
- // snowcrash
4
- // C Implementation of SourceAnnotation.h for binding purposes
5
- //
6
- // Created by Ali Khoramshahi on 13/6/14.
7
- // Copyright (c) 2014 Apiary Inc. All rights reserved.
8
- //
9
-
10
- #ifndef SC_C_SOURCEANNOTATION_H
11
- #define SC_C_SOURCEANNOTATION_H
12
-
13
- #include "Platform.h"
14
- #include "stdlib.h"
15
-
16
- #ifdef __cplusplus
17
- extern "C" {
18
- #endif
19
-
20
- /** Class Report wrapper */
21
- struct sc_report_s;
22
- typedef struct sc_report_s sc_report_t;
23
-
24
- /** Array warnings wrapper */
25
- struct sc_warnings_s;
26
- typedef struct sc_warnings_s sc_warnings_t;
27
-
28
- /** Class warning wrapper */
29
- struct sc_warning_s;
30
- typedef struct sc_warning_s sc_warning_t;
31
-
32
- /** Class error wrapper */
33
- struct sc_error_s;
34
- typedef struct sc_error_s sc_error_t;
35
-
36
- /** Class location wrapper */
37
- struct sc_location_s;
38
- typedef struct sc_location_s sc_location_t;
39
-
40
- /** Class SourceAnnotation wrapper */
41
- struct sc_source_annotation_s;
42
- typedef struct sc_source_annotation_s sc_source_annotation_t;
43
-
44
- /*----------------------------------------------------------------------*/
45
-
46
- /** \returns pointer to allocated Report*/
47
- SC_API sc_report_t* sc_report_new();
48
-
49
- /** \deallocate Report from pointer*/
50
- SC_API void sc_report_free(sc_report_t* report);
51
-
52
- /*----------------------------------------------------------------------*/
53
-
54
- /** \returns location handler*/
55
- SC_API const sc_location_t* sc_location_handler(const sc_source_annotation_t* source);
56
-
57
- /** \returns location array size*/
58
- SC_API size_t sc_location_size(const sc_location_t* location);
59
-
60
- /** \returns location at `index` length*/
61
- SC_API size_t sc_location_length(const sc_location_t* location, size_t index);
62
-
63
- /** \returns location at `index` location*/
64
- SC_API size_t sc_location_location(const sc_location_t* location, size_t index);
65
-
66
- /*----------------------------------------------------------------------*/
67
-
68
- /** \returns error handler*/
69
- SC_API const sc_error_t* sc_error_handler(const sc_report_t* report);
70
-
71
- /** \returns error message*/
72
- SC_API const char* sc_error_message(const sc_error_t* error);
73
-
74
- /** \returns error code*/
75
- SC_API int sc_error_code(const sc_error_t* error);
76
-
77
- /** \returns error OK*/
78
- SC_API int sc_error_ok(const sc_error_t* error);
79
-
80
- /*----------------------------------------------------------------------*/
81
-
82
- /** \returns warnings handler*/
83
- SC_API const sc_warnings_t* sc_warnings_handler(const sc_report_t* report);
84
-
85
- /** \returns warnings array size*/
86
- SC_API size_t sc_warnings_size(const sc_warnings_t* warning);
87
-
88
- /*----------------------------------------------------------------------*/
89
-
90
- /** \returns warning at `index` handle*/
91
- SC_API const sc_warning_t* sc_warning_handler(const sc_warnings_t* warning, size_t index);
92
-
93
- /** \returns warning message*/
94
- SC_API const char* sc_warning_message(const sc_warning_t* warning);
95
-
96
- /** \returns warning code*/
97
- SC_API int sc_warning_code(const sc_warning_t* warning);
98
-
99
- /** \returns warning OK*/
100
- SC_API int sc_warning_ok(const sc_warning_t* warning);
101
-
102
- #ifdef __cplusplus
103
- }
104
- #endif
105
-
106
- #endif
@@ -1,71 +0,0 @@
1
- //
2
- // Serialize.h
3
- // snowcrash
4
- //
5
- // Created by Zdenek Nemec on 5/3/13.
6
- // Copyright (c) 2013 Apiary Inc. All rights reserved.
7
- //
8
-
9
- #ifndef SNOWCRASH_SERIALIZE_H
10
- #define SNOWCRASH_SERIALIZE_H
11
-
12
- #include <string>
13
-
14
- /** Version of API Blueprint AST serialization */
15
- #define AST_SERIALIZATION_VERSION "2.1"
16
-
17
- namespace snowcrash {
18
-
19
- /**
20
- * \brief Escape new lines in input string.
21
- * \param input A string to escape its new lines.
22
- * \return A new string with lines escaped.
23
- *
24
- * This function replaces all occurences of "\n" with "\\n".
25
- */
26
- std::string EscapeNewlines(const std::string& input);
27
-
28
- /**
29
- * \brief Escape every double quote in input string.
30
- * \param input A string to escape its double quotes.
31
- * \return A new string with double quotes escaped.
32
- */
33
- std::string EscapeDoubleQuotes(const std::string& input);
34
-
35
- /**
36
- * AST entities serialization keys
37
- */
38
- struct SerializeKey {
39
- static const std::string ASTVersion;
40
- static const std::string Metadata;
41
- static const std::string Reference;
42
- static const std::string Id;
43
- static const std::string Name;
44
- static const std::string Description;
45
- static const std::string ResourceGroups;
46
- static const std::string Resources;
47
- static const std::string URI;
48
- static const std::string URITemplate;
49
- static const std::string Actions;
50
- static const std::string Action;
51
- static const std::string Examples;
52
- static const std::string Transaction;
53
- static const std::string Method;
54
- static const std::string Requests;
55
- static const std::string Responses;
56
- static const std::string Body;
57
- static const std::string Schema;
58
- static const std::string Headers;
59
- static const std::string Model;
60
- static const std::string Value;
61
- static const std::string Parameters;
62
- static const std::string Type;
63
- static const std::string Required;
64
- static const std::string Default;
65
- static const std::string Example;
66
- static const std::string Values;
67
-
68
- };
69
- }
70
-
71
- #endif
@@ -1,1221 +0,0 @@
1
- //
2
- // SerializeJSON.cc
3
- // snowcrash
4
- //
5
- // Created by Zdenek Nemec on 4/27/13.
6
- // Copyright (c) 2013 Apiary Inc. All rights reserved.
7
- //
8
-
9
- #include "SerializeJSON.h"
10
- #include "Serialize.h"
11
-
12
- using namespace snowcrash;
13
-
14
- static const std::string IndentBlock = " ";
15
- static const std::string NewLineItemBlock = ",\n";
16
-
17
- /**
18
- * \brief Serialize a JSON string.
19
- * \param value JSON string to serialize
20
- * \param os An output stream to serialize into
21
- */
22
- static void serialize(const std::string& value, std::ostream &os)
23
- {
24
- os << "\"" << value << "\"";
25
- }
26
-
27
- /**
28
- * \brief Inserts indentation into an output stream.
29
- * \param level Level of indentation
30
- * \param os An output stream to serialize into
31
- */
32
- static void indent(size_t level, std::ostream &os)
33
- {
34
- for (size_t i = 0; i < level; ++i) {
35
- os << IndentBlock;
36
- }
37
- }
38
-
39
- /**
40
- * \brief Serialize key value pair into output stream.
41
- * \param key Key to serialize
42
- * \param value Value to serialize
43
- * \param level Indentation level
44
- * \param object Flag to indicate whether the pair should be serialized as an object
45
- * \param os An output stream to serialize into
46
- */
47
- static void serialize(const std::string& key, const std::string& value, size_t level, bool object, std::ostream &os)
48
- {
49
- indent(level, os);
50
-
51
- if (object) {
52
- os << "{\n";
53
- indent(level + 1, os);
54
- }
55
-
56
- serialize(key, os);
57
- os << ": ";
58
-
59
- std::string normValue = EscapeDoubleQuotes(value);
60
-
61
- if (normValue.find("\n") != std::string::npos)
62
- serialize(EscapeNewlines(normValue), os);
63
- else
64
- serialize(normValue, os);
65
-
66
- if (object) {
67
- os << "\n";
68
- indent(level, os);
69
- os << "}";
70
- }
71
- }
72
-
73
- /**
74
- * \brief Serialize key boolean value pair into output stream
75
- * \param key Key to serialize
76
- * \param value Value to serialize
77
- * \param level Indentation level
78
- * \param os An output stream to serialize into
79
- */
80
- static void serialize(const std::string& key, bool value, size_t level, std::ostream &os)
81
- {
82
- indent(level, os);
83
- serialize(key, os);
84
- os << ": ";
85
- os << ((value) ? "true" : "false");
86
- }
87
-
88
- /**
89
- * \brief Serialize key value pair as an object into output stream
90
- * \param key Key to serialize
91
- * \param value Value to serialize
92
- * \param level Indentation level
93
- * \param os An output stream to serialize into
94
- */
95
- static void serialize(const std::string& key, const std::string& value, size_t level, std::ostream &os)
96
- {
97
- indent(level, os);
98
-
99
- os << "{\n";
100
-
101
- serialize(SerializeKey::Name, key, level + 1, false, os);
102
- os << NewLineItemBlock;
103
-
104
- serialize(SerializeKey::Value, value, level + 1, false, os);
105
- os << "\n";
106
-
107
- indent(level, os);
108
- os << "}";
109
- }
110
-
111
- /**
112
- * \brief Serialize source map without key into output stream
113
- * \param set Source map
114
- * \param level Indentation level
115
- * \param os An output stream to serialize into
116
- */
117
- static void serialize(const SourceMapBase& set, size_t level, std::ostream &os)
118
- {
119
- os << "[";
120
-
121
- if (!set.sourceMap.empty()) {
122
- size_t i = 0;
123
- os << "\n";
124
-
125
- for (mdp::RangeSet<mdp::BytesRange>::const_iterator it = set.sourceMap.begin(); it != set.sourceMap.end(); ++i, ++it) {
126
-
127
- if (i > 0 && i < set.sourceMap.size())
128
- os << NewLineItemBlock;
129
-
130
- indent(level + 1, os);
131
- os << "[" << it->location << ", " << it->length << "]";
132
- }
133
-
134
- os << std::endl;
135
- indent(level, os);
136
- }
137
-
138
- os << "]";
139
- }
140
-
141
- /**
142
- * \brief Serialize a key and source map value into output stream.
143
- * \param key Key to serialize
144
- * \param value Source Map to serialize
145
- * \param level Indentation level
146
- * \param object Flag to indicate whether the pair should be serialized as an object
147
- * \param os An output stream to serialize into
148
- */
149
- static void serialize(const std::string& key, const SourceMapBase& value, size_t level, bool object, std::ostream &os)
150
- {
151
- indent(level, os);
152
-
153
- if (object) {
154
- os << "{\n";
155
- indent(level + 1, os);
156
- }
157
-
158
- serialize(key, os);
159
- os << ": ";
160
-
161
- serialize(value, level, os);
162
-
163
- if (object) {
164
- os << "\n";
165
- indent(level, os);
166
- os << "}";
167
- }
168
- }
169
-
170
- /**
171
- * \brief Serialize an array of source maps.
172
- * \param collection Collection to serialize
173
- * \param level Level of indentation
174
- * \param os An output stream to serialize into
175
- */
176
- static void serializeSourceMapCollection(const Collection<SourceMap<KeyValuePair> >::type& collection, size_t level, std::ostream &os)
177
- {
178
- os << "[";
179
-
180
- if (!collection.empty()) {
181
- os << "\n";
182
- size_t i = 0;
183
-
184
- for (Collection<SourceMap<KeyValuePair> >::const_iterator it = collection.begin(); it != collection.end(); ++i, ++it) {
185
-
186
- if (i > 0 && i < collection.size())
187
- os << NewLineItemBlock;
188
-
189
- indent(level + 1, os);
190
- serialize(*it, level + 1, os);
191
- }
192
-
193
- os << "\n";
194
- indent(level, os);
195
- }
196
-
197
- os << "]";
198
- }
199
-
200
- /**
201
- * \brief Serialize an array of key value pairs.
202
- * \param collection Collection to serialize
203
- * \param level Level of indentation
204
- * \param os An output stream to serialize into
205
- */
206
- static void serializeKeyValueCollection(const Collection<KeyValuePair>::type& collection, size_t level, std::ostream &os)
207
- {
208
- os << "[";
209
-
210
- if (!collection.empty()) {
211
- os << "\n";
212
- size_t i = 0;
213
-
214
- for (Collection<KeyValuePair>::const_iterator it = collection.begin(); it != collection.end(); ++i, ++it) {
215
-
216
- if (i > 0 && i < collection.size())
217
- os << NewLineItemBlock;
218
-
219
- serialize(it->first, it->second, level + 1, os);
220
- }
221
-
222
- os << "\n";
223
- indent(level, os);
224
- }
225
-
226
- os << "]";
227
- }
228
-
229
- /**
230
- * \brief Serialize Metadata into output stream.
231
- * \param metadata Metadata to serialize
232
- * \param os An output stream to serialize into
233
- */
234
- static void serialize(const MetadataCollection& metadata, std::ostream &os)
235
- {
236
- indent(1, os);
237
- serialize(SerializeKey::Metadata, os);
238
- os << ": ";
239
-
240
- serializeKeyValueCollection(metadata, 1, os);
241
-
242
- os << NewLineItemBlock;
243
- }
244
-
245
- /**
246
- * \brief Serialize Metadata source map into output stream.
247
- * \param metadata Metadata source map to serialize
248
- * \param os An output stream to serialize into
249
- */
250
- static void serialize(const Collection<SourceMap<Metadata> >::type& metadata, std::ostream &os)
251
- {
252
- indent(1, os);
253
- serialize(SerializeKey::Metadata, os);
254
- os << ": ";
255
-
256
- serializeSourceMapCollection(metadata, 1, os);
257
-
258
- os << NewLineItemBlock;
259
- }
260
-
261
- /**
262
- * \brief Serialize Parameters into output stream.
263
- * \param prarameters Parameters to serialize.
264
- * \param level Level of indentation.
265
- * \param os An output stream to serialize into.
266
- */
267
- static void serialize(const Parameters& parameters, size_t level, std::ostream &os)
268
- {
269
- indent(level, os);
270
- serialize(SerializeKey::Parameters, os);
271
- os << ": [";
272
-
273
- if (!parameters.empty()) {
274
- os << "\n";
275
- size_t i = 0;
276
-
277
- for (Collection<Parameter>::const_iterator it = parameters.begin(); it != parameters.end(); ++i, ++it) {
278
-
279
- if (i > 0 && i < parameters.size())
280
- os << NewLineItemBlock;
281
-
282
- indent(level + 1, os);
283
- os << "{\n";
284
-
285
- // Name
286
- serialize(SerializeKey::Name, it->name, level + 2, false, os);
287
- os << NewLineItemBlock;
288
-
289
- // Description
290
- serialize(SerializeKey::Description, it->description, level + 2, false, os);
291
- os << NewLineItemBlock;
292
-
293
- // Type
294
- serialize(SerializeKey::Type, it->type, level + 2, false, os);
295
- os << NewLineItemBlock;
296
-
297
- // Requried
298
- serialize(SerializeKey::Required, (it->use != OptionalParameterUse), level + 2, os);
299
- os << NewLineItemBlock;
300
-
301
- // Default
302
- serialize(SerializeKey::Default, it->defaultValue, level + 2, false, os);
303
- os << NewLineItemBlock;
304
-
305
- // Example
306
- serialize(SerializeKey::Example, it->exampleValue, level + 2, false, os);
307
- os << NewLineItemBlock;
308
-
309
- // Values
310
- indent(level + 2, os);
311
- serialize(SerializeKey::Values, os);
312
- os << ": [";
313
-
314
- if (!it->values.empty()) {
315
- os << "\n";
316
- size_t j = 0;
317
-
318
- for (Collection<Value>::const_iterator val_it = it->values.begin();
319
- val_it != it->values.end();
320
- ++j, ++val_it) {
321
-
322
- if (j > 0 && j < it->values.size())
323
- os << NewLineItemBlock;
324
-
325
- serialize(SerializeKey::Value, *val_it, level + 3, true, os);
326
- }
327
-
328
- os << "\n";
329
- indent(level + 2, os);
330
- }
331
-
332
- // Close Values
333
- os << "]";
334
-
335
- // Close Key / name object
336
- os << "\n";
337
- indent(level + 1, os);
338
- os << "}";
339
- }
340
-
341
- os << std::endl;
342
- indent(level, os);
343
- }
344
-
345
- os << "]";
346
- }
347
-
348
- /**
349
- * \brief Serialize Parameters source map into output stream.
350
- * \param prarameters Parameters source map to serialize.
351
- * \param level Level of indentation.
352
- * \param os An output stream to serialize into.
353
- */
354
- static void serialize(const Collection<SourceMap<Parameter> >::type& parameters, size_t level, std::ostream &os)
355
- {
356
- indent(level, os);
357
- serialize(SerializeKey::Parameters, os);
358
- os << ": [";
359
-
360
- if (!parameters.empty()) {
361
- os << "\n";
362
- size_t i = 0;
363
-
364
- for (Collection<SourceMap<Parameter> >::const_iterator it = parameters.begin(); it != parameters.end(); ++i, ++it) {
365
-
366
- if (i > 0 && i < parameters.size())
367
- os << NewLineItemBlock;
368
-
369
- indent(level + 1, os);
370
- os << "{\n";
371
-
372
- // Name
373
- serialize(SerializeKey::Name, it->name, level + 2, false, os);
374
- os << NewLineItemBlock;
375
-
376
- // Description
377
- serialize(SerializeKey::Description, it->description, level + 2, false, os);
378
- os << NewLineItemBlock;
379
-
380
- // Type
381
- serialize(SerializeKey::Type, it->type, level + 2, false, os);
382
- os << NewLineItemBlock;
383
-
384
- // Requried
385
- serialize(SerializeKey::Required, it->use, level + 2, false, os);
386
- os << NewLineItemBlock;
387
-
388
- // Default
389
- serialize(SerializeKey::Default, it->defaultValue, level + 2, false, os);
390
- os << NewLineItemBlock;
391
-
392
- // Example
393
- serialize(SerializeKey::Example, it->exampleValue, level + 2, false, os);
394
- os << NewLineItemBlock;
395
-
396
- // Values
397
- indent(level + 2, os);
398
- serialize(SerializeKey::Values, os);
399
- os << ": [";
400
-
401
- if (!it->values.collection.empty()) {
402
- os << "\n";
403
- size_t j = 0;
404
-
405
- indent(level + 3, os);
406
-
407
- for (Collection<SourceMap<Value> >::const_iterator val_it = it->values.collection.begin();
408
- val_it != it->values.collection.end();
409
- ++j, ++val_it) {
410
-
411
- if (j > 0 && j < it->values.collection.size())
412
- os << NewLineItemBlock;
413
-
414
- serialize(*val_it, level + 3, os);
415
- }
416
-
417
- os << "\n";
418
- indent(level + 2, os);
419
- }
420
-
421
- // Close Values
422
- os << "]";
423
-
424
- // Close Key / name object
425
- os << "\n";
426
- indent(level + 1, os);
427
- os << "}";
428
- }
429
-
430
- os << std::endl;
431
- indent(level, os);
432
- }
433
-
434
- os << "]";
435
- }
436
-
437
- /**
438
- * \brief Serialize HTTP headers into output stream.
439
- * \param headers Headers to serialize.
440
- * \param level Level of indentation.
441
- * \param os An output stream to serialize into.
442
- */
443
- static void serialize(const Headers& headers, size_t level, std::ostream &os)
444
- {
445
- indent(level, os);
446
- serialize(SerializeKey::Headers, os);
447
- os << ": ";
448
-
449
- serializeKeyValueCollection(headers, level, os);
450
- }
451
-
452
- /**
453
- * \brief Serialize HTTP headers source map into output stream.
454
- * \param headers Headers source map to serialize.
455
- * \param level Level of indentation.
456
- * \param os An output stream to serialize into.
457
- */
458
- static void serialize(const Collection<SourceMap<Header> >::type& headers, size_t level, std::ostream &os)
459
- {
460
- indent(level, os);
461
- serialize(SerializeKey::Headers, os);
462
- os << ": ";
463
-
464
- serializeSourceMapCollection(headers, level, os);
465
- }
466
-
467
- /**
468
- * \brief Serialize a reference into output stream.
469
- * \param reference A reference to serialize.
470
- * \param os An output stream to serialize into.
471
- */
472
- static void serialize(const Reference& reference, size_t level, std::ostream &os)
473
- {
474
-
475
- if (reference.id.empty()) {
476
- return;
477
- }
478
-
479
- indent(level, os);
480
- os << "\"" << SerializeKey::Reference << "\": {\n";
481
-
482
- serialize(SerializeKey::Id, reference.id, level + 1, false, os);
483
- os << "\n";
484
-
485
- indent(level, os);
486
- os << "}";
487
-
488
- os << NewLineItemBlock;
489
- }
490
-
491
- /**
492
- * \brief Serialize a reference source map into output stream.
493
- * \param reference A reference source map to serialize.
494
- * \param os An output stream to serialize into.
495
- */
496
- static void serialize(const SourceMap<Reference>& reference, size_t level, std::ostream &os)
497
- {
498
-
499
- if (reference.sourceMap.empty()) {
500
- return;
501
- }
502
-
503
- serialize(SerializeKey::Reference, reference, level, false, os);
504
- os << NewLineItemBlock;
505
- }
506
-
507
- /**
508
- * \brief Serialize a payload into output stream.
509
- * \param payload A payload to serialize.
510
- * \param os An output stream to serialize into.
511
- */
512
- static void serialize(const Payload& payload, size_t level, std::ostream &os)
513
- {
514
- os << "{\n";
515
-
516
- // Name
517
- serialize(SerializeKey::Name, payload.name, level + 1, false, os);
518
- os << NewLineItemBlock;
519
-
520
- // Reference
521
- serialize(payload.reference, level + 1, os);
522
-
523
- // Description
524
- serialize(SerializeKey::Description, payload.description, level + 1, false, os);
525
- os << NewLineItemBlock;
526
-
527
- // Headers
528
- serialize(payload.headers, level + 1, os);
529
- os << NewLineItemBlock;
530
-
531
- // Body
532
- serialize(SerializeKey::Body, payload.body, level + 1, false, os);
533
- os << NewLineItemBlock;
534
-
535
- // Schema
536
- serialize(SerializeKey::Schema, payload.schema, level + 1, false, os);
537
-
538
- os << "\n";
539
- indent(level, os);
540
- os << "}";
541
- }
542
-
543
- /**
544
- * \brief Serialize a payload source map into output stream.
545
- * \param payload A payload source map to serialize.
546
- * \param os An output stream to serialize into.
547
- */
548
- static void serialize(const SourceMap<Payload>& payload, size_t level, std::ostream &os)
549
- {
550
- os << "{\n";
551
-
552
- // Name
553
- serialize(SerializeKey::Name, payload.name, level + 1, false, os);
554
- os << NewLineItemBlock;
555
-
556
- // Symbol Reference
557
- serialize(payload.reference, level + 1, os);
558
-
559
- // Description
560
- serialize(SerializeKey::Description, payload.description, level + 1, false, os);
561
- os << NewLineItemBlock;
562
-
563
- // Headers
564
- serialize(payload.headers.collection, level + 1, os);
565
- os << NewLineItemBlock;
566
-
567
- // Body
568
- serialize(SerializeKey::Body, payload.body, level + 1, false, os);
569
- os << NewLineItemBlock;
570
-
571
- // Schema
572
- serialize(SerializeKey::Schema, payload.schema, level + 1, false, os);
573
-
574
- os << "\n";
575
- indent(level, os);
576
- os << "}";
577
- }
578
-
579
- /**
580
- * \brief Serialize a transaction example into output stream.
581
- * \param transaction A transaction example to serialize.
582
- * \param os An output stream to serialize into.
583
- */
584
- static void serialize(const TransactionExample& example, std::ostream &os)
585
- {
586
- indent(8, os);
587
- os << "{\n";
588
-
589
- // Name
590
- serialize(SerializeKey::Name, example.name, 9, false, os);
591
- os << NewLineItemBlock;
592
-
593
- // Description
594
- serialize(SerializeKey::Description, example.description, 9, false, os);
595
- os << NewLineItemBlock;
596
-
597
- // Requests
598
- indent(9, os);
599
- serialize(SerializeKey::Requests, os);
600
- os << ": ";
601
- os << "[";
602
-
603
- if (!example.requests.empty()) {
604
- os << "\n";
605
- size_t i = 0;
606
-
607
- for (Collection<Request>::const_iterator it = example.requests.begin();
608
- it != example.requests.end();
609
- ++i, ++it) {
610
-
611
- if (i > 0 && i < example.requests.size())
612
- os << NewLineItemBlock;
613
-
614
- indent(10, os);
615
- serialize(*it, 10, os);
616
- }
617
-
618
- os << "\n";
619
- indent(9, os);
620
- }
621
- os << "]";
622
- os << NewLineItemBlock;
623
-
624
- // Responses
625
- indent(9, os);
626
- serialize(SerializeKey::Responses, os);
627
- os << ": ";
628
- os << "[";
629
-
630
- if (!example.responses.empty()) {
631
- os << "\n";
632
- size_t i = 0;
633
-
634
- for (Collection<Response>::const_iterator it = example.responses.begin();
635
- it != example.responses.end();
636
- ++i, ++it) {
637
-
638
- if (i > 0 && i < example.responses.size())
639
- os << NewLineItemBlock;
640
-
641
- indent(10, os);
642
- serialize(*it, 10, os);
643
- }
644
-
645
- os << "\n";
646
- indent(9, os);
647
- }
648
- os << "]";
649
-
650
- // Close the transaction
651
- os << "\n";
652
- indent(8, os);
653
- os << "}";
654
- }
655
-
656
- /**
657
- * \brief Serialize a transaction example source map into output stream.
658
- * \param transaction A transaction example source map to serialize.
659
- * \param os An output stream to serialize into.
660
- */
661
- static void serialize(const SourceMap<TransactionExample>& example, std::ostream &os)
662
- {
663
- indent(8, os);
664
- os << "{\n";
665
-
666
- // Name
667
- serialize(SerializeKey::Name, example.name, 9, false, os);
668
- os << NewLineItemBlock;
669
-
670
- // Description
671
- serialize(SerializeKey::Description, example.description, 9, false, os);
672
- os << NewLineItemBlock;
673
-
674
- // Requests
675
- indent(9, os);
676
- serialize(SerializeKey::Requests, os);
677
- os << ": ";
678
- os << "[";
679
-
680
- if (!example.requests.collection.empty()) {
681
- os << "\n";
682
- size_t i = 0;
683
-
684
- for (Collection<SourceMap<Request> >::const_iterator it = example.requests.collection.begin();
685
- it != example.requests.collection.end();
686
- ++i, ++it) {
687
-
688
- if (i > 0 && i < example.requests.collection.size())
689
- os << NewLineItemBlock;
690
-
691
- indent(10, os);
692
- serialize(*it, 10, os);
693
- }
694
-
695
- os << "\n";
696
- indent(9, os);
697
- }
698
- os << "]";
699
- os << NewLineItemBlock;
700
-
701
- // Responses
702
- indent(9, os);
703
- serialize(SerializeKey::Responses, os);
704
- os << ": ";
705
- os << "[";
706
-
707
- if (!example.responses.collection.empty()) {
708
- os << "\n";
709
- size_t i = 0;
710
-
711
- for (Collection<SourceMap<Response> >::const_iterator it = example.responses.collection.begin();
712
- it != example.responses.collection.end();
713
- ++i, ++it) {
714
-
715
- if (i > 0 && i < example.responses.collection.size())
716
- os << NewLineItemBlock;
717
-
718
- indent(10, os);
719
- serialize(*it, 10, os);
720
- }
721
-
722
- os << "\n";
723
- indent(9, os);
724
- }
725
- os << "]";
726
-
727
- // Close the transaction
728
- os << "\n";
729
- indent(8, os);
730
- os << "}";
731
- }
732
-
733
- /**
734
- * \brief Serialize an action into output stream.
735
- * \param action The action to serialize.
736
- * \param os An output stream to serialize into.
737
- */
738
- static void serialize(const Action& action, std::ostream &os)
739
- {
740
- indent(6, os);
741
- os << "{\n";
742
-
743
- // Name
744
- serialize(SerializeKey::Name, action.name, 7, false, os);
745
- os << NewLineItemBlock;
746
-
747
- // Description
748
- serialize(SerializeKey::Description, action.description, 7, false, os);
749
- os << NewLineItemBlock;
750
-
751
- // HTTP Method
752
- serialize(SerializeKey::Method, action.method, 7, false, os);
753
- os << NewLineItemBlock;
754
-
755
- // Parameters
756
- serialize(action.parameters, 7, os);
757
- os << NewLineItemBlock;
758
-
759
- // Transactions
760
- indent(7, os);
761
- serialize(SerializeKey::Examples, os);
762
- os << ": ";
763
- os << "[";
764
-
765
- if (!action.examples.empty()) {
766
- os << "\n";
767
- size_t i = 0;
768
-
769
- for (Collection<TransactionExample>::const_iterator it = action.examples.begin();
770
- it != action.examples.end();
771
- ++i, ++it) {
772
-
773
- if (i > 0 && i < action.examples.size())
774
- os << NewLineItemBlock;
775
-
776
- serialize(*it, os);
777
- }
778
-
779
- os << "\n";
780
- indent(7, os);
781
- }
782
-
783
- os << "]";
784
-
785
- // Close the action
786
- os << "\n";
787
- indent(6, os);
788
- os << "}";
789
- }
790
-
791
- /**
792
- * \brief Serialize an action source map into output stream.
793
- * \param action The action source map to serialize.
794
- * \param os An output stream to serialize into.
795
- */
796
- static void serialize(const SourceMap<Action>& action, std::ostream &os)
797
- {
798
- indent(6, os);
799
- os << "{\n";
800
-
801
- // Name
802
- serialize(SerializeKey::Name, action.name, 7, false, os);
803
- os << NewLineItemBlock;
804
-
805
- // Description
806
- serialize(SerializeKey::Description, action.description, 7, false, os);
807
- os << NewLineItemBlock;
808
-
809
- // HTTP Method
810
- serialize(SerializeKey::Method, action.method, 7, false, os);
811
- os << NewLineItemBlock;
812
-
813
- // Parameters
814
- serialize(action.parameters.collection, 7, os);
815
- os << NewLineItemBlock;
816
-
817
- // Transactions
818
- indent(7, os);
819
- serialize(SerializeKey::Examples, os);
820
- os << ": ";
821
- os << "[";
822
-
823
- if (!action.examples.collection.empty()) {
824
- os << "\n";
825
- size_t i = 0;
826
-
827
- for (Collection<SourceMap<TransactionExample> >::const_iterator it = action.examples.collection.begin();
828
- it != action.examples.collection.end();
829
- ++i, ++it) {
830
-
831
- if (i > 0 && i < action.examples.collection.size())
832
- os << NewLineItemBlock;
833
-
834
- serialize(*it, os);
835
- }
836
-
837
- os << "\n";
838
- indent(7, os);
839
- }
840
-
841
- os << "]";
842
-
843
- // Close the action
844
- os << "\n";
845
- indent(6, os);
846
- os << "}";
847
- }
848
-
849
- /**
850
- * \brief Serialize a resource into output stream.
851
- * \param resource A resource to serialize
852
- * \param os An output stream to serialize into
853
- */
854
- static void serialize(const Resource& resource, std::ostream &os)
855
- {
856
- indent(4, os);
857
- os << "{\n";
858
-
859
- // Name
860
- serialize(SerializeKey::Name, resource.name, 5, false, os);
861
- os << NewLineItemBlock;
862
-
863
- // Description
864
- serialize(SerializeKey::Description, resource.description, 5, false, os);
865
- os << NewLineItemBlock;
866
-
867
- // URI template
868
- serialize(SerializeKey::URITemplate, resource.uriTemplate, 5, false, os);
869
- os << NewLineItemBlock;
870
-
871
- // Model
872
- indent(5, os);
873
- serialize(SerializeKey::Model, os);
874
- if (resource.model.name.empty()) {
875
- os << ": {}";
876
- }
877
- else {
878
- os << ": ";
879
-
880
- serialize(resource.model, 5, os);
881
- }
882
- os << NewLineItemBlock;
883
-
884
- // Parameters
885
- serialize(resource.parameters, 5, os);
886
- os << NewLineItemBlock;
887
-
888
- // Actions
889
- indent(5, os);
890
- serialize(SerializeKey::Actions, os);
891
- os << ": ";
892
- os << "[";
893
-
894
- if (!resource.actions.empty()) {
895
- os << "\n";
896
- size_t i = 0;
897
-
898
- for (Collection<Action>::const_iterator it = resource.actions.begin();
899
- it != resource.actions.end();
900
- ++i, ++it) {
901
-
902
- if (i > 0 && i < resource.actions.size())
903
- os << NewLineItemBlock;
904
-
905
- serialize(*it, os);
906
- }
907
-
908
- os << "\n";
909
- indent(5, os);
910
- }
911
-
912
- os << "]";
913
-
914
- // Close the resource
915
- os << "\n";
916
- indent(4, os);
917
- os << "}";
918
- }
919
-
920
- /**
921
- * \brief Serialize a resource source map into output stream.
922
- * \param resource A resource source map to serialize
923
- * \param os An output stream to serialize into
924
- */
925
- static void serialize(const SourceMap<Resource>& resource, std::ostream &os)
926
- {
927
- indent(4, os);
928
- os << "{\n";
929
-
930
- // Name
931
- serialize(SerializeKey::Name, resource.name, 5, false, os);
932
- os << NewLineItemBlock;
933
-
934
- // Description
935
- serialize(SerializeKey::Description, resource.description, 5, false, os);
936
- os << NewLineItemBlock;
937
-
938
- // URI template
939
- serialize(SerializeKey::URITemplate, resource.uriTemplate, 5, false, os);
940
- os << NewLineItemBlock;
941
-
942
- // Model
943
- indent(5, os);
944
- serialize(SerializeKey::Model, os);
945
- if (resource.model.name.sourceMap.empty()) {
946
- os << ": {}";
947
- }
948
- else {
949
- os << ": ";
950
-
951
- serialize(resource.model, 5, os);
952
- }
953
- os << NewLineItemBlock;
954
-
955
- // Parameters
956
- serialize(resource.parameters.collection, 5, os);
957
- os << NewLineItemBlock;
958
-
959
- // Actions
960
- indent(5, os);
961
- serialize(SerializeKey::Actions, os);
962
- os << ": ";
963
- os << "[";
964
-
965
- if (!resource.actions.collection.empty()) {
966
- os << "\n";
967
- size_t i = 0;
968
-
969
- for (Collection<SourceMap<Action> >::const_iterator it = resource.actions.collection.begin();
970
- it != resource.actions.collection.end();
971
- ++i, ++it) {
972
-
973
- if (i > 0 && i < resource.actions.collection.size())
974
- os << NewLineItemBlock;
975
-
976
- serialize(*it, os);
977
- }
978
-
979
- os << "\n";
980
- indent(5, os);
981
- }
982
-
983
- os << "]";
984
-
985
- // Close the resource
986
- os << "\n";
987
- indent(4, os);
988
- os << "}";
989
- }
990
-
991
- /**
992
- * \brief Serialize a group of resources into output stream.
993
- * \param resourceGroup A group to serialize.
994
- * \brief os An output stream to serialize into.
995
- */
996
- static void serialize(const ResourceGroup& resourceGroup, std::ostream &os)
997
- {
998
- indent(2, os);
999
- os << "{\n";
1000
-
1001
- // Name
1002
- serialize(SerializeKey::Name, resourceGroup.name, 3, false, os);
1003
- os << NewLineItemBlock;
1004
-
1005
- // Description
1006
- serialize(SerializeKey::Description, resourceGroup.description, 3, false, os);
1007
- os << NewLineItemBlock;
1008
-
1009
- // Resources
1010
- indent(3, os);
1011
- serialize(SerializeKey::Resources, os);
1012
- os << ": ";
1013
- os << "[";
1014
-
1015
- if (!resourceGroup.resources.empty()) {
1016
- os << "\n";
1017
- size_t i = 0;
1018
-
1019
- for (Collection<Resource>::const_iterator it = resourceGroup.resources.begin();
1020
- it != resourceGroup.resources.end();
1021
- ++i, ++it) {
1022
-
1023
- if (i > 0 && i < resourceGroup.resources.size())
1024
- os << NewLineItemBlock;
1025
-
1026
- serialize(*it, os);
1027
- }
1028
-
1029
- if (!resourceGroup.resources.empty()) {
1030
- os << "\n";
1031
- indent(3, os);
1032
- }
1033
- }
1034
-
1035
- os << "]";
1036
-
1037
- // Close the group
1038
- os << "\n";
1039
- indent(2, os);
1040
- os << "}";
1041
- }
1042
-
1043
- /**
1044
- * \brief Serialize a source map of group of resources into output stream.
1045
- * \param resourceGroup Source map of a group to serialize.
1046
- * \brief os An output stream to serialize into.
1047
- */
1048
- static void serialize(const SourceMap<ResourceGroup>& resourceGroup, std::ostream &os)
1049
- {
1050
- indent(2, os);
1051
- os << "{\n";
1052
-
1053
- // Name
1054
- serialize(SerializeKey::Name, resourceGroup.name, 3, false, os);
1055
- os << NewLineItemBlock;
1056
-
1057
- // Description
1058
- serialize(SerializeKey::Description, resourceGroup.description, 3, false, os);
1059
- os << NewLineItemBlock;
1060
-
1061
- // Resources
1062
- indent(3, os);
1063
- serialize(SerializeKey::Resources, os);
1064
- os << ": ";
1065
- os << "[";
1066
-
1067
- if (!resourceGroup.resources.collection.empty()) {
1068
- os << "\n";
1069
- size_t i = 0;
1070
-
1071
- for (Collection<SourceMap<Resource> >::const_iterator it = resourceGroup.resources.collection.begin();
1072
- it != resourceGroup.resources.collection.end();
1073
- ++i, ++it) {
1074
-
1075
- if (i > 0 && i < resourceGroup.resources.collection.size())
1076
- os << NewLineItemBlock;
1077
-
1078
- serialize(*it, os);
1079
- }
1080
-
1081
- if (!resourceGroup.resources.collection.empty()) {
1082
- os << "\n";
1083
- indent(3, os);
1084
- }
1085
- }
1086
-
1087
- os << "]";
1088
-
1089
- // Close the group
1090
- os << "\n";
1091
- indent(2, os);
1092
- os << "}";
1093
- }
1094
-
1095
- /**
1096
- * \brief Serialize Resource Groups into output stream.
1097
- * \param resourceGroups Resource Groups to serialize.
1098
- * \param os An output stream to serialize into.
1099
- */
1100
- static void serialize(const ResourceGroups& resourceGroups, std::ostream &os)
1101
- {
1102
- indent(1, os);
1103
- serialize(SerializeKey::ResourceGroups, os);
1104
- os << ": ";
1105
- os << "[";
1106
-
1107
- if (!resourceGroups.empty()) {
1108
- os << "\n";
1109
- size_t i = 0;
1110
-
1111
- for (Collection<ResourceGroup>::const_iterator it = resourceGroups.begin(); it != resourceGroups.end(); ++i, ++it) {
1112
-
1113
- if (i > 0 && i < resourceGroups.size())
1114
- os << NewLineItemBlock;
1115
-
1116
- serialize(*it, os);
1117
- }
1118
-
1119
- os << "\n";
1120
- indent(1, os);
1121
- }
1122
-
1123
- os << "]";
1124
- }
1125
-
1126
- /**
1127
- * \brief Serialize Resource Groups source map into output stream.
1128
- * \param resourceGroups Resource Groups source map to serialize.
1129
- * \param os An output stream to serialize into.
1130
- */
1131
- static void serialize(const Collection<SourceMap<ResourceGroup> >::type& resourceGroups, std::ostream &os)
1132
- {
1133
- indent(1, os);
1134
- serialize(SerializeKey::ResourceGroups, os);
1135
- os << ": ";
1136
- os << "[";
1137
-
1138
- if (!resourceGroups.empty()) {
1139
- os << "\n";
1140
- size_t i = 0;
1141
-
1142
- for (Collection<SourceMap<ResourceGroup> >::const_iterator it = resourceGroups.begin(); it != resourceGroups.end(); ++i, ++it) {
1143
-
1144
- if (i > 0 && i < resourceGroups.size())
1145
- os << NewLineItemBlock;
1146
-
1147
- serialize(*it, os);
1148
- }
1149
-
1150
- os << "\n";
1151
- indent(1, os);
1152
- }
1153
-
1154
- os << "]";
1155
- }
1156
-
1157
- /**
1158
- * \brief Serialize a blueprint into output stream.
1159
- * \param blueprint The blueprint to serialize.
1160
- * \param os An output stream to serialize into.
1161
- */
1162
- static void serialize(const Blueprint& blueprint, std::ostream &os)
1163
- {
1164
- os << "{\n";
1165
-
1166
- // AST Version
1167
- serialize(SerializeKey::ASTVersion, AST_SERIALIZATION_VERSION, 1, false, os);
1168
- os << NewLineItemBlock;
1169
-
1170
- // Metadata
1171
- serialize(blueprint.metadata, os);
1172
-
1173
- // Name
1174
- serialize(SerializeKey::Name, blueprint.name, 1, false, os);
1175
- os << NewLineItemBlock;
1176
-
1177
- // Description
1178
- serialize(SerializeKey::Description, blueprint.description, 1, false, os);
1179
- os << NewLineItemBlock;
1180
-
1181
- // Resource Groups
1182
- serialize(blueprint.resourceGroups, os);
1183
-
1184
- os << "\n}\n";
1185
- }
1186
-
1187
- /**
1188
- * \brief Serialize a blueprint source map into output stream.
1189
- * \param blueprint The blueprint source map to serialize.
1190
- * \param os An output stream to serialize into.
1191
- */
1192
- static void serialize(const SourceMap<Blueprint>& blueprint, std::ostream &os)
1193
- {
1194
- os << "{\n";
1195
-
1196
- // Metadata
1197
- serialize(blueprint.metadata.collection, os);
1198
-
1199
- // Name
1200
- serialize(SerializeKey::Name, blueprint.name, 1, false, os);
1201
- os << NewLineItemBlock;
1202
-
1203
- // Description
1204
- serialize(SerializeKey::Description, blueprint.description, 1, false, os);
1205
- os << NewLineItemBlock;
1206
-
1207
- // Resource Groups
1208
- serialize(blueprint.resourceGroups.collection, os);
1209
-
1210
- os << "\n}\n";
1211
- }
1212
-
1213
- void snowcrash::SerializeJSON(const snowcrash::Blueprint& blueprint, std::ostream &os)
1214
- {
1215
- serialize(blueprint, os);
1216
- }
1217
-
1218
- void snowcrash::SerializeSourceMapJSON(const snowcrash::SourceMap<snowcrash::Blueprint>& blueprint, std::ostream &os)
1219
- {
1220
- serialize(blueprint, os);
1221
- }