simdjson 4.6.4
Ridiculously Fast JSON
Loading...
Searching...
No Matches
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value > Struct Reference
Inheritance diagram for simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >:
simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< SIMDJSON_IMPLEMENTATION::ondemand::value >

Public Member Functions

simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::arrayget_array () noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::objectget_object () noexcept
 
simdjson_inline simdjson_result< uint64_t > get_uint64 () noexcept
 
simdjson_inline simdjson_result< uint64_t > get_uint64_in_string () noexcept
 
simdjson_inline simdjson_result< int64_t > get_int64 () noexcept
 
simdjson_inline simdjson_result< int64_t > get_int64_in_string () noexcept
 
simdjson_inline simdjson_result< uint32_t > get_uint32 () noexcept
 
simdjson_inline simdjson_result< int32_t > get_int32 () noexcept
 
simdjson_inline simdjson_result< double > get_double () noexcept
 
simdjson_inline simdjson_result< double > get_double_in_string () noexcept
 
simdjson_inline simdjson_result< std::string_view > get_string (bool allow_replacement=false) noexcept
 
template<typename string_type >
simdjson_warn_unused simdjson_inline error_code get_string (string_type &receiver, bool allow_replacement=false) noexcept
 
simdjson_inline simdjson_result< std::string_view > get_wobbly_string () noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::raw_json_stringget_raw_json_string () noexcept
 
simdjson_inline simdjson_result< bool > get_bool () noexcept
 
simdjson_inline simdjson_result< bool > is_null () noexcept
 
template<typename T >
simdjson_inline simdjson_result< T > get () noexcept
 
template<typename T >
simdjson_inline error_code get (T &out) noexcept
 
template<class T >
simdjson_inline operator T () noexcept(false)
 
simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::array () noexcept(false)
 
simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::object () noexcept(false)
 
simdjson_inline operator uint64_t () noexcept(false)
 
simdjson_inline operator int64_t () noexcept(false)
 
simdjson_inline operator double () noexcept(false)
 
simdjson_inline operator std::string_view () noexcept(false)
 
simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string () noexcept(false)
 
simdjson_inline operator bool () noexcept(false)
 
simdjson_inline simdjson_result< size_t > count_elements () &noexcept
 
simdjson_inline simdjson_result< size_t > count_fields () &noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueat (size_t index) noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::array_iteratorbegin () &noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::array_iteratorend () &noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valuefind_field (std::string_view key) noexcept
 Look up a field by name on an object (order-sensitive).
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valuefind_field (const char *key) noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valuefind_field_unordered (std::string_view key) noexcept
 Look up a field by name on an object, without regard to key order.
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valuefind_field_unordered (const char *key) noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueoperator[] (std::string_view key) noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueoperator[] (const char *key) noexcept
 
simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueoperator[] (int) noexcept=delete
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::json_typetype () noexcept
 Get the type of this JSON value.
 
simdjson_inline simdjson_result< bool > is_scalar () noexcept
 
simdjson_inline simdjson_result< bool > is_string () noexcept
 
simdjson_inline simdjson_result< bool > is_negative () noexcept
 
simdjson_inline simdjson_result< bool > is_integer () noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::number_type > get_number_type () noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::numberget_number () noexcept
 
simdjson_inline simdjson_result< std::string_view > raw_json_token () noexcept
 std::string_view value::raw_json_token() const noexcept
 
simdjson_inline simdjson_result< std::string_view > raw_json () noexcept
 
simdjson_inline simdjson_result< const char * > current_location () noexcept
 simdjson_result<const char *> current_location() noexcept
 
simdjson_inline simdjson_result< int32_t > current_depth () const noexcept
 int32_t current_depth() const noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueat_pointer (std::string_view json_pointer) noexcept
 
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueat_path (std::string_view json_path) noexcept
 
template<typename Func >
simdjson_inline error_code for_each_at_path_with_wildcard (std::string_view json_path, Func &&callback) noexcept
 
template<typename string_type >
simdjson_inline error_code get_string (string_type &receiver, bool allow_replacement) noexcept
 
template<>
simdjson_inline error_code get (SIMDJSON_IMPLEMENTATION::ondemand::value &out) noexcept
 
template<>
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueget () noexcept
 
template<typename Func >
error_code for_each_at_path_with_wildcard (std::string_view json_path, Func &&callback) noexcept
 
template<>
simdjson_inline error_code get (SIMDJSON_IMPLEMENTATION::ondemand::value &out) noexcept
 
template<>
simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::valueget () noexcept
 
- Public Member Functions inherited from simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< SIMDJSON_IMPLEMENTATION::ondemand::value >
simdjson_inline implementation_simdjson_result_base () noexcept=default
 Create a new empty result with error = UNINITIALIZED.
 
simdjson_inline implementation_simdjson_result_base (error_code error) noexcept
 Create a new error result.
 
simdjson_inline implementation_simdjson_result_base (SIMDJSON_IMPLEMENTATION::ondemand::value &&value) noexcept
 Create a new successful result.
 
simdjson_inline implementation_simdjson_result_base (SIMDJSON_IMPLEMENTATION::ondemand::value &&value, error_code error) noexcept
 Create a new result with both things (use if you don't want to branch when creating the result).
 
simdjson_inline void tie (SIMDJSON_IMPLEMENTATION::ondemand::value &value, error_code &error) &&noexcept
 Move the value and the error to the provided variables.
 
simdjson_warn_unused simdjson_inline error_code get (SIMDJSON_IMPLEMENTATION::ondemand::value &value) &&noexcept
 Move the value to the provided variable.
 
simdjson_warn_unused simdjson_inline error_code error () const noexcept
 The error.
 
simdjson_warn_unused simdjson_inline bool has_value () const noexcept
 Whether there is a value.
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::valueoperator* () &noexcept(false)
 Get the result value.
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::value && operator* () &&noexcept(false)
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::valueoperator-> () noexcept(false)
 Arrow operator to access members of the contained value.
 
simdjson_inline const SIMDJSON_IMPLEMENTATION::ondemand::valueoperator-> () const noexcept(false)
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::valuevalue () &noexcept(false)
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::value && value () &&noexcept(false)
 Take the result value (move it).
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::value && take_value () &&noexcept(false)
 Take the result value (move it).
 
simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::value && () &&noexcept(false)
 Cast to the value (will throw on error).
 
simdjson_inline const SIMDJSON_IMPLEMENTATION::ondemand::valuevalue_unsafe () const &noexcept
 Get the result value.
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::valuevalue_unsafe () &noexcept
 Get the result value.
 
simdjson_inline SIMDJSON_IMPLEMENTATION::ondemand::value && value_unsafe () &&noexcept
 Take the result value (move it).
 

Additional Inherited Members

- Public Types inherited from simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< SIMDJSON_IMPLEMENTATION::ondemand::value >
using value_type = SIMDJSON_IMPLEMENTATION::ondemand::value
 
using error_type = error_code
 
- Protected Attributes inherited from simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< SIMDJSON_IMPLEMENTATION::ondemand::value >
SIMDJSON_IMPLEMENTATION::ondemand::value first
 users should never directly access first and second.
 
error_code second
 Users should never directly access 'first'.
 

Detailed Description

Definition at line 766 of file value.h.

Member Function Documentation

◆ at()

◆ at_path()

Definition at line 586 of file value-inl.h.

◆ at_pointer()

simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::at_pointer ( std::string_view  json_pointer)
noexcept

Definition at line 578 of file value-inl.h.

◆ begin()

◆ count_elements()

simdjson_inline simdjson_result< size_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::count_elements ( ) &
noexcept

Definition at line 356 of file value-inl.h.

◆ count_fields()

simdjson_inline simdjson_result< size_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::count_fields ( ) &
noexcept

Definition at line 360 of file value-inl.h.

◆ current_depth()

simdjson_inline simdjson_result< int32_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::current_depth ( ) const
noexcept

int32_t current_depth() const noexcept

int32_t current_depth() const noexcept

Definition at line 573 of file value-inl.h.

◆ current_location()

simdjson_inline simdjson_result< const char * > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::current_location ( )
noexcept

simdjson_result<const char *> current_location() noexcept

simdjson_result<const char *> current_location() noexcept

Definition at line 568 of file value-inl.h.

◆ end()

◆ find_field() [1/2]

Definition at line 381 of file value-inl.h.

◆ find_field() [2/2]

Look up a field by name on an object (order-sensitive).

By order-sensitive, we mean that fields must be accessed in the order they appear in the JSON text (although you can skip fields). See find_field_unordered() and operator[] for an order-insensitive version.

The following code reads z, then y, then x, and thus will not retrieve x or y if fed the JSON { "x": 1, "y": 2, "z": 3 }:

simdjson::ondemand::parser parser;
auto obj = parser.parse(R"( { "x": 1, "y": 2, "z": 3 } )"_padded);
double z = obj.find_field("z");
double y = obj.find_field("y");
double x = obj.find_field("x");

Raw Keys: The lookup will be done against the raw key, and will not unescape keys. e.g. object["a"] will match { "a": 1 }, but will not match { "\u0061": 1 }.

Parameters
keyThe key to look up.
Returns
The value of the field, or NO_SUCH_FIELD if the field is not in the object.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 377 of file value-inl.h.

◆ find_field_unordered() [1/2]

simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::find_field_unordered ( const char *  key)
noexcept

Definition at line 390 of file value-inl.h.

◆ find_field_unordered() [2/2]

simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::find_field_unordered ( std::string_view  key)
noexcept

Look up a field by name on an object, without regard to key order.

Performance Notes: This is a bit less performant than find_field(), though its effect varies and often appears negligible. It starts out normally, starting out at the last field; but if the field is not found, it scans from the beginning of the object to see if it missed it. That missing case has a non-cache-friendly bump and lots of extra scanning, especially if the object in question is large. The fact that the extra code is there also bumps the executable size.

We default operator[] on find_field_unordered() for convenience. It is the default because it would be highly surprising (and hard to debug) if the default behavior failed to look up a field just because it was in the wrong order–and many APIs assume this. Therefore, you must be explicit if you want to treat objects as out of order.

Use find_field() if you are sure fields will be in order (or are willing to treat it as if the field as not there when they are not in order).

Parameters
keyThe key to look up.
Returns
The value of the field, or NO_SUCH_FIELD if the field is not in the object.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 386 of file value-inl.h.

◆ for_each_at_path_with_wildcard()

template<typename Func >
error_code simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::for_each_at_path_with_wildcard ( std::string_view  json_path,
Func &&  callback 
)
inlinenoexcept

Definition at line 600 of file value-inl.h.

◆ get() [1/4]

◆ get() [2/4]

template<typename T >
simdjson_inline simdjson_result< T > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get ( )
noexcept

Definition at line 476 of file value-inl.h.

◆ get() [3/4]

Definition at line 470 of file value-inl.h.

◆ get() [4/4]

template<typename T >
simdjson_inline error_code simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get ( T &  out)
noexcept

Definition at line 480 of file value-inl.h.

◆ get_array()

◆ get_bool()

simdjson_inline simdjson_result< bool > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_bool ( )
noexcept

Definition at line 461 of file value-inl.h.

◆ get_double()

simdjson_inline simdjson_result< double > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_double ( )
noexcept

Definition at line 436 of file value-inl.h.

◆ get_double_in_string()

simdjson_inline simdjson_result< double > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_double_in_string ( )
noexcept

Definition at line 440 of file value-inl.h.

◆ get_int32()

simdjson_inline simdjson_result< int32_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_int32 ( )
noexcept

Definition at line 432 of file value-inl.h.

◆ get_int64()

simdjson_inline simdjson_result< int64_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_int64 ( )
noexcept

Definition at line 420 of file value-inl.h.

◆ get_int64_in_string()

simdjson_inline simdjson_result< int64_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_int64_in_string ( )
noexcept

Definition at line 424 of file value-inl.h.

◆ get_number()

◆ get_number_type()

simdjson_inline simdjson_result< SIMDJSON_IMPLEMENTATION::number_type > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_number_type ( )
noexcept

Definition at line 510 of file value-inl.h.

◆ get_object()

◆ get_raw_json_string()

◆ get_string() [1/2]

simdjson_inline simdjson_result< std::string_view > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_string ( bool  allow_replacement = false)
noexcept

Definition at line 444 of file value-inl.h.

◆ get_string() [2/2]

template<typename string_type >
simdjson_inline error_code simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_string ( string_type &  receiver,
bool  allow_replacement 
)
noexcept

Definition at line 449 of file value-inl.h.

◆ get_uint32()

simdjson_inline simdjson_result< uint32_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_uint32 ( )
noexcept

Definition at line 428 of file value-inl.h.

◆ get_uint64()

simdjson_inline simdjson_result< uint64_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_uint64 ( )
noexcept

Definition at line 412 of file value-inl.h.

◆ get_uint64_in_string()

simdjson_inline simdjson_result< uint64_t > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_uint64_in_string ( )
noexcept

Definition at line 416 of file value-inl.h.

◆ get_wobbly_string()

simdjson_inline simdjson_result< std::string_view > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::get_wobbly_string ( )
noexcept

Definition at line 453 of file value-inl.h.

◆ is_integer()

simdjson_inline simdjson_result< bool > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::is_integer ( )
noexcept

Definition at line 506 of file value-inl.h.

◆ is_negative()

simdjson_inline simdjson_result< bool > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::is_negative ( )
noexcept

Definition at line 502 of file value-inl.h.

◆ is_null()

Definition at line 465 of file value-inl.h.

◆ is_scalar()

simdjson_inline simdjson_result< bool > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::is_scalar ( )
noexcept

Definition at line 494 of file value-inl.h.

◆ is_string()

simdjson_inline simdjson_result< bool > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::is_string ( )
noexcept

Definition at line 498 of file value-inl.h.

◆ operator bool()

Definition at line 552 of file value-inl.h.

◆ operator double()

Definition at line 540 of file value-inl.h.

◆ operator int64_t()

simdjson_inline simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::operator int64_t ( )

Definition at line 536 of file value-inl.h.

◆ operator SIMDJSON_IMPLEMENTATION::ondemand::array()

◆ operator SIMDJSON_IMPLEMENTATION::ondemand::object()

◆ operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string()

◆ operator std::string_view()

simdjson_inline simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::operator std::string_view ( )

Definition at line 544 of file value-inl.h.

◆ operator T()

template<class T >
simdjson_inline simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::operator T ( )
explicit

Definition at line 520 of file value-inl.h.

◆ operator uint64_t()

simdjson_inline simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::operator uint64_t ( )

Definition at line 532 of file value-inl.h.

◆ operator[]() [1/2]

Definition at line 399 of file value-inl.h.

◆ operator[]() [2/2]

Definition at line 395 of file value-inl.h.

◆ raw_json()

simdjson_inline simdjson_result< std::string_view > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::raw_json ( )
noexcept

Definition at line 563 of file value-inl.h.

◆ raw_json_token()

simdjson_inline simdjson_result< std::string_view > simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >::raw_json_token ( )
noexcept

std::string_view value::raw_json_token() const noexcept

std::string_view value::raw_json_token() const noexcept

Definition at line 558 of file value-inl.h.

◆ type()

Get the type of this JSON value.

It does not validate or consume the value. E.g., you must still call "is_null()" to check that a value is null even if "type()" returns json_type::null.

Given a valid JSON document, the answer can be one of simdjson::ondemand::json_type::object, simdjson::ondemand::json_type::array, simdjson::ondemand::json_type::string, simdjson::ondemand::json_type::number, simdjson::ondemand::json_type::boolean, simdjson::ondemand::json_type::null.

Starting with simdjson 4.0, this function will return simdjson::ondemand::json_type::unknown given a bad token. This allows you to identify a case such as {"key": NaN} and identify the NaN value. The simdjson::ondemand::json_type::unknown value should only happen with non-valid JSON.

NOTE: If you're only expecting a value to be one type (a typical case), it's generally better to just call .get_double, .get_string, etc. and check for INCORRECT_TYPE (or just let it throw an exception).

Definition at line 490 of file value-inl.h.


The documentation for this struct was generated from the following files: