1 #ifndef SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H
3 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
4 #define SIMDJSON_GENERIC_ONDEMAND_TOKEN_ITERATOR_H
5 #include "simdjson/generic/ondemand/base.h"
6 #include "simdjson/generic/implementation_simdjson_result_base.h"
7 #include "simdjson/generic/ondemand/logger.h"
11 namespace SIMDJSON_IMPLEMENTATION {
20 class token_iterator {
27 simdjson_inline token_iterator() noexcept = default;
28 simdjson_inline token_iterator(token_iterator &&other) noexcept = default;
29 simdjson_inline token_iterator &operator=(token_iterator &&other) noexcept = default;
30 simdjson_inline token_iterator(const token_iterator &other) noexcept = default;
31 simdjson_inline token_iterator &operator=(const token_iterator &other) noexcept = default;
36 simdjson_inline const uint8_t *return_current_and_advance() noexcept;
40 simdjson_inline uint32_t current_offset() const noexcept;
52 simdjson_inline const uint8_t *peek(int32_t delta=0) const noexcept;
61 simdjson_inline uint32_t peek_length(int32_t delta=0) const noexcept;
71 simdjson_inline const uint8_t *peek(token_position position) const noexcept;
79 simdjson_inline uint32_t peek_length(token_position position) const noexcept;
87 simdjson_inline uint32_t peek_root_length(token_position position) const noexcept;
91 simdjson_inline token_position position() const noexcept;
95 simdjson_inline
void set_position(token_position target_position) noexcept;
100 simdjson_inline
bool operator==(const token_iterator &other) const noexcept;
101 simdjson_inline
bool operator!=(const token_iterator &other) const noexcept;
102 simdjson_inline
bool operator>(const token_iterator &other) const noexcept;
103 simdjson_inline
bool operator>=(const token_iterator &other) const noexcept;
104 simdjson_inline
bool operator<(const token_iterator &other) const noexcept;
105 simdjson_inline
bool operator<=(const token_iterator &other) const noexcept;
108 simdjson_inline token_iterator(const uint8_t *buf, token_position position) noexcept;
118 simdjson_inline uint32_t peek_index(int32_t delta=0) const noexcept;
127 simdjson_inline uint32_t peek_index(token_position position) const noexcept;
129 const uint8_t *buf{};
130 token_position _position{};
132 friend class json_iterator;
133 friend class value_iterator;
135 template <
typename... Args>
136 friend simdjson_inline
void logger::log_line(
const json_iterator &iter,
const char *title_prefix,
const char *title, std::string_view detail,
int delta,
int depth_delta, logger::log_level level, Args&&... args) noexcept;
137 template <
typename... Args>
138 friend simdjson_inline
void logger::log_line(
const json_iterator &iter, token_position index,
depth_t depth,
const char *title_prefix,
const char *title, std::string_view detail, logger::log_level level, Args&&... args) noexcept;
150 simdjson_inline
simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::token_iterator &&
value) noexcept;
@ object
A JSON object ( { "a": 1, "b" 2, ... } )
int32_t depth_t
Represents the depth of a JSON value (number of nested arrays/objects).
The top level simdjson namespace, containing everything the library provides.
error_code
All possible errors returned by simdjson.
The result of a simdjson operation that could fail.
The result of a simdjson operation that could fail.
simdjson_inline error_code error() const noexcept
The error.
simdjson_inline T & value() &noexcept(false)
Get the result value.