|
| bool | parse_bson_internal () |
| | Reads in a BSON-object and passes it to the SAX-parser.
|
| |
| bool | get_bson_cstr (string_t &result) |
| | Parses a C-style string from the BSON input.
|
| |
| template<typename NumberType > |
| bool | get_bson_string (const NumberType len, string_t &result) |
| | Parses a zero-terminated string of length len from the BSON input.
|
| |
| template<typename NumberType > |
| bool | get_bson_binary (const NumberType len, binary_t &result) |
| | Parses a byte array input of length len from the BSON input.
|
| |
| bool | parse_bson_element_internal (const char_int_type element_type, const std::size_t element_type_parse_position) |
| | Read a BSON document element of the given element_type.
|
| |
| bool | parse_bson_element_list (const bool is_array) |
| | Read a BSON element list (as specified in the BSON-spec)
|
| |
| bool | parse_bson_array () |
| | Reads an array from the BSON input and passes it to the SAX-parser.
|
| |
| bool | parse_cbor_internal (const bool get_char, const cbor_tag_handler_t tag_handler) |
| |
| bool | get_cbor_string (string_t &result) |
| | reads a CBOR string
|
| |
| bool | get_cbor_binary (binary_t &result) |
| | reads a CBOR byte array
|
| |
| bool | get_cbor_array (const std::size_t len, const cbor_tag_handler_t tag_handler) |
| |
| bool | get_cbor_object (const std::size_t len, const cbor_tag_handler_t tag_handler) |
| |
| bool | parse_msgpack_internal () |
| |
| bool | get_msgpack_string (string_t &result) |
| | reads a MessagePack string
|
| |
| bool | get_msgpack_binary (binary_t &result) |
| | reads a MessagePack byte array
|
| |
| bool | get_msgpack_array (const std::size_t len) |
| |
| bool | get_msgpack_object (const std::size_t len) |
| |
| bool | parse_ubjson_internal (const bool get_char=true) |
| |
| bool | get_ubjson_string (string_t &result, const bool get_char=true) |
| | reads a UBJSON string
|
| |
| bool | get_ubjson_ndarray_size (std::vector< size_t > &dim) |
| |
| bool | get_ubjson_size_value (std::size_t &result, bool &is_ndarray, char_int_type prefix=0) |
| |
| bool | get_ubjson_size_type (std::pair< std::size_t, char_int_type > &result, bool inside_ndarray=false) |
| | determine the type and size for a container
|
| |
| bool | get_ubjson_value (const char_int_type prefix) |
| |
| bool | get_ubjson_array () |
| |
| bool | get_ubjson_object () |
| |
| bool | get_ubjson_high_precision_number () |
| |
| char_int_type | get () |
| | get next character from the input
|
| |
| template<class T > |
| bool | get_to (T &dest, const input_format_t format, const char *context) |
| | get_to read into a primitive type
|
| |
| char_int_type | get_ignore_noop () |
| |
| template<typename NumberType , bool InputIsLittleEndian = false> |
| bool | get_number (const input_format_t format, NumberType &result) |
| |
| template<typename NumberType > |
| bool | get_string (const input_format_t format, const NumberType len, string_t &result) |
| | create a string by reading characters from the input
|
| |
| template<typename NumberType > |
| bool | get_binary (const input_format_t format, const NumberType len, binary_t &result) |
| | create a byte array by reading bytes from the input
|
| |
| bool | unexpect_eof (const input_format_t format, const char *context) const |
| |
| std::string | get_token_string () const |
| |
| std::string | exception_message (const input_format_t format, const std::string &detail, const std::string &context) const |
| |
template<typename BasicJsonType, typename InputAdapterType, typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
class detail::binary_reader< BasicJsonType, InputAdapterType, SAX >
deserialization of CBOR, MessagePack, and UBJSON values
Definition at line 9845 of file json.hpp.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
get next character from the input
This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a -'ve valued char_traits<char_type>::eof() in that case.
- Returns
- character read from the input
Definition at line 12553 of file json.hpp.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<typename NumberType >
create a byte array by reading bytes from the input
- Template Parameters
-
| NumberType | the type of the number |
- Parameters
-
| [in] | format | the current format (for diagnostics) |
| [in] | len | number of bytes to read |
| [out] | result | byte array created by reading len bytes |
- Returns
- whether byte array creation completed
- Note
- We can not reserve len bytes for the result, because len may be too large. Usually, unexpect_eof() detects the end of the input before we run out of memory.
Definition at line 12697 of file json.hpp.
References detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<typename NumberType >
| bool get_bson_binary |
( |
const NumberType |
len, |
|
|
binary_t & |
result |
|
) |
| |
|
inlineprivate |
Parses a byte array input of length len from the BSON input.
- Parameters
-
| [in] | len | The length of the byte array to be read. |
| [in,out] | result | A reference to the binary variable where the read array is to be stored. |
- Template Parameters
-
| NumberType | The type of the length len |
- Precondition
- len >= 0
- Returns
true if the byte array was successfully parsed
Definition at line 10023 of file json.hpp.
References detail::concat(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
Parses a C-style string from the BSON input.
- Parameters
-
| [in,out] | result | A reference to the string variable where the read string is to be stored. |
- Returns
true if the \x00-byte indicating the end of the string was encountered before the EOF; false` indicates an unexpected EOF.
Definition at line 9971 of file json.hpp.
References detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<typename NumberType >
| bool get_bson_string |
( |
const NumberType |
len, |
|
|
string_t & |
result |
|
) |
| |
|
inlineprivate |
Parses a zero-terminated string of length len from the BSON input.
- Parameters
-
| [in] | len | The length (including the zero-byte at the end) of the string to be read. |
| [in,out] | result | A reference to the string variable where the read string is to be stored. |
- Template Parameters
-
| NumberType | The type of the length len |
- Precondition
- len >= 1
- Returns
true if the string was successfully parsed
Definition at line 10001 of file json.hpp.
References detail::concat(), detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_cbor_binary |
( |
binary_t & |
result | ) |
|
|
inlineprivate |
reads a CBOR byte array
This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into the byte array. Additionally, CBOR's byte arrays with indefinite lengths are supported.
- Parameters
-
| [out] | result | created byte array |
- Returns
- whether byte array creation completed
Definition at line 10791 of file json.hpp.
References detail::concat(), detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_cbor_string |
( |
string_t & |
result | ) |
|
|
inlineprivate |
reads a CBOR string
This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. Additionally, CBOR's strings with indefinite lengths are supported.
- Parameters
-
| [out] | result | created string |
- Returns
- whether string creation completed
Definition at line 10695 of file json.hpp.
References detail::concat(), detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_msgpack_binary |
( |
binary_t & |
result | ) |
|
|
inlineprivate |
reads a MessagePack byte array
This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into a byte array.
- Parameters
-
| [out] | result | created byte array |
- Returns
- whether byte array creation completed
Definition at line 11444 of file json.hpp.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_msgpack_string |
( |
string_t & |
result | ) |
|
|
inlineprivate |
reads a MessagePack string
This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string.
- Parameters
-
| [out] | result | created string |
- Returns
- whether string creation completed
Definition at line 11361 of file json.hpp.
References detail::concat(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<typename NumberType , bool InputIsLittleEndian = false>
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<typename NumberType >
create a string by reading characters from the input
- Template Parameters
-
| NumberType | the type of the number |
- Parameters
-
| [in] | format | the current format (for diagnostics) |
| [in] | len | number of characters to read |
| [out] | result | string created by reading len bytes |
- Returns
- whether string creation completed
- Note
- We can not reserve len bytes for the result, because len may be too large. Usually, unexpect_eof() detects the end of the input before we run out of string memory.
Definition at line 12664 of file json.hpp.
References detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<class T >
| bool get_to |
( |
T & |
dest, |
|
|
const input_format_t |
format, |
|
|
const char * |
context |
|
) |
| |
|
inlineprivate |
get_to read into a primitive type
This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns false instead
- Returns
- bool, whether the read was successful
Definition at line 12568 of file json.hpp.
References JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_ubjson_size_type |
( |
std::pair< std::size_t, char_int_type > & |
result, |
|
|
bool |
inside_ndarray = false |
|
) |
| |
|
inlineprivate |
determine the type and size for a container
In the optimized UBJSON format, a type and a size can be provided to allow for a more compact representation.
- Parameters
-
| [out] | result | pair of the size and the type |
| [in] | inside_ndarray | whether the parser is parsing an ND array dimensional vector |
- Returns
- whether pair creation completed
Definition at line 12016 of file json.hpp.
References detail::concat(), detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_ubjson_size_value |
( |
std::size_t & |
result, |
|
|
bool & |
is_ndarray, |
|
|
char_int_type |
prefix = 0 |
|
) |
| |
|
inlineprivate |
- Parameters
-
| [out] | result | determined size |
| [in,out] | is_ndarray | for input, true means already inside an ndarray vector or ndarray dimension is not allowed; false means ndarray is allowed; for output, true means an ndarray is found; is_ndarray can only return true when its initial value is false |
| [in] | prefix | type marker if already read, otherwise set to 0 |
- Returns
- whether size determination completed
Definition at line 11793 of file json.hpp.
References JSON_HEDLEY_UNLIKELY, and detail::key.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool get_ubjson_string |
( |
string_t & |
result, |
|
|
const bool |
get_char = true |
|
) |
| |
|
inlineprivate |
reads a UBJSON string
This function is either called after reading the 'S' byte explicitly indicating a string, or in case of an object key where the 'S' byte can be left out.
- Parameters
-
| [out] | result | created string |
| [in] | get_char | whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead |
- Returns
- whether string creation completed
Definition at line 11633 of file json.hpp.
References detail::get(), and JSON_HEDLEY_UNLIKELY.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool parse_bson_array |
( |
| ) |
|
|
inlineprivate |
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool parse_bson_element_internal |
( |
const char_int_type |
element_type, |
|
|
const std::size_t |
element_type_parse_position |
|
) |
| |
|
inlineprivate |
Read a BSON document element of the given element_type.
- Parameters
-
| [in] | element_type | The BSON element type, c.f. http://bsonspec.org/spec.html |
| [in] | element_type_parse_position | The position in the input stream, where the element_type was read. |
- Warning
- Not all BSON element types are supported yet. An unsupported element_type will give rise to a parse_error.114: Unsupported BSON record type 0x...
- Returns
- whether a valid BSON-object/array was passed to the SAX parser
Definition at line 10050 of file json.hpp.
References detail::concat(), and detail::get().
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool parse_bson_element_list |
( |
const bool |
is_array | ) |
|
|
inlineprivate |
Read a BSON element list (as specified in the BSON-spec)
The same binary layout is used for objects and arrays, hence it must be indicated with the argument is_array which one is expected (true --> array, false --> object).
- Parameters
-
| [in] | is_array | Determines if the element list being read is to be treated as an object (is_array == false), or as an array (is_array == true). |
- Returns
- whether a valid BSON-object/array was passed to the SAX parser
Definition at line 10136 of file json.hpp.
References detail::get(), JSON_HEDLEY_UNLIKELY, and detail::key.
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
| bool parse_bson_internal |
( |
| ) |
|
|
inlineprivate |
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
- Parameters
-
| [in] | format | the binary format to parse |
| [in] | sax_ | a SAX event processor |
| [in] | strict | whether to expect the input to be consumed completed |
| [in] | tag_handler | how to treat CBOR tags |
- Returns
- whether parsing was successful
Definition at line 9883 of file json.hpp.
References detail::concat(), detail::get(), JSON_ASSERT, JSON_HEDLEY_UNLIKELY, and detail::strict.
Referenced by basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass >::sax_parse(), basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass >::sax_parse(), and basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass >::sax_parse().