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/json_value_output.cpp | |
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/json_value_output.cpp')
-rw-r--r-- | library/cpp/protobuf/json/json_value_output.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/protobuf/json/json_value_output.cpp b/library/cpp/protobuf/json/json_value_output.cpp index 33a0f3d339..d845cc1c74 100644 --- a/library/cpp/protobuf/json/json_value_output.cpp +++ b/library/cpp/protobuf/json/json_value_output.cpp @@ -1,12 +1,12 @@ #include "json_value_output.h" #include <library/cpp/json/json_reader.h> - -namespace NProtobufJson { + +namespace NProtobufJson { template <typename T> void TJsonValueOutput::WriteImpl(const T& t) { Y_ASSERT(Context.top().Type == TContext::JSON_ARRAY || Context.top().Type == TContext::JSON_AFTER_KEY); - + if (Context.top().Type == TContext::JSON_AFTER_KEY) { Context.top().Value = t; Context.pop(); @@ -14,23 +14,23 @@ namespace NProtobufJson { Context.top().Value.AppendValue(t); } } - + void TJsonValueOutput::DoWrite(const TStringBuf& s) { WriteImpl(s); } - + void TJsonValueOutput::DoWrite(const TString& s) { WriteImpl(s); } - + void TJsonValueOutput::DoWrite(int i) { WriteImpl(i); } - + void TJsonValueOutput::DoWrite(unsigned int i) { WriteImpl(i); } - + void TJsonValueOutput::DoWrite(long long i) { WriteImpl(i); } @@ -38,26 +38,26 @@ namespace NProtobufJson { void TJsonValueOutput::DoWrite(unsigned long long i) { WriteImpl(i); } - + void TJsonValueOutput::DoWrite(float f) { WriteImpl(f); } - + void TJsonValueOutput::DoWrite(double f) { WriteImpl(f); } - + void TJsonValueOutput::DoWrite(bool b) { WriteImpl(b); } - + void TJsonValueOutput::DoWriteNull() { WriteImpl(NJson::JSON_NULL); } - + void TJsonValueOutput::DoBeginList() { Y_ASSERT(Context.top().Type == TContext::JSON_ARRAY || Context.top().Type == TContext::JSON_AFTER_KEY); - + if (Context.top().Type == TContext::JSON_AFTER_KEY) { Context.top().Type = TContext::JSON_ARRAY; Context.top().Value.SetType(NJson::JSON_ARRAY); @@ -65,15 +65,15 @@ namespace NProtobufJson { Context.emplace(TContext::JSON_ARRAY, Context.top().Value.AppendValue(NJson::JSON_ARRAY)); } } - + void TJsonValueOutput::DoEndList() { Y_ASSERT(Context.top().Type == TContext::JSON_ARRAY); Context.pop(); } - + void TJsonValueOutput::DoBeginObject() { Y_ASSERT(Context.top().Type == TContext::JSON_ARRAY || Context.top().Type == TContext::JSON_AFTER_KEY); - + if (Context.top().Type == TContext::JSON_AFTER_KEY) { Context.top().Type = TContext::JSON_MAP; Context.top().Value.SetType(NJson::JSON_MAP); @@ -81,20 +81,20 @@ namespace NProtobufJson { Context.emplace(TContext::JSON_MAP, Context.top().Value.AppendValue(NJson::JSON_MAP)); } } - + void TJsonValueOutput::DoWriteKey(const TStringBuf& key) { Y_ASSERT(Context.top().Type == TContext::JSON_MAP); Context.emplace(TContext::JSON_AFTER_KEY, Context.top().Value[key]); } - + void TJsonValueOutput::DoEndObject() { Y_ASSERT(Context.top().Type == TContext::JSON_MAP); Context.pop(); } - + void TJsonValueOutput::DoWriteRawJson(const TStringBuf& str) { Y_ASSERT(Context.top().Type == TContext::JSON_ARRAY || Context.top().Type == TContext::JSON_AFTER_KEY); - + if (Context.top().Type == TContext::JSON_AFTER_KEY) { NJson::ReadJsonTree(str, &Context.top().Value); Context.pop(); @@ -102,5 +102,5 @@ namespace NProtobufJson { NJson::ReadJsonTree(str, &Context.top().Value.AppendValue(NJson::JSON_UNDEFINED)); } } - -} + +} |