Renderd7-nightly v0.7.0

Public Types | Public Member Functions | List of all members
nlohmann::byte_container_with_subtype< BinaryType > Class Template Reference

an internal type for a backed binary type More...

`#include <json.hpp>`

Inherits BinaryType.

## Public Types
using | container_type = BinaryType
| the type of the underlying container

## Public Member Functions
void | set_subtype (std::uint8_t subtype) noexcept
| sets the binary subtype More...
constexpr std::uint8_t | subtype () const noexcept
| return the binary subtype More...
constexpr bool | has_subtype () const noexcept
| return whether the value has a subtype More...
void | clear_subtype () noexcept
| clears the binary subtype More...

## Detailed Description

### template<typename BinaryType>
class nlohmann::byte_container_with_subtype< BinaryType >

an internal type for a backed binary type

This type extends the template parameter BinaryType provided to `basic_json` with a subtype used by BSON and MessagePack. This type exists so that the user does not have to specify a type themselves with a specific naming scheme in order to override the binary type.

Template Parameters

  BinaryType | container to store bytes (`std::vector<std::uint8_t>` by default)

Since
  version 3.8.0

## Member Function Documentation

## ◆ set_subtype()

template<typename BinaryType >

void nlohmann::byte_container_with_subtype< BinaryType >::set_subtype | ( | std::uint8_t | subtype | ) |
| inline noexcept

sets the binary subtype

Sets the binary subtype of the value, also flags a binary JSON value as having a subtype, which has implications for serialization.

@complexity Constant.

@exceptionsafety No-throw guarantee: this member function never throws exceptions.

See also
  subtype() – return the binary subtype
  clear_subtype() – clears the binary subtype
  has_subtype() – returns whether or not the binary value has a subtype

Since
  version 3.8.0

## ◆ subtype()

template<typename BinaryType >

constexpr std::uint8_t nlohmann::byte_container_with_subtype< BinaryType >::subtype | ( |  | ) | const
| inline constexpr noexcept

return the binary subtype

Returns the numerical subtype of the value if it has a subtype. If it does not have a subtype, this function will return size_t(-1) as a sentinel value.

Returns
  the numerical subtype of the binary value

@complexity Constant.

@exceptionsafety No-throw guarantee: this member function never throws exceptions.

See also
  set_subtype() – sets the binary subtype
  clear_subtype() – clears the binary subtype
  has_subtype() – returns whether or not the binary value has a subtype

Since
  version 3.8.0

## ◆ has_subtype()

template<typename BinaryType >

constexpr bool nlohmann::byte_container_with_subtype< BinaryType >::has_subtype | ( |  | ) | const
| inline constexpr noexcept

return whether the value has a subtype

Returns
  whether the value has a subtype

@complexity Constant.

@exceptionsafety No-throw guarantee: this member function never throws exceptions.

See also
  subtype() – return the binary subtype
  set_subtype() – sets the binary subtype
  clear_subtype() – clears the binary subtype

Since
  version 3.8.0

## ◆ clear_subtype()

template<typename BinaryType >

void nlohmann::byte_container_with_subtype< BinaryType >::clear_subtype | ( |  | ) |
| inline noexcept

clears the binary subtype

Clears the binary subtype and flags the value as not having a subtype, which has implications for serialization; for instance MessagePack will prefer the bin family over the ext family.

@complexity Constant.

@exceptionsafety No-throw guarantee: this member function never throws exceptions.

See also
  subtype() – return the binary subtype
  set_subtype() – sets the binary subtype
  has_subtype() – returns whether or not the binary value has a subtype

Since
  version 3.8.0