aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json/unknown_fields_collector.h
blob: 1e71f2164cc06d4eb2737c7c632f1650d42077ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <util/generic/string.h>

namespace google {
    namespace protobuf {
        class FieldDescriptor;
        class Descriptor;
    }
}

namespace NProtobufJson {
    /*  Methods OnEnter.../OnLeave... are called on every field of structure
     *  during traverse and should be used to build context
     *  Method OnUnknownField are called every time when field which can't
     *  be mapped
     */
    struct IUnknownFieldsCollector {
        virtual ~IUnknownFieldsCollector() = default;

        virtual void OnEnterMapItem(const TString& key) = 0;
        virtual void OnLeaveMapItem() = 0;

        virtual void OnEnterArrayItem(ui64 id) = 0;
        virtual void OnLeaveArrayItem() = 0;

        virtual void OnUnknownField(const TString& key, const google::protobuf::Descriptor& value) = 0;
    };
}