Add method to get the total number of slots used by an array in the t… (#1253)
* Add method to get the total number of slots used by an array in the tape. * Whoops
This commit is contained in:
parent
af4db55e66
commit
921c79f26f
|
@ -61,6 +61,9 @@ inline array::iterator array::end() const noexcept {
|
|||
inline size_t array::size() const noexcept {
|
||||
return tape.scope_count();
|
||||
}
|
||||
inline size_t array::slots() const noexcept {
|
||||
return tape.matching_brace_index() - tape.json_index;
|
||||
}
|
||||
inline simdjson_result<element> array::at_pointer(std::string_view json_pointer) const noexcept {
|
||||
if(json_pointer.empty()) { // an empty string means that we return the current node
|
||||
return element(this->tape); // copy the current node
|
||||
|
|
|
@ -85,6 +85,17 @@ public:
|
|||
* is 0xFFFFFF then the size is 0xFFFFFF or greater.
|
||||
*/
|
||||
inline size_t size() const noexcept;
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
inline size_t slots() const noexcept;
|
||||
/**
|
||||
* 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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue