3#include <userver/formats/json/parser/typed_parser.hpp>
9template <
typename Map,
typename ValueParser>
13 using Value =
typename Map::mapped_type;
15 explicit MapParser(ValueParser& value_parser) : value_parser_(value_parser) {}
17 void Reset()
override {
this->state_ = State::kStart; }
19 void StartObject()
override {
22 this->state_ = State::kInside;
30 void Key(std::string_view key)
override {
31 if (state_ != State::kInside)
this->Throw(
"object");
34 this->value_parser_.Reset();
35 this->value_parser_.Subscribe(*
this);
36 this->parser_state_->PushParser(
this->value_parser_.GetParser());
39 void EndObject()
override {
40 if (state_ == State::kInside) {
41 this->SetResult(std::move(result_));
48 std::string Expected()
const override {
61 void OnSend(Value&& value)
override {
62 this->result_.emplace(std::move(key_), std::move(value));
65 std::string GetPathItem()
const override {
return key_; }
74 ValueParser& value_parser_;