Template Class byte_container_with_subtype

Inheritance Relationships

Base Type

  • public BinaryType

Class Documentation

template<typename BinaryType>
class byte_container_with_subtype : public 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.

Since

version 3.8.0

Template Parameters:

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

Public Types

using container_type = BinaryType

the type of the underlying container

Public Functions

inline byte_container_with_subtype() noexcept(noexcept(container_type()))
inline byte_container_with_subtype(const container_type &b) noexcept(noexcept(container_type(b)))
inline byte_container_with_subtype(container_type &&b) noexcept(noexcept(container_type(std::move(b))))
inline byte_container_with_subtype(const container_type &b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))
inline byte_container_with_subtype(container_type &&b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
inline bool operator==(const byte_container_with_subtype &rhs) const
inline bool operator!=(const byte_container_with_subtype &rhs) const
inline void set_subtype(std::uint8_t subtype) 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() &#8212; return the binary subtype

See also

clear_subtype() &#8212; clears the binary subtype

See also

has_subtype() &#8212; returns whether or not the binary value has a subtype

Since

version 3.8.0

inline constexpr std::uint8_t subtype() const 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.

@complexity Constant.

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

See also

set_subtype() &#8212; sets the binary subtype

See also

clear_subtype() &#8212; clears the binary subtype

See also

has_subtype() &#8212; returns whether or not the binary value has a subtype

Since

version 3.8.0

Returns:

the numerical subtype of the binary value

inline constexpr bool has_subtype() const noexcept

return whether the value has a subtype

@complexity Constant.

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

See also

subtype() &#8212; return the binary subtype

See also

set_subtype() &#8212; sets the binary subtype

See also

clear_subtype() &#8212; clears the binary subtype

Since

version 3.8.0

Returns:

whether the value has a subtype

inline void clear_subtype() 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() &#8212; return the binary subtype

See also

set_subtype() &#8212; sets the binary subtype

See also

has_subtype() &#8212; returns whether or not the binary value has a subtype

Since

version 3.8.0