1 #ifndef SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H
3 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
4 #define SIMDJSON_GENERIC_ONDEMAND_OBJECT_ITERATOR_INL_H
5 #include "simdjson/generic/ondemand/base.h"
6 #include "simdjson/generic/ondemand/object_iterator.h"
7 #include "simdjson/generic/ondemand/field-inl.h"
8 #include "simdjson/generic/ondemand/value_iterator-inl.h"
12 namespace SIMDJSON_IMPLEMENTATION {
23 simdjson_inline simdjson_result<field> object_iterator::operator*() noexcept {
25 if (error) { iter.abandon();
return error; }
26 auto result = field::start(iter);
29 if (result.error()) { iter.abandon(); }
32 simdjson_inline
bool object_iterator::operator==(
const object_iterator &other)
const noexcept {
33 return !(*
this != other);
35 simdjson_inline
bool object_iterator::operator!=(
const object_iterator &)
const noexcept {
36 return iter.is_open();
39 SIMDJSON_PUSH_DISABLE_WARNINGS
40 SIMDJSON_DISABLE_STRICT_OVERFLOW_WARNING
41 simdjson_inline object_iterator &object_iterator::operator++() noexcept {
44 if (!iter.is_open()) {
return *
this; }
47 if ((error = iter.skip_child() )) {
return *
this; }
49 simdjson_unused
bool has_value;
50 if ((error = iter.has_next_field().get(has_value) )) {
return *
this; };
53 SIMDJSON_POP_DISABLE_WARNINGS
102 simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::simdjson_result(
103 SIMDJSON_IMPLEMENTATION::ondemand::object_iterator &&value
105 : implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>(std::forward<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>(value))
107 first.iter.assert_is_valid();
109 simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::simdjson_result(
error_code error) noexcept
110 : implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>({}, error)
114 simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::field> simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator*() noexcept {
119 simdjson_inline
bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator==(
const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &other)
const noexcept {
120 if (!first.iter.is_valid()) {
return !error(); }
121 return first == other.first;
124 simdjson_inline
bool simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator!=(
const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &other)
const noexcept {
125 if (!first.iter.is_valid()) {
return error(); }
126 return first != other.first;
129 simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator++() noexcept {
simdjson_inline object_iterator() noexcept=default
Create a new invalid object_iterator.
The top level simdjson namespace, containing everything the library provides.
error_code
All possible errors returned by simdjson.
simdjson_inline error_code error() const noexcept
The error.