MUQ  0.4.3
nlohmann::detail::binary_writer< BasicJsonType, CharType > Class Template Reference

serialization to CBOR and MessagePack values More...

#include <json.h>

Detailed Description

template<typename BasicJsonType, typename CharType>
class nlohmann::detail::binary_writer< BasicJsonType, CharType >

serialization to CBOR and MessagePack values

Definition at line 12752 of file json.h.

Public Member Functions

 binary_writer (output_adapter_t< CharType > adapter)
 create a binary writer More...
 
void write_bson (const BasicJsonType &j)
 
void write_cbor (const BasicJsonType &j)
 
void write_msgpack (const BasicJsonType &j)
 
void write_ubjson (const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true)
 

Static Public Member Functions

template<typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_signed< char >::value > * = nullptr>
static constexpr CharType to_char_type (std::uint8_t x) noexcept
 
template<typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_unsigned< char >::value > * = nullptr>
static CharType to_char_type (std::uint8_t x) noexcept
 
template<typename C = CharType, enable_if_t< std::is_unsigned< C >::value > * = nullptr>
static constexpr CharType to_char_type (std::uint8_t x) noexcept
 
template<typename InputCharType , typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_signed< char >::value &&std::is_same< char, typename std::remove_cv< InputCharType >::type >::value > * = nullptr>
static constexpr CharType to_char_type (InputCharType x) noexcept
 

Member Typedef Documentation

◆ binary_t

template<typename BasicJsonType , typename CharType >
using nlohmann::detail::binary_writer< BasicJsonType, CharType >::binary_t = typename BasicJsonType::binary_t
private

Definition at line 12755 of file json.h.

◆ number_float_t

template<typename BasicJsonType , typename CharType >
using nlohmann::detail::binary_writer< BasicJsonType, CharType >::number_float_t = typename BasicJsonType::number_float_t
private

Definition at line 12756 of file json.h.

◆ string_t

template<typename BasicJsonType , typename CharType >
using nlohmann::detail::binary_writer< BasicJsonType, CharType >::string_t = typename BasicJsonType::string_t
private

Definition at line 12754 of file json.h.

Constructor & Destructor Documentation

◆ binary_writer()

template<typename BasicJsonType , typename CharType >
nlohmann::detail::binary_writer< BasicJsonType, CharType >::binary_writer ( output_adapter_t< CharType >  adapter)
inlineexplicit

create a binary writer

Parameters
[in]adapteroutput adapter to write to

Definition at line 12764 of file json.h.

References nlohmann::detail::JSON_ASSERT(), and nlohmann::detail::binary_writer< BasicJsonType, CharType >::oa.

Member Function Documentation

◆ calc_bson_array_size()

template<typename BasicJsonType , typename CharType >
static std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_array_size ( const typename BasicJsonType::array_t &  value)
inlinestaticprivate

◆ calc_bson_binary_size()

template<typename BasicJsonType , typename CharType >
static std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_binary_size ( const typename BasicJsonType::binary_t &  value)
inlinestaticprivate
Returns
The size of the BSON-encoded binary array value

Definition at line 13791 of file json.h.

References nlohmann::detail::value.

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_element_size().

◆ calc_bson_element_size()

◆ calc_bson_entry_header_size()

template<typename BasicJsonType , typename CharType >
static std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_entry_header_size ( const string_t name)
inlinestaticprivate
Returns
The size of a BSON document entry header, including the id marker and the entry name size (and its null-terminator).

Definition at line 13629 of file json.h.

References nlohmann::detail::out_of_range::create(), and nlohmann::to_string().

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_element_size().

◆ calc_bson_integer_size()

template<typename BasicJsonType , typename CharType >
static std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_integer_size ( const std::int64_t  value)
inlinestaticprivate
Returns
The size of the BSON-encoded integer value

Definition at line 13706 of file json.h.

References nlohmann::detail::value.

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_element_size().

◆ calc_bson_object_size()

template<typename BasicJsonType , typename CharType >
static std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_object_size ( const typename BasicJsonType::object_t &  value)
inlinestaticprivate

Calculates the size of the BSON serialization of the given JSON-object j.

Parameters
[in]jJSON value to serialize
Precondition
j.type() == value_t::object

Definition at line 13927 of file json.h.

References nlohmann::detail::value.

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_element_size(), and nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_object().

◆ calc_bson_string_size()

template<typename BasicJsonType , typename CharType >
static std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_string_size ( const string_t value)
inlinestaticprivate
Returns
The size of the BSON-encoded string in value

Definition at line 13676 of file json.h.

References nlohmann::detail::value.

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_element_size().

◆ calc_bson_unsigned_size()

template<typename BasicJsonType , typename CharType >
static constexpr std::size_t nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_unsigned_size ( const std::uint64_t  value)
inlinestaticconstexprprivatenoexcept
Returns
The size of the BSON-encoded unsigned integer in j

Definition at line 13734 of file json.h.

References nlohmann::detail::value.

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_element_size().

◆ get_cbor_float_prefix() [1/2]

template<typename BasicJsonType , typename CharType >
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_cbor_float_prefix ( double  )
inlinestaticconstexprprivate

◆ get_cbor_float_prefix() [2/2]

template<typename BasicJsonType , typename CharType >
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_cbor_float_prefix ( float  )
inlinestaticconstexprprivate

◆ get_msgpack_float_prefix() [1/2]

template<typename BasicJsonType , typename CharType >
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_msgpack_float_prefix ( double  )
inlinestaticconstexprprivate

◆ get_msgpack_float_prefix() [2/2]

template<typename BasicJsonType , typename CharType >
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_msgpack_float_prefix ( float  )
inlinestaticconstexprprivate

◆ get_ubjson_float_prefix() [1/2]

template<typename BasicJsonType , typename CharType >
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_ubjson_float_prefix ( double  )
inlinestaticconstexprprivate

Definition at line 14214 of file json.h.

◆ get_ubjson_float_prefix() [2/2]

template<typename BasicJsonType , typename CharType >
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_ubjson_float_prefix ( float  )
inlinestaticconstexprprivate

◆ to_char_type() [1/4]

template<typename BasicJsonType , typename CharType >
template<typename InputCharType , typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_signed< char >::value &&std::is_same< char, typename std::remove_cv< InputCharType >::type >::value > * = nullptr>
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type ( InputCharType  x)
inlinestaticconstexprnoexcept

Definition at line 14307 of file json.h.

◆ to_char_type() [2/4]

◆ to_char_type() [3/4]

template<typename BasicJsonType , typename CharType >
template<typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_unsigned< char >::value > * = nullptr>
static CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type ( std::uint8_t  x)
inlinestaticnoexcept

Definition at line 14285 of file json.h.

References nlohmann::detail::value.

◆ to_char_type() [4/4]

template<typename BasicJsonType , typename CharType >
template<typename C = CharType, enable_if_t< std::is_unsigned< C >::value > * = nullptr>
static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type ( std::uint8_t  x)
inlinestaticconstexprnoexcept

Definition at line 14296 of file json.h.

◆ ubjson_prefix()

◆ write_bson()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson ( const BasicJsonType &  j)
inline

◆ write_bson_array()

◆ write_bson_binary()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_binary ( const string_t name,
const binary_t value 
)
inlineprivate

◆ write_bson_boolean()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_boolean ( const string_t name,
const bool  value 
)
inlineprivate

◆ write_bson_double()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_double ( const string_t name,
const double  value 
)
inlineprivate

◆ write_bson_element()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_element ( const string_t name,
const BasicJsonType &  j 
)
inlineprivate

◆ write_bson_entry_header()

◆ write_bson_integer()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_integer ( const string_t name,
const std::int64_t  value 
)
inlineprivate

◆ write_bson_null()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_null ( const string_t name)
inlineprivate

◆ write_bson_object()

◆ write_bson_object_entry()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_object_entry ( const string_t name,
const typename BasicJsonType::object_t &  value 
)
inlineprivate

◆ write_bson_string()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_string ( const string_t name,
const string_t value 
)
inlineprivate

◆ write_bson_unsigned()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_unsigned ( const string_t name,
const std::uint64_t  value 
)
inlineprivate

◆ write_cbor()

◆ write_compact_float()

◆ write_msgpack()

◆ write_number()

◆ write_number_with_ubjson_prefix() [1/3]

template<typename BasicJsonType , typename CharType >
template<typename NumberType , typename std::enable_if< std::is_floating_point< NumberType >::value, int >::type = 0>
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number_with_ubjson_prefix ( const NumberType  n,
const bool  add_prefix 
)
inlineprivate

◆ write_number_with_ubjson_prefix() [2/3]

template<typename BasicJsonType , typename CharType >
template<typename NumberType , typename std::enable_if< std::is_unsigned< NumberType >::value, int >::type = 0>
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number_with_ubjson_prefix ( const NumberType  n,
const bool  add_prefix 
)
inlineprivate

◆ write_number_with_ubjson_prefix() [3/3]

template<typename BasicJsonType , typename CharType >
template<typename NumberType , typename std::enable_if< std::is_signed< NumberType >::value &&!std::is_floating_point< NumberType >::value, int >::type = 0>
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number_with_ubjson_prefix ( const NumberType  n,
const bool  add_prefix 
)
inlineprivate

◆ write_ubjson()

Member Data Documentation

◆ is_little_endian

template<typename BasicJsonType , typename CharType >
const bool nlohmann::detail::binary_writer< BasicJsonType, CharType >::is_little_endian = little_endianess()
private

whether we can assume little endianess

Definition at line 14314 of file json.h.

Referenced by nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number().

◆ oa


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