3 #ifndef SIMDJSON_DOM_PARSEDJSON_ITERATOR_H
4 #define SIMDJSON_DOM_PARSEDJSON_ITERATOR_H
6 #include "simdjson/dom/base.h"
7 #include "simdjson/dom/parser.h"
9 #ifndef SIMDJSON_DISABLE_DEPRECATED_API
13 class [[deprecated("Use the new DOM navigation API instead (see doc/basics.md)")]] dom::parser::Iterator {
15 inline Iterator(
const dom::parser &parser) noexcept(
false);
16 inline Iterator(
const Iterator &o) noexcept;
17 inline ~Iterator() noexcept;
19 inline Iterator& operator=(const Iterator&) = delete;
21 inline
bool is_ok() const;
24 inline
size_t get_tape_location() const;
27 inline
size_t get_tape_length() const;
31 inline
size_t get_depth() const;
35 inline uint8_t get_scope_type() const;
38 inline
bool move_forward();
42 inline uint8_t get_type()
const {
47 inline int64_t get_integer()
const;
50 inline uint64_t get_unsigned_integer()
const;
56 inline const char *get_string()
const;
59 inline uint32_t get_string_length()
const;
63 inline double get_double()
const;
65 inline bool is_object_or_array()
const {
return is_object() || is_array(); }
67 inline bool is_object()
const {
return get_type() ==
'{'; }
69 inline bool is_array()
const {
return get_type() ==
'['; }
71 inline bool is_string()
const {
return get_type() ==
'"'; }
75 inline bool is_integer()
const {
return get_type() ==
'l'; }
85 inline bool is_unsigned_integer()
const {
return get_type() ==
'u'; }
87 inline bool is_double()
const {
return get_type() ==
'd'; }
89 inline bool is_number()
const {
90 return is_integer() || is_unsigned_integer() || is_double();
93 inline bool is_true()
const {
return get_type() ==
't'; }
95 inline bool is_false()
const {
return get_type() ==
'f'; }
97 inline bool is_null()
const {
return get_type() ==
'n'; }
99 static bool is_object_or_array(uint8_t type) {
100 return ((type ==
'[') || (type ==
'{'));
112 inline bool move_to_key(
const char *key);
115 inline bool move_to_key_insensitive(
const char *key);
124 inline bool move_to_key(
const char *key, uint32_t length);
129 inline void move_to_value();
134 inline bool move_to_index(uint32_t index);
146 inline bool move_to(
const char *pointer, uint32_t length);
157 inline bool move_to(
const std::string &pointer);
167 inline bool relative_move_to(
const char *pointer, uint32_t length);
203 inline void to_start_scope();
205 inline void rewind();
210 inline bool print(std::ostream &os,
bool escape_strings =
true)
const;
217 size_t tape_length{};
218 uint8_t current_type{};
219 uint64_t current_val{};
221 size_t start_of_scope;
225 scopeindex_t *depth_index{};
The top level simdjson namespace, containing everything the library provides.