aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/scheme/scimpl_json_write.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/scheme/scimpl_json_write.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/scheme/scimpl_json_write.cpp')
-rw-r--r--library/cpp/scheme/scimpl_json_write.cpp108
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 79a1e3cef3..aadd7e6cd5 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;
}
}
}