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_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)
| 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 and 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 and 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 and std::is_signed< char >::value and std::is_same< char, typename std::remove_cv< InputCharType >::type >::value > * = nullptr>
static 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 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

## Detailed Description

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

serialization to CBOR and MessagePack values

## Constructor & Destructor Documentation

## binary_writer() [1/2]

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] | adapter | output adapter to write to

## binary_writer() [2/2]

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] | adapter | output adapter to write to

## Member Function Documentation

## to_char_type() [1/8]

template<typename BasicJsonType , typename CharType >
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 constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type | ( | InputCharType | x | ) |

inlinestaticconstexprnoexcept

## to_char_type() [2/8]

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

## to_char_type() [3/8]

template<typename BasicJsonType , typename CharType >
template<typename C = CharType, enable_if_t< std::is_signed< C >::value and std::is_signed< char >::value > * = nullptr>

static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type | ( | std::uint8_t | x | ) |

inlinestaticconstexprnoexcept

## to_char_type() [4/8]

template<typename BasicJsonType , typename CharType >
template<typename C = CharType, enable_if_t< std::is_signed< C >::value and std::is_unsigned< char >::value > * = nullptr>

static CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type | ( | std::uint8_t | x | ) |

inlinestaticnoexcept

## to_char_type() [5/8]

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

## to_char_type() [6/8]

template<typename BasicJsonType , typename CharType >
template<typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_signed< char >::value > * = nullptr>

static constexpr CharType nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type | ( | std::uint8_t | x | ) |

inlinestaticconstexprnoexcept

## to_char_type() [7/8]

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

## to_char_type() [8/8]

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

## write_bson() [1/2]

template<typename BasicJsonType , typename CharType >

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

inline

Parameters

  [in] | j | JSON value to serialize

Precondition
  j.type() == value_t::object

## write_bson() [2/2]

template<typename BasicJsonType , typename CharType >

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

inline

Parameters

  [in] | j | JSON value to serialize

Precondition
  j.type() == value_t::object

## write_cbor() [1/2]

template<typename BasicJsonType , typename CharType >

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

inline

Parameters

  [in] | j | JSON value to serialize

## write_cbor() [2/2]

template<typename BasicJsonType , typename CharType >

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

inline

Parameters

  [in] | j | JSON value to serialize

## write_msgpack() [1/2]

template<typename BasicJsonType , typename CharType >

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

inline

Parameters

  [in] | j | JSON value to serialize

## write_msgpack() [2/2]

template<typename BasicJsonType , typename CharType >

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

inline

Parameters

  [in] | j | JSON value to serialize

## write_ubjson() [1/2]

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] | j | JSON value to serialize
  [in] | use_count | whether to use '#' prefixes (optimized format)
  [in] | use_type | whether to use '$' prefixes (optimized format)
  [in] | add_prefix | whether prefixes need to be used for this value

## write_ubjson() [2/2]

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] | j | JSON value to serialize
  [in] | use_count | whether to use '#' prefixes (optimized format)
  [in] | use_type | whether to use '$' prefixes (optimized format)
  [in] | add_prefix | whether prefixes need to be used for this value

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

- build/_deps/json-src/include/nlohmann/json.hpp