![]() |
simdjson 4.2.2
Ridiculously Fast JSON
|
JSON array. More...
#include <array.h>
Classes | |
| class | iterator |
Public Member Functions | |
| simdjson_inline | array () noexcept |
| Create a new, invalid array. | |
| 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 76 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 228 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 135 of file array-inl.h.
|
inlinenoexcept |
Adds support for JSONPath expression with wildcards '*'.
Definition at line 162 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 94 of file array-inl.h.
|
inlinenoexcept |
Return the first array element.
Part of the std::iterable interface.
Definition at line 78 of file array-inl.h.
|
inlinenoexcept |
One past the last array element.
Part of the std::iterable interface.
Definition at line 82 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 238 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 90 of file array-inl.h.
|
inlinenoexcept |
Implicitly convert object to element.
Definition at line 247 of file array-inl.h.
|
inlinenoexcept |
Recursive function which processes the JSON path of each child element.
Definition at line 141 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 86 of file array-inl.h.