diff options
author | swarmer <swarmer@yandex-team.ru> | 2022-02-10 16:46:31 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:31 +0300 |
commit | 11a24635da4c4f39428b182c49a7bc35e47c9534 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/json | |
parent | 317da38588b7898a99fd9168571408123350012b (diff) | |
download | ydb-11a24635da4c4f39428b182c49a7bc35e47c9534.tar.gz |
Restoring authorship annotation for <swarmer@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json')
-rw-r--r-- | library/cpp/json/domscheme_traits.h | 2 | ||||
-rw-r--r-- | library/cpp/json/writer/json.cpp | 36 | ||||
-rw-r--r-- | library/cpp/json/writer/json.h | 2 |
3 files changed, 20 insertions, 20 deletions
diff --git a/library/cpp/json/domscheme_traits.h b/library/cpp/json/domscheme_traits.h index f5961f2592..a5a99cd8cf 100644 --- a/library/cpp/json/domscheme_traits.h +++ b/library/cpp/json/domscheme_traits.h @@ -100,7 +100,7 @@ struct TJsonTraits { return &(*v)[key]; } - static inline size_t DictSize(TConstValueRef v) { + static inline size_t DictSize(TConstValueRef v) { return v->GetMap().size(); } diff --git a/library/cpp/json/writer/json.cpp b/library/cpp/json/writer/json.cpp index afc98b8a60..02370c2d79 100644 --- a/library/cpp/json/writer/json.cpp +++ b/library/cpp/json/writer/json.cpp @@ -89,24 +89,24 @@ namespace NJsonWriter { const int indentation = IndentSpaces * (Stack.size() - 1); if (!indentation && !closing) return; - - PrintWhitespaces(Max(0, indentation), true); - } - - void TBuf::PrintWhitespaces(size_t count, bool prependWithNewLine) { - static constexpr TStringBuf whitespacesTemplate = "\n "; - static_assert(whitespacesTemplate[0] == '\n'); - static_assert(whitespacesTemplate[1] == ' '); - - count += (prependWithNewLine); - do { - const TStringBuf buffer = whitespacesTemplate.SubString(prependWithNewLine ? 0 : 1, count); - count -= buffer.size(); - UnsafeWriteRawBytes(buffer); - prependWithNewLine = false; // skip '\n' in subsequent writes - } while (count > 0); - } - + + PrintWhitespaces(Max(0, indentation), true); + } + + void TBuf::PrintWhitespaces(size_t count, bool prependWithNewLine) { + static constexpr TStringBuf whitespacesTemplate = "\n "; + static_assert(whitespacesTemplate[0] == '\n'); + static_assert(whitespacesTemplate[1] == ' '); + + count += (prependWithNewLine); + do { + const TStringBuf buffer = whitespacesTemplate.SubString(prependWithNewLine ? 0 : 1, count); + count -= buffer.size(); + UnsafeWriteRawBytes(buffer); + prependWithNewLine = false; // skip '\n' in subsequent writes + } while (count > 0); + } + inline void TBuf::WriteComma() { if (NeedComma) { RawWriteChar(','); diff --git a/library/cpp/json/writer/json.h b/library/cpp/json/writer/json.h index 3849dc4ba4..0aae2531b9 100644 --- a/library/cpp/json/writer/json.h +++ b/library/cpp/json/writer/json.h @@ -133,7 +133,7 @@ namespace NJsonWriter { void WriteBareString(const TStringBuf s, EHtmlEscapeMode hem); void WriteComma(); void PrintIndentation(bool closing); - void PrintWhitespaces(size_t count, bool prependWithNewLine); + void PrintWhitespaces(size_t count, bool prependWithNewLine); void WriteHexEscape(unsigned char c); void StackPush(EJsonEntity e); |