@@ -137,24 +137,24 @@ JsonParser::JsonParser(JsonParserOption const& option)
137137 m_archive_writer->open (m_archive_options);
138138}
139139
140- void JsonParser::parse_obj_in_array (ondemand::object line, int32_t parent_node_id) {
141- ondemand::object_iterator it = line.begin ();
140+ void JsonParser::parse_obj_in_array (simdjson:: ondemand::object line, int32_t parent_node_id) {
141+ simdjson:: ondemand::object_iterator it = line.begin ();
142142 if (it == line.end ()) {
143143 m_current_schema.insert_unordered (parent_node_id);
144144 return ;
145145 }
146146
147- std::stack<ondemand::object> object_stack;
148- std::stack<ondemand::object_iterator> object_it_stack;
147+ std::stack<simdjson:: ondemand::object> object_stack;
148+ std::stack<simdjson:: ondemand::object_iterator> object_it_stack;
149149
150150 std::stack<int32_t > node_id_stack;
151151 node_id_stack.push (parent_node_id);
152152 object_stack.push (std::move (line));
153153 object_it_stack.push (std::move (it));
154154
155155 size_t object_start = m_current_schema.start_unordered_object (NodeType::Object);
156- ondemand::field cur_field;
157- ondemand::value cur_value;
156+ simdjson:: ondemand::field cur_field;
157+ simdjson:: ondemand::value cur_value;
158158 std::string_view cur_key;
159159 int32_t node_id;
160160 while (true ) {
@@ -177,7 +177,7 @@ void JsonParser::parse_obj_in_array(ondemand::object line, int32_t parent_node_i
177177 cur_value = cur_field.value ();
178178
179179 switch (cur_value.type ()) {
180- case ondemand::json_type::object: {
180+ case simdjson:: ondemand::json_type::object: {
181181 node_id = m_archive_writer
182182 ->add_node (node_id_stack.top (), NodeType::Object, cur_key);
183183 object_stack.push (std::move (cur_value.get_object ()));
@@ -192,7 +192,7 @@ void JsonParser::parse_obj_in_array(ondemand::object line, int32_t parent_node_i
192192 }
193193 break ;
194194 }
195- case ondemand::json_type::array: {
195+ case simdjson:: ondemand::json_type::array: {
196196 node_id = m_archive_writer->add_node (
197197 node_id_stack.top (),
198198 NodeType::StructuredArray,
@@ -201,8 +201,8 @@ void JsonParser::parse_obj_in_array(ondemand::object line, int32_t parent_node_i
201201 parse_array (cur_value.get_array (), node_id);
202202 break ;
203203 }
204- case ondemand::json_type::number: {
205- ondemand::number number_value = cur_value.get_number ();
204+ case simdjson:: ondemand::json_type::number: {
205+ simdjson:: ondemand::number number_value = cur_value.get_number ();
206206 if (true == number_value.is_double ()) {
207207 double double_value = number_value.get_double ();
208208 m_current_parsed_message.add_unordered_value (double_value);
@@ -222,7 +222,7 @@ void JsonParser::parse_obj_in_array(ondemand::object line, int32_t parent_node_i
222222 m_current_schema.insert_unordered (node_id);
223223 break ;
224224 }
225- case ondemand::json_type::string: {
225+ case simdjson:: ondemand::json_type::string: {
226226 std::string_view value = cur_value.get_string (true );
227227 if (value.find (' ' ) != std::string::npos) {
228228 node_id = m_archive_writer
@@ -235,15 +235,15 @@ void JsonParser::parse_obj_in_array(ondemand::object line, int32_t parent_node_i
235235 m_current_schema.insert_unordered (node_id);
236236 break ;
237237 }
238- case ondemand::json_type::boolean: {
238+ case simdjson:: ondemand::json_type::boolean: {
239239 bool value = cur_value.get_bool ();
240240 m_current_parsed_message.add_unordered_value (value);
241241 node_id = m_archive_writer
242242 ->add_node (node_id_stack.top (), NodeType::Boolean, cur_key);
243243 m_current_schema.insert_unordered (node_id);
244244 break ;
245245 }
246- case ondemand::json_type::null: {
246+ case simdjson:: ondemand::json_type::null: {
247247 node_id = m_archive_writer
248248 ->add_node (node_id_stack.top (), NodeType::NullValue, cur_key);
249249 m_current_schema.insert_unordered (node_id);
@@ -255,32 +255,32 @@ void JsonParser::parse_obj_in_array(ondemand::object line, int32_t parent_node_i
255255 }
256256}
257257
258- void JsonParser::parse_array (ondemand::array array, int32_t parent_node_id) {
259- ondemand::array_iterator it = array.begin ();
258+ void JsonParser::parse_array (simdjson:: ondemand::array array, int32_t parent_node_id) {
259+ simdjson:: ondemand::array_iterator it = array.begin ();
260260 if (it == array.end ()) {
261261 m_current_schema.insert_unordered (parent_node_id);
262262 return ;
263263 }
264264
265265 size_t array_start = m_current_schema.start_unordered_object (NodeType::StructuredArray);
266- ondemand::value cur_value;
266+ simdjson:: ondemand::value cur_value;
267267 int32_t node_id;
268268 for (; it != array.end (); ++it) {
269269 cur_value = *it;
270270
271271 switch (cur_value.type ()) {
272- case ondemand::json_type::object: {
272+ case simdjson:: ondemand::json_type::object: {
273273 node_id = m_archive_writer->add_node (parent_node_id, NodeType::Object, " " );
274274 parse_obj_in_array (std::move (cur_value.get_object ()), node_id);
275275 break ;
276276 }
277- case ondemand::json_type::array: {
277+ case simdjson:: ondemand::json_type::array: {
278278 node_id = m_archive_writer->add_node (parent_node_id, NodeType::StructuredArray, " " );
279279 parse_array (std::move (cur_value.get_array ()), node_id);
280280 break ;
281281 }
282- case ondemand::json_type::number: {
283- ondemand::number number_value = cur_value.get_number ();
282+ case simdjson:: ondemand::json_type::number: {
283+ simdjson:: ondemand::number number_value = cur_value.get_number ();
284284 if (true == number_value.is_double ()) {
285285 double double_value = number_value.get_double ();
286286 m_current_parsed_message.add_unordered_value (double_value);
@@ -298,7 +298,7 @@ void JsonParser::parse_array(ondemand::array array, int32_t parent_node_id) {
298298 m_current_schema.insert_unordered (node_id);
299299 break ;
300300 }
301- case ondemand::json_type::string: {
301+ case simdjson:: ondemand::json_type::string: {
302302 std::string_view value = cur_value.get_string (true );
303303 if (value.find (' ' ) != std::string::npos) {
304304 node_id = m_archive_writer->add_node (parent_node_id, NodeType::ClpString, " " );
@@ -309,14 +309,14 @@ void JsonParser::parse_array(ondemand::array array, int32_t parent_node_id) {
309309 m_current_schema.insert_unordered (node_id);
310310 break ;
311311 }
312- case ondemand::json_type::boolean: {
312+ case simdjson:: ondemand::json_type::boolean: {
313313 bool value = cur_value.get_bool ();
314314 m_current_parsed_message.add_unordered_value (value);
315315 node_id = m_archive_writer->add_node (parent_node_id, NodeType::Boolean, " " );
316316 m_current_schema.insert_unordered (node_id);
317317 break ;
318318 }
319- case ondemand::json_type::null: {
319+ case simdjson:: ondemand::json_type::null: {
320320 node_id = m_archive_writer->add_node (parent_node_id, NodeType::NullValue, " " );
321321 m_current_schema.insert_unordered (node_id);
322322 break ;
@@ -326,13 +326,17 @@ void JsonParser::parse_array(ondemand::array array, int32_t parent_node_id) {
326326 m_current_schema.end_unordered_object (array_start);
327327}
328328
329- void JsonParser::parse_line (ondemand::value line, int32_t parent_node_id, std::string const & key) {
329+ void JsonParser::parse_line (
330+ simdjson::ondemand::value line,
331+ int32_t parent_node_id,
332+ std::string const & key
333+ ) {
330334 int32_t node_id;
331- std::stack<ondemand::object> object_stack;
335+ std::stack<simdjson:: ondemand::object> object_stack;
332336 std::stack<int32_t > node_id_stack;
333- std::stack<ondemand::object_iterator> object_it_stack;
337+ std::stack<simdjson:: ondemand::object_iterator> object_it_stack;
334338
335- ondemand::field cur_field;
339+ simdjson:: ondemand::field cur_field;
336340
337341 std::string_view cur_key = key;
338342 node_id_stack.push (parent_node_id);
@@ -345,12 +349,12 @@ void JsonParser::parse_line(ondemand::value line, int32_t parent_node_id, std::s
345349 }
346350
347351 switch (line.type ()) {
348- case ondemand::json_type::object: {
352+ case simdjson:: ondemand::json_type::object: {
349353 node_id = m_archive_writer
350354 ->add_node (node_id_stack.top (), NodeType::Object, cur_key);
351355 object_stack.push (std::move (line.get_object ()));
352356 auto objref = object_stack.top ();
353- auto it = ondemand::object_iterator (objref.begin ());
357+ auto it = simdjson:: ondemand::object_iterator (objref.begin ());
354358 if (it == objref.end ()) {
355359 m_current_schema.insert_ordered (node_id);
356360 object_stack.pop ();
@@ -361,7 +365,7 @@ void JsonParser::parse_line(ondemand::value line, int32_t parent_node_id, std::s
361365 continue ;
362366 }
363367 }
364- case ondemand::json_type::array: {
368+ case simdjson:: ondemand::json_type::array: {
365369 if (m_structurize_arrays) {
366370 node_id = m_archive_writer->add_node (
367371 node_id_stack.top (),
@@ -382,9 +386,9 @@ void JsonParser::parse_line(ondemand::value line, int32_t parent_node_id, std::s
382386 }
383387 break ;
384388 }
385- case ondemand::json_type::number: {
389+ case simdjson:: ondemand::json_type::number: {
386390 NodeType type;
387- ondemand::number number_value = line.get_number ();
391+ simdjson:: ondemand::number number_value = line.get_number ();
388392 auto const matches_timestamp
389393 = m_archive_writer->matches_timestamp (node_id_stack.top (), cur_key);
390394 if (false == number_value.is_double ()) {
@@ -420,7 +424,7 @@ void JsonParser::parse_line(ondemand::value line, int32_t parent_node_id, std::s
420424 m_current_schema.insert_ordered (node_id);
421425 break ;
422426 }
423- case ondemand::json_type::string: {
427+ case simdjson:: ondemand::json_type::string: {
424428 std::string_view value = line.get_string (true );
425429 auto const matches_timestamp
426430 = m_archive_writer->matches_timestamp (node_id_stack.top (), cur_key);
@@ -451,15 +455,15 @@ void JsonParser::parse_line(ondemand::value line, int32_t parent_node_id, std::s
451455 m_current_schema.insert_ordered (node_id);
452456 break ;
453457 }
454- case ondemand::json_type::boolean: {
458+ case simdjson:: ondemand::json_type::boolean: {
455459 bool value = line.get_bool ();
456460 node_id = m_archive_writer
457461 ->add_node (node_id_stack.top (), NodeType::Boolean, cur_key);
458462 m_current_parsed_message.add_value (node_id, value);
459463 m_current_schema.insert_ordered (node_id);
460464 break ;
461465 }
462- case ondemand::json_type::null: {
466+ case simdjson:: ondemand::json_type::null: {
463467 node_id = m_archive_writer
464468 ->add_node (node_id_stack.top (), NodeType::NullValue, cur_key);
465469 m_current_schema.insert_ordered (node_id);
0 commit comments