simdjson  3.11.0
Ridiculously Fast JSON
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
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 
11 namespace simdjson {
12 namespace SIMDJSON_IMPLEMENTATION {
13 namespace ondemand {
14 
24 public:
26  simdjson_inline array_iterator() noexcept = default;
27 
28  //
29  // Iterator interface
30  //
31 
37  simdjson_inline simdjson_result<value> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
45  simdjson_inline bool operator==(const array_iterator &) const noexcept;
53  simdjson_inline bool operator!=(const array_iterator &) const noexcept;
59  simdjson_inline array_iterator &operator++() noexcept;
60 
61 private:
62  value_iterator iter{};
63 
64  simdjson_inline array_iterator(const value_iterator &iter) noexcept;
65 
66  friend class array;
67  friend class value;
68  friend struct simdjson_result<array_iterator>;
69 };
70 
71 } // namespace ondemand
72 } // namespace SIMDJSON_IMPLEMENTATION
73 } // namespace simdjson
74 
75 namespace simdjson {
76 
77 template<>
78 struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> {
79 public:
81  simdjson_inline simdjson_result(error_code error) noexcept;
82  simdjson_inline simdjson_result() noexcept = default;
83 
84  //
85  // Iterator interface
86  //
87 
88  simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
89  simdjson_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &) const noexcept;
90  simdjson_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &) const noexcept;
91  simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &operator++() noexcept;
92 };
93 
94 } // namespace simdjson
95 
96 #endif // SIMDJSON_GENERIC_ONDEMAND_ARRAY_ITERATOR_H
simdjson_inline array_iterator() noexcept=default
Create a new, invalid array iterator.
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:215
simdjson_inline error_code error() const noexcept
The error.
Definition: error-inl.h:131
simdjson_inline T & value() &noexcept(false)
Get the result value.