diff options
author | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-02-10 16:49:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:10 +0300 |
commit | 1eb755fbca92172a6aec2f57371b2b3a19dfab43 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/json/proto2json_printer.h | |
parent | 6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (diff) | |
download | ydb-1eb755fbca92172a6aec2f57371b2b3a19dfab43.tar.gz |
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/proto2json_printer.h')
-rw-r--r-- | library/cpp/protobuf/json/proto2json_printer.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/protobuf/json/proto2json_printer.h b/library/cpp/protobuf/json/proto2json_printer.h index 866fd8b545..9dc5aa86c6 100644 --- a/library/cpp/protobuf/json/proto2json_printer.h +++ b/library/cpp/protobuf/json/proto2json_printer.h @@ -1,62 +1,62 @@ -#pragma once - -#include "json_output.h" - +#pragma once + +#include "json_output.h" + #include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/message.h> - -#include <util/generic/strbuf.h> + +#include <util/generic/strbuf.h> #include <util/generic/string.h> - -namespace NProtobufJson { + +namespace NProtobufJson { struct TProto2JsonConfig; - + class TProto2JsonPrinter { public: TProto2JsonPrinter(const TProto2JsonConfig& config); virtual ~TProto2JsonPrinter(); - + virtual void Print(const NProtoBuf::Message& proto, IJsonOutput& json, bool closeMap = true); - + virtual const TProto2JsonConfig& GetConfig() const { return Config; } - + protected: virtual TStringBuf MakeKey(const NProtoBuf::FieldDescriptor& field); - + virtual void PrintField(const NProtoBuf::Message& proto, const NProtoBuf::FieldDescriptor& field, IJsonOutput& json, TStringBuf key = {}); - + void PrintRepeatedField(const NProtoBuf::Message& proto, const NProtoBuf::FieldDescriptor& field, IJsonOutput& json, TStringBuf key = {}); - + void PrintSingleField(const NProtoBuf::Message& proto, const NProtoBuf::FieldDescriptor& field, IJsonOutput& json, TStringBuf key = {}); - + void PrintKeyValue(const NProtoBuf::Message& proto, IJsonOutput& json); - + TString MakeKey(const NProtoBuf::Message& proto, const NProtoBuf::FieldDescriptor& field); - + template <bool InMapContext> void PrintEnumValue(const TStringBuf& key, const NProtoBuf::EnumValueDescriptor* value, IJsonOutput& json); - + template <bool InMapContext> void PrintStringValue(const NProtoBuf::FieldDescriptor& field, const TStringBuf& key, const TString& value, IJsonOutput& json); - + template <class T> bool NeedStringifyNumber(T value) const; @@ -64,5 +64,5 @@ namespace NProtobufJson { const TProto2JsonConfig& Config; TString TmpBuf; }; - + } |