Release 0.111.0
Bug and warning fixes:
-
A case where the json parser performed validation on a string
before all bytes of the string had been read, and failed if
missing part of a multi-byte byte sequence, is fixed. -
An issue with reading a bignum with the pull parser
json_stream_reader
(in the case that an integer value
overflows) has been fixed. -
GCC and clang warnings about switch fall through have
been fixed
Non-breaking changes:
-
The functions
json::has_key
andcbor::has_key
have been
deprecated (but still work) and renamed tojson::contains
andcbor::contains
. Rationale: consistency with C++ 20
associative mapcontains
function. -
The json function
as_integer()
is now a template function,
template <class T = int64_t>
T as_integer();
where T can be any integral type, signed or unsigned. The
default parameter is for backwards compatability, but is
a depreated feature, and may be removed in a future version.
Prefer j.as<int64_t>().
-
The json functions
is_integer()
andis_uinteger()
have been deprecated and renamed tois_int64()
,is_uint64()
.
Prefer j.is<int64_t>() and j.is<uint64_t>(). -
The json function
as_uinteger()
has been deprecated.
Prefer j.as<uint64_t>().
and as_uinteger()
have been deprecated and renamed to
is_int64()
, is_uint64()
, as_int64()
and as_uint64()
.
Change to pull parser API:
-
The
stream_filter
functionaccept
has been changed to
take aconst stream_event&
and aconst serializing_context&
. -
stream_event_type::bignum_value
has been removed.stream_event
now exposes information about optional semantic tagging through
thesemantic_tag()
function.
Enhancements:
-
j.as<bignum>()
has been enhanced to return a bignum value
if j is an integer, floating point value, or any string that
contains an optional minus sign character followed by a sequence
of digits. -
j.as<T>()
has been enhanced to support extended integer
types that havestd::numeric_limits
specializations. In particular,
it supports GCC__int128
andunsigned __int128
when code is
compiled withstd=gnu++NN
, allowing abignum
to be returned as
an__int128
orunsigned __int128
. (when code is compiled with
-std=c++NN
,__int128
andunsigned __int128
do not have
std::numeric_limits
specializations.)
New feature:
This release accomodate the additional semantics for the
CBOR data items date-time (a string), and epoch time (a positive or
negative integer or floating point value), and decimal fraction
(converted in the jsoncons data model to a string).
But first, some of the virtual functions in json_content_handler
have to be modified to preserve these semantics. Consequently,
the function signatures
bool do_int64_value(int64_t, const serializing_context&)
bool do_uint64_value(uint64_t, const serializing_context&)
bool do_double_value(double, const floating_point_options&, const serializing_context&)
bool do_string_value(const string_view_type&, const serializing_context&)
bool do_byte_string_value(const uint8_t*, size_t, const serializing_context&)
have been gifted an additonal parameter, a semantic_tag_type
,
bool do_int64_value(int64_t, semantic_tag_type, const serializing_context&)
bool do_uint64_value(uint64_t, semantic_tag_type, const serializing_context&)
bool do_double_value(double, const floating_point_options&, semantic_tag_type, const serializing_context&)
bool do_string_value(const string_view_type&, semantic_tag_type, const serializing_context&)
bool do_byte_string_value(const uint8_t*, size_t, semantic_tag_type, const serializing_context&)
For consistency, the virtual function
bool do_bignum_value(const string_view_type&, const serializing_context&)
has been removed, and in its place do_string_value
will be called
with semantic_tag_type::bignum_type.
For users who have written classes that implement all or part of
json_content_handler
, including extensions to json_filter
,
these are breaking changes. But otherwise users should be unaffected.