summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2014-12-23 23:34:04 +0100
committerAndreas Stöckel <andreas@somweyr.de>2014-12-23 23:34:04 +0100
commitad03d497658ecacbf05674e5c34c67eab894e070 (patch)
tree8c945c00e5c68826e60bb5b11c721ca14cf209a0 /src/core
parent66e382e4ea55932b1843efdfe2fd8c0fbcb1f405 (diff)
updated documentation
Diffstat (limited to 'src/core')
-rw-r--r--src/core/common/Logger.cpp68
1 files changed, 61 insertions, 7 deletions
diff --git a/src/core/common/Logger.cpp b/src/core/common/Logger.cpp
index 1811b68..d8cf5b4 100644
--- a/src/core/common/Logger.cpp
+++ b/src/core/common/Logger.cpp
@@ -85,6 +85,13 @@ void LoggerFork::commit()
/* Class Terminal */
+/**
+ * The Terminal class contains some helper functions used to interact with the
+ * terminal as used for colorful output when logging error messages.
+ *
+ * TODO: Disable on Windows or use corresponding API-functions for setting the
+ * color.
+ */
class Terminal {
private:
/**
@@ -93,17 +100,61 @@ private:
bool active;
public:
+ /**
+ * ANSI color code for black.
+ */
static const int BLACK = 30;
+
+ /**
+ * ANSI color code for red.
+ */
static const int RED = 31;
+
+ /**
+ * ANSI color code for green.
+ */
static const int GREEN = 32;
+
+ /**
+ * ANSI color code for yellow.
+ */
static const int YELLOW = 33;
+
+ /**
+ * ANSI color code for blue.
+ */
static const int BLUE = 34;
+
+ /**
+ * ANSI color code for magenta.
+ */
static const int MAGENTA = 35;
+
+ /**
+ * ANSI color code for cyan.
+ */
static const int CYAN = 36;
+
+ /**
+ * ANSI color code for white.
+ */
static const int WHITE = 37;
+ /**
+ * Creates a new instance of the Terminal class.
+ *
+ * @param active specifies whether color codes should be generated.
+ */
Terminal(bool active) : active(active) {}
+ /**
+ * Returns a control string for switching to the given color.
+ *
+ * @param color is the color the terminal should switch to.
+ * @param bright specifies whether the terminal should switch to the bright
+ * mode.
+ * @return a control string to be included in the output stream.
+ */
std::string color(int color, bool bright = true) const
{
if (!active) {
@@ -118,6 +169,11 @@ public:
return ss.str();
}
+ /**
+ * Returns a control string for switching to the bright mode.
+ *
+ * @return a control string to be included in the output stream.
+ */
std::string bright() const
{
if (!active) {
@@ -128,6 +184,11 @@ public:
return ss.str();
}
+ /**
+ * Returns a control string for switching to the default mode.
+ *
+ * @return a control string to be included in the output stream.
+ */
std::string reset() const
{
if (!active) {
@@ -139,13 +200,6 @@ public:
/* Class TerminalLogger */
-/**
- * Small class used internally for formated terminal output using ANSI/VT100
- * escape codes on supported terminals.
- *
- * TODO: Deactivate if using windows or use the corresponding API function.
- */
-
std::string TerminalLogger::currentFilename()
{
if (!files.empty()) {