diff options
author | xpahos <xpahos@yandex-team.ru> | 2022-02-10 16:47:21 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:21 +0300 |
commit | 52faf709473af8421da1e2ea84ae1879b16665b8 (patch) | |
tree | 2ec4264cfbc5e294ea04a7b12b9fa0b41f4d96ce /library/cpp/json/json_reader.cpp | |
parent | eec632e483ae34bc211138c67434b1e0e6054ced (diff) | |
download | ydb-52faf709473af8421da1e2ea84ae1879b16665b8.tar.gz |
Restoring authorship annotation for <xpahos@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/json_reader.cpp')
-rw-r--r-- | library/cpp/json/json_reader.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/json/json_reader.cpp b/library/cpp/json/json_reader.cpp index 072c8deafe..e2f1d4102f 100644 --- a/library/cpp/json/json_reader.cpp +++ b/library/cpp/json/json_reader.cpp @@ -312,37 +312,37 @@ namespace NJson { rapidjson::Reader& reader, TRapidJsonCompliantInputStream& is, THandler& handler) { - - ui8 flags = ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE; - + + ui8 flags = ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE; + if (config.AllowComments) { - flags |= ReaderConfigFlags::COMMENTS; - } - - if (config.DontValidateUtf8) { - flags &= ~(ReaderConfigFlags::VALIDATE); - } - - if (config.AllowEscapedApostrophe) { - flags |= ReaderConfigFlags::ESCAPE; - } - - switch (flags) { - case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_NOESCAPE: + flags |= ReaderConfigFlags::COMMENTS; + } + + if (config.DontValidateUtf8) { + flags &= ~(ReaderConfigFlags::VALIDATE); + } + + if (config.AllowEscapedApostrophe) { + flags |= ReaderConfigFlags::ESCAPE; + } + + switch (flags) { + case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_NOESCAPE: return reader.Parse<rapidjson::kParseCommentsFlag>(is, handler); - case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_NOESCAPE: + case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_NOESCAPE: return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseValidateEncodingFlag>(is, handler); - case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_ESCAPE: - return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); - case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_ESCAPE: - return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); - case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE: - return reader.Parse<rapidjson::kParseValidateEncodingFlag>(is, handler); - case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_ESCAPE: - return reader.Parse<rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); - case ReaderConfigToRapidJsonFlags::NOCOMMENTS_NOVALID_ESCAPE: - return reader.Parse<rapidjson::kParseEscapedApostropheFlag>(is, handler); - default: + case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_ESCAPE: + return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); + case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_ESCAPE: + return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); + case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE: + return reader.Parse<rapidjson::kParseValidateEncodingFlag>(is, handler); + case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_ESCAPE: + return reader.Parse<rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); + case ReaderConfigToRapidJsonFlags::NOCOMMENTS_NOVALID_ESCAPE: + return reader.Parse<rapidjson::kParseEscapedApostropheFlag>(is, handler); + default: return reader.Parse<rapidjson::kParseNoFlags>(is, handler); } } @@ -523,13 +523,13 @@ namespace NJson { return ReadJson(in, &config, cbs); } - bool ReadJson(IInputStream* in, bool allowComments, bool allowEscapedApostrophe, TJsonCallbacks* cbs) { - TJsonReaderConfig config; - config.AllowComments = allowComments; - config.AllowEscapedApostrophe = allowEscapedApostrophe; - return ReadJson(in, &config, cbs); - } - + bool ReadJson(IInputStream* in, bool allowComments, bool allowEscapedApostrophe, TJsonCallbacks* cbs) { + TJsonReaderConfig config; + config.AllowComments = allowComments; + config.AllowEscapedApostrophe = allowEscapedApostrophe; + return ReadJson(in, &config, cbs); + } + bool ReadJson(IInputStream* in, const TJsonReaderConfig* config, TJsonCallbacks* cbs) { TJsonCallbacksWrapper wrapper(*cbs); TInputStreamWrapper is(*in); |