Public Member Functions | Private Member Functions | Private Attributes | List of all members
nlohmann::detail::binary_writer< BasicJsonType, CharType > Class Template Reference

serialization to CBOR and MessagePack values More...

#include <json.hpp>

Public Member Functions

 binary_writer (output_adapter_t< CharType > adapter)
 create a binary writer More...
 
void write_cbor (const BasicJsonType &j)
 [in] j JSON value to serialize More...
 
void write_msgpack (const BasicJsonType &j)
 [in] j JSON value to serialize More...
 
void write_ubjson (const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true)
 

Private Member Functions

char ubjson_prefix (const BasicJsonType &j) const noexcept
 determine the type prefix of container values More...
 
template<typename NumberType >
void write_number (const NumberType n)
 
template<typename NumberType , typename std::enable_if< std::is_floating_point< NumberType >::value, int >::type = 0>
void write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix)
 
template<typename NumberType , typename std::enable_if< std::is_unsigned< NumberType >::value, int >::type = 0>
void write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix)
 
template<typename NumberType , typename std::enable_if< std::is_signed< NumberType >::value andnot std::is_floating_point< NumberType >::value, int >::type = 0>
void write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix)
 

Private Attributes

const bool is_little_endian = binary_reader<BasicJsonType>::little_endianess()
 whether we can assume little endianess More...
 
output_adapter_t< CharType > oa = nullptr
 the output More...
 

Detailed Description

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

serialization to CBOR and MessagePack values

Definition at line 6232 of file json.hpp.

Constructor & Destructor Documentation

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 6240 of file json.hpp.

Member Function Documentation

template<typename BasicJsonType , typename CharType >
char nlohmann::detail::binary_writer< BasicJsonType, CharType >::ubjson_prefix ( const BasicJsonType &  j) const
inlineprivatenoexcept

determine the type prefix of container values

Note
This function does not need to be 100% accurate when it comes to integer limits. In case a number exceeds the limits of int64_t, this will be detected by a later call to function write_number_with_ubjson_prefix. Therefore, we return 'L' for any value that does not fit the previous limits.

Definition at line 7044 of file json.hpp.

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

[in] j JSON value to serialize

Definition at line 6248 of file json.hpp.

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

[in] j JSON value to serialize

Definition at line 6492 of file json.hpp.

template<typename BasicJsonType , typename CharType >
template<typename NumberType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number ( const NumberType  n)
inlineprivate

Definition at line 6899 of file json.hpp.

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

Definition at line 6918 of file json.hpp.

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

Definition at line 6931 of file json.hpp.

template<typename BasicJsonType , typename CharType >
template<typename NumberType , typename std::enable_if< std::is_signed< NumberType >::value andnot 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

Definition at line 6984 of file json.hpp.

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_ubjson ( const BasicJsonType &  j,
const bool  use_count,
const bool  use_type,
const bool  add_prefix = true 
)
inline
Parameters
[in]jJSON value to serialize
[in]use_countwhether to use '#' prefixes (optimized format)
[in]use_typewhether to use '$' prefixes (optimized format)
[in]add_prefixwhether prefixes need to be used for this value

Definition at line 6734 of file json.hpp.

Member Data Documentation

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

whether we can assume little endianess

Definition at line 7121 of file json.hpp.

template<typename BasicJsonType , typename CharType >
output_adapter_t<CharType> nlohmann::detail::binary_writer< BasicJsonType, CharType >::oa = nullptr
private

the output

Definition at line 7124 of file json.hpp.


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


json_transport
Author(s): Paul Bovbel
autogenerated on Thu Jun 13 2019 19:12:24