@@ -9,21 +9,21 @@ simdjson_really_inline value_iterator::value_iterator(json_iterator *json_iter,
9
9
}
10
10
11
11
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::start_object () noexcept {
12
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
12
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
13
13
14
14
if (*_json_iter->advance () != ' {' ) { logger::log_error (*_json_iter, " Not an object" ); return INCORRECT_TYPE; }
15
15
return started_object ();
16
16
}
17
17
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::try_start_object () noexcept {
18
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
18
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
19
19
20
20
if (*_json_iter->peek () != ' {' ) { logger::log_error (*_json_iter, " Not an object" ); return INCORRECT_TYPE; }
21
21
_json_iter->advance ();
22
22
return started_object ();
23
23
}
24
24
25
25
simdjson_warn_unused simdjson_really_inline bool value_iterator::started_object () noexcept {
26
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
26
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
27
27
28
28
if (*_json_iter->peek () == ' }' ) {
29
29
logger::log_value (*_json_iter, " empty object" );
@@ -37,7 +37,7 @@ simdjson_warn_unused simdjson_really_inline bool value_iterator::started_object(
37
37
}
38
38
39
39
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::has_next_field () noexcept {
40
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () );
40
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth );
41
41
42
42
switch (*_json_iter->advance ()) {
43
43
case ' }' :
@@ -54,7 +54,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<bool> value_iterator
54
54
55
55
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::find_field_raw (const char *key) noexcept {
56
56
// We assume we are sitting at a key: at "key": <value>
57
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () +1 );
57
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth +1 );
58
58
59
59
bool has_next;
60
60
do {
@@ -81,37 +81,37 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<bool> value_iterator
81
81
}
82
82
83
83
simdjson_warn_unused simdjson_really_inline simdjson_result<raw_json_string> value_iterator::field_key () noexcept {
84
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () +1 );
84
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth +1 );
85
85
86
86
const uint8_t *key = _json_iter->advance ();
87
87
if (*(key++) != ' "' ) { return _json_iter->report_error (TAPE_ERROR, " Object key is not a string" ); }
88
88
return raw_json_string (key);
89
89
}
90
90
91
91
simdjson_warn_unused simdjson_really_inline error_code value_iterator::field_value () noexcept {
92
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () +1 );
92
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth +1 );
93
93
94
94
if (*_json_iter->advance () != ' :' ) { return _json_iter->report_error (TAPE_ERROR, " Missing colon in object field" ); }
95
95
return SUCCESS;
96
96
}
97
97
98
98
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::start_array () noexcept {
99
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
99
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
100
100
101
101
if (*_json_iter->advance () != ' [' ) { logger::log_error (*_json_iter, " Not an array" ); return INCORRECT_TYPE; }
102
102
return started_array ();
103
103
}
104
104
105
105
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::try_start_array () noexcept {
106
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
106
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
107
107
108
108
if (*_json_iter->peek () != ' [' ) { logger::log_error (*_json_iter, " Not an array" ); return INCORRECT_TYPE; }
109
109
_json_iter->advance ();
110
110
return started_array ();
111
111
}
112
112
113
113
simdjson_warn_unused simdjson_really_inline bool value_iterator::started_array () noexcept {
114
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
114
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
115
115
116
116
if (*_json_iter->peek () == ' ]' ) {
117
117
logger::log_value (*_json_iter, " empty array" );
@@ -125,7 +125,7 @@ simdjson_warn_unused simdjson_really_inline bool value_iterator::started_array()
125
125
}
126
126
127
127
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::has_next_element () noexcept {
128
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () );
128
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth );
129
129
130
130
switch (*_json_iter->advance ()) {
131
131
case ' ]' :
@@ -147,7 +147,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<std::string_view> va
147
147
return require_raw_json_string ().unescape (_json_iter->string_buf_loc ());
148
148
}
149
149
simdjson_warn_unused simdjson_really_inline simdjson_result<raw_json_string> value_iterator::try_get_raw_json_string () noexcept {
150
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
150
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
151
151
152
152
logger::log_value (*_json_iter, " string" , " " , 0 );
153
153
auto json = _json_iter->peek ();
@@ -157,7 +157,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<raw_json_string> val
157
157
return raw_json_string (json+1 );
158
158
}
159
159
simdjson_warn_unused simdjson_really_inline simdjson_result<raw_json_string> value_iterator::require_raw_json_string () noexcept {
160
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 0 );
160
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 0 );
161
161
162
162
logger::log_value (*_json_iter, " string" , " " , 0 );
163
163
auto json = _json_iter->advance ();
@@ -166,7 +166,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<raw_json_string> val
166
166
return raw_json_string (json+1 );
167
167
}
168
168
simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t > value_iterator::try_get_uint64 () noexcept {
169
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
169
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
170
170
171
171
logger::log_value (*_json_iter, " uint64" , " " , 0 );
172
172
uint64_t result;
@@ -176,14 +176,14 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t> value_iter
176
176
return result;
177
177
}
178
178
simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t > value_iterator::require_uint64 () noexcept {
179
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
179
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
180
180
181
181
logger::log_value (*_json_iter, " uint64" , " " , 0 );
182
182
_json_iter->ascend_to (depth ()-1 );
183
183
return numberparsing::parse_unsigned (_json_iter->advance ());
184
184
}
185
185
simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t > value_iterator::try_get_int64 () noexcept {
186
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
186
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
187
187
188
188
logger::log_value (*_json_iter, " int64" , " " , 0 );
189
189
int64_t result;
@@ -193,14 +193,14 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t> value_itera
193
193
return result;
194
194
}
195
195
simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t > value_iterator::require_int64 () noexcept {
196
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
196
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
197
197
198
198
logger::log_value (*_json_iter, " int64" , " " , 0 );
199
199
_json_iter->ascend_to (depth ()-1 );
200
200
return numberparsing::parse_integer (_json_iter->advance ());
201
201
}
202
202
simdjson_warn_unused simdjson_really_inline simdjson_result<double > value_iterator::try_get_double () noexcept {
203
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
203
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
204
204
205
205
logger::log_value (*_json_iter, " double" , " " , 0 );
206
206
double result;
@@ -210,7 +210,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<double> value_iterat
210
210
return result;
211
211
}
212
212
simdjson_warn_unused simdjson_really_inline simdjson_result<double > value_iterator::require_double () noexcept {
213
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
213
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
214
214
215
215
logger::log_value (*_json_iter, " double" , " " , 0 );
216
216
_json_iter->ascend_to (depth ()-1 );
@@ -225,7 +225,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<bool> value_iterator
225
225
return simdjson_result<bool >(!not_true);
226
226
}
227
227
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::try_get_bool () noexcept {
228
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
228
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
229
229
230
230
bool result;
231
231
SIMDJSON_TRY ( parse_bool (_json_iter->peek ()).get (result) );
@@ -234,7 +234,7 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<bool> value_iterator
234
234
return result;
235
235
}
236
236
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::require_bool () noexcept {
237
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
237
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
238
238
239
239
_json_iter->ascend_to (depth ()-1 );
240
240
return parse_bool (_json_iter->advance ());
@@ -247,7 +247,7 @@ simdjson_really_inline bool value_iterator::is_null(const uint8_t *json) const n
247
247
return false ;
248
248
}
249
249
simdjson_really_inline bool value_iterator::is_null () noexcept {
250
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
250
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
251
251
252
252
if (is_null (_json_iter->peek ())) {
253
253
_json_iter->advance ();
@@ -257,7 +257,7 @@ simdjson_really_inline bool value_iterator::is_null() noexcept {
257
257
return false ;
258
258
}
259
259
simdjson_really_inline bool value_iterator::require_null () noexcept {
260
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () > 1 );
260
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth > 1 );
261
261
262
262
_json_iter->ascend_to (depth ()-1 );
263
263
return is_null (_json_iter->advance ());
@@ -266,7 +266,7 @@ simdjson_really_inline bool value_iterator::require_null() noexcept {
266
266
constexpr const uint32_t MAX_INT_LENGTH = 1024 ;
267
267
268
268
simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t > value_iterator::parse_root_uint64 (const uint8_t *json, uint32_t max_len) const noexcept {
269
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
269
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
270
270
271
271
uint8_t tmpbuf[20 +1 ]; // <20 digits> is the longest possible unsigned integer
272
272
if (!_json_iter->copy_to_buffer (json, max_len, tmpbuf)) { logger::log_error (*_json_iter, " Root number more than 20 characters" ); return NUMBER_ERROR; }
@@ -276,21 +276,21 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t> value_iter
276
276
return result;
277
277
}
278
278
simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t > value_iterator::try_get_root_uint64 () noexcept {
279
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
279
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
280
280
281
281
uint64_t result;
282
282
SIMDJSON_TRY ( parse_root_uint64 (_json_iter->peek (), _json_iter->peek_length ()).get (result) );
283
283
_json_iter->advance ();
284
284
return result;
285
285
}
286
286
simdjson_warn_unused simdjson_really_inline simdjson_result<uint64_t > value_iterator::require_root_uint64 () noexcept {
287
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
287
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
288
288
289
289
auto max_len = _json_iter->peek_length ();
290
290
return parse_root_uint64 (_json_iter->advance (), max_len);
291
291
}
292
292
simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t > value_iterator::parse_root_int64 (const uint8_t *json, uint32_t max_len) const noexcept {
293
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
293
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
294
294
295
295
uint8_t tmpbuf[20 +1 ]; // -<19 digits> is the longest possible integer
296
296
if (!_json_iter->copy_to_buffer (json, max_len, tmpbuf)) { logger::log_error (*_json_iter, " Root number more than 20 characters" ); return NUMBER_ERROR; }
@@ -300,21 +300,21 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t> value_itera
300
300
return result;
301
301
}
302
302
simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t > value_iterator::try_get_root_int64 () noexcept {
303
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
303
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
304
304
305
305
int64_t result;
306
306
SIMDJSON_TRY ( parse_root_int64 (_json_iter->peek (), _json_iter->peek_length ()).get (result) );
307
307
_json_iter->advance ();
308
308
return result;
309
309
}
310
310
simdjson_warn_unused simdjson_really_inline simdjson_result<int64_t > value_iterator::require_root_int64 () noexcept {
311
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
311
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
312
312
313
313
auto max_len = _json_iter->peek_length ();
314
314
return parse_root_int64 (_json_iter->advance (), max_len);
315
315
}
316
316
simdjson_warn_unused simdjson_really_inline simdjson_result<double > value_iterator::parse_root_double (const uint8_t *json, uint32_t max_len) const noexcept {
317
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
317
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
318
318
319
319
// Per https://www.exploringbinary.com/maximum-number-of-decimal-digits-in-binary-floating-point-numbers/, 1074 is the maximum number of significant fractional digits. Add 8 more digits for the biggest number: -0.<fraction>e-308.
320
320
uint8_t tmpbuf[1074 +8 +1 ];
@@ -325,56 +325,56 @@ simdjson_warn_unused simdjson_really_inline simdjson_result<double> value_iterat
325
325
return result;
326
326
}
327
327
simdjson_warn_unused simdjson_really_inline simdjson_result<double > value_iterator::try_get_root_double () noexcept {
328
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
328
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
329
329
330
330
double result;
331
331
SIMDJSON_TRY ( parse_root_double (_json_iter->peek (), _json_iter->peek_length ()).get (result) );
332
332
_json_iter->advance ();
333
333
return result;
334
334
}
335
335
simdjson_warn_unused simdjson_really_inline simdjson_result<double > value_iterator::require_root_double () noexcept {
336
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
336
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
337
337
338
338
auto max_len = _json_iter->peek_length ();
339
339
return parse_root_double (_json_iter->advance (), max_len);
340
340
}
341
341
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::parse_root_bool (const uint8_t *json, uint32_t max_len) const noexcept {
342
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
342
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
343
343
344
344
uint8_t tmpbuf[5 +1 ];
345
345
if (!_json_iter->copy_to_buffer (json, max_len, tmpbuf)) { logger::log_error (*_json_iter, " Not a boolean" ); return INCORRECT_TYPE; }
346
346
return parse_bool (tmpbuf);
347
347
}
348
348
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::try_get_root_bool () noexcept {
349
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
349
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
350
350
351
351
bool result;
352
352
SIMDJSON_TRY ( parse_root_bool (_json_iter->peek (), _json_iter->peek_length ()).get (result) );
353
353
_json_iter->advance ();
354
354
return result;
355
355
}
356
356
simdjson_warn_unused simdjson_really_inline simdjson_result<bool > value_iterator::require_root_bool () noexcept {
357
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
357
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
358
358
359
359
auto max_len = _json_iter->peek_length ();
360
360
return parse_root_bool (_json_iter->advance (), max_len);
361
361
}
362
362
simdjson_really_inline bool value_iterator::is_root_null (const uint8_t *json, uint32_t max_len) const noexcept {
363
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
363
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
364
364
365
365
uint8_t tmpbuf[4 +1 ];
366
366
if (!_json_iter->copy_to_buffer (json, max_len, tmpbuf)) { return false ; }
367
367
return is_null (tmpbuf);
368
368
}
369
369
simdjson_really_inline bool value_iterator::is_root_null () noexcept {
370
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
370
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
371
371
372
372
if (!is_root_null (_json_iter->peek (), _json_iter->peek_length ())) { return false ; }
373
373
_json_iter->advance ();
374
374
return true ;
375
375
}
376
376
simdjson_really_inline bool value_iterator::require_root_null () noexcept {
377
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () && depth () == 1 );
377
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth && _depth == 1 );
378
378
379
379
auto max_len = _json_iter->peek_length ();
380
380
return is_root_null (_json_iter->advance (), max_len);
@@ -384,7 +384,7 @@ simdjson_warn_unused simdjson_really_inline error_code value_iterator::skip_chil
384
384
return _json_iter->skip_child (depth ());
385
385
}
386
386
simdjson_really_inline value_iterator value_iterator::child () const noexcept {
387
- SIMDJSON_ASSUME ( _json_iter->depth () == depth () +1 );
387
+ SIMDJSON_ASSUME ( _json_iter->_depth == _depth +1 );
388
388
return { _json_iter, depth ()+1 };
389
389
}
390
390
0 commit comments