A JSON parser.
More...
#include <json_parser.hpp>
|
| json_parser (std::unique_ptr< reader > &&p_reader, std::size_t buffer_capacity=default_buffer_capacity()) |
| Creates a JSON parser.
|
|
| ~json_parser () |
| Destroys the JSON parser.
|
|
bool | has_next () const |
| Returns true when the next element exists.
|
|
const element & | peek () const |
| Returns the current element.
|
|
void | next () |
| Moves to the next element.
|
|
A JSON parser.
Based on RFC 8259.
◆ json_parser()
Creates a JSON parser.
- Parameters
-
p_reader | A unique pointer to a reader. |
buffer_capacity | A buffer capacity. |
- Exceptions
-
std::invalid_argument | When p_reader is nullptr. |
◆ default_buffer_capacity()
static std::size_t tetengo::json::json_parser::default_buffer_capacity |
( |
| ) |
|
|
static |
Returns the default buffer capacity.
- Returns
- The default buffer capacity.
◆ has_next()
bool tetengo::json::json_parser::has_next |
( |
| ) |
const |
Returns true when the next element exists.
- Return values
-
true | When the next element exists. |
false | Otherwise. |
◆ next()
void tetengo::json::json_parser::next |
( |
| ) |
|
Moves to the next element.
- Exceptions
-
std::logic_error | When the current position is beyond the termination point. |
◆ peek()
const element & tetengo::json::json_parser::peek |
( |
| ) |
const |
Returns the current element.
- Returns
- The current element.
- Exceptions
-
std::logic_error | When the current position is beyond the termination point. |
The documentation for this class was generated from the following file: