Refactored color output of variables and keywords.

This commit is contained in:
2016-06-14 17:05:41 +02:00
parent 6fec1cc409
commit 9969281b11
2 changed files with 81 additions and 96 deletions

View File

@@ -65,7 +65,7 @@ inline LogStream &operator<<(LogStream &stream, const Format &format)
////////////////////////////////////////////////////////////////////////////////////////////////////
class ResetFormat
struct ResetFormat
{
};
@@ -81,6 +81,50 @@ inline LogStream &operator<<(LogStream &stream, const ResetFormat &)
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Keyword
{
Keyword(const std::string &name)
: name(name)
{
}
const std::string &name;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
inline LogStream &operator<<(LogStream &stream, const Keyword &keyword)
{
return (stream
<< utils::Format(utils::Color::White, utils::FontWeight::Bold)
<< keyword.name
<< utils::ResetFormat());
}
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Variable
{
Variable(const std::string &name)
: name(name)
{
}
const std::string &name;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
inline LogStream &operator<<(LogStream &stream, const Variable &variable)
{
return (stream
<< utils::Format(utils::Color::Green, utils::FontWeight::Bold)
<< variable.name
<< utils::ResetFormat());
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}