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"
12namespace SIMDJSON_IMPLEMENTATION {
23simdjson_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(); }
32simdjson_inline
bool object_iterator::operator==(
const object_iterator &other)
const noexcept {
33 return !(*
this != other);
35simdjson_inline
bool object_iterator::operator!=(
const object_iterator &)
const noexcept {
36 return iter.is_open();
39SIMDJSON_PUSH_DISABLE_WARNINGS
40SIMDJSON_DISABLE_STRICT_OVERFLOW_WARNING
41simdjson_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; };
53SIMDJSON_POP_DISABLE_WARNINGS
102simdjson_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();
109simdjson_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)
114simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::field> simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator*() noexcept {
115 if (error()) {
return error(); }
119simdjson_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;
124simdjson_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;
129simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator> &simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::object_iterator>::operator++() noexcept {
131 if (error()) { second =
SUCCESS;
return *
this; }
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.