Move phrases from tag editor to c++utilities

because they are also useful for syncthingctl
experiment/srcref_basic_cfg
Martchus 5 years ago
parent 37a84d64f1
commit 09efb1ff3e
  1. 27
      io/ansiescapecodes.cpp
  2. 7
      io/ansiescapecodes.h

@ -1 +1,28 @@
#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;
}
enum class Phrases {
Error,
Warning,
End,
};
std::ostream &operator<<(std::ostream &stream, Phrases phrase);
} // namespace EscapeCodes
#endif // IOUTILITIES_ANSIESCAPECODES

Loading…
Cancel
Save