userver: userver/formats/json/parser/parser_json.hpp Source File
Loading...
Searching...
No Matches
parser_json.hpp
1#pragma once
2
3#include <userver/formats/json/parser/typed_parser.hpp>
4#include <userver/formats/json/value.hpp>
5#include <userver/utils/fast_pimpl.hpp>
6
7USERVER_NAMESPACE_BEGIN
8
9namespace formats::json::parser {
10
11/// SAX-parser for formats::json::Value
12class JsonValueParser final : public TypedParser<Value> {
13 public:
14 JsonValueParser();
15 ~JsonValueParser() override;
16
17 void Null() override;
18 void Bool(bool) override;
19 void Int64(int64_t) override;
20 void Uint64(uint64_t) override;
21 void Double(double) override;
22 void String(std::string_view) override;
23 void StartObject() override;
24 void Key(std::string_view key) override;
25 void EndObject(size_t) override;
26 void StartArray() override;
27 void EndArray(size_t) override;
28
29 std::string Expected() const override;
30
31 private:
32 void MaybePopSelf();
33
34 std::string GetPathItem() const override { return {}; }
35
36 struct Impl;
37 utils::FastPimpl<Impl, 127, 8> impl_;
38};
39
40} // namespace formats::json::parser
41
42USERVER_NAMESPACE_END