17 using Value =
typename Map::mapped_type;
19 explicit MapParser(ValueParser& value_parser)
20 : value_parser_(value_parser)
23 void Reset()
override {
this->state_ = State::kStart; }
25 void StartObject()
override {
28 this->state_ = State::kInside;
36 void Key(std::string_view key)
override {
37 if (state_ != State::kInside) {
38 this->Throw(
"object");
42 this->value_parser_.Reset();
43 this->value_parser_.Subscribe(*
this);
44 this->parser_state_->PushParser(
this->value_parser_.GetParser());
47 void EndObject()
override {
48 if (state_ == State::kInside) {
49 this->SetResult(std::move(result_));
56 std::string Expected()
const override {
69 void OnSend(Value&& value)
override {
this->result_.emplace(std::move(key_), std::move(value)); }
71 std::string GetPathItem()
const override {
return key_; }
77 State state_{State::kStart};
80 ValueParser& value_parser_;