| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
|
3 |
|
|
| 4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
|
|
6 |
|
|
| 7 |
|
// Official repository: https://github.com/boostorg/json
|
7 |
|
// Official repository: https://github.com/boostorg/json
|
| 8 |
|
|
8 |
|
|
| 9 |
|
|
9 |
|
|
| 10 |
|
#ifndef BOOST_JSON_STREAM_PARSER_HPP
|
10 |
|
#ifndef BOOST_JSON_STREAM_PARSER_HPP
|
| 11 |
|
#define BOOST_JSON_STREAM_PARSER_HPP
|
11 |
|
#define BOOST_JSON_STREAM_PARSER_HPP
|
| 12 |
|
|
12 |
|
|
| 13 |
|
#include <boost/json/detail/config.hpp>
|
13 |
|
#include <boost/json/detail/config.hpp>
|
| 14 |
|
#include <boost/json/basic_parser.hpp>
|
14 |
|
#include <boost/json/basic_parser.hpp>
|
| 15 |
|
#include <boost/json/parse_options.hpp>
|
15 |
|
#include <boost/json/parse_options.hpp>
|
| 16 |
|
#include <boost/json/storage_ptr.hpp>
|
16 |
|
#include <boost/json/storage_ptr.hpp>
|
| 17 |
|
#include <boost/json/value.hpp>
|
17 |
|
#include <boost/json/value.hpp>
|
| 18 |
|
#include <boost/json/detail/handler.hpp>
|
18 |
|
#include <boost/json/detail/handler.hpp>
|
| 19 |
|
|
19 |
|
|
| 20 |
|
|
20 |
|
|
| 21 |
|
|
21 |
|
|
| 22 |
|
|
22 |
|
|
| 23 |
|
|
23 |
|
|
| 24 |
|
|
24 |
|
|
| 25 |
|
//----------------------------------------------------------
|
25 |
|
//----------------------------------------------------------
|
| 26 |
|
|
26 |
|
|
| 27 |
|
/** A DOM parser for JSON text contained in multiple buffers.
|
27 |
|
/** A DOM parser for JSON text contained in multiple buffers.
|
| 28 |
|
|
28 |
|
|
| 29 |
|
This class is used to parse a JSON text contained in a series of one or
|
29 |
|
This class is used to parse a JSON text contained in a series of one or
|
| 30 |
|
more character buffers, into a @ref value container. It implements a
|
30 |
|
more character buffers, into a @ref value container. It implements a
|
| 31 |
|
[_streaming algorithm_](https://en.wikipedia.org/wiki/Streaming_algorithm),
|
31 |
|
[_streaming algorithm_](https://en.wikipedia.org/wiki/Streaming_algorithm),
|
| 32 |
|
allowing these parsing strategies:
|
32 |
|
allowing these parsing strategies:
|
| 33 |
|
|
33 |
|
|
| 34 |
|
@li parse a JSON file a piece at a time;
|
34 |
|
@li parse a JSON file a piece at a time;
|
| 35 |
|
@li parse incoming JSON text as it arrives, one buffer at a time;
|
35 |
|
@li parse incoming JSON text as it arrives, one buffer at a time;
|
| 36 |
|
@li parse with bounded resource consumption per cycle.
|
36 |
|
@li parse with bounded resource consumption per cycle.
|
| 37 |
|
|
37 |
|
|
| 38 |
|
|
38 |
|
|
| 39 |
|
To use the parser first construct it, then optionally call @ref reset to
|
39 |
|
To use the parser first construct it, then optionally call @ref reset to
|
| 40 |
|
specify a @ref storage_ptr to use for the resulting @ref value. Then call
|
40 |
|
specify a @ref storage_ptr to use for the resulting @ref value. Then call
|
| 41 |
|
@ref write one or more times to parse a single, complete JSON text. Call
|
41 |
|
@ref write one or more times to parse a single, complete JSON text. Call
|
| 42 |
|
@ref done to determine if the parse has completed. To indicate there are no
|
42 |
|
@ref done to determine if the parse has completed. To indicate there are no
|
| 43 |
|
more buffers, call @ref finish. If the parse is successful, call @ref
|
43 |
|
more buffers, call @ref finish. If the parse is successful, call @ref
|
| 44 |
|
release to take ownership of the value:
|
44 |
|
release to take ownership of the value:
|
| 45 |
|
|
45 |
|
|
| 46 |
|
|
46 |
|
|
| 47 |
|
stream_parser p; // construct a parser
|
47 |
|
stream_parser p; // construct a parser
|
| 48 |
|
p.write( "[1,2" ); // parse some of a JSON text
|
48 |
|
p.write( "[1,2" ); // parse some of a JSON text
|
| 49 |
|
p.write( ",3,4]" ); // parse the rest of the JSON text
|
49 |
|
p.write( ",3,4]" ); // parse the rest of the JSON text
|
| 50 |
|
assert( p.done() ); // we have a complete JSON text
|
50 |
|
assert( p.done() ); // we have a complete JSON text
|
| 51 |
|
value jv = p.release(); // take ownership of the value
|
51 |
|
value jv = p.release(); // take ownership of the value
|
| 52 |
|
|
52 |
|
|
| 53 |
|
|
53 |
|
|
| 54 |
|
|
54 |
|
|
| 55 |
|
When the character buffer provided as input contains additional data that
|
55 |
|
When the character buffer provided as input contains additional data that
|
| 56 |
|
is not part of the complete JSON text, an error is returned. The @ref
|
56 |
|
is not part of the complete JSON text, an error is returned. The @ref
|
| 57 |
|
write_some function is an alternative which allows the parse to finish
|
57 |
|
write_some function is an alternative which allows the parse to finish
|
| 58 |
|
early, without consuming all the characters in the buffer. This allows
|
58 |
|
early, without consuming all the characters in the buffer. This allows
|
| 59 |
|
parsing of a buffer containing multiple individual JSON texts or containing
|
59 |
|
parsing of a buffer containing multiple individual JSON texts or containing
|
| 60 |
|
|
60 |
|
|
| 61 |
|
|
61 |
|
|
| 62 |
|
|
62 |
|
|
| 63 |
|
stream_parser p; // construct a parser
|
63 |
|
stream_parser p; // construct a parser
|
| 64 |
|
std::size_t n; // number of characters used
|
64 |
|
std::size_t n; // number of characters used
|
| 65 |
|
n = p.write_some( "[1,2" ); // parse some of a JSON text
|
65 |
|
n = p.write_some( "[1,2" ); // parse some of a JSON text
|
| 66 |
|
assert( n == 4 ); // all characters consumed
|
66 |
|
assert( n == 4 ); // all characters consumed
|
| 67 |
|
n = p.write_some( ",3,4] null" ); // parse the remainder of the JSON text
|
67 |
|
n = p.write_some( ",3,4] null" ); // parse the remainder of the JSON text
|
| 68 |
|
assert( n == 6 ); // only some characters consumed
|
68 |
|
assert( n == 6 ); // only some characters consumed
|
| 69 |
|
assert( p.done() ); // we have a complete JSON text
|
69 |
|
assert( p.done() ); // we have a complete JSON text
|
| 70 |
|
value jv = p.release(); // take ownership of the value
|
70 |
|
value jv = p.release(); // take ownership of the value
|
| 71 |
|
|
71 |
|
|
| 72 |
|
|
72 |
|
|
| 73 |
|
|
73 |
|
|
| 74 |
|
The parser may dynamically allocate temporary storage as needed to
|
74 |
|
The parser may dynamically allocate temporary storage as needed to
|
| 75 |
|
accommodate the nesting level of the JSON text being parsed. Temporary
|
75 |
|
accommodate the nesting level of the JSON text being parsed. Temporary
|
| 76 |
|
storage is first obtained from an optional, caller-owned buffer specified
|
76 |
|
storage is first obtained from an optional, caller-owned buffer specified
|
| 77 |
|
upon construction. When that is exhausted, the next allocation uses the
|
77 |
|
upon construction. When that is exhausted, the next allocation uses the
|
| 78 |
|
@ref boost::container::pmr::memory_resource passed to the constructor; if
|
78 |
|
@ref boost::container::pmr::memory_resource passed to the constructor; if
|
| 79 |
|
no such argument is specified, the default memory resource is used.
|
79 |
|
no such argument is specified, the default memory resource is used.
|
| 80 |
|
Temporary storage is freed only when the parser is destroyed; The
|
80 |
|
Temporary storage is freed only when the parser is destroyed; The
|
| 81 |
|
performance of parsing multiple JSON texts may be improved by reusing the
|
81 |
|
performance of parsing multiple JSON texts may be improved by reusing the
|
| 82 |
|
|
82 |
|
|
| 83 |
|
|
83 |
|
|
| 84 |
|
It is important to note that the @ref
|
84 |
|
It is important to note that the @ref
|
| 85 |
|
boost::container::pmr::memory_resource supplied upon construction is used
|
85 |
|
boost::container::pmr::memory_resource supplied upon construction is used
|
| 86 |
|
for temporary storage only, and not for allocating the elements which make
|
86 |
|
for temporary storage only, and not for allocating the elements which make
|
| 87 |
|
up the parsed value. That other memory resource is optionally supplied in
|
87 |
|
up the parsed value. That other memory resource is optionally supplied in
|
| 88 |
|
|
88 |
|
|
| 89 |
|
|
89 |
|
|
| 90 |
|
|
90 |
|
|
| 91 |
|
If there are object elements with duplicate keys; that is, if multiple
|
91 |
|
If there are object elements with duplicate keys; that is, if multiple
|
| 92 |
|
elements in an object have keys that compare equal, only the last
|
92 |
|
elements in an object have keys that compare equal, only the last
|
| 93 |
|
equivalent element will be inserted.
|
93 |
|
equivalent element will be inserted.
|
| 94 |
|
|
94 |
|
|
| 95 |
|
|
95 |
|
|
| 96 |
|
The @ref parse_options structure optionally provided upon construction is
|
96 |
|
The @ref parse_options structure optionally provided upon construction is
|
| 97 |
|
used to customize some parameters of the parser, including which
|
97 |
|
used to customize some parameters of the parser, including which
|
| 98 |
|
non-standard JSON extensions should be allowed. A default-constructed parse
|
98 |
|
non-standard JSON extensions should be allowed. A default-constructed parse
|
| 99 |
|
options allows only standard JSON.
|
99 |
|
options allows only standard JSON.
|
| 100 |
|
|
100 |
|
|
| 101 |
|
|
101 |
|
|
| 102 |
|
Distinct instances may be accessed concurrently. Non-const member functions
|
102 |
|
Distinct instances may be accessed concurrently. Non-const member functions
|
| 103 |
|
of a shared instance may not be called concurrently with any other member
|
103 |
|
of a shared instance may not be called concurrently with any other member
|
| 104 |
|
functions of that instance.
|
104 |
|
functions of that instance.
|
| 105 |
|
|
105 |
|
|
| 106 |
|
@see @ref parse, @ref parser, @ref parse_options.
|
106 |
|
@see @ref parse, @ref parser, @ref parse_options.
|
| 107 |
|
|
107 |
|
|
| 108 |
|
|
108 |
|
|
| 109 |
|
|
109 |
|
|
| 110 |
|
basic_parser<detail::handler> p_;
|
110 |
|
basic_parser<detail::handler> p_;
|
| 111 |
|
|
111 |
|
|
| 112 |
|
|
112 |
|
|
| 113 |
|
|
113 |
|
|
| 114 |
|
|
114 |
|
|
| 115 |
|
All dynamically allocated memory, including
|
115 |
|
All dynamically allocated memory, including
|
| 116 |
|
any incomplete parsing results, is freed.
|
116 |
|
any incomplete parsing results, is freed.
|
| 117 |
|
|
117 |
|
|
| 118 |
|
|
118 |
|
|
| 119 |
|
Linear in the size of partial results
|
119 |
|
Linear in the size of partial results
|
| 120 |
|
|
120 |
|
|
| 121 |
|
|
121 |
|
|
| 122 |
|
|
122 |
|
|
| 123 |
|
|
123 |
|
|
| 124 |
|
~stream_parser() = default;
|
124 |
|
~stream_parser() = default;
|
| 125 |
|
|
125 |
|
|
| 126 |
|
|
126 |
|
|
| 127 |
|
|
127 |
|
|
| 128 |
|
|
128 |
|
|
| 129 |
|
|
129 |
|
|
| 130 |
|
The parser will only support standard JSON if overloads **(1)**
|
130 |
|
The parser will only support standard JSON if overloads **(1)**
|
| 131 |
|
or **(2)** are used. Otherwise the parser will support extensions
|
131 |
|
or **(2)** are used. Otherwise the parser will support extensions
|
| 132 |
|
specified by the parameter `opt`.
|
132 |
|
specified by the parameter `opt`.
|
| 133 |
|
|
133 |
|
|
| 134 |
|
The parsed value will use the \<\<default_memory_resource,default
|
134 |
|
The parsed value will use the \<\<default_memory_resource,default
|
| 135 |
|
memory resource\>\> for storage. To use a different resource, call @ref
|
135 |
|
memory resource\>\> for storage. To use a different resource, call @ref
|
| 136 |
|
reset after construction.
|
136 |
|
reset after construction.
|
| 137 |
|
|
137 |
|
|
| 138 |
|
The main difference between the overloads is in what the constructed
|
138 |
|
The main difference between the overloads is in what the constructed
|
| 139 |
|
parser will use for temporary storage:
|
139 |
|
parser will use for temporary storage:
|
| 140 |
|
|
140 |
|
|
| 141 |
|
@li **(1)** the constructed parser uses the default memory resource for
|
141 |
|
@li **(1)** the constructed parser uses the default memory resource for
|
| 142 |
|
|
142 |
|
|
| 143 |
|
|
143 |
|
|
| 144 |
|
@li **(2)**, **(3)** the constructed parser uses the memory resource of
|
144 |
|
@li **(2)**, **(3)** the constructed parser uses the memory resource of
|
| 145 |
|
`sp` for temporary storage.
|
145 |
|
`sp` for temporary storage.
|
| 146 |
|
|
146 |
|
|
| 147 |
|
@li **(4)**, **(6)** the constructed parser first uses the caller-owned
|
147 |
|
@li **(4)**, **(6)** the constructed parser first uses the caller-owned
|
| 148 |
|
storage `[buffer, buffer + size)` for temporary storage, falling back
|
148 |
|
storage `[buffer, buffer + size)` for temporary storage, falling back
|
| 149 |
|
to the memory resource of `sp` if needed.
|
149 |
|
to the memory resource of `sp` if needed.
|
| 150 |
|
|
150 |
|
|
| 151 |
|
@li **(5)**, **(7)** the constructed parser first uses the caller-owned
|
151 |
|
@li **(5)**, **(7)** the constructed parser first uses the caller-owned
|
| 152 |
|
storage `[buffer, buffer + N)` for temporary storage, falling back to
|
152 |
|
storage `[buffer, buffer + N)` for temporary storage, falling back to
|
| 153 |
|
the memory resource of `sp` if needed.
|
153 |
|
the memory resource of `sp` if needed.
|
| 154 |
|
|
154 |
|
|
| 155 |
|
@note Ownership of `buffer` is not transferred. The caller is
|
155 |
|
@note Ownership of `buffer` is not transferred. The caller is
|
| 156 |
|
responsible for ensuring the lifetime of the storage pointed to by
|
156 |
|
responsible for ensuring the lifetime of the storage pointed to by
|
| 157 |
|
`buffer` extends until the parser is destroyed.
|
157 |
|
`buffer` extends until the parser is destroyed.
|
| 158 |
|
|
158 |
|
|
| 159 |
|
Overload **(8)** is the copy constructor. The type is neither copyable
|
159 |
|
Overload **(8)** is the copy constructor. The type is neither copyable
|
| 160 |
|
nor movable, so the overload is deleted.
|
160 |
|
nor movable, so the overload is deleted.
|
| 161 |
|
|
161 |
|
|
| 162 |
|
|
162 |
|
|
| 163 |
|
|
163 |
|
|
| 164 |
|
|
164 |
|
|
| 165 |
|
|
165 |
|
|
| 166 |
|
|
166 |
|
|
| 167 |
|
|
167 |
|
|
| 168 |
|
|
168 |
|
|
| 169 |
|
|
169 |
|
|
| 170 |
|
|
170 |
|
|
| 171 |
|
|
171 |
|
|
| 172 |
|
|
172 |
|
|
| 173 |
|
|
173 |
|
|
| 174 |
|
|
174 |
|
|
| 175 |
|
|
175 |
|
|
| 176 |
|
|
176 |
|
|
| 177 |
|
|
177 |
|
|
| 178 |
|
@param sp The memory resource to use for temporary storage.
|
178 |
|
@param sp The memory resource to use for temporary storage.
|
| 179 |
|
|
179 |
|
|
| 180 |
|
|
180 |
|
|
| 181 |
|
stream_parser(storage_ptr sp) noexcept
|
181 |
|
stream_parser(storage_ptr sp) noexcept
|
| 182 |
|
: stream_parser(std::move(sp), {})
|
182 |
|
: stream_parser(std::move(sp), {})
|
| 183 |
|
|
183 |
|
|
| 184 |
|
|
184 |
|
|
| 185 |
|
|
185 |
|
|
| 186 |
|
|
186 |
|
|
| 187 |
|
|
187 |
|
|
| 188 |
|
@param opt The parsing options to use.
|
188 |
|
@param opt The parsing options to use.
|
| 189 |
|
|
189 |
|
|
| 190 |
|
|
190 |
|
|
| 191 |
|
|
191 |
|
|
| 192 |
|
|
192 |
|
|
| 193 |
|
|
193 |
|
|
| 194 |
|
parse_options const& opt) noexcept;
|
194 |
|
parse_options const& opt) noexcept;
|
| 195 |
|
|
195 |
|
|
| 196 |
|
|
196 |
|
|
| 197 |
|
@param buffer A pointer to valid storage.
|
197 |
|
@param buffer A pointer to valid storage.
|
| 198 |
|
@param size The number of valid bytes in `buffer`.
|
198 |
|
@param size The number of valid bytes in `buffer`.
|
| 199 |
|
|
199 |
|
|
| 200 |
|
|
200 |
|
|
| 201 |
|
|
201 |
|
|
| 202 |
|
|
202 |
|
|
| 203 |
|
|
203 |
|
|
| 204 |
|
|
204 |
|
|
| 205 |
|
parse_options const& opt,
|
205 |
|
parse_options const& opt,
|
| 206 |
|
|
206 |
|
|
| 207 |
|
std::size_t size) noexcept;
|
207 |
|
std::size_t size) noexcept;
|
| 208 |
|
|
208 |
|
|
| 209 |
|
|
209 |
|
|
| 210 |
|
|
210 |
|
|
| 211 |
|
@tparam N The number of valid bytes in `buffer`.
|
211 |
|
@tparam N The number of valid bytes in `buffer`.
|
| 212 |
|
|
212 |
|
|
| 213 |
|
|
213 |
|
|
| 214 |
|
|
214 |
|
|
| 215 |
|
|
215 |
|
|
| 216 |
|
|
216 |
|
|
| 217 |
|
|
217 |
|
|
| 218 |
|
|
218 |
|
|
| 219 |
|
parse_options const& opt,
|
219 |
|
parse_options const& opt,
|
| 220 |
|
unsigned char(&buffer)[N]) noexcept
|
220 |
|
unsigned char(&buffer)[N]) noexcept
|
| 221 |
|
: stream_parser(std::move(sp),
|
221 |
|
: stream_parser(std::move(sp),
|
| 222 |
|
|
222 |
|
|
| 223 |
|
|
223 |
|
|
| 224 |
|
|
224 |
|
|
| 225 |
|
|
225 |
|
|
| 226 |
|
#if defined(__cpp_lib_byte) || defined(BOOST_JSON_DOCS)
|
226 |
|
#if defined(__cpp_lib_byte) || defined(BOOST_JSON_DOCS)
|
| 227 |
|
|
227 |
|
|
| 228 |
|
|
228 |
|
|
| 229 |
|
|
229 |
|
|
| 230 |
|
|
230 |
|
|
| 231 |
|
|
231 |
|
|
| 232 |
|
|
232 |
|
|
| 233 |
|
|
233 |
|
|
| 234 |
|
|
234 |
|
|
| 235 |
|
|
235 |
|
|
| 236 |
|
parse_options const& opt,
|
236 |
|
parse_options const& opt,
|
| 237 |
|
|
237 |
|
|
| 238 |
|
std::size_t size) noexcept
|
238 |
|
std::size_t size) noexcept
|
| 239 |
|
: stream_parser(sp, opt, reinterpret_cast<
|
239 |
|
: stream_parser(sp, opt, reinterpret_cast<
|
| 240 |
|
unsigned char*>(buffer), size)
|
240 |
|
unsigned char*>(buffer), size)
|
| 241 |
|
|
241 |
|
|
| 242 |
|
|
242 |
|
|
| 243 |
|
|
243 |
|
|
| 244 |
|
|
244 |
|
|
| 245 |
|
|
245 |
|
|
| 246 |
|
|
246 |
|
|
| 247 |
|
|
247 |
|
|
| 248 |
|
|
248 |
|
|
| 249 |
|
|
249 |
|
|
| 250 |
|
|
250 |
|
|
| 251 |
|
|
251 |
|
|
| 252 |
|
|
252 |
|
|
| 253 |
|
|
253 |
|
|
| 254 |
|
parse_options const& opt,
|
254 |
|
parse_options const& opt,
|
| 255 |
|
std::byte(&buffer)[N]) noexcept
|
255 |
|
std::byte(&buffer)[N]) noexcept
|
| 256 |
|
: stream_parser(std::move(sp),
|
256 |
|
: stream_parser(std::move(sp),
|
| 257 |
|
|
257 |
|
|
| 258 |
|
|
258 |
|
|
| 259 |
|
|
259 |
|
|
| 260 |
|
|
260 |
|
|
| 261 |
|
|
261 |
|
|
| 262 |
|
|
262 |
|
|
| 263 |
|
// Safety net for accidental buffer overflows
|
263 |
|
// Safety net for accidental buffer overflows
|
| 264 |
|
|
264 |
|
|
| 265 |
|
|
265 |
|
|
| 266 |
|
|
266 |
|
|
| 267 |
|
parse_options const& opt,
|
267 |
|
parse_options const& opt,
|
| 268 |
|
unsigned char(&buffer)[N],
|
268 |
|
unsigned char(&buffer)[N],
|
| 269 |
|
|
269 |
|
|
| 270 |
|
: stream_parser(std::move(sp),
|
270 |
|
: stream_parser(std::move(sp),
|
| 271 |
|
|
271 |
|
|
| 272 |
|
|
272 |
|
|
| 273 |
|
// If this goes off, check your parameters
|
273 |
|
// If this goes off, check your parameters
|
| 274 |
|
// closely, chances are you passed an array
|
274 |
|
// closely, chances are you passed an array
|
| 275 |
|
// thinking it was a pointer.
|
275 |
|
// thinking it was a pointer.
|
| 276 |
|
|
276 |
|
|
| 277 |
|
|
277 |
|
|
| 278 |
|
|
278 |
|
|
| 279 |
|
|
279 |
|
|
| 280 |
|
// Safety net for accidental buffer overflows
|
280 |
|
// Safety net for accidental buffer overflows
|
| 281 |
|
|
281 |
|
|
| 282 |
|
|
282 |
|
|
| 283 |
|
|
283 |
|
|
| 284 |
|
parse_options const& opt,
|
284 |
|
parse_options const& opt,
|
| 285 |
|
std::byte(&buffer)[N], std::size_t n) noexcept
|
285 |
|
std::byte(&buffer)[N], std::size_t n) noexcept
|
| 286 |
|
: stream_parser(std::move(sp),
|
286 |
|
: stream_parser(std::move(sp),
|
| 287 |
|
|
287 |
|
|
| 288 |
|
|
288 |
|
|
| 289 |
|
// If this goes off, check your parameters
|
289 |
|
// If this goes off, check your parameters
|
| 290 |
|
// closely, chances are you passed an array
|
290 |
|
// closely, chances are you passed an array
|
| 291 |
|
// thinking it was a pointer.
|
291 |
|
// thinking it was a pointer.
|
| 292 |
|
|
292 |
|
|
| 293 |
|
|
293 |
|
|
| 294 |
|
|
294 |
|
|
| 295 |
|
|
295 |
|
|
| 296 |
|
|
296 |
|
|
| 297 |
|
|
297 |
|
|
| 298 |
|
|
298 |
|
|
| 299 |
|
stream_parser const&) = delete;
|
299 |
|
stream_parser const&) = delete;
|
| 300 |
|
|
300 |
|
|
| 301 |
|
|
301 |
|
|
| 302 |
|
|
302 |
|
|
| 303 |
|
|
303 |
|
|
| 304 |
|
This type is neither copyable nor movable, so copy assignment operator
|
304 |
|
This type is neither copyable nor movable, so copy assignment operator
|
| 305 |
|
|
305 |
|
|
| 306 |
|
|
306 |
|
|
| 307 |
|
stream_parser& operator=(
|
307 |
|
stream_parser& operator=(
|
| 308 |
|
stream_parser const&) = delete;
|
308 |
|
stream_parser const&) = delete;
|
| 309 |
|
|
309 |
|
|
| 310 |
|
/** Reset the parser for a new JSON text.
|
310 |
|
/** Reset the parser for a new JSON text.
|
| 311 |
|
|
311 |
|
|
| 312 |
|
This function is used to reset the parser to prepare it for parsing
|
312 |
|
This function is used to reset the parser to prepare it for parsing
|
| 313 |
|
a new complete JSON text. Any previous partial results are destroyed.
|
313 |
|
a new complete JSON text. Any previous partial results are destroyed.
|
| 314 |
|
The new value will use the memory resource of `sp`.
|
314 |
|
The new value will use the memory resource of `sp`.
|
| 315 |
|
|
315 |
|
|
| 316 |
|
|
316 |
|
|
| 317 |
|
Constant or linear in the size of any previous partial parsing results.
|
317 |
|
Constant or linear in the size of any previous partial parsing results.
|
| 318 |
|
|
318 |
|
|
| 319 |
|
|
319 |
|
|
| 320 |
|
|
320 |
|
|
| 321 |
|
|
321 |
|
|
| 322 |
|
@param sp A pointer to the @ref boost::container::pmr::memory_resource.
|
322 |
|
@param sp A pointer to the @ref boost::container::pmr::memory_resource.
|
| 323 |
|
|
323 |
|
|
| 324 |
|
|
324 |
|
|
| 325 |
|
|
325 |
|
|
| 326 |
|
reset(storage_ptr sp = {}) noexcept;
|
326 |
|
reset(storage_ptr sp = {}) noexcept;
|
| 327 |
|
|
327 |
|
|
| 328 |
|
/** Check if a complete JSON text has been parsed.
|
328 |
|
/** Check if a complete JSON text has been parsed.
|
| 329 |
|
|
329 |
|
|
| 330 |
|
This function returns `true` when all of these conditions are met:
|
330 |
|
This function returns `true` when all of these conditions are met:
|
| 331 |
|
|
331 |
|
|
| 332 |
|
@li A complete serialized JSON text has been presented to the parser,
|
332 |
|
@li A complete serialized JSON text has been presented to the parser,
|
| 333 |
|
|
333 |
|
|
| 334 |
|
|
334 |
|
|
| 335 |
|
@li No error has occurred since the parser was constructed, or since
|
335 |
|
@li No error has occurred since the parser was constructed, or since
|
| 336 |
|
the last call to @ref reset,
|
336 |
|
the last call to @ref reset,
|
| 337 |
|
|
337 |
|
|
| 338 |
|
|
338 |
|
|
| 339 |
|
|
339 |
|
|
| 340 |
|
|
340 |
|
|
| 341 |
|
|
341 |
|
|
| 342 |
|
|
342 |
|
|
| 343 |
|
|
343 |
|
|
| 344 |
|
|
344 |
|
|
| 345 |
|
|
345 |
|
|
| 346 |
|
|
346 |
|
|
| 347 |
|
|
347 |
|
|
| 348 |
|
|
348 |
|
|
| 349 |
|
|
349 |
|
|
| 350 |
|
/** Parse a buffer containing all or part of a complete JSON text.
|
350 |
|
/** Parse a buffer containing all or part of a complete JSON text.
|
| 351 |
|
|
351 |
|
|
| 352 |
|
This function parses JSON text contained in the specified character
|
352 |
|
This function parses JSON text contained in the specified character
|
| 353 |
|
buffer. If parsing completes, any additional characters past the end of
|
353 |
|
buffer. If parsing completes, any additional characters past the end of
|
| 354 |
|
the complete JSON text are ignored. The function returns the actual
|
354 |
|
the complete JSON text are ignored. The function returns the actual
|
| 355 |
|
number of characters parsed, which may be less than the size of the
|
355 |
|
number of characters parsed, which may be less than the size of the
|
| 356 |
|
input. This allows parsing of a buffer containing multiple individual
|
356 |
|
input. This allows parsing of a buffer containing multiple individual
|
| 357 |
|
JSON texts or containing different protocol data.
|
357 |
|
JSON texts or containing different protocol data.
|
| 358 |
|
|
358 |
|
|
| 359 |
|
Overloads **(1)**, **(2)**, **(4)**, and **(5)** report errors by
|
359 |
|
Overloads **(1)**, **(2)**, **(4)**, and **(5)** report errors by
|
| 360 |
|
setting `ec`. Overloads **(3)** and **(6)** report errors by throwing
|
360 |
|
setting `ec`. Overloads **(3)** and **(6)** report errors by throwing
|
| 361 |
|
exceptions. Upon error or exception, subsequent calls will fail until
|
361 |
|
exceptions. Upon error or exception, subsequent calls will fail until
|
| 362 |
|
@ref reset is called to parse a new JSON text.
|
362 |
|
@ref reset is called to parse a new JSON text.
|
| 363 |
|
|
363 |
|
|
| 364 |
|
@note To indicate there are no more character buffers, such as when
|
364 |
|
@note To indicate there are no more character buffers, such as when
|
| 365 |
|
@ref done returns `false` after writing, call @ref finish.
|
365 |
|
@ref done returns `false` after writing, call @ref finish.
|
| 366 |
|
|
366 |
|
|
| 367 |
|
|
367 |
|
|
| 368 |
|
|
368 |
|
|
| 369 |
|
stream_parser p; // construct a parser
|
369 |
|
stream_parser p; // construct a parser
|
| 370 |
|
std::size_t n; // number of characters used
|
370 |
|
std::size_t n; // number of characters used
|
| 371 |
|
n = p.write_some( "[1,2" ); // parse the first part of the JSON text
|
371 |
|
n = p.write_some( "[1,2" ); // parse the first part of the JSON text
|
| 372 |
|
assert( n == 4 ); // all characters consumed
|
372 |
|
assert( n == 4 ); // all characters consumed
|
| 373 |
|
n = p.write_some( "3,4] null" ); // parse the rest of the JSON text
|
373 |
|
n = p.write_some( "3,4] null" ); // parse the rest of the JSON text
|
| 374 |
|
assert( n == 5 ); // only some characters consumed
|
374 |
|
assert( n == 5 ); // only some characters consumed
|
| 375 |
|
value jv = p.release(); // take ownership of the value
|
375 |
|
value jv = p.release(); // take ownership of the value
|
| 376 |
|
|
376 |
|
|
| 377 |
|
|
377 |
|
|
| 378 |
|
|
378 |
|
|
| 379 |
|
@li **(1)**--**(3)** linear in `size`.
|
379 |
|
@li **(1)**--**(3)** linear in `size`.
|
| 380 |
|
@li **(4)**--**(6)** linear in `s.size()`.
|
380 |
|
@li **(4)**--**(6)** linear in `s.size()`.
|
| 381 |
|
|
381 |
|
|
| 382 |
|
|
382 |
|
|
| 383 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
383 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
| 384 |
|
|
384 |
|
|
| 385 |
|
@return The number of characters consumed from the buffer.
|
385 |
|
@return The number of characters consumed from the buffer.
|
| 386 |
|
|
386 |
|
|
| 387 |
|
@param data A pointer to a buffer of `size` characters to parse.
|
387 |
|
@param data A pointer to a buffer of `size` characters to parse.
|
| 388 |
|
@param size The number of characters pointed to by `data`.
|
388 |
|
@param size The number of characters pointed to by `data`.
|
| 389 |
|
@param ec Set to the error, if any occurred.
|
389 |
|
@param ec Set to the error, if any occurred.
|
| 390 |
|
|
390 |
|
|
| 391 |
|
|
391 |
|
|
| 392 |
|
|
392 |
|
|
| 393 |
|
|
393 |
|
|
| 394 |
|
|
394 |
|
|
| 395 |
|
|
395 |
|
|
| 396 |
|
|
396 |
|
|
| 397 |
|
|
397 |
|
|
| 398 |
|
|
398 |
|
|
| 399 |
|
|
399 |
|
|
| 400 |
|
|
400 |
|
|
| 401 |
|
|
401 |
|
|
| 402 |
|
|
402 |
|
|
| 403 |
|
|
403 |
|
|
| 404 |
|
|
404 |
|
|
| 405 |
|
|
405 |
|
|
| 406 |
|
|
406 |
|
|
| 407 |
|
|
407 |
|
|
| 408 |
|
|
408 |
|
|
| 409 |
|
|
409 |
|
|
| 410 |
|
|
410 |
|
|
| 411 |
|
|
411 |
|
|
| 412 |
|
@throw boost::system::system_error Thrown on error.
|
412 |
|
@throw boost::system::system_error Thrown on error.
|
| 413 |
|
|
413 |
|
|
| 414 |
|
|
414 |
|
|
| 415 |
|
|
415 |
|
|
| 416 |
|
|
416 |
|
|
| 417 |
|
|
417 |
|
|
| 418 |
|
|
418 |
|
|
| 419 |
|
|
419 |
|
|
| 420 |
|
|
420 |
|
|
| 421 |
|
@param s The character string to parse.
|
421 |
|
@param s The character string to parse.
|
| 422 |
|
|
422 |
|
|
| 423 |
|
|
423 |
|
|
| 424 |
|
|
424 |
|
|
| 425 |
|
|
425 |
|
|
| 426 |
|
|
426 |
|
|
| 427 |
|
|
427 |
|
|
| 428 |
|
|
428 |
|
|
| 429 |
|
|
429 |
|
|
| 430 |
|
|
430 |
|
|
| 431 |
|
|
431 |
|
|
| 432 |
|
|
432 |
|
|
| 433 |
|
|
433 |
|
|
| 434 |
|
|
434 |
|
|
| 435 |
|
|
435 |
|
|
| 436 |
|
|
436 |
|
|
| 437 |
|
|
437 |
|
|
| 438 |
|
|
438 |
|
|
| 439 |
|
|
439 |
|
|
| 440 |
|
|
440 |
|
|
| 441 |
|
|
441 |
|
|
| 442 |
|
|
442 |
|
|
| 443 |
|
|
443 |
|
|
| 444 |
|
|
444 |
|
|
| 445 |
|
|
445 |
|
|
| 446 |
|
|
446 |
|
|
| 447 |
|
|
447 |
|
|
| 448 |
|
|
448 |
|
|
| 449 |
|
|
449 |
|
|
| 450 |
|
|
450 |
|
|
| 451 |
|
|
451 |
|
|
| 452 |
|
|
452 |
|
|
| 453 |
|
|
453 |
|
|
| 454 |
|
|
454 |
|
|
| 455 |
|
|
455 |
|
|
| 456 |
|
|
456 |
|
|
| 457 |
|
|
457 |
|
|
| 458 |
|
/** Parse a buffer containing all or part of a complete JSON text.
|
458 |
|
/** Parse a buffer containing all or part of a complete JSON text.
|
| 459 |
|
|
459 |
|
|
| 460 |
|
This function parses all or part of a JSON text contained in the
|
460 |
|
This function parses all or part of a JSON text contained in the
|
| 461 |
|
specified character buffer. The entire buffer must be consumed; if
|
461 |
|
specified character buffer. The entire buffer must be consumed; if
|
| 462 |
|
there are additional characters past the end of the complete JSON text,
|
462 |
|
there are additional characters past the end of the complete JSON text,
|
| 463 |
|
the parse fails and an error is returned.
|
463 |
|
the parse fails and an error is returned.
|
| 464 |
|
|
464 |
|
|
| 465 |
|
Overloads **(1)**, **(2)**, **(4)**, and **(5)** report errors by
|
465 |
|
Overloads **(1)**, **(2)**, **(4)**, and **(5)** report errors by
|
| 466 |
|
setting `ec`. Overloads **(3)** and **(6)** report errors by throwing
|
466 |
|
setting `ec`. Overloads **(3)** and **(6)** report errors by throwing
|
| 467 |
|
exceptions. Upon error or exception, subsequent calls will fail until
|
467 |
|
exceptions. Upon error or exception, subsequent calls will fail until
|
| 468 |
|
@ref reset is called to parse a new JSON text.
|
468 |
|
@ref reset is called to parse a new JSON text.
|
| 469 |
|
|
469 |
|
|
| 470 |
|
@note To indicate there are no more character buffers, such as when
|
470 |
|
@note To indicate there are no more character buffers, such as when
|
| 471 |
|
@ref done returns `false` after writing, call @ref finish.
|
471 |
|
@ref done returns `false` after writing, call @ref finish.
|
| 472 |
|
|
472 |
|
|
| 473 |
|
|
473 |
|
|
| 474 |
|
|
474 |
|
|
| 475 |
|
stream_parser p; // construct a parser
|
475 |
|
stream_parser p; // construct a parser
|
| 476 |
|
std::size_t n; // number of characters used
|
476 |
|
std::size_t n; // number of characters used
|
| 477 |
|
n = p.write( "[1,2" ); // parse some of the JSON text
|
477 |
|
n = p.write( "[1,2" ); // parse some of the JSON text
|
| 478 |
|
assert( n == 4 ); // all characters consumed
|
478 |
|
assert( n == 4 ); // all characters consumed
|
| 479 |
|
n = p.write( "3,4]" ); // parse the rest of the JSON text
|
479 |
|
n = p.write( "3,4]" ); // parse the rest of the JSON text
|
| 480 |
|
assert( n == 4 ); // all characters consumed
|
480 |
|
assert( n == 4 ); // all characters consumed
|
| 481 |
|
value jv = p.release(); // take ownership of the value
|
481 |
|
value jv = p.release(); // take ownership of the value
|
| 482 |
|
|
482 |
|
|
| 483 |
|
|
483 |
|
|
| 484 |
|
|
484 |
|
|
| 485 |
|
@li **(1)**--**(3)** linear in `size`.
|
485 |
|
@li **(1)**--**(3)** linear in `size`.
|
| 486 |
|
@li **(4)**--**(6)** linear in `s.size()`.
|
486 |
|
@li **(4)**--**(6)** linear in `s.size()`.
|
| 487 |
|
|
487 |
|
|
| 488 |
|
|
488 |
|
|
| 489 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
489 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
| 490 |
|
@return The number of characters consumed from the buffer.
|
490 |
|
@return The number of characters consumed from the buffer.
|
| 491 |
|
|
491 |
|
|
| 492 |
|
@param data A pointer to a buffer of `size` characters to parse.
|
492 |
|
@param data A pointer to a buffer of `size` characters to parse.
|
| 493 |
|
|
493 |
|
|
| 494 |
|
@param size The number of characters pointed to by `data`.
|
494 |
|
@param size The number of characters pointed to by `data`.
|
| 495 |
|
|
495 |
|
|
| 496 |
|
@param ec Set to the error, if any occurred.
|
496 |
|
@param ec Set to the error, if any occurred.
|
| 497 |
|
|
497 |
|
|
| 498 |
|
|
498 |
|
|
| 499 |
|
|
499 |
|
|
| 500 |
|
|
500 |
|
|
| 501 |
|
|
501 |
|
|
| 502 |
|
|
502 |
|
|
| 503 |
|
|
503 |
|
|
| 504 |
|
|
504 |
|
|
| 505 |
|
|
505 |
|
|
| 506 |
|
|
506 |
|
|
| 507 |
|
|
507 |
|
|
| 508 |
|
|
508 |
|
|
| 509 |
|
|
509 |
|
|
| 510 |
|
|
510 |
|
|
| 511 |
|
|
511 |
|
|
| 512 |
|
|
512 |
|
|
| 513 |
|
|
513 |
|
|
| 514 |
|
|
514 |
|
|
| 515 |
|
|
515 |
|
|
| 516 |
|
|
516 |
|
|
| 517 |
|
|
517 |
|
|
| 518 |
|
|
518 |
|
|
| 519 |
|
@throw boost::system::system_error Thrown on error.
|
519 |
|
@throw boost::system::system_error Thrown on error.
|
| 520 |
|
|
520 |
|
|
| 521 |
|
|
521 |
|
|
| 522 |
|
|
522 |
|
|
| 523 |
|
|
523 |
|
|
| 524 |
|
|
524 |
|
|
| 525 |
|
|
525 |
|
|
| 526 |
|
|
526 |
|
|
| 527 |
|
|
527 |
|
|
| 528 |
|
|
528 |
|
|
| 529 |
|
@param s The character string to parse.
|
529 |
|
@param s The character string to parse.
|
| 530 |
|
|
530 |
|
|
| 531 |
|
|
531 |
|
|
| 532 |
|
|
532 |
|
|
| 533 |
|
|
533 |
|
|
| 534 |
|
|
534 |
|
|
| 535 |
|
|
535 |
|
|
| 536 |
|
|
536 |
|
|
| 537 |
|
|
537 |
|
|
| 538 |
|
|
538 |
|
|
| 539 |
|
|
539 |
|
|
| 540 |
|
|
540 |
|
|
| 541 |
|
|
541 |
|
|
| 542 |
|
|
542 |
|
|
| 543 |
|
|
543 |
|
|
| 544 |
|
|
544 |
|
|
| 545 |
|
|
545 |
|
|
| 546 |
|
|
546 |
|
|
| 547 |
|
|
547 |
|
|
| 548 |
|
|
548 |
|
|
| 549 |
|
|
549 |
|
|
| 550 |
|
|
550 |
|
|
| 551 |
|
|
551 |
|
|
| 552 |
|
|
552 |
|
|
| 553 |
|
|
553 |
|
|
| 554 |
|
|
554 |
|
|
| 555 |
|
|
555 |
|
|
| 556 |
|
|
556 |
|
|
| 557 |
|
|
557 |
|
|
| 558 |
|
|
558 |
|
|
| 559 |
|
|
559 |
|
|
| 560 |
|
|
560 |
|
|
| 561 |
|
|
561 |
|
|
| 562 |
|
|
562 |
|
|
| 563 |
|
|
563 |
|
|
| 564 |
|
|
564 |
|
|
| 565 |
|
|
565 |
|
|
| 566 |
|
|
566 |
|
|
| 567 |
|
/** Indicate the end of JSON input.
|
567 |
|
/** Indicate the end of JSON input.
|
| 568 |
|
|
568 |
|
|
| 569 |
|
This function is used to indicate that there are no more character
|
569 |
|
This function is used to indicate that there are no more character
|
| 570 |
|
buffers in the current JSON text being parsed. If the resulting JSON
|
570 |
|
buffers in the current JSON text being parsed. If the resulting JSON
|
| 571 |
|
text is incomplete, **(1)** and **(2)** assign the relevant
|
571 |
|
text is incomplete, **(1)** and **(2)** assign the relevant
|
| 572 |
|
`error_code` to `ec`, while **(3)** throws an exception.
|
572 |
|
`error_code` to `ec`, while **(3)** throws an exception.
|
| 573 |
|
|
573 |
|
|
| 574 |
|
Upon error or exception, subsequent calls will fail until @ref reset is
|
574 |
|
Upon error or exception, subsequent calls will fail until @ref reset is
|
| 575 |
|
called to parse a new JSON text.
|
575 |
|
called to parse a new JSON text.
|
| 576 |
|
|
576 |
|
|
| 577 |
|
|
577 |
|
|
| 578 |
|
In the code below, @ref finish is called to
|
578 |
|
In the code below, @ref finish is called to
|
| 579 |
|
indicate there are no more digits in the
|
579 |
|
indicate there are no more digits in the
|
| 580 |
|
|
580 |
|
|
| 581 |
|
|
581 |
|
|
| 582 |
|
stream_parser p; // construct a parser
|
582 |
|
stream_parser p; // construct a parser
|
| 583 |
|
p.write( "3." ); // write the first part of the number
|
583 |
|
p.write( "3." ); // write the first part of the number
|
| 584 |
|
p.write( "14" ); // write the second part of the number
|
584 |
|
p.write( "14" ); // write the second part of the number
|
| 585 |
|
assert( ! p.done() ); // there could be more digits
|
585 |
|
assert( ! p.done() ); // there could be more digits
|
| 586 |
|
p.finish(); // indicate the end of the JSON input
|
586 |
|
p.finish(); // indicate the end of the JSON input
|
| 587 |
|
assert( p.done() ); // now we are finished
|
587 |
|
assert( p.done() ); // now we are finished
|
| 588 |
|
value jv = p.release(); // take ownership of the value
|
588 |
|
value jv = p.release(); // take ownership of the value
|
| 589 |
|
|
589 |
|
|
| 590 |
|
|
590 |
|
|
| 591 |
|
|
591 |
|
|
| 592 |
|
|
592 |
|
|
| 593 |
|
|
593 |
|
|
| 594 |
|
|
594 |
|
|
| 595 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
595 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
| 596 |
|
|
596 |
|
|
| 597 |
|
@param ec Set to the error, if any occurred.
|
597 |
|
@param ec Set to the error, if any occurred.
|
| 598 |
|
|
598 |
|
|
| 599 |
|
|
599 |
|
|
| 600 |
|
|
600 |
|
|
| 601 |
|
|
601 |
|
|
| 602 |
|
|
602 |
|
|
| 603 |
|
finish(system::error_code& ec);
|
603 |
|
finish(system::error_code& ec);
|
| 604 |
|
|
604 |
|
|
| 605 |
|
|
605 |
|
|
| 606 |
|
|
606 |
|
|
| 607 |
|
finish(std::error_code& ec);
|
607 |
|
finish(std::error_code& ec);
|
| 608 |
|
|
608 |
|
|
| 609 |
|
|
609 |
|
|
| 610 |
|
|
610 |
|
|
| 611 |
|
@throw boost::system::system_error Parsing error.
|
611 |
|
@throw boost::system::system_error Parsing error.
|
| 612 |
|
|
612 |
|
|
| 613 |
|
|
613 |
|
|
| 614 |
|
|
614 |
|
|
| 615 |
|
|
615 |
|
|
| 616 |
|
|
616 |
|
|
| 617 |
|
|
617 |
|
|
| 618 |
|
/** Return the parsed JSON as a @ref value.
|
618 |
|
/** Return the parsed JSON as a @ref value.
|
| 619 |
|
|
619 |
|
|
| 620 |
|
This returns the parsed value, or throws an exception if the parsing is
|
620 |
|
This returns the parsed value, or throws an exception if the parsing is
|
| 621 |
|
incomplete or failed. If `! this->done()`, calls @ref finish() first.
|
621 |
|
incomplete or failed. If `! this->done()`, calls @ref finish() first.
|
| 622 |
|
It is necessary to call @ref reset after calling this function in order
|
622 |
|
It is necessary to call @ref reset after calling this function in order
|
| 623 |
|
to parse another JSON text.
|
623 |
|
to parse another JSON text.
|
| 624 |
|
|
624 |
|
|
| 625 |
|
|
625 |
|
|
| 626 |
|
|
626 |
|
|
| 627 |
|
|
627 |
|
|
| 628 |
|
@return The parsed value. Ownership of this value is transferred to the
|
628 |
|
@return The parsed value. Ownership of this value is transferred to the
|
| 629 |
|
|
629 |
|
|
| 630 |
|
|
630 |
|
|
| 631 |
|
@throw boost::system::system_error A complete JSON text hasn't been
|
631 |
|
@throw boost::system::system_error A complete JSON text hasn't been
|
| 632 |
|
parsed, or parsing failed.
|
632 |
|
parsed, or parsing failed.
|
| 633 |
|
|
633 |
|
|
| 634 |
|
|
634 |
|
|
| 635 |
|
|
635 |
|
|
| 636 |
|
|
636 |
|
|
| 637 |
|
|
637 |
|
|
| 638 |
|
|
638 |
|
|
| 639 |
|
|
639 |
|
|
| 640 |
|
|
640 |
|
|
| 641 |
|
|
641 |
|
|
| 642 |
|
|
642 |
|
|