![]() |
simdjson
3.1.8
Ridiculously Fast JSON
|
JSON array. More...
Classes | |
| class | iterator |
Public Member Functions | |
| simdjson_inline | array () noexcept |
| Create a new, invalid array. | |
| iterator | begin () const noexcept |
| Return the first array element. More... | |
| iterator | end () const noexcept |
| One past the last array element. More... | |
| size_t | size () const noexcept |
| Get the size of the array (number of immediate children). More... | |
| size_t | number_of_slots () const noexcept |
| Get the total number of slots used by this array on the tape. More... | |
| simdjson_result< element > | at_pointer (std::string_view json_pointer) const noexcept |
| Get the value associated with the given JSON pointer. More... | |
| simdjson_result< element > | at (size_t index) const noexcept |
| Get the value at the given index. More... | |
|
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 112 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 71 of file array-inl.h.
|
inlinenoexcept |
Return the first array element.
Part of the std::iterable interface.
Definition at line 55 of file array-inl.h.
|
inlinenoexcept |
One past the last array element.
Part of the std::iterable interface.
Definition at line 59 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 67 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 63 of file array-inl.h.