♻️ rename internal_binary_t with binary_t

This commit is contained in:
Niels Lohmann committed 2020-05-17 22:50:27 +02:00
1 parent dead99eb0e
commit 904642f261
59 files changed
+536 -457

No files matched your search

+79 -19
View File
@@ -19,36 +19,51 @@ template<typename BinaryType>
class wrapped_binary_t : public BinaryType
{
public:
using binary_t = BinaryType;
/// the type of the underlying container
using container_type = BinaryType;
wrapped_binary_t() noexcept(noexcept(binary_t()))
: binary_t()
wrapped_binary_t() noexcept(noexcept(container_type()))
: container_type()
{}
wrapped_binary_t(const binary_t& b) noexcept(noexcept(binary_t(b)))
: binary_t(b)
wrapped_binary_t(const container_type& b) noexcept(noexcept(container_type(b)))
: container_type(b)
{}
wrapped_binary_t(binary_t&& b) noexcept(noexcept(binary_t(std::move(b))))
: binary_t(std::move(b))
wrapped_binary_t(container_type&& b) noexcept(noexcept(container_type(std::move(b))))
: container_type(std::move(b))
{}
wrapped_binary_t(const binary_t& b,
std::uint8_t subtype) noexcept(noexcept(binary_t(b)))
: binary_t(b)
wrapped_binary_t(const container_type& b,
std::uint8_t subtype) noexcept(noexcept(container_type(b)))
: container_type(b)
, m_subtype(subtype)
, m_has_subtype(true)
{}
wrapped_binary_t(binary_t&& b, std::uint8_t subtype) noexcept(noexcept(binary_t(std::move(b))))
: binary_t(std::move(b))
wrapped_binary_t(container_type&& b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
: container_type(std::move(b))
, m_subtype(subtype)
, m_has_subtype(true)
{}
/*!
@brief set the subtype
@param subtype subtype to set (implementation specific)
@brief 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.
@sa @ref subtype() -- return the binary subtype
@sa @ref clear_subtype() -- clears the binary subtype
@sa @ref has_subtype() -- returns whether or not the binary value has a
subtype
@since version 3.8.0
*/
void set_subtype(std::uint8_t subtype) noexcept
{
@@ -57,8 +72,25 @@ class wrapped_binary_t : public BinaryType
}
/*!
@brief get the subtype
@return subtype (implementation specific)
@brief 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.
@return the numerical subtype of the binary value
@complexity Constant.
@exceptionsafety No-throw guarantee: this member function never throws
exceptions.
@sa @ref set_subtype() -- sets the binary subtype
@sa @ref clear_subtype() -- clears the binary subtype
@sa @ref has_subtype() -- returns whether or not the binary value has a
subtype
@since version 3.8.0
*/
constexpr std::uint8_t subtype() const noexcept
{
@@ -66,8 +98,20 @@ class wrapped_binary_t : public BinaryType
}
/*!
@brief get whether a subtype was set
@return whether a subtype was set
@brief return whether the value has a subtype
@return whether the value has a subtype
@complexity Constant.
@exceptionsafety No-throw guarantee: this member function never throws
exceptions.
@sa @ref subtype() -- return the binary subtype
@sa @ref set_subtype() -- sets the binary subtype
@sa @ref clear_subtype() -- clears the binary subtype
@since version 3.8.0
*/
constexpr bool has_subtype() const noexcept
{
@@ -75,7 +119,23 @@ class wrapped_binary_t : public BinaryType
}
/*!
@brief clear the subtype
@brief 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.
@sa @ref subtype() -- return the binary subtype
@sa @ref set_subtype() -- sets the binary subtype
@sa @ref has_subtype() -- returns whether or not the binary value has a
subtype
@since version 3.8.0
*/
void clear_subtype() noexcept
{