deserialization of CBOR and MessagePack values More...
#include <json.hpp>
Public Member Functions | |
binary_reader (input_adapter_t adapter) | |
create a binary reader More... | |
BasicJsonType | parse_cbor (const bool strict) |
create a JSON value from CBOR input More... | |
BasicJsonType | parse_msgpack (const bool strict) |
create a JSON value from MessagePack input More... | |
BasicJsonType | parse_ubjson (const bool strict) |
create a JSON value from UBJSON input More... | |
Static Public Member Functions | |
static constexpr bool | little_endianess (int num=1) noexcept |
determine system byte order More... | |
Private Types | |
using | number_integer_t = typename BasicJsonType::number_integer_t |
using | number_unsigned_t = typename BasicJsonType::number_unsigned_t |
using | string_t = typename BasicJsonType::string_t |
Private Member Functions | |
void | expect_eof () const |
throw if end of input is not reached More... | |
int | get () |
get next character from the input More... | |
template<typename NumberType > | |
BasicJsonType | get_cbor_array (const NumberType len) |
template<typename NumberType > | |
BasicJsonType | get_cbor_object (const NumberType len) |
string_t | get_cbor_string () |
reads a CBOR string More... | |
int | get_ignore_noop () |
template<typename NumberType > | |
BasicJsonType | get_msgpack_array (const NumberType len) |
template<typename NumberType > | |
BasicJsonType | get_msgpack_object (const NumberType len) |
string_t | get_msgpack_string () |
reads a MessagePack string More... | |
template<typename NumberType > | |
NumberType | get_number () |
template<typename NumberType > | |
string_t | get_string (const NumberType len) |
create a string by reading characters from the input More... | |
BasicJsonType | get_ubjson_array () |
BasicJsonType | get_ubjson_object () |
std::pair< std::size_t, int > | get_ubjson_size_type () |
determine the type and size for a container More... | |
string_t | get_ubjson_string (const bool get_char=true) |
reads a UBJSON string More... | |
BasicJsonType | get_ubjson_value (const int prefix) |
BasicJsonType | parse_cbor_internal (const bool get_char=true) |
BasicJsonType | parse_msgpack_internal () |
BasicJsonType | parse_ubjson_internal (const bool get_char=true) |
void | unexpect_eof () const |
Private Attributes | |
std::size_t | chars_read = 0 |
the number of characters read More... | |
int | current = std::char_traits<char>::eof() |
the current character More... | |
input_adapter_t | ia = nullptr |
input adapter More... | |
const bool | is_little_endian = little_endianess() |
whether we can assume little endianess More... | |
deserialization of CBOR and MessagePack values
|
private |
|
private |
|
private |
|
inlineexplicit |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
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.
parse_error.110 | if input ended |
parse_error.113 | if an unexpected byte is read |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
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.
parse_error.110 | if input ended |
parse_error.113 | if an unexpected byte is read |
|
inlineprivate |
|
inlineprivate |
create a string by reading characters from the input
[in] | len | number of bytes to read |
parse_error.110 | if input has less than len bytes |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
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.
[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 |
parse_error.110 | if input ended |
parse_error.113 | if an unexpected byte is read |
|
inlineprivate |
|
inlinestaticnoexcept |
determine system byte order
|
inline |
create a JSON value from CBOR input
[in] | strict | whether to expect the input to be consumed completed |
parse_error.110 | if input ended unexpectedly or the end of file was not reached when strict was set to true |
parse_error.112 | if unsupported byte was read |
|
inlineprivate |
|
inline |
create a JSON value from MessagePack input
[in] | strict | whether to expect the input to be consumed completed |
parse_error.110 | if input ended unexpectedly or the end of file was not reached when strict was set to true |
parse_error.112 | if unsupported byte was read |
|
inlineprivate |
|
inline |
create a JSON value from UBJSON input
[in] | strict | whether to expect the input to be consumed completed |
parse_error.110 | if input ended unexpectedly or the end of file was not reached when strict was set to true |
parse_error.112 | if unsupported byte was read |
|
inlineprivate |
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |