jsoncons 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/ext/jsoncons/extconf.rb +43 -0
  3. data/ext/jsoncons/jsoncons.cpp +161 -0
  4. data/ext/jsoncons/jsoncons.h +10 -0
  5. data/jsoncons.gemspec +44 -0
  6. data/lib/jsoncons/jsoncons/examples/input/address-book.json +13 -0
  7. data/lib/jsoncons/jsoncons/examples/input/books.json +28 -0
  8. data/lib/jsoncons/jsoncons/examples/input/countries.json +7 -0
  9. data/lib/jsoncons/jsoncons/examples/input/employees.json +30 -0
  10. data/lib/jsoncons/jsoncons/examples/input/jsonschema/name.json +15 -0
  11. data/lib/jsoncons/jsoncons/examples/input/multiple-json-objects.json +3 -0
  12. data/lib/jsoncons/jsoncons/examples/input/sales.csv +6 -0
  13. data/lib/jsoncons/jsoncons/examples/input/store.json +28 -0
  14. data/lib/jsoncons/jsoncons/examples/input/tasks.csv +6 -0
  15. data/lib/jsoncons/jsoncons/include/jsoncons/allocator_holder.hpp +38 -0
  16. data/lib/jsoncons/jsoncons/include/jsoncons/basic_json.hpp +5905 -0
  17. data/lib/jsoncons/jsoncons/include/jsoncons/bigint.hpp +1611 -0
  18. data/lib/jsoncons/jsoncons/include/jsoncons/byte_string.hpp +820 -0
  19. data/lib/jsoncons/jsoncons/include/jsoncons/config/binary_config.hpp +226 -0
  20. data/lib/jsoncons/jsoncons/include/jsoncons/config/compiler_support.hpp +375 -0
  21. data/lib/jsoncons/jsoncons/include/jsoncons/config/jsoncons_config.hpp +309 -0
  22. data/lib/jsoncons/jsoncons/include/jsoncons/config/version.hpp +40 -0
  23. data/lib/jsoncons/jsoncons/include/jsoncons/conv_error.hpp +218 -0
  24. data/lib/jsoncons/jsoncons/include/jsoncons/decode_json.hpp +209 -0
  25. data/lib/jsoncons/jsoncons/include/jsoncons/decode_traits.hpp +651 -0
  26. data/lib/jsoncons/jsoncons/include/jsoncons/detail/endian.hpp +44 -0
  27. data/lib/jsoncons/jsoncons/include/jsoncons/detail/grisu3.hpp +312 -0
  28. data/lib/jsoncons/jsoncons/include/jsoncons/detail/optional.hpp +483 -0
  29. data/lib/jsoncons/jsoncons/include/jsoncons/detail/parse_number.hpp +1133 -0
  30. data/lib/jsoncons/jsoncons/include/jsoncons/detail/span.hpp +188 -0
  31. data/lib/jsoncons/jsoncons/include/jsoncons/detail/string_view.hpp +537 -0
  32. data/lib/jsoncons/jsoncons/include/jsoncons/detail/string_wrapper.hpp +370 -0
  33. data/lib/jsoncons/jsoncons/include/jsoncons/detail/write_number.hpp +567 -0
  34. data/lib/jsoncons/jsoncons/include/jsoncons/encode_json.hpp +315 -0
  35. data/lib/jsoncons/jsoncons/include/jsoncons/encode_traits.hpp +378 -0
  36. data/lib/jsoncons/jsoncons/include/jsoncons/json.hpp +18 -0
  37. data/lib/jsoncons/jsoncons/include/jsoncons/json_array.hpp +324 -0
  38. data/lib/jsoncons/jsoncons/include/jsoncons/json_content_handler.hpp +12 -0
  39. data/lib/jsoncons/jsoncons/include/jsoncons/json_cursor.hpp +448 -0
  40. data/lib/jsoncons/jsoncons/include/jsoncons/json_decoder.hpp +420 -0
  41. data/lib/jsoncons/jsoncons/include/jsoncons/json_encoder.hpp +1587 -0
  42. data/lib/jsoncons/jsoncons/include/jsoncons/json_error.hpp +156 -0
  43. data/lib/jsoncons/jsoncons/include/jsoncons/json_exception.hpp +241 -0
  44. data/lib/jsoncons/jsoncons/include/jsoncons/json_filter.hpp +653 -0
  45. data/lib/jsoncons/jsoncons/include/jsoncons/json_fwd.hpp +23 -0
  46. data/lib/jsoncons/jsoncons/include/jsoncons/json_object.hpp +1772 -0
  47. data/lib/jsoncons/jsoncons/include/jsoncons/json_options.hpp +862 -0
  48. data/lib/jsoncons/jsoncons/include/jsoncons/json_parser.hpp +2900 -0
  49. data/lib/jsoncons/jsoncons/include/jsoncons/json_reader.hpp +731 -0
  50. data/lib/jsoncons/jsoncons/include/jsoncons/json_traits_macros.hpp +1072 -0
  51. data/lib/jsoncons/jsoncons/include/jsoncons/json_traits_macros_deprecated.hpp +144 -0
  52. data/lib/jsoncons/jsoncons/include/jsoncons/json_type.hpp +206 -0
  53. data/lib/jsoncons/jsoncons/include/jsoncons/json_type_traits.hpp +1830 -0
  54. data/lib/jsoncons/jsoncons/include/jsoncons/json_visitor.hpp +1560 -0
  55. data/lib/jsoncons/jsoncons/include/jsoncons/json_visitor2.hpp +2079 -0
  56. data/lib/jsoncons/jsoncons/include/jsoncons/pretty_print.hpp +89 -0
  57. data/lib/jsoncons/jsoncons/include/jsoncons/ser_context.hpp +62 -0
  58. data/lib/jsoncons/jsoncons/include/jsoncons/sink.hpp +289 -0
  59. data/lib/jsoncons/jsoncons/include/jsoncons/source.hpp +777 -0
  60. data/lib/jsoncons/jsoncons/include/jsoncons/source_adaptor.hpp +148 -0
  61. data/lib/jsoncons/jsoncons/include/jsoncons/staj2_cursor.hpp +1189 -0
  62. data/lib/jsoncons/jsoncons/include/jsoncons/staj_cursor.hpp +1254 -0
  63. data/lib/jsoncons/jsoncons/include/jsoncons/staj_iterator.hpp +449 -0
  64. data/lib/jsoncons/jsoncons/include/jsoncons/tag_type.hpp +245 -0
  65. data/lib/jsoncons/jsoncons/include/jsoncons/text_source_adaptor.hpp +144 -0
  66. data/lib/jsoncons/jsoncons/include/jsoncons/traits_extension.hpp +884 -0
  67. data/lib/jsoncons/jsoncons/include/jsoncons/typed_array_view.hpp +250 -0
  68. data/lib/jsoncons/jsoncons/include/jsoncons/unicode_traits.hpp +1330 -0
  69. data/lib/jsoncons/jsoncons/include/jsoncons/uri.hpp +635 -0
  70. data/lib/jsoncons/jsoncons/include/jsoncons/value_converter.hpp +340 -0
  71. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson.hpp +23 -0
  72. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_cursor.hpp +320 -0
  73. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_decimal128.hpp +865 -0
  74. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_encoder.hpp +585 -0
  75. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_error.hpp +103 -0
  76. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_oid.hpp +245 -0
  77. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_options.hpp +75 -0
  78. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_parser.hpp +645 -0
  79. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_reader.hpp +92 -0
  80. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_type.hpp +44 -0
  81. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/decode_bson.hpp +201 -0
  82. data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/encode_bson.hpp +144 -0
  83. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor.hpp +26 -0
  84. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_cursor.hpp +351 -0
  85. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_cursor2.hpp +265 -0
  86. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_detail.hpp +93 -0
  87. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_encoder.hpp +1766 -0
  88. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_error.hpp +105 -0
  89. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_options.hpp +113 -0
  90. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_parser.hpp +1942 -0
  91. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_reader.hpp +116 -0
  92. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/decode_cbor.hpp +203 -0
  93. data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/encode_cbor.hpp +151 -0
  94. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv.hpp +17 -0
  95. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_cursor.hpp +358 -0
  96. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_encoder.hpp +954 -0
  97. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_error.hpp +85 -0
  98. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_options.hpp +973 -0
  99. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_parser.hpp +2099 -0
  100. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_reader.hpp +348 -0
  101. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_serializer.hpp +12 -0
  102. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/decode_csv.hpp +208 -0
  103. data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/encode_csv.hpp +122 -0
  104. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jmespath/jmespath.hpp +5215 -0
  105. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jmespath/jmespath_error.hpp +215 -0
  106. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpatch/jsonpatch.hpp +579 -0
  107. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpatch/jsonpatch_error.hpp +121 -0
  108. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/expression.hpp +3329 -0
  109. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/flatten.hpp +432 -0
  110. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/json_location.hpp +445 -0
  111. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/json_query.hpp +115 -0
  112. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath.hpp +13 -0
  113. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath_error.hpp +240 -0
  114. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp +2612 -0
  115. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath_selector.hpp +1322 -0
  116. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpointer/jsonpointer.hpp +1577 -0
  117. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpointer/jsonpointer_error.hpp +119 -0
  118. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/format_validator.hpp +968 -0
  119. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/json_validator.hpp +120 -0
  120. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/jsonschema.hpp +13 -0
  121. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/jsonschema_error.hpp +105 -0
  122. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/jsonschema_version.hpp +18 -0
  123. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/keyword_validator.hpp +1745 -0
  124. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/keyword_validator_factory.hpp +556 -0
  125. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/schema_draft7.hpp +198 -0
  126. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/schema_location.hpp +200 -0
  127. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/schema_version.hpp +35 -0
  128. data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/subschema.hpp +144 -0
  129. data/lib/jsoncons/jsoncons/include/jsoncons_ext/mergepatch/mergepatch.hpp +103 -0
  130. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/decode_msgpack.hpp +202 -0
  131. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/encode_msgpack.hpp +142 -0
  132. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack.hpp +24 -0
  133. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_cursor.hpp +343 -0
  134. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_cursor2.hpp +259 -0
  135. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_encoder.hpp +753 -0
  136. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_error.hpp +94 -0
  137. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_options.hpp +74 -0
  138. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_parser.hpp +748 -0
  139. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_reader.hpp +116 -0
  140. data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_type.hpp +63 -0
  141. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/decode_ubjson.hpp +201 -0
  142. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/encode_ubjson.hpp +142 -0
  143. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson.hpp +23 -0
  144. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_cursor.hpp +307 -0
  145. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_encoder.hpp +502 -0
  146. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_error.hpp +100 -0
  147. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_options.hpp +87 -0
  148. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_parser.hpp +880 -0
  149. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_reader.hpp +92 -0
  150. data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_type.hpp +43 -0
  151. data/lib/jsoncons/version.rb +5 -0
  152. data/lib/jsoncons.rb +33 -0
  153. data/test/jsoncons_test.rb +108 -0
  154. data/test/test_helper.rb +7 -0
  155. metadata +268 -0
@@ -0,0 +1,1560 @@
1
+ // Copyright 2018 Daniel Parker
2
+ // Distributed under the Boost license, Version 1.0.
3
+ // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
+
5
+ // See https://github.com/danielaparker/jsoncons for latest version
6
+
7
+ #ifndef JSONCONS_JSON_VISITOR_HPP
8
+ #define JSONCONS_JSON_VISITOR_HPP
9
+
10
+ #include <iostream>
11
+ #include <string>
12
+ #include <utility>
13
+ #include <jsoncons/json_exception.hpp>
14
+ #include <jsoncons/bigint.hpp>
15
+ #include <jsoncons/ser_context.hpp>
16
+ #include <jsoncons/json_options.hpp>
17
+ #include <jsoncons/config/jsoncons_config.hpp>
18
+ #include <jsoncons/tag_type.hpp>
19
+ #include <jsoncons/byte_string.hpp>
20
+
21
+ namespace jsoncons {
22
+
23
+ template <class CharT>
24
+ class basic_json_visitor
25
+ {
26
+ public:
27
+ using char_type = CharT;
28
+ using char_traits_type = std::char_traits<char_type>;
29
+
30
+ using string_view_type = jsoncons::basic_string_view<char_type,char_traits_type>;
31
+
32
+ basic_json_visitor(basic_json_visitor&&) = default;
33
+
34
+ basic_json_visitor& operator=(basic_json_visitor&&) = default;
35
+
36
+ basic_json_visitor() = default;
37
+
38
+ virtual ~basic_json_visitor() noexcept = default;
39
+
40
+ void flush()
41
+ {
42
+ visit_flush();
43
+ }
44
+
45
+ bool begin_object(semantic_tag tag=semantic_tag::none,
46
+ const ser_context& context=ser_context())
47
+ {
48
+ std::error_code ec;
49
+ bool more = visit_begin_object(tag, context, ec);
50
+ if (ec)
51
+ {
52
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
53
+ }
54
+ return more;
55
+ }
56
+
57
+ bool begin_object(std::size_t length,
58
+ semantic_tag tag=semantic_tag::none,
59
+ const ser_context& context = ser_context())
60
+ {
61
+ std::error_code ec;
62
+ bool more = visit_begin_object(length, tag, context, ec);
63
+ if (ec)
64
+ {
65
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
66
+ }
67
+ return more;
68
+ }
69
+
70
+ bool end_object(const ser_context& context = ser_context())
71
+ {
72
+ std::error_code ec;
73
+ bool more = visit_end_object(context, ec);
74
+ if (ec)
75
+ {
76
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
77
+ }
78
+ return more;
79
+ }
80
+
81
+ bool begin_array(semantic_tag tag=semantic_tag::none,
82
+ const ser_context& context=ser_context())
83
+ {
84
+ std::error_code ec;
85
+ bool more = visit_begin_array(tag, context, ec);
86
+ if (ec)
87
+ {
88
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
89
+ }
90
+ return more;
91
+ }
92
+
93
+ bool begin_array(std::size_t length,
94
+ semantic_tag tag=semantic_tag::none,
95
+ const ser_context& context=ser_context())
96
+ {
97
+ std::error_code ec;
98
+ bool more = visit_begin_array(length, tag, context, ec);
99
+ if (ec)
100
+ {
101
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
102
+ }
103
+ return more;
104
+ }
105
+
106
+ bool end_array(const ser_context& context=ser_context())
107
+ {
108
+ std::error_code ec;
109
+ bool more = visit_end_array(context, ec);
110
+ if (ec)
111
+ {
112
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
113
+ }
114
+ return more;
115
+ }
116
+
117
+ bool key(const string_view_type& name, const ser_context& context=ser_context())
118
+ {
119
+ std::error_code ec;
120
+ bool more = visit_key(name, context, ec);
121
+ if (ec)
122
+ {
123
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
124
+ }
125
+ return more;
126
+ }
127
+
128
+ bool null_value(semantic_tag tag = semantic_tag::none,
129
+ const ser_context& context=ser_context())
130
+ {
131
+ std::error_code ec;
132
+ bool more = visit_null(tag, context, ec);
133
+ if (ec)
134
+ {
135
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
136
+ }
137
+ return more;
138
+ }
139
+
140
+ bool bool_value(bool value,
141
+ semantic_tag tag = semantic_tag::none,
142
+ const ser_context& context=ser_context())
143
+ {
144
+ std::error_code ec;
145
+ bool more = visit_bool(value, tag, context, ec);
146
+ if (ec)
147
+ {
148
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
149
+ }
150
+ return more;
151
+ }
152
+
153
+ bool string_value(const string_view_type& value,
154
+ semantic_tag tag = semantic_tag::none,
155
+ const ser_context& context=ser_context())
156
+ {
157
+ std::error_code ec;
158
+ bool more = visit_string(value, tag, context, ec);
159
+ if (ec)
160
+ {
161
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
162
+ }
163
+ return more;
164
+ }
165
+
166
+ template <class Source>
167
+ bool byte_string_value(const Source& b,
168
+ semantic_tag tag=semantic_tag::none,
169
+ const ser_context& context=ser_context(),
170
+ typename std::enable_if<traits_extension::is_byte_sequence<Source>::value,int>::type = 0)
171
+ {
172
+ std::error_code ec;
173
+ bool more = visit_byte_string(byte_string_view(reinterpret_cast<const uint8_t*>(b.data()),b.size()), tag, context, ec);
174
+ if (ec)
175
+ {
176
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
177
+ }
178
+ return more;
179
+ }
180
+
181
+ template <class Source>
182
+ bool byte_string_value(const Source& b,
183
+ uint64_t ext_tag,
184
+ const ser_context& context=ser_context(),
185
+ typename std::enable_if<traits_extension::is_byte_sequence<Source>::value,int>::type = 0)
186
+ {
187
+ std::error_code ec;
188
+ bool more = visit_byte_string(byte_string_view(reinterpret_cast<const uint8_t*>(b.data()),b.size()), ext_tag, context, ec);
189
+ if (ec)
190
+ {
191
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
192
+ }
193
+ return more;
194
+ }
195
+
196
+ bool uint64_value(uint64_t value,
197
+ semantic_tag tag = semantic_tag::none,
198
+ const ser_context& context=ser_context())
199
+ {
200
+ std::error_code ec;
201
+ bool more = visit_uint64(value, tag, context, ec);
202
+ if (ec)
203
+ {
204
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
205
+ }
206
+ return more;
207
+ }
208
+
209
+ bool int64_value(int64_t value,
210
+ semantic_tag tag = semantic_tag::none,
211
+ const ser_context& context=ser_context())
212
+ {
213
+ std::error_code ec;
214
+ bool more = visit_int64(value, tag, context, ec);
215
+ if (ec)
216
+ {
217
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
218
+ }
219
+ return more;
220
+ }
221
+
222
+ bool half_value(uint16_t value,
223
+ semantic_tag tag = semantic_tag::none,
224
+ const ser_context& context=ser_context())
225
+ {
226
+ std::error_code ec;
227
+ bool more = visit_half(value, tag, context, ec);
228
+ if (ec)
229
+ {
230
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
231
+ }
232
+ return more;
233
+ }
234
+
235
+ bool double_value(double value,
236
+ semantic_tag tag = semantic_tag::none,
237
+ const ser_context& context=ser_context())
238
+ {
239
+ std::error_code ec;
240
+ bool more = visit_double(value, tag, context, ec);
241
+ if (ec)
242
+ {
243
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
244
+ }
245
+ return more;
246
+ }
247
+
248
+ bool begin_object(semantic_tag tag,
249
+ const ser_context& context,
250
+ std::error_code& ec)
251
+ {
252
+ return visit_begin_object(tag, context, ec);
253
+ }
254
+
255
+ bool begin_object(std::size_t length,
256
+ semantic_tag tag,
257
+ const ser_context& context,
258
+ std::error_code& ec)
259
+ {
260
+ return visit_begin_object(length, tag, context, ec);
261
+ }
262
+
263
+ bool end_object(const ser_context& context, std::error_code& ec)
264
+ {
265
+ return visit_end_object(context, ec);
266
+ }
267
+
268
+ bool begin_array(semantic_tag tag, const ser_context& context, std::error_code& ec)
269
+ {
270
+ return visit_begin_array(tag, context, ec);
271
+ }
272
+
273
+ bool begin_array(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code& ec)
274
+ {
275
+ return visit_begin_array(length, tag, context, ec);
276
+ }
277
+
278
+ bool end_array(const ser_context& context, std::error_code& ec)
279
+ {
280
+ return visit_end_array(context, ec);
281
+ }
282
+
283
+ bool key(const string_view_type& name, const ser_context& context, std::error_code& ec)
284
+ {
285
+ return visit_key(name, context, ec);
286
+ }
287
+
288
+ bool null_value(semantic_tag tag,
289
+ const ser_context& context,
290
+ std::error_code& ec)
291
+ {
292
+ return visit_null(tag, context, ec);
293
+ }
294
+
295
+ bool bool_value(bool value,
296
+ semantic_tag tag,
297
+ const ser_context& context,
298
+ std::error_code& ec)
299
+ {
300
+ return visit_bool(value, tag, context, ec);
301
+ }
302
+
303
+ bool string_value(const string_view_type& value,
304
+ semantic_tag tag,
305
+ const ser_context& context,
306
+ std::error_code& ec)
307
+ {
308
+ return visit_string(value, tag, context, ec);
309
+ }
310
+
311
+ template <class Source>
312
+ bool byte_string_value(const Source& b,
313
+ semantic_tag tag,
314
+ const ser_context& context,
315
+ std::error_code& ec,
316
+ typename std::enable_if<traits_extension::is_byte_sequence<Source>::value,int>::type = 0)
317
+ {
318
+ return visit_byte_string(byte_string_view(reinterpret_cast<const uint8_t*>(b.data()),b.size()), tag, context, ec);
319
+ }
320
+
321
+ template <class Source>
322
+ bool byte_string_value(const Source& b,
323
+ uint64_t ext_tag,
324
+ const ser_context& context,
325
+ std::error_code& ec,
326
+ typename std::enable_if<traits_extension::is_byte_sequence<Source>::value,int>::type = 0)
327
+ {
328
+ return visit_byte_string(byte_string_view(reinterpret_cast<const uint8_t*>(b.data()),b.size()), ext_tag, context, ec);
329
+ }
330
+
331
+ bool uint64_value(uint64_t value,
332
+ semantic_tag tag,
333
+ const ser_context& context,
334
+ std::error_code& ec)
335
+ {
336
+ return visit_uint64(value, tag, context, ec);
337
+ }
338
+
339
+ bool int64_value(int64_t value,
340
+ semantic_tag tag,
341
+ const ser_context& context,
342
+ std::error_code& ec)
343
+ {
344
+ return visit_int64(value, tag, context, ec);
345
+ }
346
+
347
+ bool half_value(uint16_t value,
348
+ semantic_tag tag,
349
+ const ser_context& context,
350
+ std::error_code& ec)
351
+ {
352
+ return visit_half(value, tag, context, ec);
353
+ }
354
+
355
+ bool double_value(double value,
356
+ semantic_tag tag,
357
+ const ser_context& context,
358
+ std::error_code& ec)
359
+ {
360
+ return visit_double(value, tag, context, ec);
361
+ }
362
+
363
+ template <class T>
364
+ bool typed_array(const jsoncons::span<T>& data,
365
+ semantic_tag tag=semantic_tag::none,
366
+ const ser_context& context=ser_context())
367
+ {
368
+ std::error_code ec;
369
+ bool more = visit_typed_array(data, tag, context, ec);
370
+ if (ec)
371
+ {
372
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
373
+ }
374
+ return more;
375
+ }
376
+
377
+ template <class T>
378
+ bool typed_array(const jsoncons::span<T>& data,
379
+ semantic_tag tag,
380
+ const ser_context& context,
381
+ std::error_code& ec)
382
+ {
383
+ return visit_typed_array(data, tag, context, ec);
384
+ }
385
+
386
+ bool typed_array(half_arg_t, const jsoncons::span<const uint16_t>& s,
387
+ semantic_tag tag = semantic_tag::none,
388
+ const ser_context& context = ser_context())
389
+ {
390
+ std::error_code ec;
391
+ bool more = visit_typed_array(half_arg, s, tag, context, ec);
392
+ if (ec)
393
+ {
394
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
395
+ }
396
+ return more;
397
+ }
398
+
399
+ bool typed_array(half_arg_t, const jsoncons::span<const uint16_t>& s,
400
+ semantic_tag tag,
401
+ const ser_context& context,
402
+ std::error_code& ec)
403
+ {
404
+ return visit_typed_array(half_arg, s, tag, context, ec);
405
+ }
406
+
407
+ bool begin_multi_dim(const jsoncons::span<const size_t>& shape,
408
+ semantic_tag tag = semantic_tag::multi_dim_row_major,
409
+ const ser_context& context=ser_context())
410
+ {
411
+ std::error_code ec;
412
+ bool more = visit_begin_multi_dim(shape, tag, context, ec);
413
+ if (ec)
414
+ {
415
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
416
+ }
417
+ return more;
418
+ }
419
+
420
+ bool begin_multi_dim(const jsoncons::span<const size_t>& shape,
421
+ semantic_tag tag,
422
+ const ser_context& context,
423
+ std::error_code& ec)
424
+ {
425
+ return visit_begin_multi_dim(shape, tag, context, ec);
426
+ }
427
+
428
+ bool end_multi_dim(const ser_context& context=ser_context())
429
+ {
430
+ std::error_code ec;
431
+ bool more = visit_end_multi_dim(context, ec);
432
+ if (ec)
433
+ {
434
+ JSONCONS_THROW(ser_error(ec, context.line(), context.column()));
435
+ }
436
+ return more;
437
+ }
438
+
439
+ bool end_multi_dim(const ser_context& context,
440
+ std::error_code& ec)
441
+ {
442
+ return visit_end_multi_dim(context, ec);
443
+ }
444
+
445
+ #if !defined(JSONCONS_NO_DEPRECATED)
446
+
447
+ JSONCONS_DEPRECATED_MSG("Instead, use byte_string_value(const Source&,semantic_tag=semantic_tag::none, const ser_context&=ser_context()")
448
+ bool byte_string_value(const uint8_t* p, std::size_t size,
449
+ semantic_tag tag=semantic_tag::none,
450
+ const ser_context& context=ser_context())
451
+ {
452
+ return byte_string_value(byte_string(p, size), tag, context);
453
+ }
454
+
455
+ JSONCONS_DEPRECATED_MSG("Instead, use byte_string_value(const Source&, semantic_tag, const ser_context&, std::error_code&")
456
+ bool byte_string_value(const uint8_t* p, std::size_t size,
457
+ semantic_tag tag,
458
+ const ser_context& context,
459
+ std::error_code& ec)
460
+ {
461
+ return byte_string_value(byte_string(p, size), tag, context, ec);
462
+ }
463
+
464
+ JSONCONS_DEPRECATED_MSG("Instead, use key(const string_view_type&, const ser_context&=ser_context())")
465
+ bool name(const string_view_type& name, const ser_context& context=ser_context())
466
+ {
467
+ return key(name, context);
468
+ }
469
+
470
+ JSONCONS_DEPRECATED_MSG("Instead, use key(const string_view_type&, const ser_context&, std::error_code&)")
471
+ bool name(const string_view_type& name, const ser_context& context, std::error_code& ec)
472
+ {
473
+ return key(name, context, ec);
474
+ }
475
+
476
+ JSONCONS_DEPRECATED_MSG("Instead, use byte_string_value(const byte_string_view&, semantic_tag=semantic_tag::none, const ser_context&=ser_context()")
477
+ bool byte_string_value(const byte_string_view& b,
478
+ byte_string_chars_format encoding_hint,
479
+ semantic_tag tag=semantic_tag::none,
480
+ const ser_context& context=ser_context())
481
+ {
482
+ switch (encoding_hint)
483
+ {
484
+ case byte_string_chars_format::base16:
485
+ tag = semantic_tag::base16;
486
+ break;
487
+ case byte_string_chars_format::base64:
488
+ tag = semantic_tag::base64;
489
+ break;
490
+ case byte_string_chars_format::base64url:
491
+ tag = semantic_tag::base64url;
492
+ break;
493
+ default:
494
+ break;
495
+ }
496
+ return byte_string_value(b, tag, context);
497
+ }
498
+
499
+ JSONCONS_DEPRECATED_MSG("Instead, use byte_string_value(const byte_string_view&, semantic_tag=semantic_tag::none, const ser_context&=ser_context()")
500
+ bool byte_string_value(const uint8_t* p, std::size_t size,
501
+ byte_string_chars_format encoding_hint,
502
+ semantic_tag tag=semantic_tag::none,
503
+ const ser_context& context=ser_context())
504
+ {
505
+ switch (encoding_hint)
506
+ {
507
+ case byte_string_chars_format::base16:
508
+ tag = semantic_tag::base16;
509
+ break;
510
+ case byte_string_chars_format::base64:
511
+ tag = semantic_tag::base64;
512
+ break;
513
+ case byte_string_chars_format::base64url:
514
+ tag = semantic_tag::base64url;
515
+ break;
516
+ default:
517
+ break;
518
+ }
519
+ return byte_string_value(byte_string(p, size), tag, context);
520
+ }
521
+
522
+ JSONCONS_DEPRECATED_MSG("Instead, use string_value with semantic_tag::bigint")
523
+ bool big_integer_value(const string_view_type& value, const ser_context& context=ser_context())
524
+ {
525
+ return string_value(value, semantic_tag::bigint, context);
526
+ }
527
+
528
+ JSONCONS_DEPRECATED_MSG("Instead, use string_value with semantic_tag::bigdec")
529
+ bool big_decimal_value(const string_view_type& value, const ser_context& context=ser_context())
530
+ {
531
+ return string_value(value, semantic_tag::bigdec, context);
532
+ }
533
+
534
+ JSONCONS_DEPRECATED_MSG("Instead, use string_value with semantic_tag::datetime")
535
+ bool date_time_value(const string_view_type& value, const ser_context& context=ser_context())
536
+ {
537
+ return string_value(value, semantic_tag::datetime, context);
538
+ }
539
+
540
+ JSONCONS_DEPRECATED_MSG("Instead, use int64_value with semantic_tag::epoch_second")
541
+ bool timestamp_value(int64_t val, const ser_context& context=ser_context())
542
+ {
543
+ return int64_value(val, semantic_tag::epoch_second, context);
544
+ }
545
+
546
+ JSONCONS_DEPRECATED_MSG("Remove calls to this method, it doesn't do anything")
547
+ bool begin_document()
548
+ {
549
+ return true;
550
+ }
551
+
552
+ JSONCONS_DEPRECATED_MSG("Instead, use flush() when serializing")
553
+ bool end_document()
554
+ {
555
+ flush();
556
+ return true;
557
+ }
558
+
559
+ JSONCONS_DEPRECATED_MSG("Remove calls to this method, it doesn't do anything")
560
+ void begin_json()
561
+ {
562
+ }
563
+
564
+ JSONCONS_DEPRECATED_MSG("Instead, use flush() when serializing")
565
+ void end_json()
566
+ {
567
+ end_document();
568
+ }
569
+
570
+ JSONCONS_DEPRECATED_MSG("Instead, use key(const string_view_type&, const ser_context&=ser_context())")
571
+ void name(const char_type* p, std::size_t length, const ser_context& context)
572
+ {
573
+ name(string_view_type(p, length), context);
574
+ }
575
+
576
+ JSONCONS_DEPRECATED_MSG("Instead, use uint64_value(uint64_t, semantic_tag = semantic_tag::none, const ser_context&=ser_context())")
577
+ void integer_value(int64_t value)
578
+ {
579
+ int64_value(value);
580
+ }
581
+
582
+ JSONCONS_DEPRECATED_MSG("Instead, use int64_value(int64_t, semantic_tag = semantic_tag::none, const ser_context&=ser_context())")
583
+ void integer_value(int64_t value, const ser_context& context)
584
+ {
585
+ int64_value(value,context);
586
+ }
587
+
588
+ JSONCONS_DEPRECATED_MSG("Instead, use uint64_value(uint64_t, semantic_tag = semantic_tag::none, const ser_context&=ser_context())")
589
+ void uinteger_value(uint64_t value)
590
+ {
591
+ uint64_value(value);
592
+ }
593
+
594
+ JSONCONS_DEPRECATED_MSG("Instead, use uint64_value(uint64_t, semantic_tag = semantic_tag::none, const ser_context&=ser_context())")
595
+ void uinteger_value(uint64_t value, const ser_context& context)
596
+ {
597
+ uint64_value(value,context);
598
+ }
599
+
600
+ JSONCONS_DEPRECATED_MSG("Instead, use string_value with semantic_tag::bigint")
601
+ bool bignum_value(const string_view_type& value, const ser_context& context=ser_context())
602
+ {
603
+ return string_value(value, semantic_tag::bigint, context);
604
+ }
605
+
606
+ JSONCONS_DEPRECATED_MSG("Instead, use string_value with semantic_tag::bigdec")
607
+ bool decimal_value(const string_view_type& value, const ser_context& context=ser_context())
608
+ {
609
+ return string_value(value, semantic_tag::bigdec, context);
610
+ }
611
+
612
+ #endif
613
+ private:
614
+
615
+ virtual void visit_flush() = 0;
616
+
617
+ virtual bool visit_begin_object(semantic_tag tag,
618
+ const ser_context& context,
619
+ std::error_code& ec) = 0;
620
+
621
+ virtual bool visit_begin_object(std::size_t /*length*/,
622
+ semantic_tag tag,
623
+ const ser_context& context,
624
+ std::error_code& ec)
625
+ {
626
+ return visit_begin_object(tag, context, ec);
627
+ }
628
+
629
+ virtual bool visit_end_object(const ser_context& context,
630
+ std::error_code& ec) = 0;
631
+
632
+ virtual bool visit_begin_array(semantic_tag tag,
633
+ const ser_context& context,
634
+ std::error_code& ec) = 0;
635
+
636
+ virtual bool visit_begin_array(std::size_t /*length*/,
637
+ semantic_tag tag,
638
+ const ser_context& context,
639
+ std::error_code& ec)
640
+ {
641
+ return visit_begin_array(tag, context, ec);
642
+ }
643
+
644
+ virtual bool visit_end_array(const ser_context& context,
645
+ std::error_code& ec) = 0;
646
+
647
+ virtual bool visit_key(const string_view_type& name,
648
+ const ser_context& context,
649
+ std::error_code&) = 0;
650
+
651
+ virtual bool visit_null(semantic_tag tag,
652
+ const ser_context& context,
653
+ std::error_code& ec) = 0;
654
+
655
+ virtual bool visit_bool(bool value,
656
+ semantic_tag tag,
657
+ const ser_context& context,
658
+ std::error_code&) = 0;
659
+
660
+ virtual bool visit_string(const string_view_type& value,
661
+ semantic_tag tag,
662
+ const ser_context& context,
663
+ std::error_code& ec) = 0;
664
+
665
+ virtual bool visit_byte_string(const byte_string_view& value,
666
+ semantic_tag tag,
667
+ const ser_context& context,
668
+ std::error_code& ec) = 0;
669
+
670
+ virtual bool visit_byte_string(const byte_string_view& value,
671
+ uint64_t /* ext_tag */,
672
+ const ser_context& context,
673
+ std::error_code& ec)
674
+ {
675
+ return visit_byte_string(value, semantic_tag::none, context, ec);
676
+ }
677
+
678
+ virtual bool visit_uint64(uint64_t value,
679
+ semantic_tag tag,
680
+ const ser_context& context,
681
+ std::error_code& ec) = 0;
682
+
683
+ virtual bool visit_int64(int64_t value,
684
+ semantic_tag tag,
685
+ const ser_context& context,
686
+ std::error_code& ec) = 0;
687
+
688
+ virtual bool visit_half(uint16_t value,
689
+ semantic_tag tag,
690
+ const ser_context& context,
691
+ std::error_code& ec)
692
+ {
693
+ return visit_double(binary::decode_half(value),
694
+ tag,
695
+ context,
696
+ ec);
697
+ }
698
+
699
+ virtual bool visit_double(double value,
700
+ semantic_tag tag,
701
+ const ser_context& context,
702
+ std::error_code& ec) = 0;
703
+
704
+ virtual bool visit_typed_array(const jsoncons::span<const uint8_t>& s,
705
+ semantic_tag tag,
706
+ const ser_context& context,
707
+ std::error_code& ec)
708
+ {
709
+ bool more = begin_array(s.size(), tag, context, ec);
710
+ for (auto p = s.begin(); more && p != s.end(); ++p)
711
+ {
712
+ more = uint64_value(*p, semantic_tag::none, context, ec);
713
+ }
714
+ if (more)
715
+ {
716
+ more = end_array(context, ec);
717
+ }
718
+ return more;
719
+ }
720
+
721
+ virtual bool visit_typed_array(const jsoncons::span<const uint16_t>& s,
722
+ semantic_tag tag,
723
+ const ser_context& context,
724
+ std::error_code& ec)
725
+ {
726
+ bool more = begin_array(s.size(), tag, context, ec);
727
+ for (auto p = s.begin(); more && p != s.end(); ++p)
728
+ {
729
+ more = uint64_value(*p, semantic_tag::none, context, ec);
730
+ }
731
+ if (more)
732
+ {
733
+ more = end_array(context, ec);
734
+ }
735
+ return more;
736
+ }
737
+
738
+ virtual bool visit_typed_array(const jsoncons::span<const uint32_t>& s,
739
+ semantic_tag tag,
740
+ const ser_context& context,
741
+ std::error_code& ec)
742
+ {
743
+ bool more = begin_array(s.size(), tag, context, ec);
744
+ for (auto p = s.begin(); more && p != s.end(); ++p)
745
+ {
746
+ more = uint64_value(*p, semantic_tag::none, context, ec);
747
+ }
748
+ if (more)
749
+ {
750
+ more = end_array(context, ec);
751
+ }
752
+ return more;
753
+ }
754
+
755
+ virtual bool visit_typed_array(const jsoncons::span<const uint64_t>& s,
756
+ semantic_tag tag,
757
+ const ser_context& context,
758
+ std::error_code& ec)
759
+ {
760
+ bool more = begin_array(s.size(), tag, context, ec);
761
+ for (auto p = s.begin(); more && p != s.end(); ++p)
762
+ {
763
+ more = uint64_value(*p,semantic_tag::none,context, ec);
764
+ }
765
+ if (more)
766
+ {
767
+ more = end_array(context, ec);
768
+ }
769
+ return more;
770
+ }
771
+
772
+ virtual bool visit_typed_array(const jsoncons::span<const int8_t>& s,
773
+ semantic_tag tag,
774
+ const ser_context& context,
775
+ std::error_code& ec)
776
+ {
777
+ bool more = begin_array(s.size(), tag,context, ec);
778
+ for (auto p = s.begin(); more && p != s.end(); ++p)
779
+ {
780
+ more = int64_value(*p,semantic_tag::none,context, ec);
781
+ }
782
+ if (more)
783
+ {
784
+ more = end_array(context, ec);
785
+ }
786
+ return more;
787
+ }
788
+
789
+ virtual bool visit_typed_array(const jsoncons::span<const int16_t>& s,
790
+ semantic_tag tag,
791
+ const ser_context& context,
792
+ std::error_code& ec)
793
+ {
794
+ bool more = begin_array(s.size(), tag,context, ec);
795
+ for (auto p = s.begin(); more && p != s.end(); ++p)
796
+ {
797
+ more = int64_value(*p,semantic_tag::none,context, ec);
798
+ }
799
+ if (more)
800
+ {
801
+ more = end_array(context, ec);
802
+ }
803
+ return more;
804
+ }
805
+
806
+ virtual bool visit_typed_array(const jsoncons::span<const int32_t>& s,
807
+ semantic_tag tag,
808
+ const ser_context& context,
809
+ std::error_code& ec)
810
+ {
811
+ bool more = begin_array(s.size(), tag,context, ec);
812
+ for (auto p = s.begin(); more && p != s.end(); ++p)
813
+ {
814
+ more = int64_value(*p,semantic_tag::none,context, ec);
815
+ }
816
+ if (more)
817
+ {
818
+ more = end_array(context, ec);
819
+ }
820
+ return more;
821
+ }
822
+
823
+ virtual bool visit_typed_array(const jsoncons::span<const int64_t>& s,
824
+ semantic_tag tag,
825
+ const ser_context& context,
826
+ std::error_code& ec)
827
+ {
828
+ bool more = begin_array(s.size(), tag,context, ec);
829
+ for (auto p = s.begin(); more && p != s.end(); ++p)
830
+ {
831
+ more = int64_value(*p,semantic_tag::none,context, ec);
832
+ }
833
+ if (more)
834
+ {
835
+ more = end_array(context, ec);
836
+ }
837
+ return more;
838
+ }
839
+
840
+ virtual bool visit_typed_array(half_arg_t,
841
+ const jsoncons::span<const uint16_t>& s,
842
+ semantic_tag tag,
843
+ const ser_context& context,
844
+ std::error_code& ec)
845
+ {
846
+ bool more = begin_array(s.size(), tag, context, ec);
847
+ for (auto p = s.begin(); more && p != s.end(); ++p)
848
+ {
849
+ more = half_value(*p, semantic_tag::none, context, ec);
850
+ }
851
+ if (more)
852
+ {
853
+ more = end_array(context, ec);
854
+ }
855
+ return more;
856
+ }
857
+
858
+ virtual bool visit_typed_array(const jsoncons::span<const float>& s,
859
+ semantic_tag tag,
860
+ const ser_context& context,
861
+ std::error_code& ec)
862
+ {
863
+ bool more = begin_array(s.size(), tag,context, ec);
864
+ for (auto p = s.begin(); more && p != s.end(); ++p)
865
+ {
866
+ more = double_value(*p,semantic_tag::none,context, ec);
867
+ }
868
+ if (more)
869
+ {
870
+ more = end_array(context, ec);
871
+ }
872
+ return more;
873
+ }
874
+
875
+ virtual bool visit_typed_array(const jsoncons::span<const double>& s,
876
+ semantic_tag tag,
877
+ const ser_context& context,
878
+ std::error_code& ec)
879
+ {
880
+ bool more = begin_array(s.size(), tag,context, ec);
881
+ for (auto p = s.begin(); more && p != s.end(); ++p)
882
+ {
883
+ more = double_value(*p,semantic_tag::none,context, ec);
884
+ }
885
+ if (more)
886
+ {
887
+ more = end_array(context, ec);
888
+ }
889
+ return more;
890
+ }
891
+
892
+ virtual bool visit_begin_multi_dim(const jsoncons::span<const size_t>& shape,
893
+ semantic_tag tag,
894
+ const ser_context& context,
895
+ std::error_code& ec)
896
+ {
897
+ bool more = visit_begin_array(2, tag, context, ec);
898
+ if (more)
899
+ {
900
+ more = visit_begin_array(shape.size(), tag, context, ec);
901
+ for (auto it = shape.begin(); more && it != shape.end(); ++it)
902
+ {
903
+ visit_uint64(*it, semantic_tag::none, context, ec);
904
+ }
905
+ if (more)
906
+ {
907
+ more = visit_end_array(context, ec);
908
+ }
909
+ }
910
+ return more;
911
+ }
912
+
913
+ virtual bool visit_end_multi_dim(const ser_context& context,
914
+ std::error_code& ec)
915
+ {
916
+ return visit_end_array(context, ec);
917
+ }
918
+ };
919
+
920
+ template <class CharT>
921
+ class basic_default_json_visitor : public basic_json_visitor<CharT>
922
+ {
923
+ bool parse_more_;
924
+ std::error_code ec_;
925
+ public:
926
+ using typename basic_json_visitor<CharT>::string_view_type;
927
+
928
+ basic_default_json_visitor(bool accept_more = true,
929
+ std::error_code ec = std::error_code())
930
+ : parse_more_(accept_more), ec_(ec)
931
+ {
932
+ }
933
+ private:
934
+ void visit_flush() override
935
+ {
936
+ }
937
+
938
+ bool visit_begin_object(semantic_tag, const ser_context&, std::error_code& ec) override
939
+ {
940
+ if (ec_)
941
+ {
942
+ ec = ec_;
943
+ }
944
+ return parse_more_;
945
+ }
946
+
947
+ bool visit_end_object(const ser_context&, std::error_code& ec) override
948
+ {
949
+ if (ec_)
950
+ {
951
+ ec = ec_;
952
+ }
953
+ return parse_more_;
954
+ }
955
+
956
+ bool visit_begin_array(semantic_tag, const ser_context&, std::error_code& ec) override
957
+ {
958
+ if (ec_)
959
+ {
960
+ ec = ec_;
961
+ }
962
+ return parse_more_;
963
+ }
964
+
965
+ bool visit_end_array(const ser_context&, std::error_code& ec) override
966
+ {
967
+ if (ec_)
968
+ {
969
+ ec = ec_;
970
+ }
971
+ return parse_more_;
972
+ }
973
+
974
+ bool visit_key(const string_view_type&, const ser_context&, std::error_code& ec) override
975
+ {
976
+ if (ec_)
977
+ {
978
+ ec = ec_;
979
+ }
980
+ return parse_more_;
981
+ }
982
+
983
+ bool visit_null(semantic_tag, const ser_context&, std::error_code& ec) override
984
+ {
985
+ if (ec_)
986
+ {
987
+ ec = ec_;
988
+ }
989
+ return parse_more_;
990
+ }
991
+
992
+ bool visit_string(const string_view_type&, semantic_tag, const ser_context&, std::error_code& ec) override
993
+ {
994
+ if (ec_)
995
+ {
996
+ ec = ec_;
997
+ }
998
+ return parse_more_;
999
+ }
1000
+
1001
+ bool visit_byte_string(const byte_string_view&, semantic_tag, const ser_context&, std::error_code& ec) override
1002
+ {
1003
+ if (ec_)
1004
+ {
1005
+ ec = ec_;
1006
+ }
1007
+ return parse_more_;
1008
+ }
1009
+
1010
+ bool visit_uint64(uint64_t, semantic_tag, const ser_context&, std::error_code& ec) override
1011
+ {
1012
+ if (ec_)
1013
+ {
1014
+ ec = ec_;
1015
+ }
1016
+ return parse_more_;
1017
+ }
1018
+
1019
+ bool visit_int64(int64_t, semantic_tag, const ser_context&, std::error_code& ec) override
1020
+ {
1021
+ if (ec_)
1022
+ {
1023
+ ec = ec_;
1024
+ }
1025
+ return parse_more_;
1026
+ }
1027
+
1028
+ bool visit_half(uint16_t, semantic_tag, const ser_context&, std::error_code& ec) override
1029
+ {
1030
+ if (ec_)
1031
+ {
1032
+ ec = ec_;
1033
+ }
1034
+ return parse_more_;
1035
+ }
1036
+
1037
+ bool visit_double(double, semantic_tag, const ser_context&, std::error_code& ec) override
1038
+ {
1039
+ if (ec_)
1040
+ {
1041
+ ec = ec_;
1042
+ }
1043
+ return parse_more_;
1044
+ }
1045
+
1046
+ bool visit_bool(bool, semantic_tag, const ser_context&, std::error_code& ec) override
1047
+ {
1048
+ if (ec_)
1049
+ {
1050
+ ec = ec_;
1051
+ }
1052
+ return parse_more_;
1053
+ }
1054
+ };
1055
+
1056
+ template <class CharT>
1057
+ class basic_json_tee_visitor : public basic_json_visitor<CharT>
1058
+ {
1059
+ public:
1060
+ using typename basic_json_visitor<CharT>::char_type;
1061
+ using typename basic_json_visitor<CharT>::string_view_type;
1062
+ private:
1063
+ basic_json_visitor<char_type>& destination0_;
1064
+ basic_json_visitor<char_type>& destination1_;
1065
+
1066
+ // noncopyable and nonmoveable
1067
+ basic_json_tee_visitor(const basic_json_tee_visitor&) = delete;
1068
+ basic_json_tee_visitor& operator=(const basic_json_tee_visitor&) = delete;
1069
+ public:
1070
+ basic_json_tee_visitor(basic_json_visitor<char_type>& destination0,
1071
+ basic_json_visitor<char_type>& destination1)
1072
+ : destination0_(destination0), destination1_(destination1)
1073
+ {
1074
+ }
1075
+
1076
+ basic_json_visitor<char_type>& destination1()
1077
+ {
1078
+ return destination0_;
1079
+ }
1080
+
1081
+ basic_json_visitor<char_type>& destination2()
1082
+ {
1083
+ return destination1_;
1084
+ }
1085
+
1086
+ private:
1087
+ void visit_flush() override
1088
+ {
1089
+ destination0_.flush();
1090
+ }
1091
+
1092
+ bool visit_begin_object(semantic_tag tag, const ser_context& context, std::error_code& ec) override
1093
+ {
1094
+ bool more0 = destination0_.begin_object(tag, context, ec);
1095
+ bool more1 = destination1_.begin_object(tag, context, ec);
1096
+
1097
+ return more0 && more1;
1098
+ }
1099
+
1100
+ bool visit_begin_object(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1101
+ {
1102
+ bool more0 = destination0_.begin_object(length, tag, context, ec);
1103
+ bool more1 = destination1_.begin_object(length, tag, context, ec);
1104
+
1105
+ return more0 && more1;
1106
+ }
1107
+
1108
+ bool visit_end_object(const ser_context& context, std::error_code& ec) override
1109
+ {
1110
+ bool more0 = destination0_.end_object(context, ec);
1111
+ bool more1 = destination1_.end_object(context, ec);
1112
+
1113
+ return more0 && more1;
1114
+ }
1115
+
1116
+ bool visit_begin_array(semantic_tag tag, const ser_context& context, std::error_code& ec) override
1117
+ {
1118
+ bool more0 = destination0_.begin_array(tag, context, ec);
1119
+ bool more1 = destination1_.begin_array(tag, context, ec);
1120
+
1121
+ return more0 && more1;
1122
+ }
1123
+
1124
+ bool visit_begin_array(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1125
+ {
1126
+ bool more0 = destination0_.begin_array(length, tag, context, ec);
1127
+ bool more1 = destination1_.begin_array(length, tag, context, ec);
1128
+
1129
+ return more0 && more1;
1130
+ }
1131
+
1132
+ bool visit_end_array(const ser_context& context, std::error_code& ec) override
1133
+ {
1134
+ bool more0 = destination0_.end_array(context, ec);
1135
+ bool more1 = destination1_.end_array(context, ec);
1136
+
1137
+ return more0 && more1;
1138
+ }
1139
+
1140
+ bool visit_key(const string_view_type& name,
1141
+ const ser_context& context,
1142
+ std::error_code& ec) override
1143
+ {
1144
+ bool more0 = destination0_.key(name, context, ec);
1145
+ bool more1 = destination1_.key(name, context, ec);
1146
+
1147
+ return more0 && more1;
1148
+ }
1149
+
1150
+ bool visit_string(const string_view_type& value,
1151
+ semantic_tag tag,
1152
+ const ser_context& context,
1153
+ std::error_code& ec) override
1154
+ {
1155
+ bool more0 = destination0_.string_value(value, tag, context, ec);
1156
+ bool more1 = destination1_.string_value(value, tag, context, ec);
1157
+
1158
+ return more0 && more1;
1159
+ }
1160
+
1161
+ bool visit_byte_string(const byte_string_view& b,
1162
+ semantic_tag tag,
1163
+ const ser_context& context,
1164
+ std::error_code& ec) override
1165
+ {
1166
+ bool more0 = destination0_.byte_string_value(b, tag, context, ec);
1167
+ bool more1 = destination1_.byte_string_value(b, tag, context, ec);
1168
+
1169
+ return more0 && more1;
1170
+ }
1171
+
1172
+ bool visit_uint64(uint64_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1173
+ {
1174
+ bool more0 = destination0_.uint64_value(value, tag, context, ec);
1175
+ bool more1 = destination1_.uint64_value(value, tag, context, ec);
1176
+
1177
+ return more0 && more1;
1178
+ }
1179
+
1180
+ bool visit_int64(int64_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1181
+ {
1182
+ bool more0 = destination0_.int64_value(value, tag, context, ec);
1183
+ bool more1 = destination1_.int64_value(value, tag, context, ec);
1184
+
1185
+ return more0 && more1;
1186
+ }
1187
+
1188
+ bool visit_half(uint16_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1189
+ {
1190
+ bool more0 = destination0_.half_value(value, tag, context, ec);
1191
+ bool more1 = destination1_.half_value(value, tag, context, ec);
1192
+
1193
+ return more0 && more1;
1194
+ }
1195
+
1196
+ bool visit_double(double value, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1197
+ {
1198
+ bool more0 = destination0_.double_value(value, tag, context, ec);
1199
+ bool more1 = destination1_.double_value(value, tag, context, ec);
1200
+
1201
+ return more0 && more1;
1202
+ }
1203
+
1204
+ bool visit_bool(bool value, semantic_tag tag, const ser_context& context, std::error_code& ec) override
1205
+ {
1206
+ bool more0 = destination0_.bool_value(value, tag, context, ec);
1207
+ bool more1 = destination1_.bool_value(value, tag, context, ec);
1208
+
1209
+ return more0 && more1;
1210
+ }
1211
+
1212
+ bool visit_null(semantic_tag tag, const ser_context& context, std::error_code& ec) override
1213
+ {
1214
+ bool more0 = destination0_.null_value(tag, context, ec);
1215
+ bool more1 = destination1_.null_value(tag, context, ec);
1216
+
1217
+ return more0 && more1;
1218
+ }
1219
+
1220
+ bool visit_typed_array(const jsoncons::span<const uint8_t>& s,
1221
+ semantic_tag tag,
1222
+ const ser_context& context,
1223
+ std::error_code& ec) override
1224
+ {
1225
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1226
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1227
+
1228
+ return more0 && more1;
1229
+ }
1230
+
1231
+ bool visit_typed_array(const jsoncons::span<const uint16_t>& s,
1232
+ semantic_tag tag,
1233
+ const ser_context& context,
1234
+ std::error_code& ec) override
1235
+ {
1236
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1237
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1238
+
1239
+ return more0 && more1;
1240
+ }
1241
+
1242
+ bool visit_typed_array(const jsoncons::span<const uint32_t>& s,
1243
+ semantic_tag tag,
1244
+ const ser_context& context,
1245
+ std::error_code& ec) override
1246
+ {
1247
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1248
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1249
+
1250
+ return more0 && more1;
1251
+ }
1252
+
1253
+ bool visit_typed_array(const jsoncons::span<const uint64_t>& s,
1254
+ semantic_tag tag,
1255
+ const ser_context& context,
1256
+ std::error_code& ec) override
1257
+ {
1258
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1259
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1260
+
1261
+ return more0 && more1;
1262
+ }
1263
+
1264
+ bool visit_typed_array(const jsoncons::span<const int8_t>& s,
1265
+ semantic_tag tag,
1266
+ const ser_context& context,
1267
+ std::error_code& ec) override
1268
+ {
1269
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1270
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1271
+
1272
+ return more0 && more1;
1273
+ }
1274
+
1275
+ bool visit_typed_array(const jsoncons::span<const int16_t>& s,
1276
+ semantic_tag tag,
1277
+ const ser_context& context,
1278
+ std::error_code& ec) override
1279
+ {
1280
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1281
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1282
+
1283
+ return more0 && more1;
1284
+ }
1285
+
1286
+ bool visit_typed_array(const jsoncons::span<const int32_t>& s,
1287
+ semantic_tag tag,
1288
+ const ser_context& context,
1289
+ std::error_code& ec) override
1290
+ {
1291
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1292
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1293
+
1294
+ return more0 && more1;
1295
+ }
1296
+
1297
+ bool visit_typed_array(const jsoncons::span<const int64_t>& s,
1298
+ semantic_tag tag,
1299
+ const ser_context& context,
1300
+ std::error_code& ec) override
1301
+ {
1302
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1303
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1304
+
1305
+ return more0 && more1;
1306
+ }
1307
+
1308
+ bool visit_typed_array(half_arg_t,
1309
+ const jsoncons::span<const uint16_t>& s,
1310
+ semantic_tag tag,
1311
+ const ser_context& context,
1312
+ std::error_code& ec) override
1313
+ {
1314
+ bool more0 = destination0_.typed_array(half_arg, s, tag, context, ec);
1315
+ bool more1 = destination1_.typed_array(half_arg, s, tag, context, ec);
1316
+
1317
+ return more0 && more1;
1318
+ }
1319
+
1320
+ bool visit_typed_array(const jsoncons::span<const float>& s,
1321
+ semantic_tag tag,
1322
+ const ser_context& context,
1323
+ std::error_code& ec) override
1324
+ {
1325
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1326
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1327
+
1328
+ return more0 && more1;
1329
+ }
1330
+
1331
+ bool visit_typed_array(const jsoncons::span<const double>& s,
1332
+ semantic_tag tag,
1333
+ const ser_context& context,
1334
+ std::error_code& ec) override
1335
+ {
1336
+ bool more0 = destination0_.typed_array(s, tag, context, ec);
1337
+ bool more1 = destination1_.typed_array(s, tag, context, ec);
1338
+
1339
+ return more0 && more1;
1340
+ }
1341
+
1342
+ bool visit_begin_multi_dim(const jsoncons::span<const size_t>& shape,
1343
+ semantic_tag tag,
1344
+ const ser_context& context,
1345
+ std::error_code& ec) override
1346
+ {
1347
+ bool more0 = destination0_.begin_multi_dim(shape, tag, context, ec);
1348
+ bool more1 = destination1_.begin_multi_dim(shape, tag, context, ec);
1349
+
1350
+ return more0 && more1;
1351
+ }
1352
+
1353
+ bool visit_end_multi_dim(const ser_context& context,
1354
+ std::error_code& ec) override
1355
+ {
1356
+ bool more0 = destination0_.end_multi_dim(context, ec);
1357
+ bool more1 = destination1_.end_multi_dim(context, ec);
1358
+
1359
+ return more0 && more1;
1360
+ }
1361
+
1362
+ };
1363
+
1364
+ template <class CharT>
1365
+ class basic_json_diagnostics_visitor : public basic_default_json_visitor<CharT>
1366
+ {
1367
+ public:
1368
+ using stream_type = std::basic_ostream<CharT>;
1369
+ using string_type = std::basic_string<CharT>;
1370
+
1371
+ private:
1372
+ using supertype = basic_default_json_visitor<CharT>;
1373
+ using string_view_type = typename supertype::string_view_type;
1374
+
1375
+ struct enabler {};
1376
+
1377
+ static constexpr CharT visit_begin_array_name[] = {'v','i','s','i','t','_','b','e','g','i','n','_','a','r','r','a','y', 0};
1378
+ static constexpr CharT visit_end_array_name[] = {'v','i','s','i','t','_','e','n','d','_','a','r','r','a','y', 0};
1379
+ static constexpr CharT visit_begin_object_name[] = {'v','i','s','i','t','_','b','e','g','i','n','_','o','b','j','e','c','t', 0};
1380
+ static constexpr CharT visit_end_object_name[] = {'v','i','s','i','t','_','e','n','d','_','o','b','j','e','c','t', 0};
1381
+ static constexpr CharT visit_key_name[] = {'v','i','s','i','t','_','k','e','y', 0};
1382
+ static constexpr CharT visit_string_name[] = {'v','i','s','i','t','_','s','t','r','i','n','g', 0};
1383
+ static constexpr CharT visit_byte_string_name[] = {'v','i','s','i','t','_','b','y','t','e','_','s','t','r','i','n','g', 0};
1384
+ static constexpr CharT visit_null_name[] = {'v','i','s','i','t','_','n','u','l','l', 0};
1385
+ static constexpr CharT visit_bool_name[] = {'v','i','s','i','t','_','b','o','o','l', 0};
1386
+ static constexpr CharT visit_uint64_name[] = {'v','i','s','i','t','_','u','i','n','t','6','4', 0};
1387
+ static constexpr CharT visit_int64_name[] = {'v','i','s','i','t','_','i','n','t','6','4', 0};
1388
+ static constexpr CharT visit_half_name[] = {'v','i','s','i','t','_','h','a','l','f', 0};
1389
+ static constexpr CharT visit_double_name[] = {'v','i','s','i','t','_','d','o','u','b','l','e', 0};
1390
+
1391
+ static constexpr CharT separator_ = ':';
1392
+
1393
+ stream_type& output_;
1394
+ string_type indentation_;
1395
+ long level_;
1396
+
1397
+ public:
1398
+ // If CharT is char, then enable the default constructor which binds to
1399
+ // std::cout.
1400
+ template <class U = enabler>
1401
+ basic_json_diagnostics_visitor(
1402
+ typename std::enable_if<std::is_same<CharT, char>::value, U>::type = enabler{})
1403
+ : basic_json_diagnostics_visitor(std::cout)
1404
+ {
1405
+ }
1406
+
1407
+ // If CharT is wchar_t, then enable the default constructor which binds
1408
+ // to std::wcout.
1409
+ template <class U = enabler>
1410
+ basic_json_diagnostics_visitor(
1411
+ typename std::enable_if<std::is_same<CharT, wchar_t>::value, U>::type = enabler{})
1412
+ : basic_json_diagnostics_visitor(std::wcout)
1413
+ {
1414
+ }
1415
+
1416
+ explicit basic_json_diagnostics_visitor(
1417
+ stream_type& output,
1418
+ string_type indentation = string_type())
1419
+ : output_(output),
1420
+ indentation_(std::move(indentation)),
1421
+ level_(0)
1422
+ {
1423
+ }
1424
+
1425
+ private:
1426
+ void indent()
1427
+ {
1428
+ for (long i=0; i<level_; ++i)
1429
+ output_ << indentation_;
1430
+ }
1431
+
1432
+ bool visit_begin_object(semantic_tag, const ser_context&, std::error_code&) override
1433
+ {
1434
+ indent();
1435
+ output_ << visit_begin_object_name << std::endl;
1436
+ ++level_;
1437
+ return true;
1438
+ }
1439
+
1440
+ bool visit_begin_object(std::size_t length, semantic_tag, const ser_context&, std::error_code&) override
1441
+ {
1442
+ indent();
1443
+ output_ << visit_begin_object_name << separator_ << length << std::endl;
1444
+ ++level_;
1445
+ return true;
1446
+ }
1447
+
1448
+ bool visit_end_object(const ser_context&, std::error_code&) override
1449
+ {
1450
+ --level_;
1451
+ indent();
1452
+ output_ << visit_end_object_name << std::endl;
1453
+ return true;
1454
+ }
1455
+
1456
+ bool visit_begin_array(semantic_tag, const ser_context&, std::error_code&) override
1457
+ {
1458
+ indent();
1459
+ output_ << visit_begin_array_name << std::endl;
1460
+ ++level_;
1461
+ return true;
1462
+ }
1463
+
1464
+ bool visit_begin_array(std::size_t length, semantic_tag, const ser_context&, std::error_code&) override
1465
+ {
1466
+ indent();
1467
+ output_ << visit_begin_array_name << separator_ << length << std::endl;
1468
+ ++level_;
1469
+ return true;
1470
+ }
1471
+
1472
+ bool visit_end_array(const ser_context&, std::error_code&) override
1473
+ {
1474
+ --level_;
1475
+ indent();
1476
+ output_ << visit_end_array_name << std::endl;
1477
+ return true;
1478
+ }
1479
+
1480
+ bool visit_key(const string_view_type& s, const ser_context&, std::error_code&) override
1481
+ {
1482
+ indent();
1483
+ output_ << visit_key_name << separator_ << s << std::endl;
1484
+ return true;
1485
+ }
1486
+ bool visit_string(const string_view_type& s, semantic_tag, const ser_context&, std::error_code&) override
1487
+ {
1488
+ indent();
1489
+ output_ << visit_string_name << separator_ << s << std::endl;
1490
+ return true;
1491
+ }
1492
+ bool visit_int64(int64_t val, semantic_tag, const ser_context&, std::error_code&) override
1493
+ {
1494
+ indent();
1495
+ output_ << visit_int64_name << separator_ << val << std::endl;
1496
+ return true;
1497
+ }
1498
+ bool visit_uint64(uint64_t val, semantic_tag, const ser_context&, std::error_code&) override
1499
+ {
1500
+ indent();
1501
+ output_ << visit_uint64_name << separator_ << val << std::endl;
1502
+ return true;
1503
+ }
1504
+ bool visit_bool(bool val, semantic_tag, const ser_context&, std::error_code&) override
1505
+ {
1506
+ indent();
1507
+ output_ << visit_bool_name << separator_ << val << std::endl;
1508
+ return true;
1509
+ }
1510
+ bool visit_null(semantic_tag, const ser_context&, std::error_code&) override
1511
+ {
1512
+ indent();
1513
+ output_ << visit_null_name << std::endl;
1514
+ return true;
1515
+ }
1516
+ };
1517
+
1518
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_begin_array_name[];
1519
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_end_array_name[];
1520
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_begin_object_name[];
1521
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_end_object_name[];
1522
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_key_name[];
1523
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_string_name[];
1524
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_byte_string_name[];
1525
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_null_name[];
1526
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_bool_name[];
1527
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_uint64_name[];
1528
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_int64_name[];
1529
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_half_name[];
1530
+ template <class C> constexpr C basic_json_diagnostics_visitor<C>::visit_double_name[];
1531
+
1532
+ using json_visitor = basic_json_visitor<char>;
1533
+ using wjson_visitor = basic_json_visitor<wchar_t>;
1534
+
1535
+ using json_tee_visitor = basic_json_tee_visitor<char>;
1536
+ using wjson_tee_visitor = basic_json_tee_visitor<wchar_t>;
1537
+
1538
+ using default_json_visitor = basic_default_json_visitor<char>;
1539
+ using wdefault_json_visitor = basic_default_json_visitor<wchar_t>;
1540
+
1541
+ using json_diagnostics_visitor = basic_json_diagnostics_visitor<char>;
1542
+ using wjson_diagnostics_visitor = basic_json_diagnostics_visitor<wchar_t>;
1543
+
1544
+ #if !defined(JSONCONS_NO_DEPRECATED)
1545
+ template<class CharT>
1546
+ using basic_json_content_handler = basic_json_visitor<CharT>;
1547
+
1548
+ JSONCONS_DEPRECATED_MSG("Instead, use json_visitor") typedef json_visitor json_content_handler;
1549
+ JSONCONS_DEPRECATED_MSG("Instead, use wjson_visitor") typedef wjson_visitor wjson_content_handler;
1550
+
1551
+ template<class CharT>
1552
+ using basic_default_json_content_handler = basic_default_json_visitor<CharT>;
1553
+
1554
+ JSONCONS_DEPRECATED_MSG("Instead, use default_json_visitor") typedef default_json_visitor default_json_content_handler;
1555
+ JSONCONS_DEPRECATED_MSG("Instead, use default_wjson_visitor") typedef wdefault_json_visitor default_wjson_content_handler;
1556
+ #endif
1557
+
1558
+ } // namespace jsoncons
1559
+
1560
+ #endif