stream_parser::stream_parser
Constructors.
Synopsis
stream_parser() noexcept; (1)
explicit
stream_parser(
storage_ptr sp) noexcept; (2)
stream_parser(
storage_ptr sp,
parse_options const& opt) noexcept; (3)
stream_parser(
storage_ptr sp,
parse_options const& opt,
unsigned char* buffer,
std::size_t size) noexcept; (4)
template<
std::size_t N>
stream_parser(
storage_ptr sp,
parse_options const& opt,
unsigned char (&buffer) [N]) noexcept; (5)
stream_parser(
storage_ptr sp,
parse_options const& opt,
std::byte* buffer,
std::size_t size) noexcept; (6)
template<
std::size_t N>
stream_parser(
storage_ptr sp,
parse_options const& opt,
std::byte (&buffer) [N]) noexcept; (7)
stream_parser(
stream_parser const&) = delete; (8)
Description
Construct a new parser.
The parser will only support standard JSON if overloads (1) or (2) are used. Otherwise the parser will support extensions specified by the parameter opt
.
The parsed value will use the default memory resource for storage. To use a different resource, call reset
after construction.
The main difference between the overloads is in what the constructed parser will use for temporary storage:
-
(1) the constructed parser uses the default memory resource for temporary storage.
-
(2), (3) the constructed parser uses the memory resource of
sp
for temporary storage. -
(4), (6) the constructed parser first uses the caller-owned storage
[buffer, buffer + size)
for temporary storage, falling back to the memory resource ofsp
if needed. -
(5), (7) the constructed parser first uses the caller-owned storage
[buffer, buffer + N)
for temporary storage, falling back to the memory resource ofsp
if needed.
Ownership of |
Overload (8) is the copy constructor. The type is neither copyable nor movable, so the overload is deleted.
Complexity
Constant.
Exception Safety
No-throw guarantee.
Template Parameters
Type | Description |
---|---|
|
The number of valid bytes in |
Parameters
Name | Description |
---|---|
|
The memory resource to use for temporary storage. |
|
The parsing options to use. |
|
A pointer to valid storage. |
|
The number of valid bytes in |