diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/json/json_prettifier.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/json_prettifier.h')
-rw-r--r-- | library/cpp/json/json_prettifier.h | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/json/json_prettifier.h b/library/cpp/json/json_prettifier.h index 27d611b0b4..873942f11a 100644 --- a/library/cpp/json/json_prettifier.h +++ b/library/cpp/json/json_prettifier.h @@ -5,54 +5,54 @@ #include <util/generic/ylimits.h> namespace NJson { - struct TJsonPrettifier { - bool Unquote = false; - ui8 Padding = 4; - bool SingleQuotes = false; - bool Compactify = false; - 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; - p.Padding = padding; - p.SingleQuotes = singlequotes; - return p; - } - - static TJsonPrettifier Compactifier(bool unquote = false, bool singlequote = false) { - TJsonPrettifier p; - p.Unquote = unquote; - p.Padding = 0; - p.Compactify = true; - 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); - } + struct TJsonPrettifier { + bool Unquote = false; + ui8 Padding = 4; + bool SingleQuotes = false; + bool Compactify = false; + 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; + p.Padding = padding; + p.SingleQuotes = singlequotes; + return p; + } + + static TJsonPrettifier Compactifier(bool unquote = false, bool singlequote = false) { + TJsonPrettifier p; + p.Unquote = unquote; + p.Padding = 0; + p.Compactify = true; + 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); + } } |