jsoncons 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/jsoncons/extconf.rb +43 -0
- data/ext/jsoncons/jsoncons.cpp +161 -0
- data/ext/jsoncons/jsoncons.h +10 -0
- data/jsoncons.gemspec +44 -0
- data/lib/jsoncons/jsoncons/examples/input/address-book.json +13 -0
- data/lib/jsoncons/jsoncons/examples/input/books.json +28 -0
- data/lib/jsoncons/jsoncons/examples/input/countries.json +7 -0
- data/lib/jsoncons/jsoncons/examples/input/employees.json +30 -0
- data/lib/jsoncons/jsoncons/examples/input/jsonschema/name.json +15 -0
- data/lib/jsoncons/jsoncons/examples/input/multiple-json-objects.json +3 -0
- data/lib/jsoncons/jsoncons/examples/input/sales.csv +6 -0
- data/lib/jsoncons/jsoncons/examples/input/store.json +28 -0
- data/lib/jsoncons/jsoncons/examples/input/tasks.csv +6 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/allocator_holder.hpp +38 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/basic_json.hpp +5905 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/bigint.hpp +1611 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/byte_string.hpp +820 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/config/binary_config.hpp +226 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/config/compiler_support.hpp +375 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/config/jsoncons_config.hpp +309 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/config/version.hpp +40 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/conv_error.hpp +218 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/decode_json.hpp +209 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/decode_traits.hpp +651 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/endian.hpp +44 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/grisu3.hpp +312 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/optional.hpp +483 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/parse_number.hpp +1133 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/span.hpp +188 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/string_view.hpp +537 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/string_wrapper.hpp +370 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/detail/write_number.hpp +567 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/encode_json.hpp +315 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/encode_traits.hpp +378 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json.hpp +18 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_array.hpp +324 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_content_handler.hpp +12 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_cursor.hpp +448 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_decoder.hpp +420 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_encoder.hpp +1587 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_error.hpp +156 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_exception.hpp +241 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_filter.hpp +653 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_fwd.hpp +23 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_object.hpp +1772 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_options.hpp +862 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_parser.hpp +2900 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_reader.hpp +731 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_traits_macros.hpp +1072 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_traits_macros_deprecated.hpp +144 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_type.hpp +206 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_type_traits.hpp +1830 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_visitor.hpp +1560 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/json_visitor2.hpp +2079 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/pretty_print.hpp +89 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/ser_context.hpp +62 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/sink.hpp +289 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/source.hpp +777 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/source_adaptor.hpp +148 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/staj2_cursor.hpp +1189 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/staj_cursor.hpp +1254 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/staj_iterator.hpp +449 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/tag_type.hpp +245 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/text_source_adaptor.hpp +144 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/traits_extension.hpp +884 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/typed_array_view.hpp +250 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/unicode_traits.hpp +1330 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/uri.hpp +635 -0
- data/lib/jsoncons/jsoncons/include/jsoncons/value_converter.hpp +340 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson.hpp +23 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_cursor.hpp +320 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_decimal128.hpp +865 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_encoder.hpp +585 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_error.hpp +103 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_oid.hpp +245 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_options.hpp +75 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_parser.hpp +645 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_reader.hpp +92 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/bson_type.hpp +44 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/decode_bson.hpp +201 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/bson/encode_bson.hpp +144 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor.hpp +26 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_cursor.hpp +351 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_cursor2.hpp +265 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_detail.hpp +93 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_encoder.hpp +1766 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_error.hpp +105 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_options.hpp +113 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_parser.hpp +1942 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/cbor_reader.hpp +116 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/decode_cbor.hpp +203 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/cbor/encode_cbor.hpp +151 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv.hpp +17 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_cursor.hpp +358 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_encoder.hpp +954 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_error.hpp +85 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_options.hpp +973 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_parser.hpp +2099 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_reader.hpp +348 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/csv_serializer.hpp +12 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/decode_csv.hpp +208 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/csv/encode_csv.hpp +122 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jmespath/jmespath.hpp +5215 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jmespath/jmespath_error.hpp +215 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpatch/jsonpatch.hpp +579 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpatch/jsonpatch_error.hpp +121 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/expression.hpp +3329 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/flatten.hpp +432 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/json_location.hpp +445 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/json_query.hpp +115 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath.hpp +13 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath_error.hpp +240 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp +2612 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpath/jsonpath_selector.hpp +1322 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpointer/jsonpointer.hpp +1577 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonpointer/jsonpointer_error.hpp +119 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/format_validator.hpp +968 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/json_validator.hpp +120 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/jsonschema.hpp +13 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/jsonschema_error.hpp +105 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/jsonschema_version.hpp +18 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/keyword_validator.hpp +1745 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/keyword_validator_factory.hpp +556 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/schema_draft7.hpp +198 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/schema_location.hpp +200 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/schema_version.hpp +35 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/jsonschema/subschema.hpp +144 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/mergepatch/mergepatch.hpp +103 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/decode_msgpack.hpp +202 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/encode_msgpack.hpp +142 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack.hpp +24 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_cursor.hpp +343 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_cursor2.hpp +259 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_encoder.hpp +753 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_error.hpp +94 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_options.hpp +74 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_parser.hpp +748 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_reader.hpp +116 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/msgpack/msgpack_type.hpp +63 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/decode_ubjson.hpp +201 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/encode_ubjson.hpp +142 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson.hpp +23 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_cursor.hpp +307 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_encoder.hpp +502 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_error.hpp +100 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_options.hpp +87 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_parser.hpp +880 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_reader.hpp +92 -0
- data/lib/jsoncons/jsoncons/include/jsoncons_ext/ubjson/ubjson_type.hpp +43 -0
- data/lib/jsoncons/version.rb +5 -0
- data/lib/jsoncons.rb +33 -0
- data/test/jsoncons_test.rb +108 -0
- data/test/test_helper.rb +7 -0
- metadata +268 -0
@@ -0,0 +1,1254 @@
|
|
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_STAJ_CURSOR_HPP
|
8
|
+
#define JSONCONS_STAJ_CURSOR_HPP
|
9
|
+
|
10
|
+
#include <memory> // std::allocator
|
11
|
+
#include <string>
|
12
|
+
#include <stdexcept>
|
13
|
+
#include <system_error>
|
14
|
+
#include <ios>
|
15
|
+
#include <type_traits> // std::enable_if
|
16
|
+
#include <array> // std::array
|
17
|
+
#include <functional> // std::function
|
18
|
+
#include <jsoncons/json_exception.hpp>
|
19
|
+
#include <jsoncons/json_visitor.hpp>
|
20
|
+
#include <jsoncons/bigint.hpp>
|
21
|
+
#include <jsoncons/json_parser.hpp>
|
22
|
+
#include <jsoncons/ser_context.hpp>
|
23
|
+
#include <jsoncons/sink.hpp>
|
24
|
+
#include <jsoncons/detail/write_number.hpp>
|
25
|
+
#include <jsoncons/json_type_traits.hpp>
|
26
|
+
#include <jsoncons/typed_array_view.hpp>
|
27
|
+
#include <jsoncons/value_converter.hpp>
|
28
|
+
|
29
|
+
namespace jsoncons {
|
30
|
+
|
31
|
+
enum class staj_event_type
|
32
|
+
{
|
33
|
+
begin_array,
|
34
|
+
end_array,
|
35
|
+
begin_object,
|
36
|
+
end_object,
|
37
|
+
key,
|
38
|
+
string_value,
|
39
|
+
byte_string_value,
|
40
|
+
null_value,
|
41
|
+
bool_value,
|
42
|
+
int64_value,
|
43
|
+
uint64_value,
|
44
|
+
half_value,
|
45
|
+
double_value
|
46
|
+
#if !defined(JSONCONS_NO_DEPRECATED)
|
47
|
+
,name = key
|
48
|
+
#endif
|
49
|
+
};
|
50
|
+
|
51
|
+
template <class CharT>
|
52
|
+
std::basic_ostream<CharT>& operator<<(std::basic_ostream<CharT>& os, staj_event_type tag)
|
53
|
+
{
|
54
|
+
static constexpr const CharT* begin_array_name = JSONCONS_CSTRING_CONSTANT(CharT, "begin_array");
|
55
|
+
static constexpr const CharT* end_array_name = JSONCONS_CSTRING_CONSTANT(CharT, "end_array");
|
56
|
+
static constexpr const CharT* begin_object_name = JSONCONS_CSTRING_CONSTANT(CharT, "begin_object");
|
57
|
+
static constexpr const CharT* end_object_name = JSONCONS_CSTRING_CONSTANT(CharT, "end_object");
|
58
|
+
static constexpr const CharT* key_name = JSONCONS_CSTRING_CONSTANT(CharT, "key");
|
59
|
+
static constexpr const CharT* string_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "string_value");
|
60
|
+
static constexpr const CharT* byte_string_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "byte_string_value");
|
61
|
+
static constexpr const CharT* null_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "null_value");
|
62
|
+
static constexpr const CharT* bool_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "bool_value");
|
63
|
+
static constexpr const CharT* uint64_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "uint64_value");
|
64
|
+
static constexpr const CharT* int64_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "int64_value");
|
65
|
+
static constexpr const CharT* half_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "half_value");
|
66
|
+
static constexpr const CharT* double_value_name = JSONCONS_CSTRING_CONSTANT(CharT, "double_value");
|
67
|
+
|
68
|
+
switch (tag)
|
69
|
+
{
|
70
|
+
case staj_event_type::begin_array:
|
71
|
+
{
|
72
|
+
os << begin_array_name;
|
73
|
+
break;
|
74
|
+
}
|
75
|
+
case staj_event_type::end_array:
|
76
|
+
{
|
77
|
+
os << end_array_name;
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
case staj_event_type::begin_object:
|
81
|
+
{
|
82
|
+
os << begin_object_name;
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
case staj_event_type::end_object:
|
86
|
+
{
|
87
|
+
os << end_object_name;
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
case staj_event_type::key:
|
91
|
+
{
|
92
|
+
os << key_name;
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
case staj_event_type::string_value:
|
96
|
+
{
|
97
|
+
os << string_value_name;
|
98
|
+
break;
|
99
|
+
}
|
100
|
+
case staj_event_type::byte_string_value:
|
101
|
+
{
|
102
|
+
os << byte_string_value_name;
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
case staj_event_type::null_value:
|
106
|
+
{
|
107
|
+
os << null_value_name;
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
case staj_event_type::bool_value:
|
111
|
+
{
|
112
|
+
os << bool_value_name;
|
113
|
+
break;
|
114
|
+
}
|
115
|
+
case staj_event_type::int64_value:
|
116
|
+
{
|
117
|
+
os << int64_value_name;
|
118
|
+
break;
|
119
|
+
}
|
120
|
+
case staj_event_type::uint64_value:
|
121
|
+
{
|
122
|
+
os << uint64_value_name;
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
case staj_event_type::half_value:
|
126
|
+
{
|
127
|
+
os << half_value_name;
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
case staj_event_type::double_value:
|
131
|
+
{
|
132
|
+
os << double_value_name;
|
133
|
+
break;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
return os;
|
137
|
+
}
|
138
|
+
|
139
|
+
template <class CharT>
|
140
|
+
class basic_staj_visitor;
|
141
|
+
|
142
|
+
template<class CharT>
|
143
|
+
class basic_staj_event
|
144
|
+
{
|
145
|
+
staj_event_type event_type_;
|
146
|
+
semantic_tag tag_;
|
147
|
+
uint64_t ext_tag_;
|
148
|
+
union
|
149
|
+
{
|
150
|
+
bool bool_value_;
|
151
|
+
int64_t int64_value_;
|
152
|
+
uint64_t uint64_value_;
|
153
|
+
uint16_t half_value_;
|
154
|
+
double double_value_;
|
155
|
+
const CharT* string_data_;
|
156
|
+
const uint8_t* byte_string_data_;
|
157
|
+
} value_;
|
158
|
+
std::size_t length_;
|
159
|
+
public:
|
160
|
+
using string_view_type = jsoncons::basic_string_view<CharT>;
|
161
|
+
|
162
|
+
basic_staj_event(staj_event_type event_type, semantic_tag tag = semantic_tag::none)
|
163
|
+
: event_type_(event_type), tag_(tag), ext_tag_(0), value_(), length_(0)
|
164
|
+
{
|
165
|
+
}
|
166
|
+
|
167
|
+
basic_staj_event(staj_event_type event_type, std::size_t length, semantic_tag tag = semantic_tag::none)
|
168
|
+
: event_type_(event_type), tag_(tag), ext_tag_(0), value_(), length_(length)
|
169
|
+
{
|
170
|
+
}
|
171
|
+
|
172
|
+
basic_staj_event(null_type, semantic_tag tag)
|
173
|
+
: event_type_(staj_event_type::null_value), tag_(tag), ext_tag_(0), value_(), length_(0)
|
174
|
+
{
|
175
|
+
}
|
176
|
+
|
177
|
+
basic_staj_event(bool value, semantic_tag tag)
|
178
|
+
: event_type_(staj_event_type::bool_value), tag_(tag), ext_tag_(0), length_(0)
|
179
|
+
{
|
180
|
+
value_.bool_value_ = value;
|
181
|
+
}
|
182
|
+
|
183
|
+
basic_staj_event(int64_t value, semantic_tag tag)
|
184
|
+
: event_type_(staj_event_type::int64_value), tag_(tag), ext_tag_(0), length_(0)
|
185
|
+
{
|
186
|
+
value_.int64_value_ = value;
|
187
|
+
}
|
188
|
+
|
189
|
+
basic_staj_event(uint64_t value, semantic_tag tag)
|
190
|
+
: event_type_(staj_event_type::uint64_value), tag_(tag), ext_tag_(0), length_(0)
|
191
|
+
{
|
192
|
+
value_.uint64_value_ = value;
|
193
|
+
}
|
194
|
+
|
195
|
+
basic_staj_event(half_arg_t, uint16_t value, semantic_tag tag)
|
196
|
+
: event_type_(staj_event_type::half_value), tag_(tag), ext_tag_(0), length_(0)
|
197
|
+
{
|
198
|
+
value_.half_value_ = value;
|
199
|
+
}
|
200
|
+
|
201
|
+
basic_staj_event(double value, semantic_tag tag)
|
202
|
+
: event_type_(staj_event_type::double_value), tag_(tag), ext_tag_(0), length_(0)
|
203
|
+
{
|
204
|
+
value_.double_value_ = value;
|
205
|
+
}
|
206
|
+
|
207
|
+
basic_staj_event(const string_view_type& s,
|
208
|
+
staj_event_type event_type,
|
209
|
+
semantic_tag tag = semantic_tag::none)
|
210
|
+
: event_type_(event_type), tag_(tag), ext_tag_(0), length_(s.length())
|
211
|
+
{
|
212
|
+
value_.string_data_ = s.data();
|
213
|
+
}
|
214
|
+
|
215
|
+
basic_staj_event(const byte_string_view& s,
|
216
|
+
staj_event_type event_type,
|
217
|
+
semantic_tag tag = semantic_tag::none)
|
218
|
+
: event_type_(event_type), tag_(tag), ext_tag_(0), length_(s.size())
|
219
|
+
{
|
220
|
+
value_.byte_string_data_ = s.data();
|
221
|
+
}
|
222
|
+
|
223
|
+
basic_staj_event(const byte_string_view& s,
|
224
|
+
staj_event_type event_type,
|
225
|
+
uint64_t ext_tag)
|
226
|
+
: event_type_(event_type), tag_(semantic_tag::ext), ext_tag_(ext_tag), length_(s.size())
|
227
|
+
{
|
228
|
+
value_.byte_string_data_ = s.data();
|
229
|
+
}
|
230
|
+
|
231
|
+
std::size_t size() const
|
232
|
+
{
|
233
|
+
return length_;
|
234
|
+
}
|
235
|
+
|
236
|
+
template <class T>
|
237
|
+
T get() const
|
238
|
+
{
|
239
|
+
std::error_code ec;
|
240
|
+
T val = get<T>(ec);
|
241
|
+
if (ec)
|
242
|
+
{
|
243
|
+
JSONCONS_THROW(ser_error(ec));
|
244
|
+
}
|
245
|
+
return val;
|
246
|
+
}
|
247
|
+
|
248
|
+
template <class T>
|
249
|
+
T get(std::error_code& ec) const
|
250
|
+
{
|
251
|
+
return get_<T>(std::allocator<char>{}, ec);
|
252
|
+
}
|
253
|
+
|
254
|
+
template<class T, class Allocator, class CharT_ = CharT>
|
255
|
+
typename std::enable_if<traits_extension::is_string<T>::value && std::is_same<typename T::value_type, CharT_>::value, T>::type
|
256
|
+
get_(Allocator,std::error_code& ec) const
|
257
|
+
{
|
258
|
+
switch (event_type_)
|
259
|
+
{
|
260
|
+
case staj_event_type::key:
|
261
|
+
case staj_event_type::string_value:
|
262
|
+
{
|
263
|
+
value_converter<jsoncons::basic_string_view<CharT>,T> converter;
|
264
|
+
return converter.convert(jsoncons::basic_string_view<CharT>(value_.string_data_, length_), tag(), ec);
|
265
|
+
}
|
266
|
+
case staj_event_type::byte_string_value:
|
267
|
+
{
|
268
|
+
value_converter<jsoncons::byte_string_view,T> converter;
|
269
|
+
return converter.convert(byte_string_view(value_.byte_string_data_,length_),tag(),ec);
|
270
|
+
}
|
271
|
+
case staj_event_type::uint64_value:
|
272
|
+
{
|
273
|
+
value_converter<uint64_t,T> converter;
|
274
|
+
return converter.convert(value_.uint64_value_, tag(), ec);
|
275
|
+
}
|
276
|
+
case staj_event_type::int64_value:
|
277
|
+
{
|
278
|
+
value_converter<int64_t,T> converter;
|
279
|
+
return converter.convert(value_.int64_value_, tag(), ec);
|
280
|
+
}
|
281
|
+
case staj_event_type::half_value:
|
282
|
+
{
|
283
|
+
value_converter<half_arg_t,T> converter;
|
284
|
+
return converter.convert(value_.half_value_, tag(), ec);
|
285
|
+
}
|
286
|
+
case staj_event_type::double_value:
|
287
|
+
{
|
288
|
+
value_converter<double,T> converter;
|
289
|
+
return converter.convert(value_.double_value_, tag(), ec);
|
290
|
+
}
|
291
|
+
case staj_event_type::bool_value:
|
292
|
+
{
|
293
|
+
value_converter<bool,T> converter;
|
294
|
+
return converter.convert(value_.bool_value_,tag(),ec);
|
295
|
+
}
|
296
|
+
case staj_event_type::null_value:
|
297
|
+
{
|
298
|
+
value_converter<null_type,T> converter;
|
299
|
+
return converter.convert(tag(), ec);
|
300
|
+
}
|
301
|
+
default:
|
302
|
+
{
|
303
|
+
ec = conv_errc::not_string;
|
304
|
+
return T{};
|
305
|
+
}
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
template<class T, class Allocator, class CharT_ = CharT>
|
310
|
+
typename std::enable_if<traits_extension::is_string_view<T>::value && std::is_same<typename T::value_type, CharT_>::value, T>::type
|
311
|
+
get_(Allocator, std::error_code& ec) const
|
312
|
+
{
|
313
|
+
T s;
|
314
|
+
switch (event_type_)
|
315
|
+
{
|
316
|
+
case staj_event_type::key:
|
317
|
+
case staj_event_type::string_value:
|
318
|
+
s = T(value_.string_data_, length_);
|
319
|
+
break;
|
320
|
+
default:
|
321
|
+
ec = conv_errc::not_string_view;
|
322
|
+
break;
|
323
|
+
}
|
324
|
+
return s;
|
325
|
+
}
|
326
|
+
|
327
|
+
template<class T, class Allocator>
|
328
|
+
typename std::enable_if<std::is_same<T, byte_string_view>::value, T>::type
|
329
|
+
get_(Allocator, std::error_code& ec) const
|
330
|
+
{
|
331
|
+
T s;
|
332
|
+
switch (event_type_)
|
333
|
+
{
|
334
|
+
case staj_event_type::byte_string_value:
|
335
|
+
s = T(value_.byte_string_data_, length_);
|
336
|
+
break;
|
337
|
+
default:
|
338
|
+
ec = conv_errc::not_byte_string_view;
|
339
|
+
break;
|
340
|
+
}
|
341
|
+
return s;
|
342
|
+
}
|
343
|
+
|
344
|
+
template<class T, class Allocator>
|
345
|
+
typename std::enable_if<traits_extension::is_list_like<T>::value &&
|
346
|
+
std::is_same<typename T::value_type,uint8_t>::value,T>::type
|
347
|
+
get_(Allocator, std::error_code& ec) const
|
348
|
+
{
|
349
|
+
switch (event_type_)
|
350
|
+
{
|
351
|
+
case staj_event_type::byte_string_value:
|
352
|
+
{
|
353
|
+
value_converter<byte_string_view,T> converter;
|
354
|
+
return converter.convert(byte_string_view(value_.byte_string_data_, length_), tag(), ec);
|
355
|
+
}
|
356
|
+
case staj_event_type::string_value:
|
357
|
+
{
|
358
|
+
value_converter<jsoncons::basic_string_view<CharT>,T> converter;
|
359
|
+
return converter.convert(jsoncons::basic_string_view<CharT>(value_.string_data_, length_), tag(), ec);
|
360
|
+
}
|
361
|
+
default:
|
362
|
+
ec = conv_errc::not_byte_string;
|
363
|
+
return T{};
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
template <class IntegerType, class Allocator>
|
368
|
+
typename std::enable_if<traits_extension::is_integer<IntegerType>::value, IntegerType>::type
|
369
|
+
get_(Allocator, std::error_code& ec) const
|
370
|
+
{
|
371
|
+
switch (event_type_)
|
372
|
+
{
|
373
|
+
case staj_event_type::string_value:
|
374
|
+
{
|
375
|
+
IntegerType val;
|
376
|
+
auto result = jsoncons::detail::to_integer(value_.string_data_, length_, val);
|
377
|
+
if (!result)
|
378
|
+
{
|
379
|
+
ec = conv_errc::not_integer;
|
380
|
+
return IntegerType();
|
381
|
+
}
|
382
|
+
return val;
|
383
|
+
}
|
384
|
+
case staj_event_type::half_value:
|
385
|
+
return static_cast<IntegerType>(value_.half_value_);
|
386
|
+
case staj_event_type::double_value:
|
387
|
+
return static_cast<IntegerType>(value_.double_value_);
|
388
|
+
case staj_event_type::int64_value:
|
389
|
+
return static_cast<IntegerType>(value_.int64_value_);
|
390
|
+
case staj_event_type::uint64_value:
|
391
|
+
return static_cast<IntegerType>(value_.uint64_value_);
|
392
|
+
case staj_event_type::bool_value:
|
393
|
+
return static_cast<IntegerType>(value_.bool_value_ ? 1 : 0);
|
394
|
+
default:
|
395
|
+
ec = conv_errc::not_integer;
|
396
|
+
return IntegerType();
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
template<class T, class Allocator>
|
401
|
+
typename std::enable_if<std::is_floating_point<T>::value, T>::type
|
402
|
+
get_(Allocator, std::error_code& ec) const
|
403
|
+
{
|
404
|
+
return static_cast<T>(as_double(ec));
|
405
|
+
}
|
406
|
+
|
407
|
+
template<class T, class Allocator>
|
408
|
+
typename std::enable_if<traits_extension::is_bool<T>::value, T>::type
|
409
|
+
get_(Allocator, std::error_code& ec) const
|
410
|
+
{
|
411
|
+
return as_bool(ec);
|
412
|
+
}
|
413
|
+
|
414
|
+
#if !defined(JSONCONS_NO_DEPRECATED)
|
415
|
+
template<class T>
|
416
|
+
JSONCONS_DEPRECATED_MSG("Instead, use get<T>()")
|
417
|
+
T as() const
|
418
|
+
{
|
419
|
+
return get<T>();
|
420
|
+
}
|
421
|
+
semantic_tag get_semantic_tag() const noexcept { return tag_; }
|
422
|
+
#endif
|
423
|
+
|
424
|
+
staj_event_type event_type() const noexcept { return event_type_; }
|
425
|
+
|
426
|
+
semantic_tag tag() const noexcept { return tag_; }
|
427
|
+
|
428
|
+
uint64_t ext_tag() const noexcept { return ext_tag_; }
|
429
|
+
|
430
|
+
private:
|
431
|
+
|
432
|
+
double as_double(std::error_code& ec) const
|
433
|
+
{
|
434
|
+
switch (event_type_)
|
435
|
+
{
|
436
|
+
case staj_event_type::key:
|
437
|
+
case staj_event_type::string_value:
|
438
|
+
{
|
439
|
+
jsoncons::detail::chars_to f;
|
440
|
+
return f(value_.string_data_, length_);
|
441
|
+
}
|
442
|
+
case staj_event_type::double_value:
|
443
|
+
return value_.double_value_;
|
444
|
+
case staj_event_type::int64_value:
|
445
|
+
return static_cast<double>(value_.int64_value_);
|
446
|
+
case staj_event_type::uint64_value:
|
447
|
+
return static_cast<double>(value_.uint64_value_);
|
448
|
+
case staj_event_type::half_value:
|
449
|
+
{
|
450
|
+
double x = binary::decode_half(value_.half_value_);
|
451
|
+
return static_cast<double>(x);
|
452
|
+
}
|
453
|
+
default:
|
454
|
+
ec = conv_errc::not_double;
|
455
|
+
return double();
|
456
|
+
}
|
457
|
+
}
|
458
|
+
|
459
|
+
bool as_bool(std::error_code& ec) const
|
460
|
+
{
|
461
|
+
switch (event_type_)
|
462
|
+
{
|
463
|
+
case staj_event_type::bool_value:
|
464
|
+
return value_.bool_value_;
|
465
|
+
case staj_event_type::double_value:
|
466
|
+
return value_.double_value_ != 0.0;
|
467
|
+
case staj_event_type::int64_value:
|
468
|
+
return value_.int64_value_ != 0;
|
469
|
+
case staj_event_type::uint64_value:
|
470
|
+
return value_.uint64_value_ != 0;
|
471
|
+
default:
|
472
|
+
ec = conv_errc::not_bool;
|
473
|
+
return bool();
|
474
|
+
}
|
475
|
+
}
|
476
|
+
|
477
|
+
friend bool send_json_event(const basic_staj_event<CharT>& ev,
|
478
|
+
basic_json_visitor<CharT>& visitor,
|
479
|
+
const ser_context& context,
|
480
|
+
std::error_code& ec)
|
481
|
+
{
|
482
|
+
switch (ev.event_type())
|
483
|
+
{
|
484
|
+
case staj_event_type::begin_array:
|
485
|
+
return visitor.begin_array(ev.tag(), context);
|
486
|
+
case staj_event_type::end_array:
|
487
|
+
return visitor.end_array(context);
|
488
|
+
case staj_event_type::begin_object:
|
489
|
+
return visitor.begin_object(ev.tag(), context, ec);
|
490
|
+
case staj_event_type::end_object:
|
491
|
+
return visitor.end_object(context, ec);
|
492
|
+
case staj_event_type::key:
|
493
|
+
return visitor.key(string_view_type(ev.value_.string_data_,ev.length_), context);
|
494
|
+
case staj_event_type::string_value:
|
495
|
+
return visitor.string_value(string_view_type(ev.value_.string_data_,ev.length_), ev.tag(), context);
|
496
|
+
case staj_event_type::byte_string_value:
|
497
|
+
return visitor.byte_string_value(byte_string_view(ev.value_.byte_string_data_,ev.length_), ev.tag(), context);
|
498
|
+
case staj_event_type::null_value:
|
499
|
+
return visitor.null_value(ev.tag(), context);
|
500
|
+
case staj_event_type::bool_value:
|
501
|
+
return visitor.bool_value(ev.value_.bool_value_, ev.tag(), context);
|
502
|
+
case staj_event_type::int64_value:
|
503
|
+
return visitor.int64_value(ev.value_.int64_value_, ev.tag(), context);
|
504
|
+
case staj_event_type::uint64_value:
|
505
|
+
return visitor.uint64_value(ev.value_.uint64_value_, ev.tag(), context);
|
506
|
+
case staj_event_type::half_value:
|
507
|
+
return visitor.half_value(ev.value_.half_value_, ev.tag(), context);
|
508
|
+
case staj_event_type::double_value:
|
509
|
+
return visitor.double_value(ev.value_.double_value_, ev.tag(), context);
|
510
|
+
default:
|
511
|
+
return false;
|
512
|
+
}
|
513
|
+
}
|
514
|
+
};
|
515
|
+
|
516
|
+
// basic_staj_visitor
|
517
|
+
|
518
|
+
enum class staj_cursor_state
|
519
|
+
{
|
520
|
+
typed_array = 1,
|
521
|
+
multi_dim,
|
522
|
+
shape
|
523
|
+
};
|
524
|
+
|
525
|
+
template <class CharT>
|
526
|
+
class basic_staj_visitor : public basic_json_visitor<CharT>
|
527
|
+
{
|
528
|
+
using super_type = basic_json_visitor<CharT>;
|
529
|
+
public:
|
530
|
+
using char_type = CharT;
|
531
|
+
using typename super_type::string_view_type;
|
532
|
+
private:
|
533
|
+
std::function<bool(const basic_staj_event<CharT>&, const ser_context&)> pred_;
|
534
|
+
basic_staj_event<CharT> event_;
|
535
|
+
|
536
|
+
staj_cursor_state state_;
|
537
|
+
typed_array_view data_;
|
538
|
+
jsoncons::span<const size_t> shape_;
|
539
|
+
std::size_t index_;
|
540
|
+
public:
|
541
|
+
basic_staj_visitor()
|
542
|
+
: pred_(accept), event_(staj_event_type::null_value),
|
543
|
+
state_(), data_(), shape_(), index_(0)
|
544
|
+
{
|
545
|
+
}
|
546
|
+
|
547
|
+
basic_staj_visitor(std::function<bool(const basic_staj_event<CharT>&, const ser_context&)> pred)
|
548
|
+
: pred_(pred), event_(staj_event_type::null_value),
|
549
|
+
state_(), data_(), shape_(), index_(0)
|
550
|
+
{
|
551
|
+
}
|
552
|
+
|
553
|
+
void reset()
|
554
|
+
{
|
555
|
+
event_ = staj_event_type::null_value;
|
556
|
+
state_ = {};
|
557
|
+
data_ = {};
|
558
|
+
shape_ = {};
|
559
|
+
index_ = 0;
|
560
|
+
}
|
561
|
+
|
562
|
+
const basic_staj_event<CharT>& event() const
|
563
|
+
{
|
564
|
+
return event_;
|
565
|
+
}
|
566
|
+
|
567
|
+
bool in_available() const
|
568
|
+
{
|
569
|
+
return state_ != staj_cursor_state();
|
570
|
+
}
|
571
|
+
|
572
|
+
void send_available(std::error_code& ec)
|
573
|
+
{
|
574
|
+
switch (state_)
|
575
|
+
{
|
576
|
+
case staj_cursor_state::typed_array:
|
577
|
+
advance_typed_array(ec);
|
578
|
+
break;
|
579
|
+
case staj_cursor_state::multi_dim:
|
580
|
+
case staj_cursor_state::shape:
|
581
|
+
advance_multi_dim(ec);
|
582
|
+
break;
|
583
|
+
default:
|
584
|
+
break;
|
585
|
+
}
|
586
|
+
}
|
587
|
+
|
588
|
+
bool is_typed_array() const
|
589
|
+
{
|
590
|
+
return data_.type() != typed_array_type();
|
591
|
+
}
|
592
|
+
|
593
|
+
staj_cursor_state state() const
|
594
|
+
{
|
595
|
+
return state_;
|
596
|
+
}
|
597
|
+
|
598
|
+
void advance_typed_array(std::error_code& ec)
|
599
|
+
{
|
600
|
+
if (is_typed_array())
|
601
|
+
{
|
602
|
+
if (index_ < data_.size())
|
603
|
+
{
|
604
|
+
switch (data_.type())
|
605
|
+
{
|
606
|
+
case typed_array_type::uint8_value:
|
607
|
+
{
|
608
|
+
this->uint64_value(data_.data(uint8_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
609
|
+
break;
|
610
|
+
}
|
611
|
+
case typed_array_type::uint16_value:
|
612
|
+
{
|
613
|
+
this->uint64_value(data_.data(uint16_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
614
|
+
break;
|
615
|
+
}
|
616
|
+
case typed_array_type::uint32_value:
|
617
|
+
{
|
618
|
+
this->uint64_value(data_.data(uint32_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
619
|
+
break;
|
620
|
+
}
|
621
|
+
case typed_array_type::uint64_value:
|
622
|
+
{
|
623
|
+
this->uint64_value(data_.data(uint64_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
624
|
+
break;
|
625
|
+
}
|
626
|
+
case typed_array_type::int8_value:
|
627
|
+
{
|
628
|
+
this->int64_value(data_.data(int8_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
629
|
+
break;
|
630
|
+
}
|
631
|
+
case typed_array_type::int16_value:
|
632
|
+
{
|
633
|
+
this->int64_value(data_.data(int16_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
634
|
+
break;
|
635
|
+
}
|
636
|
+
case typed_array_type::int32_value:
|
637
|
+
{
|
638
|
+
this->int64_value(data_.data(int32_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
639
|
+
break;
|
640
|
+
}
|
641
|
+
case typed_array_type::int64_value:
|
642
|
+
{
|
643
|
+
this->int64_value(data_.data(int64_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
644
|
+
break;
|
645
|
+
}
|
646
|
+
case typed_array_type::half_value:
|
647
|
+
{
|
648
|
+
this->half_value(data_.data(half_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
649
|
+
break;
|
650
|
+
}
|
651
|
+
case typed_array_type::float_value:
|
652
|
+
{
|
653
|
+
this->double_value(data_.data(float_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
654
|
+
break;
|
655
|
+
}
|
656
|
+
case typed_array_type::double_value:
|
657
|
+
{
|
658
|
+
this->double_value(data_.data(double_array_arg)[index_], semantic_tag::none, ser_context(), ec);
|
659
|
+
break;
|
660
|
+
}
|
661
|
+
default:
|
662
|
+
break;
|
663
|
+
}
|
664
|
+
++index_;
|
665
|
+
}
|
666
|
+
else
|
667
|
+
{
|
668
|
+
this->end_array();
|
669
|
+
state_ = staj_cursor_state();
|
670
|
+
data_ = typed_array_view();
|
671
|
+
index_ = 0;
|
672
|
+
}
|
673
|
+
}
|
674
|
+
}
|
675
|
+
|
676
|
+
void advance_multi_dim(std::error_code& ec)
|
677
|
+
{
|
678
|
+
if (shape_.size() != 0)
|
679
|
+
{
|
680
|
+
if (state_ == staj_cursor_state::multi_dim)
|
681
|
+
{
|
682
|
+
this->begin_array(shape_.size(), semantic_tag::none, ser_context(), ec);
|
683
|
+
state_ = staj_cursor_state::shape;
|
684
|
+
}
|
685
|
+
else if (index_ < shape_.size())
|
686
|
+
{
|
687
|
+
this->uint64_value(shape_[index_], semantic_tag::none, ser_context(), ec);
|
688
|
+
++index_;
|
689
|
+
}
|
690
|
+
else
|
691
|
+
{
|
692
|
+
state_ = staj_cursor_state();
|
693
|
+
this->end_array(ser_context(), ec);
|
694
|
+
shape_ = jsoncons::span<const size_t>();
|
695
|
+
index_ = 0;
|
696
|
+
}
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
700
|
+
bool dump(basic_json_visitor<CharT>& visitor, const ser_context& context, std::error_code& ec)
|
701
|
+
{
|
702
|
+
bool more = true;
|
703
|
+
if (is_typed_array())
|
704
|
+
{
|
705
|
+
if (index_ != 0)
|
706
|
+
{
|
707
|
+
more = send_json_event(event(), visitor, context, ec);
|
708
|
+
while (more && is_typed_array())
|
709
|
+
{
|
710
|
+
if (index_ < data_.size())
|
711
|
+
{
|
712
|
+
switch (data_.type())
|
713
|
+
{
|
714
|
+
case typed_array_type::uint8_value:
|
715
|
+
{
|
716
|
+
more = visitor.uint64_value(data_.data(uint8_array_arg)[index_]);
|
717
|
+
break;
|
718
|
+
}
|
719
|
+
case typed_array_type::uint16_value:
|
720
|
+
{
|
721
|
+
more = visitor.uint64_value(data_.data(uint16_array_arg)[index_]);
|
722
|
+
break;
|
723
|
+
}
|
724
|
+
case typed_array_type::uint32_value:
|
725
|
+
{
|
726
|
+
more = visitor.uint64_value(data_.data(uint32_array_arg)[index_]);
|
727
|
+
break;
|
728
|
+
}
|
729
|
+
case typed_array_type::uint64_value:
|
730
|
+
{
|
731
|
+
more = visitor.uint64_value(data_.data(uint64_array_arg)[index_]);
|
732
|
+
break;
|
733
|
+
}
|
734
|
+
case typed_array_type::int8_value:
|
735
|
+
{
|
736
|
+
more = visitor.int64_value(data_.data(int8_array_arg)[index_]);
|
737
|
+
break;
|
738
|
+
}
|
739
|
+
case typed_array_type::int16_value:
|
740
|
+
{
|
741
|
+
more = visitor.int64_value(data_.data(int16_array_arg)[index_]);
|
742
|
+
break;
|
743
|
+
}
|
744
|
+
case typed_array_type::int32_value:
|
745
|
+
{
|
746
|
+
more = visitor.int64_value(data_.data(int32_array_arg)[index_]);
|
747
|
+
break;
|
748
|
+
}
|
749
|
+
case typed_array_type::int64_value:
|
750
|
+
{
|
751
|
+
more = visitor.int64_value(data_.data(int64_array_arg)[index_]);
|
752
|
+
break;
|
753
|
+
}
|
754
|
+
case typed_array_type::float_value:
|
755
|
+
{
|
756
|
+
more = visitor.double_value(data_.data(float_array_arg)[index_]);
|
757
|
+
break;
|
758
|
+
}
|
759
|
+
case typed_array_type::double_value:
|
760
|
+
{
|
761
|
+
more = visitor.double_value(data_.data(double_array_arg)[index_]);
|
762
|
+
break;
|
763
|
+
}
|
764
|
+
default:
|
765
|
+
break;
|
766
|
+
}
|
767
|
+
++index_;
|
768
|
+
}
|
769
|
+
else
|
770
|
+
{
|
771
|
+
more = visitor.end_array();
|
772
|
+
state_ = staj_cursor_state();
|
773
|
+
data_ = typed_array_view();
|
774
|
+
index_ = 0;
|
775
|
+
}
|
776
|
+
}
|
777
|
+
}
|
778
|
+
else
|
779
|
+
{
|
780
|
+
switch (data_.type())
|
781
|
+
{
|
782
|
+
case typed_array_type::uint8_value:
|
783
|
+
{
|
784
|
+
more = visitor.typed_array(data_.data(uint8_array_arg));
|
785
|
+
break;
|
786
|
+
}
|
787
|
+
case typed_array_type::uint16_value:
|
788
|
+
{
|
789
|
+
more = visitor.typed_array(data_.data(uint16_array_arg));
|
790
|
+
break;
|
791
|
+
}
|
792
|
+
case typed_array_type::uint32_value:
|
793
|
+
{
|
794
|
+
more = visitor.typed_array(data_.data(uint32_array_arg));
|
795
|
+
break;
|
796
|
+
}
|
797
|
+
case typed_array_type::uint64_value:
|
798
|
+
{
|
799
|
+
more = visitor.typed_array(data_.data(uint64_array_arg));
|
800
|
+
break;
|
801
|
+
}
|
802
|
+
case typed_array_type::int8_value:
|
803
|
+
{
|
804
|
+
more = visitor.typed_array(data_.data(int8_array_arg));
|
805
|
+
break;
|
806
|
+
}
|
807
|
+
case typed_array_type::int16_value:
|
808
|
+
{
|
809
|
+
more = visitor.typed_array(data_.data(int16_array_arg));
|
810
|
+
break;
|
811
|
+
}
|
812
|
+
case typed_array_type::int32_value:
|
813
|
+
{
|
814
|
+
more = visitor.typed_array(data_.data(int32_array_arg));
|
815
|
+
break;
|
816
|
+
}
|
817
|
+
case typed_array_type::int64_value:
|
818
|
+
{
|
819
|
+
more = visitor.typed_array(data_.data(int64_array_arg));
|
820
|
+
break;
|
821
|
+
}
|
822
|
+
case typed_array_type::float_value:
|
823
|
+
{
|
824
|
+
more = visitor.typed_array(data_.data(float_array_arg));
|
825
|
+
break;
|
826
|
+
}
|
827
|
+
case typed_array_type::double_value:
|
828
|
+
{
|
829
|
+
more = visitor.typed_array(data_.data(double_array_arg));
|
830
|
+
break;
|
831
|
+
}
|
832
|
+
default:
|
833
|
+
break;
|
834
|
+
}
|
835
|
+
|
836
|
+
state_ = staj_cursor_state();
|
837
|
+
data_ = typed_array_view();
|
838
|
+
}
|
839
|
+
}
|
840
|
+
else
|
841
|
+
{
|
842
|
+
more = send_json_event(event(), visitor, context, ec);
|
843
|
+
}
|
844
|
+
return more;
|
845
|
+
}
|
846
|
+
|
847
|
+
private:
|
848
|
+
static constexpr bool accept(const basic_staj_event<CharT>&, const ser_context&)
|
849
|
+
{
|
850
|
+
return true;
|
851
|
+
}
|
852
|
+
|
853
|
+
bool visit_begin_object(semantic_tag tag, const ser_context& context, std::error_code&) override
|
854
|
+
{
|
855
|
+
event_ = basic_staj_event<CharT>(staj_event_type::begin_object, tag);
|
856
|
+
return !pred_(event_, context);
|
857
|
+
}
|
858
|
+
|
859
|
+
bool visit_begin_object(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code&) override
|
860
|
+
{
|
861
|
+
event_ = basic_staj_event<CharT>(staj_event_type::begin_object, length, tag);
|
862
|
+
return !pred_(event_, context);
|
863
|
+
}
|
864
|
+
|
865
|
+
bool visit_end_object(const ser_context& context, std::error_code&) override
|
866
|
+
{
|
867
|
+
event_ = basic_staj_event<CharT>(staj_event_type::end_object);
|
868
|
+
return !pred_(event_, context);
|
869
|
+
}
|
870
|
+
|
871
|
+
bool visit_begin_array(semantic_tag tag, const ser_context& context, std::error_code&) override
|
872
|
+
{
|
873
|
+
event_ = basic_staj_event<CharT>(staj_event_type::begin_array, tag);
|
874
|
+
return !pred_(event_, context);
|
875
|
+
}
|
876
|
+
|
877
|
+
bool visit_begin_array(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code&) override
|
878
|
+
{
|
879
|
+
event_ = basic_staj_event<CharT>(staj_event_type::begin_array, length, tag);
|
880
|
+
return !pred_(event_, context);
|
881
|
+
}
|
882
|
+
|
883
|
+
bool visit_end_array(const ser_context& context, std::error_code&) override
|
884
|
+
{
|
885
|
+
event_ = basic_staj_event<CharT>(staj_event_type::end_array);
|
886
|
+
return !pred_(event_, context);
|
887
|
+
}
|
888
|
+
|
889
|
+
bool visit_key(const string_view_type& name, const ser_context& context, std::error_code&) override
|
890
|
+
{
|
891
|
+
event_ = basic_staj_event<CharT>(name, staj_event_type::key);
|
892
|
+
return !pred_(event_, context);
|
893
|
+
}
|
894
|
+
|
895
|
+
bool visit_null(semantic_tag tag, const ser_context& context, std::error_code&) override
|
896
|
+
{
|
897
|
+
event_ = basic_staj_event<CharT>(staj_event_type::null_value, tag);
|
898
|
+
return !pred_(event_, context);
|
899
|
+
}
|
900
|
+
|
901
|
+
bool visit_bool(bool value, semantic_tag tag, const ser_context& context, std::error_code&) override
|
902
|
+
{
|
903
|
+
event_ = basic_staj_event<CharT>(value, tag);
|
904
|
+
return !pred_(event_, context);
|
905
|
+
}
|
906
|
+
|
907
|
+
bool visit_string(const string_view_type& s, semantic_tag tag, const ser_context& context, std::error_code&) override
|
908
|
+
{
|
909
|
+
event_ = basic_staj_event<CharT>(s, staj_event_type::string_value, tag);
|
910
|
+
return !pred_(event_, context);
|
911
|
+
}
|
912
|
+
|
913
|
+
bool visit_byte_string(const byte_string_view& s,
|
914
|
+
semantic_tag tag,
|
915
|
+
const ser_context& context,
|
916
|
+
std::error_code&) override
|
917
|
+
{
|
918
|
+
event_ = basic_staj_event<CharT>(s, staj_event_type::byte_string_value, tag);
|
919
|
+
return !pred_(event_, context);
|
920
|
+
}
|
921
|
+
|
922
|
+
bool visit_byte_string(const byte_string_view& s,
|
923
|
+
uint64_t ext_tag,
|
924
|
+
const ser_context& context,
|
925
|
+
std::error_code&) override
|
926
|
+
{
|
927
|
+
event_ = basic_staj_event<CharT>(s, staj_event_type::byte_string_value, ext_tag);
|
928
|
+
return !pred_(event_, context);
|
929
|
+
}
|
930
|
+
|
931
|
+
bool visit_uint64(uint64_t value,
|
932
|
+
semantic_tag tag,
|
933
|
+
const ser_context& context,
|
934
|
+
std::error_code&) override
|
935
|
+
{
|
936
|
+
event_ = basic_staj_event<CharT>(value, tag);
|
937
|
+
return !pred_(event_, context);
|
938
|
+
}
|
939
|
+
|
940
|
+
bool visit_int64(int64_t value,
|
941
|
+
semantic_tag tag,
|
942
|
+
const ser_context& context,
|
943
|
+
std::error_code&) override
|
944
|
+
{
|
945
|
+
event_ = basic_staj_event<CharT>(value, tag);
|
946
|
+
return !pred_(event_, context);
|
947
|
+
}
|
948
|
+
|
949
|
+
bool visit_half(uint16_t value,
|
950
|
+
semantic_tag tag,
|
951
|
+
const ser_context& context,
|
952
|
+
std::error_code&) override
|
953
|
+
{
|
954
|
+
event_ = basic_staj_event<CharT>(half_arg, value, tag);
|
955
|
+
return !pred_(event_, context);
|
956
|
+
}
|
957
|
+
|
958
|
+
bool visit_double(double value,
|
959
|
+
semantic_tag tag,
|
960
|
+
const ser_context& context,
|
961
|
+
std::error_code&) override
|
962
|
+
{
|
963
|
+
event_ = basic_staj_event<CharT>(value, tag);
|
964
|
+
return !pred_(event_, context);
|
965
|
+
}
|
966
|
+
|
967
|
+
bool visit_typed_array(const jsoncons::span<const uint8_t>& v,
|
968
|
+
semantic_tag tag,
|
969
|
+
const ser_context& context,
|
970
|
+
std::error_code& ec) override
|
971
|
+
{
|
972
|
+
state_ = staj_cursor_state::typed_array;
|
973
|
+
data_ = typed_array_view(v.data(), v.size());
|
974
|
+
index_ = 0;
|
975
|
+
return this->begin_array(tag, context, ec);
|
976
|
+
}
|
977
|
+
|
978
|
+
bool visit_typed_array(const jsoncons::span<const uint16_t>& data,
|
979
|
+
semantic_tag tag,
|
980
|
+
const ser_context& context,
|
981
|
+
std::error_code& ec) override
|
982
|
+
{
|
983
|
+
state_ = staj_cursor_state::typed_array;
|
984
|
+
data_ = typed_array_view(data.data(), data.size());
|
985
|
+
index_ = 0;
|
986
|
+
return this->begin_array(tag, context, ec);
|
987
|
+
}
|
988
|
+
|
989
|
+
bool visit_typed_array(const jsoncons::span<const uint32_t>& data,
|
990
|
+
semantic_tag tag,
|
991
|
+
const ser_context& context,
|
992
|
+
std::error_code& ec) override
|
993
|
+
{
|
994
|
+
state_ = staj_cursor_state::typed_array;
|
995
|
+
data_ = typed_array_view(data.data(), data.size());
|
996
|
+
index_ = 0;
|
997
|
+
return this->begin_array(tag, context, ec);
|
998
|
+
}
|
999
|
+
|
1000
|
+
bool visit_typed_array(const jsoncons::span<const uint64_t>& data,
|
1001
|
+
semantic_tag tag,
|
1002
|
+
const ser_context& context,
|
1003
|
+
std::error_code& ec) override
|
1004
|
+
{
|
1005
|
+
state_ = staj_cursor_state::typed_array;
|
1006
|
+
data_ = typed_array_view(data.data(), data.size());
|
1007
|
+
index_ = 0;
|
1008
|
+
return this->begin_array(tag, context, ec);
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
bool visit_typed_array(const jsoncons::span<const int8_t>& data,
|
1012
|
+
semantic_tag tag,
|
1013
|
+
const ser_context& context,
|
1014
|
+
std::error_code& ec) override
|
1015
|
+
{
|
1016
|
+
state_ = staj_cursor_state::typed_array;
|
1017
|
+
data_ = typed_array_view(data.data(), data.size());
|
1018
|
+
index_ = 0;
|
1019
|
+
return this->begin_array(tag, context, ec);
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
bool visit_typed_array(const jsoncons::span<const int16_t>& data,
|
1023
|
+
semantic_tag tag,
|
1024
|
+
const ser_context& context,
|
1025
|
+
std::error_code& ec) override
|
1026
|
+
{
|
1027
|
+
state_ = staj_cursor_state::typed_array;
|
1028
|
+
data_ = typed_array_view(data.data(), data.size());
|
1029
|
+
index_ = 0;
|
1030
|
+
return this->begin_array(tag, context, ec);
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
bool visit_typed_array(const jsoncons::span<const int32_t>& data,
|
1034
|
+
semantic_tag tag,
|
1035
|
+
const ser_context& context,
|
1036
|
+
std::error_code& ec) override
|
1037
|
+
{
|
1038
|
+
state_ = staj_cursor_state::typed_array;
|
1039
|
+
data_ = typed_array_view(data.data(), data.size());
|
1040
|
+
index_ = 0;
|
1041
|
+
return this->begin_array(tag, context, ec);
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
bool visit_typed_array(const jsoncons::span<const int64_t>& data,
|
1045
|
+
semantic_tag tag,
|
1046
|
+
const ser_context& context,
|
1047
|
+
std::error_code& ec) override
|
1048
|
+
{
|
1049
|
+
state_ = staj_cursor_state::typed_array;
|
1050
|
+
data_ = typed_array_view(data.data(), data.size());
|
1051
|
+
index_ = 0;
|
1052
|
+
return this->begin_array(tag, context, ec);
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
bool visit_typed_array(half_arg_t, const jsoncons::span<const uint16_t>& data,
|
1056
|
+
semantic_tag tag,
|
1057
|
+
const ser_context& context,
|
1058
|
+
std::error_code& ec) override
|
1059
|
+
{
|
1060
|
+
state_ = staj_cursor_state::typed_array;
|
1061
|
+
data_ = typed_array_view(data.data(), data.size());
|
1062
|
+
index_ = 0;
|
1063
|
+
return this->begin_array(tag, context, ec);
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
bool visit_typed_array(const jsoncons::span<const float>& data,
|
1067
|
+
semantic_tag tag,
|
1068
|
+
const ser_context& context,
|
1069
|
+
std::error_code& ec) override
|
1070
|
+
{
|
1071
|
+
state_ = staj_cursor_state::typed_array;
|
1072
|
+
data_ = typed_array_view(data.data(), data.size());
|
1073
|
+
index_ = 0;
|
1074
|
+
return this->begin_array(tag, context, ec);
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
bool visit_typed_array(const jsoncons::span<const double>& data,
|
1078
|
+
semantic_tag tag,
|
1079
|
+
const ser_context& context,
|
1080
|
+
std::error_code& ec) override
|
1081
|
+
{
|
1082
|
+
state_ = staj_cursor_state::typed_array;
|
1083
|
+
data_ = typed_array_view(data.data(), data.size());
|
1084
|
+
index_ = 0;
|
1085
|
+
return this->begin_array(tag, context, ec);
|
1086
|
+
}
|
1087
|
+
/*
|
1088
|
+
bool visit_typed_array(const jsoncons::span<const float128_type>&,
|
1089
|
+
semantic_tag,
|
1090
|
+
const ser_context&,
|
1091
|
+
std::error_code&) override
|
1092
|
+
{
|
1093
|
+
return true;
|
1094
|
+
}
|
1095
|
+
*/
|
1096
|
+
bool visit_begin_multi_dim(const jsoncons::span<const size_t>& shape,
|
1097
|
+
semantic_tag tag,
|
1098
|
+
const ser_context& context,
|
1099
|
+
std::error_code& ec) override
|
1100
|
+
{
|
1101
|
+
state_ = staj_cursor_state::multi_dim;
|
1102
|
+
shape_ = shape;
|
1103
|
+
return this->begin_array(2, tag, context, ec);
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
bool visit_end_multi_dim(const ser_context& context,
|
1107
|
+
std::error_code& ec) override
|
1108
|
+
{
|
1109
|
+
return this->end_array(context, ec);
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
void visit_flush() override
|
1113
|
+
{
|
1114
|
+
}
|
1115
|
+
};
|
1116
|
+
|
1117
|
+
|
1118
|
+
// basic_staj_cursor
|
1119
|
+
|
1120
|
+
template<class CharT>
|
1121
|
+
class basic_staj_cursor
|
1122
|
+
{
|
1123
|
+
public:
|
1124
|
+
virtual ~basic_staj_cursor() noexcept = default;
|
1125
|
+
|
1126
|
+
virtual void array_expected(std::error_code& ec)
|
1127
|
+
{
|
1128
|
+
if (!(current().event_type() == staj_event_type::begin_array || current().event_type() == staj_event_type::byte_string_value))
|
1129
|
+
{
|
1130
|
+
ec = conv_errc::not_vector;
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
virtual bool done() const = 0;
|
1135
|
+
|
1136
|
+
virtual const basic_staj_event<CharT>& current() const = 0;
|
1137
|
+
|
1138
|
+
virtual void read_to(basic_json_visitor<CharT>& visitor) = 0;
|
1139
|
+
|
1140
|
+
virtual void read_to(basic_json_visitor<CharT>& visitor,
|
1141
|
+
std::error_code& ec) = 0;
|
1142
|
+
|
1143
|
+
virtual void next() = 0;
|
1144
|
+
|
1145
|
+
virtual void next(std::error_code& ec) = 0;
|
1146
|
+
|
1147
|
+
virtual const ser_context& context() const = 0;
|
1148
|
+
};
|
1149
|
+
|
1150
|
+
template<class CharT>
|
1151
|
+
class basic_staj_filter_view : basic_staj_cursor<CharT>
|
1152
|
+
{
|
1153
|
+
basic_staj_cursor<CharT>* cursor_;
|
1154
|
+
std::function<bool(const basic_staj_event<CharT>&, const ser_context&)> pred_;
|
1155
|
+
public:
|
1156
|
+
basic_staj_filter_view(basic_staj_cursor<CharT>& cursor,
|
1157
|
+
std::function<bool(const basic_staj_event<CharT>&, const ser_context&)> pred)
|
1158
|
+
: cursor_(std::addressof(cursor)), pred_(pred)
|
1159
|
+
{
|
1160
|
+
while (!done() && !pred_(current(),context()))
|
1161
|
+
{
|
1162
|
+
cursor_->next();
|
1163
|
+
}
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
bool done() const override
|
1167
|
+
{
|
1168
|
+
return cursor_->done();
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
const basic_staj_event<CharT>& current() const override
|
1172
|
+
{
|
1173
|
+
return cursor_->current();
|
1174
|
+
}
|
1175
|
+
|
1176
|
+
void read_to(basic_json_visitor<CharT>& visitor) override
|
1177
|
+
{
|
1178
|
+
cursor_->read_to(visitor);
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
void read_to(basic_json_visitor<CharT>& visitor,
|
1182
|
+
std::error_code& ec) override
|
1183
|
+
{
|
1184
|
+
cursor_->read_to(visitor, ec);
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
void next() override
|
1188
|
+
{
|
1189
|
+
cursor_->next();
|
1190
|
+
while (!done() && !pred_(current(),context()))
|
1191
|
+
{
|
1192
|
+
cursor_->next();
|
1193
|
+
}
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
void next(std::error_code& ec) override
|
1197
|
+
{
|
1198
|
+
cursor_->next(ec);
|
1199
|
+
while (!done() && !pred_(current(),context()) && !ec)
|
1200
|
+
{
|
1201
|
+
cursor_->next(ec);
|
1202
|
+
}
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
const ser_context& context() const override
|
1206
|
+
{
|
1207
|
+
return cursor_->context();
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
friend
|
1211
|
+
basic_staj_filter_view<CharT> operator|(basic_staj_filter_view& cursor,
|
1212
|
+
std::function<bool(const basic_staj_event<CharT>&, const ser_context&)> pred)
|
1213
|
+
{
|
1214
|
+
return basic_staj_filter_view<CharT>(cursor, pred);
|
1215
|
+
}
|
1216
|
+
};
|
1217
|
+
|
1218
|
+
using staj_event = basic_staj_event<char>;
|
1219
|
+
using wstaj_event = basic_staj_event<wchar_t>;
|
1220
|
+
|
1221
|
+
using staj_cursor = basic_staj_cursor<char>;
|
1222
|
+
using wstaj_cursor = basic_staj_cursor<wchar_t>;
|
1223
|
+
|
1224
|
+
using staj_filter_view = basic_staj_filter_view<char>;
|
1225
|
+
using wstaj_filter_view = basic_staj_filter_view<wchar_t>;
|
1226
|
+
|
1227
|
+
#if !defined(JSONCONS_NO_DEPRECATED)
|
1228
|
+
|
1229
|
+
JSONCONS_DEPRECATED_MSG("Instead, use staj_event_type") typedef staj_event_type stream_event_type;
|
1230
|
+
|
1231
|
+
template<class CharT>
|
1232
|
+
using basic_stream_event = basic_staj_event<CharT>;
|
1233
|
+
|
1234
|
+
template<class CharT>
|
1235
|
+
using basic_stream_reader = basic_staj_cursor<CharT>;
|
1236
|
+
|
1237
|
+
template<class CharT>
|
1238
|
+
using basic_staj_reader = basic_staj_cursor<CharT>;
|
1239
|
+
|
1240
|
+
JSONCONS_DEPRECATED_MSG("Instead, use staj_event") typedef basic_staj_event<char> stream_event;
|
1241
|
+
JSONCONS_DEPRECATED_MSG("Instead, use wstaj_event") typedef basic_staj_event<wchar_t> wstream_event;
|
1242
|
+
|
1243
|
+
JSONCONS_DEPRECATED_MSG("Instead, use staj_cursor") typedef basic_staj_cursor<char> stream_reader;
|
1244
|
+
JSONCONS_DEPRECATED_MSG("Instead, use wstaj_cursor") typedef basic_staj_cursor<wchar_t> wstream_reader;
|
1245
|
+
|
1246
|
+
JSONCONS_DEPRECATED_MSG("Instead, use staj_cursor") typedef basic_staj_cursor<char> staj_reader;
|
1247
|
+
JSONCONS_DEPRECATED_MSG("Instead, use wstaj_cursor") typedef basic_staj_cursor<wchar_t> wstaj_reader;
|
1248
|
+
|
1249
|
+
#endif
|
1250
|
+
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
#endif
|
1254
|
+
|