@@ -56,50 +56,44 @@ struct tape_builder {
56
56
empty_container (iter, internal::tape_type::START_ARRAY, internal::tape_type::END_ARRAY);
57
57
}
58
58
59
- simdjson_really_inline void start_document (json_iterator &iter) {
59
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_document (json_iterator &iter) {
60
60
iter.log_start_value (" document" );
61
61
start_container (iter);
62
62
iter.dom_parser .is_array [iter.depth ] = false ;
63
+ return SUCCESS;
63
64
}
64
- simdjson_really_inline void start_object (json_iterator &iter) {
65
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_object (json_iterator &iter) {
65
66
iter.log_start_value (" object" );
66
67
start_container (iter);
67
68
iter.dom_parser .is_array [iter.depth ] = false ;
69
+ return SUCCESS;
68
70
}
69
- simdjson_really_inline void start_array (json_iterator &iter) {
71
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_array (json_iterator &iter) {
70
72
iter.log_start_value (" array" );
71
73
start_container (iter);
72
74
iter.dom_parser .is_array [iter.depth ] = true ;
75
+ return SUCCESS;
73
76
}
74
77
75
- simdjson_really_inline void end_object (json_iterator &iter) {
78
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code end_object (json_iterator &iter) {
76
79
iter.log_end_value (" object" );
77
- end_container (iter, internal::tape_type::START_OBJECT, internal::tape_type::END_OBJECT);
80
+ return end_container (iter, internal::tape_type::START_OBJECT, internal::tape_type::END_OBJECT);
78
81
}
79
- simdjson_really_inline void end_array (json_iterator &iter) {
82
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code end_array (json_iterator &iter) {
80
83
iter.log_end_value (" array" );
81
- end_container (iter, internal::tape_type::START_ARRAY, internal::tape_type::END_ARRAY);
84
+ return end_container (iter, internal::tape_type::START_ARRAY, internal::tape_type::END_ARRAY);
82
85
}
83
- simdjson_really_inline void end_document (json_iterator &iter) {
86
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code end_document (json_iterator &iter) {
84
87
iter.log_end_value (" document" );
85
88
constexpr uint32_t start_tape_index = 0 ;
86
89
tape.append (start_tape_index, internal::tape_type::ROOT);
87
90
tape_writer::write (iter.dom_parser .doc ->tape [start_tape_index], next_tape_index (iter), internal::tape_type::ROOT);
91
+ return SUCCESS;
88
92
}
89
93
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code key (json_iterator &iter, const uint8_t *key) {
90
94
return parse_string (iter, key, true );
91
95
}
92
96
93
- // Called after end_object/end_array. Not called after empty_object/empty_array,
94
- // as the parent is already known in those cases.
95
- //
96
- // The object returned from end_container() should support the in_container(),
97
- // in_array() and in_object() methods, allowing the iterator to branch to the
98
- // correct place.
99
- simdjson_really_inline tape_builder &end_container (json_iterator &iter) {
100
- iter.depth --;
101
- return *this ;
102
- }
103
97
// increment_count increments the count of keys in an object or values in an array.
104
98
simdjson_really_inline void increment_count (json_iterator &iter) {
105
99
iter.dom_parser .open_containers [iter.depth ].count ++; // we have a key value pair in the object at parser.dom_parser.depth - 1
@@ -219,7 +213,7 @@ struct tape_builder {
219
213
tape.skip (); // We don't actually *write* the start element until the end.
220
214
}
221
215
222
- simdjson_really_inline void end_container (json_iterator &iter, internal::tape_type start, internal::tape_type end) noexcept {
216
+ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code end_container (json_iterator &iter, internal::tape_type start, internal::tape_type end) noexcept {
223
217
// Write the ending tape element, pointing at the start location
224
218
const uint32_t start_tape_index = iter.dom_parser .open_containers [iter.depth ].tape_index ;
225
219
tape.append (start_tape_index, end);
@@ -229,6 +223,7 @@ struct tape_builder {
229
223
const uint32_t count = iter.dom_parser .open_containers [iter.depth ].count ;
230
224
const uint32_t cntsat = count > 0xFFFFFF ? 0xFFFFFF : count;
231
225
tape_writer::write (iter.dom_parser .doc ->tape [start_tape_index], next_tape_index (iter) | (uint64_t (cntsat) << 32 ), start);
226
+ return SUCCESS;
232
227
}
233
228
234
229
simdjson_really_inline uint8_t *on_start_string (json_iterator &iter) noexcept {
0 commit comments