Crossfire Server, Trunk
nlohmann::byte_container_with_subtype< BinaryType > Class Template Reference

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

#include <json.hpp>

+ Inheritance diagram for nlohmann::byte_container_with_subtype< BinaryType >:
+ Collaboration diagram for nlohmann::byte_container_with_subtype< BinaryType >:

Public Types

using container_type = BinaryType
 the type of the underlying container More...
 
using subtype_type = std::uint64_t
 the type of the subtype More...
 

Public Member Functions

 byte_container_with_subtype () noexcept(noexcept(container_type()))
 
 byte_container_with_subtype (const container_type &b) noexcept(noexcept(container_type(b)))
 
 byte_container_with_subtype (const container_type &b, subtype_type subtype_) noexcept(noexcept(container_type(b)))
 
 byte_container_with_subtype (container_type &&b) noexcept(noexcept(container_type(std::move(b))))
 
 byte_container_with_subtype (container_type &&b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))))
 
void clear_subtype () noexcept
 clears the binary subtype More...
 
constexpr bool has_subtype () const noexcept
 return whether the value has a subtype More...
 
bool operator!= (const byte_container_with_subtype &rhs) const
 
bool operator== (const byte_container_with_subtype &rhs) const
 
void set_subtype (subtype_type subtype_) noexcept
 sets the binary subtype More...
 
constexpr subtype_type subtype () const noexcept
 return the binary subtype More...
 

Private Attributes

bool m_has_subtype = false
 
subtype_type m_subtype = 0
 

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
BinaryTypecontainer to store bytes (std::vector<std::uint8_t> by default)
Since
version 3.8.0; changed type of subtypes to std::uint64_t in 3.10.0.

Definition at line 5010 of file json.hpp.

Member Typedef Documentation

◆ container_type

template<typename BinaryType >
using nlohmann::byte_container_with_subtype< BinaryType >::container_type = BinaryType

the type of the underlying container

Definition at line 5014 of file json.hpp.

◆ subtype_type

template<typename BinaryType >
using nlohmann::byte_container_with_subtype< BinaryType >::subtype_type = std::uint64_t

the type of the subtype

Definition at line 5016 of file json.hpp.

Constructor & Destructor Documentation

◆ byte_container_with_subtype() [1/5]

template<typename BinaryType >
nlohmann::byte_container_with_subtype< BinaryType >::byte_container_with_subtype ( )
inlinenoexcept

Definition at line 5018 of file json.hpp.

◆ byte_container_with_subtype() [2/5]

template<typename BinaryType >
nlohmann::byte_container_with_subtype< BinaryType >::byte_container_with_subtype ( const container_type b)
inlinenoexcept

Definition at line 5022 of file json.hpp.

◆ byte_container_with_subtype() [3/5]

template<typename BinaryType >
nlohmann::byte_container_with_subtype< BinaryType >::byte_container_with_subtype ( container_type &&  b)
inlinenoexcept

Definition at line 5026 of file json.hpp.

◆ byte_container_with_subtype() [4/5]

template<typename BinaryType >
nlohmann::byte_container_with_subtype< BinaryType >::byte_container_with_subtype ( const container_type b,
subtype_type  subtype_ 
)
inlinenoexcept

Definition at line 5030 of file json.hpp.

◆ byte_container_with_subtype() [5/5]

template<typename BinaryType >
nlohmann::byte_container_with_subtype< BinaryType >::byte_container_with_subtype ( container_type &&  b,
subtype_type  subtype_ 
)
inlinenoexcept

Definition at line 5036 of file json.hpp.

Member Function Documentation

◆ clear_subtype()

template<typename BinaryType >
void nlohmann::byte_container_with_subtype< BinaryType >::clear_subtype ( )
inlinenoexcept

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
see subtype() – return the binary subtype
see set_subtype() – sets the binary subtype
see has_subtype() – returns whether or not the binary value has a subtype
Since
version 3.8.0

Definition at line 5144 of file json.hpp.

References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype, and nlohmann::byte_container_with_subtype< BinaryType >::m_subtype.

◆ has_subtype()

template<typename BinaryType >
constexpr bool nlohmann::byte_container_with_subtype< BinaryType >::has_subtype ( ) const
inlineconstexprnoexcept

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
see subtype() – return the binary subtype
see set_subtype() – sets the binary subtype
see clear_subtype() – clears the binary subtype
Since
version 3.8.0

Definition at line 5120 of file json.hpp.

References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype.

◆ operator!=()

template<typename BinaryType >
bool nlohmann::byte_container_with_subtype< BinaryType >::operator!= ( const byte_container_with_subtype< BinaryType > &  rhs) const
inline

Definition at line 5048 of file json.hpp.

◆ operator==()

template<typename BinaryType >
bool nlohmann::byte_container_with_subtype< BinaryType >::operator== ( const byte_container_with_subtype< BinaryType > &  rhs) const
inline

◆ set_subtype()

template<typename BinaryType >
void nlohmann::byte_container_with_subtype< BinaryType >::set_subtype ( subtype_type  subtype_)
inlinenoexcept

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
see subtype() – return the binary subtype
see clear_subtype() – clears the binary subtype
see has_subtype() – returns whether or not the binary value has a subtype
Since
version 3.8.0

Definition at line 5071 of file json.hpp.

References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype, and nlohmann::byte_container_with_subtype< BinaryType >::m_subtype.

◆ subtype()

template<typename BinaryType >
constexpr subtype_type nlohmann::byte_container_with_subtype< BinaryType >::subtype ( ) const
inlineconstexprnoexcept

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 subtype_type(-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
see set_subtype() – sets the binary subtype
see clear_subtype() – clears the binary subtype
see has_subtype() – returns whether or not the binary value has a subtype
Since
version 3.8.0; fixed return value to properly return subtype_type(-1) as documented in version 3.10.0

Definition at line 5099 of file json.hpp.

References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype, and nlohmann::byte_container_with_subtype< BinaryType >::m_subtype.

Field Documentation

◆ m_has_subtype

◆ m_subtype


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