tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
json_parser.hpp
Go to the documentation of this file.
1
7#if !defined(TETENGO_JSON_JSONPARSER_HPP)
8#define TETENGO_JSON_JSONPARSER_HPP
9
10#include <cstddef>
11#include <memory>
12
13#include <boost/core/noncopyable.hpp>
14
15
16namespace tetengo::json
17{
18 class element;
19 class reader;
20
21
27 class json_parser : private boost::noncopyable
28 {
29 public:
30 // static functions
31
37 [[nodiscard]] static std::size_t default_buffer_capacity();
38
39
40 // constructors and destructor
41
50 explicit json_parser(
51 std::unique_ptr<reader>&& p_reader,
52 std::size_t buffer_capacity = default_buffer_capacity());
53
58
59
60 // functions
61
68 [[nodiscard]] bool has_next() const;
69
77 [[nodiscard]] const element& peek() const;
78
84 void next();
85
86
87 private:
88 // types
89
90 class impl;
91
92
93 // variables
94
95 const std::unique_ptr<impl> m_p_impl;
96 };
97
98
99}
100
101
102#endif
An element.
Definition element.hpp:22
A JSON parser.
Definition json_parser.hpp:28
const element & peek() const
Returns the current element.
bool has_next() const
Returns true when the next element exists.
static std::size_t default_buffer_capacity()
Returns the default buffer capacity.
json_parser(std::unique_ptr< reader > &&p_reader, std::size_t buffer_capacity=default_buffer_capacity())
Creates a JSON parser.
void next()
Moves to the next element.
~json_parser()
Destroys the JSON parser.
A JSON library.