Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a00475_source.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a00475_source.php on line 2
The ARGoS Website

argos_colored_text.h
Go to the documentation of this file.
1 
12 #ifndef ARGOS_COLORED_TEXT_H
13 #define ARGOS_COLORED_TEXT_H
14 
15 #include <argos3/core/utility/datatypes/datatypes.h>
16 
17 namespace argos {
18 
30  };
31 
44  };
45 
49  struct SLogColor {
58 
63  Attribute(ARGOS_LOG_ATTRIBUTE_RESET),
64  Foreground(ARGOS_LOG_COLOR_WHITE) {}
69  EARGoSLogColors e_foreground_color) :
70  Attribute(e_attribute),
71  Foreground(e_foreground_color) {}
72  };
73 
78  inline std::ostream& operator<<(std::ostream& c_os, const SLogColor& s_log_color)
79  {
80  c_os << "\033["
81  << s_log_color.Attribute << ";"
82  << (s_log_color.Foreground + 30) << "m";
83  return c_os;
84  }
85 
89 #define DEFINE_ARGOS_STREAM_COLOR_HELPER(lc_color, uc_color) \
90  inline std::ostream& lc_color(std::ostream& c_os) { \
91  c_os << SLogColor(ARGOS_LOG_ATTRIBUTE_BRIGHT, ARGOS_LOG_COLOR_ ## uc_color); \
92  return c_os; \
93  }
94 
102  DEFINE_ARGOS_STREAM_COLOR_HELPER(green, GREEN);
106  DEFINE_ARGOS_STREAM_COLOR_HELPER(yellow, YELLOW);
114  DEFINE_ARGOS_STREAM_COLOR_HELPER(magenta, MAGENTA);
122  DEFINE_ARGOS_STREAM_COLOR_HELPER(white, WHITE);
123 
128  inline std::ostream& reset(std::ostream& c_os) {
129  c_os << "\033["
131  << "m";
132  return c_os;
133  }
134 
135 }
136 
137 #endif
std::ostream & operator<<(std::ostream &c_os, const CByteArray &c_byte_array)
Definition: byte_array.cpp:530
unsigned char UInt8
8-bit unsigned integer.
Definition: datatypes.h:60
Stream modifier to set attribute and color of the subsequent text.
EARGoSLogColors
The possible colors of the logged text.
SLogColor()
Constructor with standard settings.
SLogColor(EARGoSLogAttributes e_attribute, EARGoSLogColors e_foreground_color)
Constructor with custom settings.
std::ostream & reset(std::ostream &c_os)
Resets the text to the default settings.
DEFINE_ARGOS_STREAM_COLOR_HELPER(red, RED)
Bright red text modifier.
UInt8 Foreground
The foreground color.
EARGoSLogAttributes
The possible attributes of the logged text.
UInt8 Attribute
The text attribute.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12