mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
📝 release preparation
This commit is contained in:
@ -1276,7 +1276,7 @@ class basic_json
|
||||
was provided), strong guarantee holds: if an exception is thrown, there are
|
||||
no changes to any JSON value.
|
||||
|
||||
@since version 3.1.2
|
||||
@since version 3.2.0
|
||||
*/
|
||||
template <typename BasicJsonType,
|
||||
detail::enable_if_t<
|
||||
@ -2509,7 +2509,7 @@ class basic_json
|
||||
@complexity Depending on the implementation of the called `from_json()`
|
||||
method.
|
||||
|
||||
@since version 3.1.2
|
||||
@since version 3.2.0
|
||||
*/
|
||||
template<typename BasicJsonType, detail::enable_if_t<
|
||||
not std::is_same<BasicJsonType, basic_json>::value and
|
||||
@ -6014,6 +6014,58 @@ class basic_json
|
||||
return parser(i).accept(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief generate SAX events
|
||||
|
||||
The SAX event lister must follow the interface of @ref json_sax.
|
||||
|
||||
This function reads from a compatible input. Examples are:
|
||||
- an array of 1-byte values
|
||||
- strings with character/literal type with size of 1 byte
|
||||
- input streams
|
||||
- container with contiguous storage of 1-byte values. Compatible container
|
||||
types include `std::vector`, `std::string`, `std::array`,
|
||||
`std::valarray`, and `std::initializer_list`. Furthermore, C-style
|
||||
arrays can be used with `std::begin()`/`std::end()`. User-defined
|
||||
containers can be used as long as they implement random-access iterators
|
||||
and a contiguous storage.
|
||||
|
||||
@pre Each element of the container has a size of 1 byte. Violating this
|
||||
precondition yields undefined behavior. **This precondition is enforced
|
||||
with a static assertion.**
|
||||
|
||||
@pre The container storage is contiguous. Violating this precondition
|
||||
yields undefined behavior. **This precondition is enforced with an
|
||||
assertion.**
|
||||
@pre Each element of the container has a size of 1 byte. Violating this
|
||||
precondition yields undefined behavior. **This precondition is enforced
|
||||
with a static assertion.**
|
||||
|
||||
@warning There is no way to enforce all preconditions at compile-time. If
|
||||
the function is called with a noncompliant container and with
|
||||
assertions switched off, the behavior is undefined and will most
|
||||
likely yield segmentation violation.
|
||||
|
||||
@param[in] i input to read from
|
||||
@param[in,out] sax SAX event listener
|
||||
@param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON)
|
||||
@param[in] strict whether the input has to be consumed completely
|
||||
|
||||
@return return value of the last processed SAX event
|
||||
|
||||
@throw parse_error.101 if a parse error occurs; example: `""unexpected end
|
||||
of input; expected string literal""`
|
||||
@throw parse_error.102 if to_unicode fails or surrogate error
|
||||
@throw parse_error.103 if to_unicode fails
|
||||
|
||||
@complexity Linear in the length of the input. The parser is a predictive
|
||||
LL(1) parser. The complexity can be higher if the SAX consumer @a sax has
|
||||
a super-linear complexity.
|
||||
|
||||
@note A UTF-8 byte order mark is silently ignored.
|
||||
|
||||
@since version 3.2.0
|
||||
*/
|
||||
template <typename SAX>
|
||||
static bool sax_parse(detail::input_adapter&& i, SAX* sax,
|
||||
input_format_t format = input_format_t::json,
|
||||
@ -7215,11 +7267,13 @@ class basic_json
|
||||
break;
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
default:
|
||||
{
|
||||
// if there exists a parent it cannot be primitive
|
||||
assert(false); // LCOV_EXCL_LINE
|
||||
assert(false);
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user