userver: userver/formats/json/parser/parser_state.hpp Source File
Loading...
Searching...
No Matches
parser_state.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/formats/json/parser/parser_state.hpp
4/// @brief @copybrief formats::json::parser::ParserState
5/// @ingroup userver_universal
6
7#include <string>
8
9#include <userver/utils/fast_pimpl.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace formats::json::parser {
14
15class BaseParser;
16class ParserHandler;
17
18/// @brief Parser stack and streaming driver for JSON SAX parsing.
19class ParserState final {
20public:
21 ParserState();
22 ParserState(const ParserState&) = delete;
23 ParserState(ParserState&&) = delete;
24 ~ParserState();
25
26 ParserState& operator=(const ParserState&) = delete;
27
28 void PushParser(BaseParser& parser);
29
30 void ProcessInput(std::string_view sw);
31
32 void PopMe(BaseParser& parser);
33
34 [[noreturn]] void ThrowError(const std::string& err_msg);
35
36 std::string GetCurrentPath() const;
37
38private:
39 BaseParser& GetTopParser() const;
40
41 struct Impl;
42 utils::FastPimpl<Impl, 792, 8> impl_;
43
44 friend class ParserHandler;
45};
46
47} // namespace formats::json::parser
48
49USERVER_NAMESPACE_END