diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 9123176b341b6f2658cff5132482b8237c1416c8 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/json/json_prettifier.h | |
parent | 59e19371de37995fcb36beb16cd6ec030af960bc (diff) | |
download | ydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json/json_prettifier.h')
-rw-r--r-- | library/cpp/json/json_prettifier.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/json/json_prettifier.h b/library/cpp/json/json_prettifier.h index 70473ce0e7..27d611b0b4 100644 --- a/library/cpp/json/json_prettifier.h +++ b/library/cpp/json/json_prettifier.h @@ -1,10 +1,10 @@ -#pragma once - -#include "json_reader.h" - +#pragma once + +#include "json_reader.h" + #include <util/generic/ylimits.h> -namespace NJson { +namespace NJson { struct TJsonPrettifier { bool Unquote = false; ui8 Padding = 4; @@ -13,7 +13,7 @@ namespace NJson { bool Strict = false; bool NewUnquote = false; // use new unquote, may break old tests ui32 MaxPaddingLevel = Max<ui32>(); - + static TJsonPrettifier Prettifier(bool unquote = false, ui8 padding = 4, bool singlequotes = false) { TJsonPrettifier p; p.Unquote = unquote; @@ -21,7 +21,7 @@ namespace NJson { p.SingleQuotes = singlequotes; return p; } - + static TJsonPrettifier Compactifier(bool unquote = false, bool singlequote = false) { TJsonPrettifier p; p.Unquote = unquote; @@ -30,29 +30,29 @@ namespace NJson { p.SingleQuotes = singlequote; return p; } - + bool Prettify(TStringBuf in, IOutputStream& out) const; - + TString Prettify(TStringBuf in) const; - + static bool MayUnquoteNew(TStringBuf in); static bool MayUnquoteOld(TStringBuf in); }; - + inline TString PrettifyJson(TStringBuf in, bool unquote = false, ui8 padding = 4, bool sq = false) { return TJsonPrettifier::Prettifier(unquote, padding, sq).Prettify(in); } - + inline bool PrettifyJson(TStringBuf in, IOutputStream& out, bool unquote = false, ui8 padding = 4, bool sq = false) { return TJsonPrettifier::Prettifier(unquote, padding, sq).Prettify(in, out); } - + inline bool CompactifyJson(TStringBuf in, IOutputStream& out, bool unquote = false, bool sq = false) { return TJsonPrettifier::Compactifier(unquote, sq).Prettify(in, out); } - + inline TString CompactifyJson(TStringBuf in, bool unquote = false, bool sq = false) { return TJsonPrettifier::Compactifier(unquote, sq).Prettify(in); } - -} + +} |