![]() |
simdjson 5.0.2
Ridiculously Fast JSON
|
JSON array. More...
#include <array.h>
Classes | |
| class | iterator |
| class | reverse_iterator |
| A forward iterator that visits the array's elements in reverse order. More... | |
Public Member Functions | |
| simdjson_inline | array () noexcept |
| Create a new, invalid array. | |
| reverse_iterator | rbegin () const noexcept |
| Return the last array element, or rend() for an empty array. | |
| reverse_iterator | rend () const noexcept |
| Return the reverse traversal sentinel, before the first element. | |
| iterator | begin () const noexcept |
| Return the first array element. | |
| iterator | end () const noexcept |
| One past the last array element. | |
| size_t | size () const noexcept |
| Get the size of the array (number of immediate children). | |
| size_t | number_of_slots () const noexcept |
| Get the total number of slots used by this array on the tape. | |
| simdjson_result< element > | at_pointer (std::string_view json_pointer) const noexcept |
| Get the value associated with the given JSON pointer. | |
| 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< std::vector< element > > | at_path_with_wildcard (std::string_view json_path) const noexcept |
| Adds support for JSONPath expression with wildcards '*'. | |
| 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 (size_t index) const noexcept |
| Get the value at the given index. | |
| std::vector< element > & | get_values (std::vector< element > &out) const noexcept |
| Gets the values of items in an array element This function has linear-time complexity: the values are checked one by one. | |
| operator element () const noexcept | |
| Implicitly convert object to element. | |
|
noexcept |
Create a new, invalid array.
Definition at line 85 of file array-inl.h.
|
inlinenoexcept |
Get the value at the given index.
This function has linear-time complexity and is equivalent to the following:
size_t i=0; for (auto element : *this) { if (i == index) { return element; } i++; } return INDEX_OUT_OF_BOUNDS;
Avoid calling the at() function repeatedly.
Definition at line 233 of file array-inl.h.
|
inlinenoexcept |
Get the value associated with the given JSONPath expression.
We only support JSONPath queries that trivially convertible to JSON Pointer queries: key names and array indices.
https://www.rfc-editor.org/rfc/rfc9535 (RFC 9535)
Definition at line 141 of file array-inl.h.
|
inlinenoexcept |
Adds support for JSONPath expression with wildcards '*'.
Definition at line 167 of file array-inl.h.
|
inlinenoexcept |
Get the value associated with the given JSON pointer.
We use the RFC 6901 https://tools.ietf.org/html/rfc6901 standard, interpreting the current node as the root of its own JSON document.
dom::parser parser; array a = parser.parse(R"([ { "foo": { "a": [ 10, 20, 30 ] }} ])"_padded); a.at_pointer("/0/foo/a/1") == 20 a.at_pointer("0")["foo"]["a"].at(1) == 20
Definition at line 112 of file array-inl.h.
|
inlinenoexcept |
Return the first array element.
Part of the std::iterable interface.
Definition at line 87 of file array-inl.h.
|
inlinenoexcept |
One past the last array element.
Part of the std::iterable interface.
Definition at line 91 of file array-inl.h.
|
inlinenoexcept |
Gets the values of items in an array element This function has linear-time complexity: the values are checked one by one.
Definition at line 243 of file array-inl.h.
|
inlinenoexcept |
Get the total number of slots used by this array on the tape.
Note that this is not the same thing as size(), which reports the number of actual elements within an array (not counting its children).
Since an element can use 1 or 2 slots on the tape, you can only use this to figure out the total size of an array (including its children, recursively) if you know its structure ahead of time.
Definition at line 108 of file array-inl.h.
|
inlinenoexcept |
Implicitly convert object to element.
Definition at line 252 of file array-inl.h.
|
inlinenoexcept |
Recursive function which processes the JSON path of each child element.
Definition at line 147 of file array-inl.h.
|
inlinenoexcept |
Return the last array element, or rend() for an empty array.
Incrementing the returned iterator moves toward the first element. A complete traversal takes O(n) time and O(1) additional space, where n is the number of immediate elements in the array. Finding the last or previous element can take O(n) time in the worst case when numeric payloads equal numeric type markers. Increments are amortized O(1) over a complete traversal; nested values do not increase this bound.
Definition at line 99 of file array-inl.h.
|
inlinenoexcept |
Return the reverse traversal sentinel, before the first element.
Definition at line 104 of file array-inl.h.
|
inlinenoexcept |
Get the size of the array (number of immediate children).
It is a saturated value with a maximum of 0xFFFFFF: if the value is 0xFFFFFF then the size is 0xFFFFFF or greater.
Definition at line 95 of file array-inl.h.