aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/colorizer
diff options
context:
space:
mode:
authorVasily Gerasimov <UgnineSirdis@gmail.com>2022-02-10 16:49:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:09 +0300
commit6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (patch)
treef69637041e6fed76ebae0c74ae1fa0c4be6ab5b4 /library/cpp/colorizer
parente5d4696304c6689379ac7ce334512404d4b7836c (diff)
downloadydb-6cdc8f140213c595e4ad38bc3d97fcef1146b8c3.tar.gz
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/colorizer')
-rw-r--r--library/cpp/colorizer/colors.cpp58
-rw-r--r--library/cpp/colorizer/colors.h12
-rw-r--r--library/cpp/colorizer/fwd.h16
3 files changed, 43 insertions, 43 deletions
diff --git a/library/cpp/colorizer/colors.cpp b/library/cpp/colorizer/colors.cpp
index decc5c9847..47408ac08f 100644
--- a/library/cpp/colorizer/colors.cpp
+++ b/library/cpp/colorizer/colors.cpp
@@ -1,6 +1,6 @@
#include "colors.h"
-#include <util/stream/output.h>
+#include <util/stream/output.h>
#include <util/generic/singleton.h>
#include <util/system/env.h>
@@ -166,10 +166,10 @@ bool TColors::CalcIsTTY(FILE* file) {
#endif
}
-TColors::TColors(FILE* f)
+TColors::TColors(FILE* f)
: IsTTY_(true)
{
- SetIsTTY(CalcIsTTY(f));
+ SetIsTTY(CalcIsTTY(f));
}
TColors::TColors(bool ontty)
@@ -418,7 +418,7 @@ TStringBuf TColors::WhiteColor() const noexcept {
}
-namespace {
+namespace {
class TStdErrColors: public TColors {
public:
TStdErrColors()
@@ -426,24 +426,24 @@ namespace {
{
}
};
-
- class TStdOutColors: public TColors {
- public:
- TStdOutColors()
- : TColors(stdout)
- {
- }
- };
-
- class TDisabledColors: public TColors {
- public:
- TDisabledColors()
- : TColors(false)
- {
- }
- };
-} // anonymous namespace
-
+
+ class TStdOutColors: public TColors {
+ public:
+ TStdOutColors()
+ : TColors(stdout)
+ {
+ }
+ };
+
+ class TDisabledColors: public TColors {
+ public:
+ TDisabledColors()
+ : TColors(false)
+ {
+ }
+ };
+} // anonymous namespace
+
TColors& NColorizer::StdErr() {
return *Singleton<TStdErrColors>();
}
@@ -453,13 +453,13 @@ TColors& NColorizer::StdOut() {
}
TColors& NColorizer::AutoColors(IOutputStream& os) {
- if (&os == &Cerr) {
- return StdErr();
- }
- if (&os == &Cout) {
- return StdOut();
- }
- return *Singleton<TDisabledColors>();
+ if (&os == &Cerr) {
+ return StdErr();
+ }
+ if (&os == &Cout) {
+ return StdOut();
+ }
+ return *Singleton<TDisabledColors>();
}
size_t NColorizer::TotalAnsiEscapeCodeLen(TStringBuf text) {
diff --git a/library/cpp/colorizer/colors.h b/library/cpp/colorizer/colors.h
index 474a918994..c40570c9bc 100644
--- a/library/cpp/colorizer/colors.h
+++ b/library/cpp/colorizer/colors.h
@@ -1,6 +1,6 @@
#pragma once
-#include "fwd.h"
+#include "fwd.h"
#include <util/generic/string.h>
#include <util/generic/strbuf.h>
@@ -104,8 +104,8 @@ namespace NColorizer {
static bool CalcIsTTY(FILE* file);
public:
- explicit TColors(FILE* = stderr);
- explicit TColors(bool ontty);
+ explicit TColors(FILE* = stderr);
+ explicit TColors(bool ontty);
TStringBuf Reset() const noexcept;
@@ -213,9 +213,9 @@ namespace NColorizer {
};
/// Singletone `TColors` instances for stderr/stdout.
- TColors& StdErr();
- TColors& StdOut();
-
+ TColors& StdErr();
+ TColors& StdOut();
+
/// Choose `TColors` depending on output stream. If passed stream is stderr/stdout, return a corresponding
/// singletone. Otherwise, return a disabled singletone (which you can, but should *not* enable).
TColors& AutoColors(IOutputStream& os);
diff --git a/library/cpp/colorizer/fwd.h b/library/cpp/colorizer/fwd.h
index d71efdc053..d94f728284 100644
--- a/library/cpp/colorizer/fwd.h
+++ b/library/cpp/colorizer/fwd.h
@@ -1,11 +1,11 @@
-#pragma once
-
+#pragma once
+
class IOutputStream;
-
-namespace NColorizer {
- class TColors;
-
- TColors& StdErr();
- TColors& StdOut();
+
+namespace NColorizer {
+ class TColors;
+
+ TColors& StdErr();
+ TColors& StdOut();
TColors& AutoColors(IOutputStream&);
}