![]() |
simdjson
0.3.1
Ridiculously Fast JSON
|
A JSON element. More...
Public Member Functions | |
| really_inline | element () noexcept |
| Create a new, invalid element. | |
| really_inline element_type | type () const noexcept |
| The type of this element. | |
| really_inline bool | is_null () const noexcept |
Whether this element is a json null. | |
| template<typename T > | |
| really_inline bool | is () const noexcept |
| Tell whether the value can be cast to the given primitive type. More... | |
| template<typename T > | |
| really_inline simdjson_result< T > | get () const noexcept |
| Get the value as the given primitive type. More... | |
| operator bool () const noexcept(false) | |
| Read this element as a boolean. More... | |
| operator const char * () const noexcept(false) | |
| Read this element as a null-terminated string. More... | |
| operator std::string_view () const noexcept(false) | |
| Read this element as a null-terminated string. More... | |
| operator uint64_t () const noexcept(false) | |
| Read this element as an unsigned integer. More... | |
| operator int64_t () const noexcept(false) | |
| Read this element as an signed integer. More... | |
| operator double () const noexcept(false) | |
| Read this element as an double. More... | |
| operator array () const noexcept(false) | |
| Read this element as a JSON array. More... | |
| operator object () const noexcept(false) | |
| Read this element as a JSON object (key/value pairs). More... | |
| dom::array::iterator | begin () const noexcept(false) |
| Iterate over each element in this array. More... | |
| dom::array::iterator | end () const noexcept(false) |
| Iterate over each element in this array. More... | |
| simdjson_result< element > | operator[] (const std::string_view &key) const noexcept |
| Get the value associated with the given key. More... | |
| simdjson_result< element > | operator[] (const char *key) const noexcept |
| Get the value associated with the given key. 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... | |
| simdjson_result< element > | at_key (const std::string_view &key) const noexcept |
| Get the value associated with the given key. More... | |
| simdjson_result< element > | at_key_case_insensitive (const std::string_view &key) const noexcept |
| Get the value associated with the given key in a case-insensitive manner. More... | |
| template<> | |
| simdjson_result< bool > | get () const noexcept |
| template<> | |
| simdjson_result< const char * > | get () const noexcept |
| template<> | |
| simdjson_result< uint64_t > | get () const noexcept |
| template<> | |
| simdjson_result< int64_t > | get () const noexcept |
| template<> | |
| simdjson_result< double > | get () const noexcept |
| template<> | |
| simdjson_result< array > | get () const noexcept |
| template<> | |
| simdjson_result< object > | get () const noexcept |
A JSON element.
References an element in a JSON document, representing a JSON null, boolean, string, number, array or object.
Definition at line 380 of file document.h.
|
inlinenoexcept |
Get the value associated with the given JSON pointer.
dom::parser parser; element doc = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})"); doc.at("/foo/a/1") == 20 doc.at("/")["foo"]["a"].at(1) == 20 doc.at("")["foo"]["a"].at(1) == 20
Definition at line 886 of file document.h.
|
inlinenoexcept |
Get the value at the given index.
Definition at line 896 of file document.h.
|
inlinenoexcept |
Get the value associated with the given key.
The key will be matched against unescaped JSON:
dom::parser parser; parser.parse(R"({ "a
": 1 })")["a\n"].get<uint64_t>().value == 1 parser.parse(R"({ "a
": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
Definition at line 899 of file document.h.
|
inlinenoexcept |
Get the value associated with the given key in a case-insensitive manner.
Note: The key will be matched against unescaped JSON.
Definition at line 902 of file document.h.
|
inlinenoexcept |
Iterate over each element in this array.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not an array |
Definition at line 871 of file document.h.
|
inlinenoexcept |
Iterate over each element in this array.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not an array |
Definition at line 874 of file document.h.
|
noexcept |
Get the value as the given primitive type.
Supported types:
|
noexcept |
Tell whether the value can be cast to the given primitive type.
Supported types:
Definition at line 855 of file document.h.
|
inlinenoexcept |
Read this element as a JSON array.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not an array |
Definition at line 868 of file document.h.
|
inlinenoexcept |
Read this element as a boolean.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not a boolean. |
Definition at line 862 of file document.h.
|
inlineexplicitnoexcept |
Read this element as a null-terminated string.
Does not convert other types to a string; requires that the JSON type of the element was an actual string.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not a string. |
Definition at line 863 of file document.h.
|
inlinenoexcept |
Read this element as an double.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not a number |
| simdjson_error(NUMBER_OUT_OF_RANGE) | if the integer doesn't fit in 64 bits or is negative |
Definition at line 867 of file document.h.
|
inlinenoexcept |
Read this element as an signed integer.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not an integer |
| simdjson_error(NUMBER_OUT_OF_RANGE) | if the integer doesn't fit in 64 bits |
Definition at line 866 of file document.h.
|
inlinenoexcept |
Read this element as a JSON object (key/value pairs).
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not an object |
Definition at line 869 of file document.h.
|
inlinenoexcept |
Read this element as a null-terminated string.
Does not convert other types to a string; requires that the JSON type of the element was an actual string.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not a string. |
Definition at line 864 of file document.h.
|
inlinenoexcept |
Read this element as an unsigned integer.
| simdjson_error(INCORRECT_TYPE) | if the JSON element is not an integer |
| simdjson_error(NUMBER_OUT_OF_RANGE) | if the integer doesn't fit in 64 bits or is negative |
Definition at line 865 of file document.h.
|
inlinenoexcept |
Get the value associated with the given key.
The key will be matched against unescaped JSON:
dom::parser parser; parser.parse(R"({ "a
": 1 })")["a\n"].get<uint64_t>().value == 1 parser.parse(R"({ "a
": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
Definition at line 883 of file document.h.
|
inlinenoexcept |
Get the value associated with the given key.
The key will be matched against unescaped JSON:
dom::parser parser; parser.parse(R"({ "a
": 1 })")["a\n"].get<uint64_t>().value == 1 parser.parse(R"({ "a
": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
Definition at line 880 of file document.h.
1.8.17