1 #ifndef SIMDJSON_DOM_OBJECT_H
2 #define SIMDJSON_DOM_OBJECT_H
4 #include "simdjson/dom/base.h"
5 #include "simdjson/dom/element.h"
6 #include "simdjson/internal/tape_ref.h"
17 simdjson_inline
object() noexcept;
22 using difference_type = std::ptrdiff_t;
25 using iterator_category = std::forward_iterator_tag;
51 inline bool operator==(
const iterator& other)
const noexcept;
53 inline bool operator<(
const iterator& other)
const noexcept;
54 inline bool operator<=(
const iterator& other)
const noexcept;
55 inline bool operator>=(
const iterator& other)
const noexcept;
56 inline bool operator>(
const iterator& other)
const noexcept;
60 inline std::string_view
key()
const noexcept;
70 inline bool key_equals(std::string_view o)
const noexcept;
80 inline const char *
key_c_str()
const noexcept;
90 simdjson_inline
iterator(
const internal::tape_ref &tape) noexcept;
92 internal::tape_ref tape;
114 inline
size_t size() const noexcept;
222 inline operator
element() const noexcept;
225 simdjson_inline
object(const internal::tape_ref &tape) noexcept;
227 internal::tape_ref tape;
232 friend class
simdjson::internal::string_builder;
254 struct simdjson_result<dom::object> :
public internal::simdjson_result_base<dom::object> {
268 #if SIMDJSON_EXCEPTIONS
271 inline size_t size()
const noexcept(
false);
277 #if defined(__cpp_lib_ranges)
283 inline constexpr
bool enable_view<simdjson::dom::object> =
true;
284 #if SIMDJSON_EXCEPTIONS
286 inline constexpr
bool enable_view<simdjson::simdjson_result<simdjson::dom::object>> =
true;
Key/value pair in an object.
std::string_view key
key in the key-value pair
element value
value in the key-value pair
bool operator!=(const iterator &other) const noexcept
Check if these values come from the same place in the JSON.
element value() const noexcept
Get the value of this key/value pair.
bool key_equals(std::string_view o) const noexcept
Returns true if the key in this key/value pair is equal to the provided string_view.
const char * key_c_str() const noexcept
Get the key of this key/value pair.
uint32_t key_length() const noexcept
Get the length (in bytes) of the key in this key/value pair.
reference operator*() const noexcept
Get the actual key/value pair.
bool key_equals_case_insensitive(std::string_view o) const noexcept
Returns true if the key in this key/value pair is equal to the provided string_view in a case-insensi...
std::string_view key() const noexcept
Get the key of this key/value pair.
iterator & operator++() noexcept
Get the next key/value pair.
simdjson_result< element > at_key(std::string_view key) const noexcept
Get the value associated with the given key.
iterator end() const noexcept
One past the last key/value pair.
size_t size() const noexcept
Get the size of the object (number of keys).
simdjson_result< element > at_path(std::string_view json_path) const noexcept
Get the value associated with the given JSONPath expression.
simdjson_result< element > at_key_case_insensitive(std::string_view key) const noexcept
Get the value associated with the given key in a case-insensitive manner.
simdjson_result< element > at_pointer(std::string_view json_pointer) const noexcept
Get the value associated with the given JSON pointer.
simdjson_inline object() noexcept
Create a new, invalid object.
iterator begin() const noexcept
Return the first key/value pair.
The top level simdjson namespace, containing everything the library provides.
error_code
All possible errors returned by simdjson.
The result of a JSON navigation that may fail.
The result of a simdjson operation that could fail.