File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
docs/mkdocs/docs/api/basic_json
include/nlohmann/detail/output Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,11 @@ The exact mapping and its limitations is described on a [dedicated page](../../f
37
37
38
38
`use_type` (in)
39
39
: whether to add type annotations to container types (must be combined with `#!cpp use_size = true`); optional,
40
+ `#!cpp false` by default.
40
41
41
42
`version` (in)
42
- : which version of BJData to use (see [draft 3](../../features/binary_formats/bjdata.md#draft-3-binary-format)); optional,
43
- `#!cpp false ` by default.
43
+ : which version of BJData to use (see [draft 3](../../features/binary_formats/bjdata.md#draft-3-binary-format));
44
+ optional, `#!cpp bjdata_version_t::draft2 ` by default.
44
45
45
46
## Return value
46
47
Original file line number Diff line number Diff line change @@ -748,7 +748,7 @@ class binary_writer
748
748
const bool use_type, const bool add_prefix = true ,
749
749
const bool use_bjdata = false , const bjdata_version_t bjdata_version = bjdata_version_t ::draft2)
750
750
{
751
- const bool bjdata_draft3 = bjdata_version == bjdata_version_t ::draft3;
751
+ const bool bjdata_draft3 = use_bjdata && bjdata_version == bjdata_version_t ::draft3;
752
752
753
753
switch (j.type ())
754
754
{
@@ -857,11 +857,11 @@ class binary_writer
857
857
oa->write_character (to_char_type (' [' ));
858
858
}
859
859
860
- if (use_type && ((use_bjdata && bjdata_draft3) || !j.m_data .m_value .binary ->empty ()))
860
+ if (use_type && (bjdata_draft3 || !j.m_data .m_value .binary ->empty ()))
861
861
{
862
862
JSON_ASSERT (use_count);
863
863
oa->write_character (to_char_type (' $' ));
864
- oa->write_character (use_bjdata && bjdata_draft3 ? ' B' : ' U' );
864
+ oa->write_character (bjdata_draft3 ? ' B' : ' U' );
865
865
}
866
866
867
867
if (use_count)
@@ -880,7 +880,7 @@ class binary_writer
880
880
{
881
881
for (size_t i = 0 ; i < j.m_data .m_value .binary ->size (); ++i)
882
882
{
883
- oa->write_character (to_char_type ((use_bjdata && bjdata_draft3) ? ' B' : ' U' ));
883
+ oa->write_character (to_char_type (bjdata_draft3 ? ' B' : ' U' ));
884
884
oa->write_character (j.m_data .m_value .binary ->data ()[i]);
885
885
}
886
886
}
Original file line number Diff line number Diff line change @@ -16390,7 +16390,7 @@ class binary_writer
16390
16390
const bool use_type, const bool add_prefix = true,
16391
16391
const bool use_bjdata = false, const bjdata_version_t bjdata_version = bjdata_version_t::draft2)
16392
16392
{
16393
- const bool bjdata_draft3 = bjdata_version == bjdata_version_t::draft3;
16393
+ const bool bjdata_draft3 = use_bjdata && bjdata_version == bjdata_version_t::draft3;
16394
16394
16395
16395
switch (j.type())
16396
16396
{
@@ -16499,11 +16499,11 @@ class binary_writer
16499
16499
oa->write_character(to_char_type('['));
16500
16500
}
16501
16501
16502
- if (use_type && ((use_bjdata && bjdata_draft3) || !j.m_data.m_value.binary->empty()))
16502
+ if (use_type && (bjdata_draft3 || !j.m_data.m_value.binary->empty()))
16503
16503
{
16504
16504
JSON_ASSERT(use_count);
16505
16505
oa->write_character(to_char_type('$'));
16506
- oa->write_character(use_bjdata && bjdata_draft3 ? 'B' : 'U');
16506
+ oa->write_character(bjdata_draft3 ? 'B' : 'U');
16507
16507
}
16508
16508
16509
16509
if (use_count)
@@ -16522,7 +16522,7 @@ class binary_writer
16522
16522
{
16523
16523
for (size_t i = 0; i < j.m_data.m_value.binary->size(); ++i)
16524
16524
{
16525
- oa->write_character(to_char_type((use_bjdata && bjdata_draft3) ? 'B' : 'U'));
16525
+ oa->write_character(to_char_type(bjdata_draft3 ? 'B' : 'U'));
16526
16526
oa->write_character(j.m_data.m_value.binary->data()[i]);
16527
16527
}
16528
16528
}
You can’t perform that action at this time.
0 commit comments