🚚 rename binary_array() to binary()

This commit is contained in:
Niels Lohmann 2020-05-19 13:30:22 +02:00
parent 86b053e916
commit 21b1680ea1
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
16 changed files with 85 additions and 61 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <cstdint> // uint8_t
#include <tuple> // tie
#include <utility> // move
namespace nlohmann
@ -51,6 +52,17 @@ class byte_container_with_subtype : public BinaryType
, m_has_subtype(true)
{}
bool operator==(const byte_container_with_subtype& rhs) const
{
return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==
std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);
}
bool operator!=(const byte_container_with_subtype& rhs) const
{
return !(rhs == *this);
}
/*!
@brief sets the binary subtype

View file

@ -899,7 +899,7 @@ class basic_json
- If a subtype is given, it is used and added as unsigned 8-bit integer.
- If no subtype is given, the generic binary subtype 0x00 is used.
@sa @ref binary_array -- create a binary array
@sa @ref binary -- create a binary array
@since version 3.8.0
*/
@ -1672,7 +1672,7 @@ class basic_json
@since version 3.8.0
*/
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json binary_array(const typename binary_t::container_type& init)
static basic_json binary(const typename binary_t::container_type& init)
{
auto res = basic_json();
res.m_type = value_t::binary;
@ -1709,7 +1709,7 @@ class basic_json
@since version 3.8.0
*/
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json binary_array(const typename binary_t::container_type& init, std::uint8_t subtype)
static basic_json binary(const typename binary_t::container_type& init, std::uint8_t subtype)
{
auto res = basic_json();
res.m_type = value_t::binary;
@ -1717,9 +1717,9 @@ class basic_json
return res;
}
/// @copydoc binary_array(const typename binary_t::container_type&)
/// @copydoc binary(const typename binary_t::container_type&)
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json binary_array(typename binary_t::container_type&& init)
static basic_json binary(typename binary_t::container_type&& init)
{
auto res = basic_json();
res.m_type = value_t::binary;
@ -1727,9 +1727,9 @@ class basic_json
return res;
}
/// @copydoc binary_array(const typename binary_t::container_type&, std::uint8_t)
/// @copydoc binary(const typename binary_t::container_type&, std::uint8_t)
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json binary_array(typename binary_t::container_type&& init, std::uint8_t subtype)
static basic_json binary(typename binary_t::container_type&& init, std::uint8_t subtype)
{
auto res = basic_json();
res.m_type = value_t::binary;