an internal type for a backed binary type More...
#include "json.h"
Public Types | |
using | container_type = BinaryType |
the type of the underlying container 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, std::uint8_t 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, std::uint8_t 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 (std::uint8_t subtype) noexcept |
sets the binary subtype More... | |
constexpr std::uint8_t | subtype () const noexcept |
return the binary subtype More... | |
Private Attributes | |
bool | m_has_subtype = false |
std::uint8_t | m_subtype = 0 |
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.
BinaryType | container to store bytes (std::vector<std::uint8_t> by default) |
using nlohmann::byte_container_with_subtype< BinaryType >::container_type = BinaryType |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
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.
Definition at line 4631 of file json.h.
References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype, and nlohmann::byte_container_with_subtype< BinaryType >::m_subtype.
|
inlineconstexprnoexcept |
return whether the value has a subtype
@complexity Constant.
@exceptionsafety No-throw guarantee: this member function never throws exceptions.
Definition at line 4607 of file json.h.
References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype.
|
inline |
|
inline |
Definition at line 4530 of file json.h.
References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype, and nlohmann::byte_container_with_subtype< BinaryType >::m_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.
Definition at line 4559 of file json.h.
References nlohmann::byte_container_with_subtype< BinaryType >::m_has_subtype, nlohmann::byte_container_with_subtype< BinaryType >::m_subtype, and nlohmann::byte_container_with_subtype< BinaryType >::subtype().
|
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 size_t(-1) as a sentinel value.
@complexity Constant.
@exceptionsafety No-throw guarantee: this member function never throws exceptions.
Definition at line 4586 of file json.h.
References nlohmann::byte_container_with_subtype< BinaryType >::m_subtype.
Referenced by nlohmann::byte_container_with_subtype< BinaryType >::set_subtype().
|
private |
Definition at line 4639 of file json.h.
Referenced by nlohmann::byte_container_with_subtype< BinaryType >::clear_subtype(), nlohmann::byte_container_with_subtype< BinaryType >::has_subtype(), nlohmann::byte_container_with_subtype< BinaryType >::operator==(), and nlohmann::byte_container_with_subtype< BinaryType >::set_subtype().
|
private |
Definition at line 4638 of file json.h.
Referenced by nlohmann::byte_container_with_subtype< BinaryType >::clear_subtype(), nlohmann::byte_container_with_subtype< BinaryType >::operator==(), nlohmann::byte_container_with_subtype< BinaryType >::set_subtype(), and nlohmann::byte_container_with_subtype< BinaryType >::subtype().