simdjson  0.3.1
Ridiculously Fast JSON
Classes | Public Member Functions | List of all members
simdjson::dom::array Class Reference

JSON array. More...

Inheritance diagram for simdjson::dom::array:

Classes

class  iterator
 

Public Member Functions

really_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...
 
simdjson_result< element > at (const 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...
 

Detailed Description

JSON array.

Definition at line 106 of file document.h.

Member Function Documentation

◆ at() [1/2]

simdjson_result< element > simdjson::dom::array::at ( const std::string_view &  json_pointer) const
inlinenoexcept

Get the value associated with the given JSON pointer.

dom::parser parser; array a = parser.parse(R"([ { "foo": { "a": [ 10, 20, 30 ] }} ])"); a.at("0/foo/a/1") == 20 a.at("0")["foo"]["a"].at(1) == 20

Returns
The value associated with the given JSON pointer, or:
  • NO_SUCH_FIELD if a field does not exist in an object
  • INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
  • INCORRECT_TYPE if a non-integer is used to access an array
  • INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed

Definition at line 546 of file document.h.

◆ at() [2/2]

simdjson_result< element > simdjson::dom::array::at ( size_t  index) const
inlinenoexcept

Get the value at the given index.

Returns
The value at the given index, or:
  • INDEX_OUT_OF_BOUNDS if the array index is larger than an array length

Definition at line 575 of file document.h.

◆ begin()

array::iterator simdjson::dom::array::begin ( ) const
inlinenoexcept

Return the first array element.

Part of the std::iterable interface.

Definition at line 539 of file document.h.

◆ end()

array::iterator simdjson::dom::array::end ( ) const
inlinenoexcept

One past the last array element.

Part of the std::iterable interface.

Definition at line 542 of file document.h.


The documentation for this class was generated from the following file: