1#ifndef SIMDJSON_DOM_OBJECT_H
2#define SIMDJSON_DOM_OBJECT_H
6#include "simdjson/dom/base.h"
7#include "simdjson/dom/element.h"
8#include "simdjson/internal/tape_ref.h"
19 simdjson_inline
object()
noexcept;
24 using difference_type = std::ptrdiff_t;
27 using iterator_category = std::forward_iterator_tag;
62 inline std::string_view
key()
const noexcept;
72 inline bool key_equals(std::string_view
o)
const noexcept;
82 inline const char *
key_c_str()
const noexcept;
92 simdjson_inline
iterator(
const internal::tape_ref &tape)
noexcept;
94 internal::tape_ref tape{};
245 simdjson_inline
object(
const internal::tape_ref &tape)
noexcept;
247 internal::tape_ref tape{};
252 friend class simdjson::internal::string_builder;
274struct simdjson_result<dom::object> :
public internal::simdjson_result_base<dom::object> {
284 inline void process_json_path_of_child_elements(std::vector<dom::element>::iterator& current, std::vector<dom::element>::iterator& end,
const std::string_view& path_suffix, std::vector<dom::element>& accumulator)
const noexcept;
288 inline std::vector<dom::element>& get_values(std::vector<dom::element>& out)
const noexcept;
291#if SIMDJSON_EXCEPTIONS
294 inline size_t size()
const noexcept(
false);
300#if SIMDJSON_SUPPORTS_RANGES
304inline constexpr bool enable_view<simdjson::dom::object> =
true;
305#if SIMDJSON_EXCEPTIONS
307inline 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.
std::vector< element > & get_values(std::vector< element > &out) const noexcept
Gets the values associated with keys of an object This function has linear-time complexity: the keys ...
void process_json_path_of_child_elements(std::vector< element >::iterator ¤t, std::vector< element >::iterator &end, const std::string_view &path_suffix, std::vector< element > &accumulator) const noexcept
Recursive function which processes the JSON path of each child element.
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.
simdjson_result< std::vector< element > > at_path_with_wildcard(std::string_view json_path) const noexcept
Adds support for JSONPath expression with wildcards '*'.
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 simdjson operation that could fail.
simdjson_inline error_code error() const noexcept
The error.