simdjson 4.6.4
Ridiculously Fast JSON
Loading...
Searching...
No Matches
simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference Class Reference

A document_reference is a thin wrapper around a document reference instance. More...

#include <document.h>

Public Member Functions

simdjson_inline document_reference (document &d) noexcept
 
simdjson_inline document_reference (const document_reference &other) noexcept=default
 
simdjson_inline document_referenceoperator= (const document_reference &other) noexcept=default
 
simdjson_inline void rewind () noexcept
 
simdjson_inline simdjson_result< arrayget_array () &noexcept
 
simdjson_inline simdjson_result< objectget_object () &noexcept
 
simdjson_inline simdjson_result< uint64_t > get_uint64 () noexcept
 The document_reference instances are used primarily/solely for streams of JSON documents.
 
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< raw_json_stringget_raw_json_string () noexcept
 
simdjson_inline simdjson_result< bool > get_bool () noexcept
 
simdjson_inline simdjson_result< valueget_value () noexcept
 
simdjson_inline simdjson_result< bool > is_null () noexcept
 
template<typename T >
simdjson_inline simdjson_result< T > get () &noexcept
 
template<typename T >
simdjson_inline simdjson_result< T > get () &&noexcept
 
template<typename T >
simdjson_warn_unused simdjson_inline error_code get (T &out) &noexcept
 Get this value as the given type.
 
template<typename T >
simdjson_inline error_code get (T &out) &&noexcept
 
simdjson_inline simdjson_result< std::string_view > raw_json () noexcept
 
simdjson_inline operator document & () const noexcept
 
template<class T >
simdjson_inline operator T () noexcept(false)
 
simdjson_inline operator array () &noexcept(false)
 
simdjson_inline operator 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 raw_json_string () noexcept(false)
 
simdjson_inline operator bool () noexcept(false)
 
simdjson_inline operator value () noexcept(false)
 
simdjson_inline simdjson_result< size_t > count_elements () &noexcept
 
simdjson_inline simdjson_result< size_t > count_fields () &noexcept
 
simdjson_inline simdjson_result< valueat (size_t index) &noexcept
 
simdjson_inline simdjson_result< array_iteratorbegin () &noexcept
 
simdjson_inline simdjson_result< array_iteratorend () &noexcept
 
simdjson_inline simdjson_result< valuefind_field (std::string_view key) &noexcept
 
simdjson_inline simdjson_result< valuefind_field (const char *key) &noexcept
 
simdjson_inline simdjson_result< valueoperator[] (std::string_view key) &noexcept
 
simdjson_inline simdjson_result< valueoperator[] (const char *key) &noexcept
 
simdjson_result< valueoperator[] (int) &noexcept=delete
 
simdjson_inline simdjson_result< valuefind_field_unordered (std::string_view key) &noexcept
 
simdjson_inline simdjson_result< valuefind_field_unordered (const char *key) &noexcept
 
simdjson_inline simdjson_result< json_typetype () noexcept
 
simdjson_inline simdjson_result< bool > is_scalar () noexcept
 
simdjson_inline simdjson_result< bool > is_string () noexcept
 
simdjson_inline simdjson_result< const char * > current_location () noexcept
 
simdjson_inline int32_t current_depth () const noexcept
 
simdjson_inline bool is_negative () noexcept
 
simdjson_inline simdjson_result< bool > is_integer () noexcept
 
simdjson_inline simdjson_result< number_typeget_number_type () noexcept
 
simdjson_inline simdjson_result< numberget_number () noexcept
 
simdjson_inline simdjson_result< std::string_view > raw_json_token () noexcept
 
simdjson_inline simdjson_result< valueat_pointer (std::string_view json_pointer) noexcept
 
simdjson_inline simdjson_result< 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<>
simdjson_inline simdjson_result< arrayget () &noexcept
 
template<>
simdjson_inline simdjson_result< objectget () &noexcept
 
template<>
simdjson_inline simdjson_result< raw_json_stringget () &noexcept
 
template<>
simdjson_inline simdjson_result< std::string_view > get () &noexcept
 
template<>
simdjson_inline simdjson_result< double > get () &noexcept
 
template<>
simdjson_inline simdjson_result< uint64_t > get () &noexcept
 
template<>
simdjson_inline simdjson_result< int64_t > get () &noexcept
 
template<>
simdjson_inline simdjson_result< uint32_t > get () &noexcept
 
template<>
simdjson_inline simdjson_result< int32_t > get () &noexcept
 
template<>
simdjson_inline simdjson_result< bool > get () &noexcept
 
template<>
simdjson_inline simdjson_result< valueget () &noexcept
 

Detailed Description

A document_reference is a thin wrapper around a document reference instance.

The document_reference instances are used primarily/solely for streams of JSON documents. They differ from document instances when parsing a scalar value (a document that is not an array or an object). In the case of a document, we expect the document to be fully consumed. In the case of a document_reference, we allow trailing content.

Definition at line 842 of file document.h.

Constructor & Destructor Documentation

◆ document_reference() [1/2]

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::document_reference ( )
noexcept

Definition at line 749 of file document-inl.h.

◆ document_reference() [2/2]

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::document_reference ( document d)
noexcept

Definition at line 750 of file document-inl.h.

Member Function Documentation

◆ at()

simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::at ( size_t  index) &
noexcept

Definition at line 820 of file document-inl.h.

◆ at_path()

simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::at_path ( std::string_view  json_path)
noexcept

Definition at line 840 of file document-inl.h.

◆ at_pointer()

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

Definition at line 839 of file document-inl.h.

◆ begin()

simdjson_inline simdjson_result< array_iterator > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::begin ( ) &
noexcept

Definition at line 821 of file document-inl.h.

◆ count_elements()

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

Definition at line 818 of file document-inl.h.

◆ count_fields()

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

Definition at line 819 of file document-inl.h.

◆ current_depth()

simdjson_inline int32_t simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::current_depth ( ) const
noexcept

Definition at line 833 of file document-inl.h.

◆ current_location()

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

Definition at line 832 of file document-inl.h.

◆ end()

simdjson_inline simdjson_result< array_iterator > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::end ( ) &
noexcept

Definition at line 822 of file document-inl.h.

◆ find_field() [1/2]

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

Definition at line 824 of file document-inl.h.

◆ find_field() [2/2]

simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::find_field ( std::string_view  key) &
noexcept

Definition at line 823 of file document-inl.h.

◆ find_field_unordered() [1/2]

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

Definition at line 828 of file document-inl.h.

◆ find_field_unordered() [2/2]

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

Definition at line 827 of file document-inl.h.

◆ for_each_at_path_with_wildcard()

template<typename Func >
simdjson_inline error_code simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::for_each_at_path_with_wildcard ( std::string_view  json_path,
Func &&  callback 
)
noexcept

Definition at line 847 of file document-inl.h.

◆ get() [1/14]

template<typename T >
simdjson_inline simdjson_result< T > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &&
inlinenoexcept

Definition at line 882 of file document.h.

◆ get() [2/14]

template<>
simdjson_inline simdjson_result< array > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 794 of file document-inl.h.

◆ get() [3/14]

template<>
simdjson_inline simdjson_result< object > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 795 of file document-inl.h.

◆ get() [4/14]

template<>
simdjson_inline simdjson_result< raw_json_string > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 796 of file document-inl.h.

◆ get() [5/14]

template<>
simdjson_inline simdjson_result< std::string_view > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 797 of file document-inl.h.

◆ get() [6/14]

template<>
simdjson_inline simdjson_result< double > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 798 of file document-inl.h.

◆ get() [7/14]

template<>
simdjson_inline simdjson_result< uint64_t > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 799 of file document-inl.h.

◆ get() [8/14]

template<>
simdjson_inline simdjson_result< int64_t > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 800 of file document-inl.h.

◆ get() [9/14]

template<>
simdjson_inline simdjson_result< uint32_t > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 801 of file document-inl.h.

◆ get() [10/14]

template<>
simdjson_inline simdjson_result< int32_t > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 802 of file document-inl.h.

◆ get() [11/14]

template<>
simdjson_inline simdjson_result< bool > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 803 of file document-inl.h.

◆ get() [12/14]

template<>
simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
noexcept

Definition at line 804 of file document-inl.h.

◆ get() [13/14]

template<typename T >
simdjson_inline simdjson_result< T > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( ) &
inlinenoexcept

Definition at line 869 of file document.h.

◆ get() [14/14]

template<typename T >
simdjson_warn_unused simdjson_inline error_code simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get ( T &  out) &
inlinenoexcept

Get this value as the given type.

Supported types: object, array, raw_json_string, string_view, uint64_t, int64_t, double, bool, value

Be mindful that the document instance must remain in scope while you are accessing object, array and value instances.

Parameters
outThis is set to a value of the given type, parsed from the JSON. If there is an error, this may not be initialized.
Returns
INCORRECT_TYPE If the JSON value is not an object.
SUCCESS If the parse succeeded and the out parameter was set to the value.

Definition at line 905 of file document.h.

◆ get_array()

simdjson_inline simdjson_result< array > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get_array ( ) &
noexcept

Definition at line 752 of file document-inl.h.

◆ get_bool()

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

Definition at line 791 of file document-inl.h.

◆ get_double()

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

Definition at line 784 of file document-inl.h.

◆ get_double_in_string()

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

Definition at line 785 of file document-inl.h.

◆ get_int32()

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

Definition at line 778 of file document-inl.h.

◆ get_int64()

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

Definition at line 770 of file document-inl.h.

◆ get_int64_in_string()

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

Definition at line 771 of file document-inl.h.

◆ get_number()

simdjson_inline simdjson_result< number > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get_number ( )
noexcept

Definition at line 837 of file document-inl.h.

◆ get_number_type()

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

Definition at line 836 of file document-inl.h.

◆ get_object()

simdjson_inline simdjson_result< object > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get_object ( ) &
noexcept

Definition at line 753 of file document-inl.h.

◆ get_raw_json_string()

simdjson_inline simdjson_result< raw_json_string > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get_raw_json_string ( )
noexcept

Definition at line 790 of file document-inl.h.

◆ get_string() [1/2]

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

Definition at line 786 of file document-inl.h.

◆ get_string() [2/2]

template<typename string_type >
simdjson_warn_unused simdjson_inline error_code simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get_string ( string_type &  receiver,
bool  allow_replacement = false 
)
noexcept

Definition at line 788 of file document-inl.h.

◆ get_uint32()

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

Definition at line 772 of file document-inl.h.

◆ get_uint64()

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

The document_reference instances are used primarily/solely for streams of JSON documents.

We decided that calling 'get_double()' on the JSON document '1.233 blabla' should give an error, so we check for trailing content.

However, for streams of JSON documents, we want to be able to start from "321" "321" "321" and parse it successfully as a stream of JSON documents, calling get_uint64_in_string() successfully each time.

To achieve this result, we pass a 'false' to a get_root_value_iterator() method: this indicates that we allow trailing content.

Definition at line 768 of file document-inl.h.

◆ get_uint64_in_string()

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

Definition at line 769 of file document-inl.h.

◆ get_value()

simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::get_value ( )
noexcept

Definition at line 792 of file document-inl.h.

◆ get_wobbly_string()

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

Definition at line 789 of file document-inl.h.

◆ is_integer()

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

Definition at line 835 of file document-inl.h.

◆ is_negative()

simdjson_inline bool simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::is_negative ( )
noexcept

Definition at line 834 of file document-inl.h.

◆ is_null()

simdjson_inline simdjson_result< bool > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::is_null ( )
noexcept

Definition at line 793 of file document-inl.h.

◆ is_scalar()

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

Definition at line 830 of file document-inl.h.

◆ is_string()

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

Definition at line 831 of file document-inl.h.

◆ operator array()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator array ( ) &

Definition at line 808 of file document-inl.h.

◆ operator bool()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator bool ( )

Definition at line 815 of file document-inl.h.

◆ operator document &()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator document & ( ) const
noexcept

Definition at line 849 of file document-inl.h.

◆ operator double()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator double ( )

Definition at line 812 of file document-inl.h.

◆ operator int64_t()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator int64_t ( )

Definition at line 811 of file document-inl.h.

◆ operator object()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator object ( ) &

Definition at line 809 of file document-inl.h.

◆ operator raw_json_string()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator raw_json_string ( )

Definition at line 814 of file document-inl.h.

◆ operator std::string_view()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator std::string_view ( )

Definition at line 813 of file document-inl.h.

◆ operator T()

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

Definition at line 807 of file document-inl.h.

◆ operator uint64_t()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator uint64_t ( )

Definition at line 810 of file document-inl.h.

◆ operator value()

simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator value ( )

Definition at line 816 of file document-inl.h.

◆ operator[]() [1/2]

simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator[] ( const char *  key) &
noexcept

Definition at line 826 of file document-inl.h.

◆ operator[]() [2/2]

simdjson_inline simdjson_result< value > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::operator[] ( std::string_view  key) &
noexcept

Definition at line 825 of file document-inl.h.

◆ raw_json()

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

Definition at line 848 of file document-inl.h.

◆ raw_json_token()

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

Definition at line 838 of file document-inl.h.

◆ rewind()

simdjson_inline void simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::rewind ( )
noexcept

Definition at line 751 of file document-inl.h.

◆ type()

simdjson_inline simdjson_result< json_type > simdjson::SIMDJSON_IMPLEMENTATION::ondemand::document_reference::type ( )
noexcept

Definition at line 829 of file document-inl.h.


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