mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
Tag binary values in cbor if set
CBOR has tags, which work similarly to "subtype"s: https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml Unsure if this makes sense. Note that the subtype must just be one byte wide.
This commit is contained in:
@ -279,6 +279,12 @@ class binary_writer
|
|||||||
|
|
||||||
case value_t::binary:
|
case value_t::binary:
|
||||||
{
|
{
|
||||||
|
if (j.m_value.binary->has_subtype())
|
||||||
|
{
|
||||||
|
write_number(static_cast<std::uint8_t>(0xd8));
|
||||||
|
write_number(j.m_value.binary->subtype());
|
||||||
|
}
|
||||||
|
|
||||||
// step 1: write control byte and the binary array size
|
// step 1: write control byte and the binary array size
|
||||||
const auto N = j.m_value.binary->size();
|
const auto N = j.m_value.binary->size();
|
||||||
if (N <= 0x17)
|
if (N <= 0x17)
|
||||||
|
@ -12641,6 +12641,12 @@ class binary_writer
|
|||||||
|
|
||||||
case value_t::binary:
|
case value_t::binary:
|
||||||
{
|
{
|
||||||
|
if (j.m_value.binary->has_subtype())
|
||||||
|
{
|
||||||
|
write_number(static_cast<std::uint8_t>(0xd8));
|
||||||
|
write_number(j.m_value.binary->subtype());
|
||||||
|
}
|
||||||
|
|
||||||
// step 1: write control byte and the binary array size
|
// step 1: write control byte and the binary array size
|
||||||
const auto N = j.m_value.binary->size();
|
const auto N = j.m_value.binary->size();
|
||||||
if (N <= 0x17)
|
if (N <= 0x17)
|
||||||
|
Reference in New Issue
Block a user