diff options
author | innokentii <innokentii@yandex-team.com> | 2023-09-29 00:02:43 +0300 |
---|---|---|
committer | innokentii <innokentii@yandex-team.com> | 2023-09-29 00:22:17 +0300 |
commit | 95fac3fb8d054fb4f0b538d358e09bbadcffbc91 (patch) | |
tree | 78f954781759681d6793710cca8ea2e407bebbbd /library/cpp/protobuf/json/unknown_fields_collector.h | |
parent | af047ff0da562d2220c693343306c4833e875040 (diff) | |
download | ydb-95fac3fb8d054fb4f0b538d358e09bbadcffbc91.tar.gz |
Add basic unknown fields collector
add basic unknown fields collector
Diffstat (limited to 'library/cpp/protobuf/json/unknown_fields_collector.h')
-rw-r--r-- | library/cpp/protobuf/json/unknown_fields_collector.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/library/cpp/protobuf/json/unknown_fields_collector.h b/library/cpp/protobuf/json/unknown_fields_collector.h new file mode 100644 index 0000000000..1e71f2164c --- /dev/null +++ b/library/cpp/protobuf/json/unknown_fields_collector.h @@ -0,0 +1,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; + }; +} |