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