diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/scheme/scimpl_json_write.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/scheme/scimpl_json_write.cpp')
-rw-r--r-- | library/cpp/scheme/scimpl_json_write.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/library/cpp/scheme/scimpl_json_write.cpp b/library/cpp/scheme/scimpl_json_write.cpp index aadd7e6cd5..79a1e3cef3 100644 --- a/library/cpp/scheme/scimpl_json_write.cpp +++ b/library/cpp/scheme/scimpl_json_write.cpp @@ -40,7 +40,7 @@ namespace NSc { template <typename TDictKeys> static inline void WriteDict(IOutputStream& out, const TDictKeys& keys, const TDict& dict, - const TJsonOpts& jopts, NImpl::TKeySortContext& sortCtx, NImpl::TSelfLoopContext& loopCtx) { + const TJsonOpts& jopts, NImpl::TKeySortContext& sortCtx, NImpl::TSelfLoopContext& loopCtx) { using const_iterator = typename TDictKeys::const_iterator; const_iterator begin = keys.begin(); const_iterator end = keys.end(); @@ -64,7 +64,7 @@ namespace NSc { } void TValue::DoWriteJsonImpl(IOutputStream& out, const TJsonOpts& jopts, - NImpl::TKeySortContext& sortCtx, NImpl::TSelfLoopContext& loopCtx) const { + NImpl::TKeySortContext& sortCtx, NImpl::TSelfLoopContext& loopCtx) const { const TScCore& core = Core(); NImpl::TSelfLoopContext::TGuard loopCheck(loopCtx, core); @@ -75,67 +75,67 @@ namespace NSc { } switch (core.ValueType) { - default: { - Y_ASSERT(false); + default: { + Y_ASSERT(false); [[fallthrough]]; /* no break */ } - case EType::Null: { + case EType::Null: { out << TStringBuf("null"); - break; + break; } - case EType::Bool: { + case EType::Bool: { out << (core.IntNumber ? TStringBuf("true") : TStringBuf("false")); - break; - } - case EType::IntNumber: { - out << core.IntNumber; - break; - } - case EType::FloatNumber: { - double d = core.FloatNumber; - if (!jopts.NumberPolicy || jopts.NumberPolicy(d)) { - out << d; - } else { + break; + } + case EType::IntNumber: { + out << core.IntNumber; + break; + } + case EType::FloatNumber: { + double d = core.FloatNumber; + if (!jopts.NumberPolicy || jopts.NumberPolicy(d)) { + out << d; + } else { out << TStringBuf("null"); } - break; - } - case EType::String: { - TStringBuf s = core.String; - if (!jopts.StringPolicy || jopts.StringPolicy(s)) { - WriteString(out, s); - } else { + break; + } + case EType::String: { + TStringBuf s = core.String; + if (!jopts.StringPolicy || jopts.StringPolicy(s)) { + WriteString(out, s); + } else { out << TStringBuf("null"); - } - break; - } - case EType::Array: { - out << '['; - const TArray& a = core.GetArray(); - for (TArray::const_iterator it = a.begin(); it != a.end(); ++it) { - if (it != a.begin()) { - out << ','; - } - - it->DoWriteJsonImpl(out, jopts, sortCtx, loopCtx); - } - out << ']'; - break; + } + break; + } + case EType::Array: { + out << '['; + const TArray& a = core.GetArray(); + for (TArray::const_iterator it = a.begin(); it != a.end(); ++it) { + if (it != a.begin()) { + out << ','; + } + + it->DoWriteJsonImpl(out, jopts, sortCtx, loopCtx); + } + out << ']'; + break; } - case EType::Dict: { - out << '{'; - - const TDict& dict = core.GetDict(); - - if (jopts.SortKeys) { - NImpl::TKeySortContext::TGuard keys(sortCtx, dict); - WriteDict(out, keys, dict, jopts, sortCtx, loopCtx); - } else { - WriteDict(out, dict, dict, jopts, sortCtx, loopCtx); - } - - out << '}'; - break; + case EType::Dict: { + out << '{'; + + const TDict& dict = core.GetDict(); + + if (jopts.SortKeys) { + NImpl::TKeySortContext::TGuard keys(sortCtx, dict); + WriteDict(out, keys, dict, jopts, sortCtx, loopCtx); + } else { + WriteDict(out, dict, dict, jopts, sortCtx, loopCtx); + } + + out << '}'; + break; } } } |