diff options
author | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-02-10 16:49:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:09 +0300 |
commit | 6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (patch) | |
tree | f69637041e6fed76ebae0c74ae1fa0c4be6ab5b4 /library/cpp/protobuf/json/json_writer_output.h | |
parent | e5d4696304c6689379ac7ce334512404d4b7836c (diff) | |
download | ydb-6cdc8f140213c595e4ad38bc3d97fcef1146b8c3.tar.gz |
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/json_writer_output.h')
-rw-r--r-- | library/cpp/protobuf/json/json_writer_output.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/protobuf/json/json_writer_output.h b/library/cpp/protobuf/json/json_writer_output.h index 3d8a2daa56..a634d9d565 100644 --- a/library/cpp/protobuf/json/json_writer_output.h +++ b/library/cpp/protobuf/json/json_writer_output.h @@ -1,21 +1,21 @@ -#pragma once - -#include "json_output.h" -#include "config.h" - +#pragma once + +#include "json_output.h" +#include "config.h" + #include <library/cpp/json/json_writer.h> - + #include <util/string/builder.h> -#include <util/generic/store_policy.h> - -namespace NProtobufJson { +#include <util/generic/store_policy.h> + +namespace NProtobufJson { class TBaseJsonWriterOutput: public IJsonOutput { public: TBaseJsonWriterOutput(NJson::TJsonWriter& writer) : Writer(writer) { } - + private: void DoWrite(int i) override { Writer.Write(i); @@ -47,14 +47,14 @@ namespace NProtobufJson { void DoWrite(const TString& s) override { Writer.Write(s); } - + void DoBeginList() override { Writer.OpenArray(); } void DoEndList() override { Writer.CloseArray(); } - + void DoBeginObject() override { Writer.OpenMap(); } @@ -64,14 +64,14 @@ namespace NProtobufJson { void DoEndObject() override { Writer.CloseMap(); } - + void DoWriteRawJson(const TStringBuf& str) override { Writer.UnsafeWrite(str); } - + NJson::TJsonWriter& Writer; }; - + class TJsonWriterOutput: public TEmbedPolicy<NJson::TJsonWriter>, public TBaseJsonWriterOutput { public: TJsonWriterOutput(IOutputStream* outputStream, const NJson::TJsonWriterConfig& cfg) @@ -79,17 +79,17 @@ namespace NProtobufJson { , TBaseJsonWriterOutput(*Ptr()) { } - + TJsonWriterOutput(IOutputStream* outputStream, const TProto2JsonConfig& cfg) : TEmbedPolicy<NJson::TJsonWriter>(outputStream, CreateJsonWriterConfig(cfg)) , TBaseJsonWriterOutput(*Ptr()) { } - + private: static NJson::TJsonWriterConfig CreateJsonWriterConfig(const TProto2JsonConfig& cfg); }; - + class TJsonStringWriterOutput: public TEmbedPolicy<TStringOutput>, public TJsonWriterOutput { public: template <typename TConfig> @@ -99,5 +99,5 @@ namespace NProtobufJson { { } }; - + } |