Template Class binary_writer

Class Documentation

template<typename BasicJsonType, typename CharType>
class binary_writer

serialization to CBOR and MessagePack values

Public Functions

inline explicit binary_writer(output_adapter_t<CharType> adapter)

create a binary writer

Parameters:

adapter[in] output adapter to write to

inline void write_bson(const BasicJsonType &j)
Parameters:

j[in] JSON value to serialize

Pre:

j.type() == value_t::object

inline void write_cbor(const BasicJsonType &j)
Parameters:

j[in] JSON value to serialize

inline void write_msgpack(const BasicJsonType &j)
Parameters:

j[in] JSON value to serialize

inline void write_ubjson(const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix = true)
Parameters:
  • j[in] JSON value to serialize

  • use_count[in] whether to use ‘#’ prefixes (optimized format)

  • use_type[in] whether to use ‘$’ prefixes (optimized format)

  • add_prefix[in] whether prefixes need to be used for this value

inline explicit binary_writer(output_adapter_t<CharType> adapter)

create a binary writer

Parameters:

adapter[in] output adapter to write to

inline void write_bson(const BasicJsonType &j)
Parameters:

j[in] JSON value to serialize

Pre:

j.type() == value_t::object

inline void write_cbor(const BasicJsonType &j)
Parameters:

j[in] JSON value to serialize

inline void write_msgpack(const BasicJsonType &j)
Parameters:

j[in] JSON value to serialize

inline void write_ubjson(const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix = true)
Parameters:
  • j[in] JSON value to serialize

  • use_count[in] whether to use ‘#’ prefixes (optimized format)

  • use_type[in] whether to use ‘$’ prefixes (optimized format)

  • add_prefix[in] whether prefixes need to be used for this value

Public Static Functions

template<typename C = CharType, enable_if_t<std::is_signed<C>::value and std::is_signed<char>::value>* = nullptr>
static inline constexpr CharType to_char_type(std::uint8_t x) noexcept
template<typename C = CharType, enable_if_t<std::is_signed<C>::value and std::is_unsigned<char>::value>* = nullptr>
static inline CharType to_char_type(std::uint8_t x) noexcept
template<typename C = CharType, enable_if_t<std::is_unsigned<C>::value>* = nullptr>
static inline constexpr CharType to_char_type(std::uint8_t x) noexcept
template<typename InputCharType, typename C = CharType, enable_if_t<std::is_signed<C>::value and std::is_signed<char>::value and std::is_same<char, typename std::remove_cv<InputCharType>::type>::value>* = nullptr>
static inline constexpr CharType to_char_type(InputCharType x) noexcept
template<typename C = CharType, enable_if_t<std::is_signed<C>::value && std::is_signed<char>::value>* = nullptr>
static inline 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 inline CharType to_char_type(std::uint8_t x) noexcept
template<typename C = CharType, enable_if_t<std::is_unsigned<C>::value>* = nullptr>
static inline 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 inline constexpr CharType to_char_type(InputCharType x) noexcept