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/scheme/scimpl_json_read.cpp | |
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/scheme/scimpl_json_read.cpp')
-rw-r--r-- | library/cpp/scheme/scimpl_json_read.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/library/cpp/scheme/scimpl_json_read.cpp b/library/cpp/scheme/scimpl_json_read.cpp index 8a29cc7739..a0edc15d01 100644 --- a/library/cpp/scheme/scimpl_json_read.cpp +++ b/library/cpp/scheme/scimpl_json_read.cpp @@ -22,13 +22,13 @@ namespace NSc { { } - bool Add(TStringBuf v, bool allowDuplicated) { - if (!ExpectKey || Y_UNLIKELY(!Container->IsDict())) - return false; - - if (!allowDuplicated && Y_UNLIKELY(Container->Has(v))) + bool Add(TStringBuf v, bool allowDuplicated) { + if (!ExpectKey || Y_UNLIKELY(!Container->IsDict())) return false; + if (!allowDuplicated && Y_UNLIKELY(Container->Has(v))) + return false; + LastValue = &Container->GetOrAdd(v); ExpectKey = false; return true; @@ -62,16 +62,16 @@ namespace NSc { public: TValue& Root; TJsonError& Error; - const TJsonOpts& Cfg; + const TJsonOpts& Cfg; TStackType Stack; bool Virgin = true; public: - TJsonDeserializer(TValue& root, TJsonError& err, const TJsonOpts& cfg) + TJsonDeserializer(TValue& root, TJsonError& err, const TJsonOpts& cfg) : Root(root) , Error(err) - , Cfg(cfg) + , Cfg(cfg) { Root.SetNull(); Stack.reserve(10); @@ -143,7 +143,7 @@ namespace NSc { bool OnMapKey(const TStringBuf& k) override { if (Y_UNLIKELY(Stack.empty())) return false; - return Stack.back().Add(k, !(Cfg.Opts & TJsonOpts::JO_PARSER_DISALLOW_DUPLICATE_KEYS)); + return Stack.back().Add(k, !(Cfg.Opts & TJsonOpts::JO_PARSER_DISALLOW_DUPLICATE_KEYS)); } bool OnOpenMap() override { @@ -180,8 +180,8 @@ namespace NSc { } }; - static bool DoParseFromJson(TValue& res, TJsonError& err, TStringBuf json, const TJsonOpts& cfg) { - TJsonDeserializer d(res, err, cfg); + static bool DoParseFromJson(TValue& res, TJsonError& err, TStringBuf json, const TJsonOpts& cfg) { + TJsonDeserializer d(res, err, cfg); if (cfg.RelaxedJson) { return NJson::ReadJsonFast(json, &d); @@ -191,7 +191,7 @@ namespace NSc { } } - static bool DoParseFromJson(TValue& res, TStringBuf json, const TJsonOpts& cfg) { + static bool DoParseFromJson(TValue& res, TStringBuf json, const TJsonOpts& cfg) { TJsonError err; return DoParseFromJson(res, err, json, cfg); } |