simdjson 4.1.0
Ridiculously Fast JSON
Loading...
Searching...
No Matches
array_iterator.h
1#ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H
2
3#ifndef SIMDJSON_CONDITIONAL_INCLUDE
4#define SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H
5#include "simdjson/generic/implementation_simdjson_result_base.h"
6#include "simdjson/generic/ondemand/base.h"
7#include "simdjson/generic/ondemand/value_iterator.h"
8#endif // SIMDJSON_CONDITIONAL_INCLUDE
9
10
11namespace simdjson {
12namespace SIMDJSON_IMPLEMENTATION {
13namespace ondemand {
14
24public:
26 simdjson_inline array_iterator() noexcept = default;
27
28 //
29 // Iterator interface
30 //
31
37 simdjson_inline simdjson_result<value>
38 operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
46 simdjson_inline bool operator==(const array_iterator &) const noexcept;
54 simdjson_inline bool operator!=(const array_iterator &) const noexcept;
60 simdjson_inline array_iterator &operator++() noexcept;
61
65 simdjson_warn_unused simdjson_inline bool at_end() const noexcept;
66
67private:
68 value_iterator iter{};
69
70 simdjson_inline array_iterator(const value_iterator &iter) noexcept;
71
72 friend class array;
73 friend class value;
74 friend struct simdjson_result<array_iterator>;
75};
76
77} // namespace ondemand
78} // namespace SIMDJSON_IMPLEMENTATION
79} // namespace simdjson
80
81namespace simdjson {
82
83template<>
84struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> {
85 simdjson_inline simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::array_iterator &&value) noexcept;
86 simdjson_inline simdjson_result(error_code error) noexcept;
87 simdjson_inline simdjson_result() noexcept = default;
88
89 //
90 // Iterator interface
91 //
92
93 simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
94 simdjson_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &) const noexcept;
95 simdjson_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &) const noexcept;
96 simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &operator++() noexcept;
97
98 simdjson_warn_unused simdjson_inline bool at_end() const noexcept;
99};
100
101} // namespace simdjson
102
103#endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H
simdjson_inline array_iterator() noexcept=default
Create a new, invalid array iterator.
simdjson_warn_unused simdjson_inline bool at_end() const noexcept
Check if the array is at the end.
An ephemeral JSON value returned during iteration.
Definition value.h:21
The top level simdjson namespace, containing everything the library provides.
Definition base.h:8
error_code
All possible errors returned by simdjson.
Definition error.h:19
The result of a simdjson operation that could fail.
Definition error.h:278
simdjson_inline error_code error() const noexcept
The error.
Definition error-inl.h:168