simdjson  3.1.1
Ridiculously Fast JSON
array_iterator.h
1 #include "simdjson/error.h"
2 
3 namespace simdjson {
4 namespace SIMDJSON_IMPLEMENTATION {
5 namespace ondemand {
6 
7 class array;
8 class value;
9 class document;
10 
20 public:
22  simdjson_inline array_iterator() noexcept = default;
23 
24  //
25  // Iterator interface
26  //
27 
33  simdjson_inline simdjson_result<value> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
41  simdjson_inline bool operator==(const array_iterator &) const noexcept;
49  simdjson_inline bool operator!=(const array_iterator &) const noexcept;
55  simdjson_inline array_iterator &operator++() noexcept;
56 
57 private:
58  value_iterator iter{};
59 
60  simdjson_inline array_iterator(const value_iterator &iter) noexcept;
61 
62  friend class array;
63  friend class value;
64  friend struct simdjson_result<array_iterator>;
65 };
66 
67 } // namespace ondemand
68 } // namespace SIMDJSON_IMPLEMENTATION
69 } // namespace simdjson
70 
71 namespace simdjson {
72 
73 template<>
74 struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> {
75 public:
77  simdjson_inline simdjson_result(error_code error) noexcept;
78  simdjson_inline simdjson_result() noexcept = default;
79 
80  //
81  // Iterator interface
82  //
83 
84  simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::value> operator*() noexcept; // MUST ONLY BE CALLED ONCE PER ITERATION.
85  simdjson_inline bool operator==(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &) const noexcept;
86  simdjson_inline bool operator!=(const simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &) const noexcept;
87  simdjson_inline simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::array_iterator> &operator++() noexcept;
88 };
89 
90 } // namespace simdjson
simdjson_inline array_iterator() noexcept=default
Create a new, invalid array iterator.
An ephemeral JSON value returned during iteration.
Definition: value.h:17
We want to support argument-dependent lookup (ADL).
error_code
All possible errors returned by simdjson.
Definition: error.h:17
The result of a simdjson operation that could fail.
Definition: error.h:205
simdjson_inline error_code error() const noexcept
The error.
Definition: error-inl.h:132
simdjson_inline T & value() &noexcept(false)
Get the result value.