Move phrases from tag editor to c++utilities
because they are also useful for syncthingctl
This commit is contained in:
parent
37a84d64f1
commit
09efb1ff3e
|
@ -1 +1,28 @@
|
||||||
#include "./ansiescapecodes.h"
|
#include "./ansiescapecodes.h"
|
||||||
|
|
||||||
|
namespace EscapeCodes {
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &stream, Phrases phrase)
|
||||||
|
{
|
||||||
|
switch (phrase) {
|
||||||
|
case Phrases::Error:
|
||||||
|
setStyle(stream, Color::Red, ColorContext::Foreground, TextAttribute::Bold);
|
||||||
|
stream << "Error: ";
|
||||||
|
setStyle(stream, TextAttribute::Reset);
|
||||||
|
setStyle(stream, TextAttribute::Bold);
|
||||||
|
break;
|
||||||
|
case Phrases::Warning:
|
||||||
|
setStyle(stream, Color::Yellow, ColorContext::Foreground, TextAttribute::Bold);
|
||||||
|
stream << "Warning: ";
|
||||||
|
setStyle(stream, TextAttribute::Reset);
|
||||||
|
setStyle(stream, TextAttribute::Bold);
|
||||||
|
break;
|
||||||
|
case Phrases::End:
|
||||||
|
setStyle(stream, TextAttribute::Reset);
|
||||||
|
stream << '\n';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace EscapeCodes
|
||||||
|
|
|
@ -98,6 +98,13 @@ inline std::ostream &operator<<(std::ostream &stream, std::tuple<Color, Color, T
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class Phrases {
|
||||||
|
Error,
|
||||||
|
Warning,
|
||||||
|
End,
|
||||||
|
};
|
||||||
|
std::ostream &operator<<(std::ostream &stream, Phrases phrase);
|
||||||
|
|
||||||
} // namespace EscapeCodes
|
} // namespace EscapeCodes
|
||||||
|
|
||||||
#endif // IOUTILITIES_ANSIESCAPECODES
|
#endif // IOUTILITIES_ANSIESCAPECODES
|
||||||
|
|
Loading…
Reference in New Issue