Class that provides messages with a built-in verbosity 'level'.
More...
#include <message.h>
+ Inheritance diagram for messaget:
+ Collaboration diagram for messaget:
Generate output to message_stream using output_generator if the configured verbosity is at least as high as that of message_stream.
Static Public Member Functions
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest.
Create an ECMA-48 SGR (Select Graphic Rendition) command.
return to default formatting, as defined by the terminal
render text with red foreground color
render text with green foreground color
render text with yellow foreground color
render text with blue foreground color
render text with magenta foreground color
render text with cyan foreground color
render text with bright red foreground color
render text with bright green foreground color
render text with bright yellow foreground color
render text with bright blue foreground color
render text with bright magenta foreground color
render text with bright cyan foreground color
render text with bold font
render text with faint font
render italic text
render underlined text
Start quoted text.
End quoted text.
feed a command into an mstreamt
Detailed Description
Class that provides messages with a built-in verbosity 'level'.
These messages are then processed by a subclass of message_handlert - which filters out all messages above a set verbosity level. By default the verbosity filtering level is set to the maximum level (10) - all messages printed (level 10 messages are debug information). Common practice is to inherit from the messaget class, to provide local infrastructure for messaging, by calling one of the utility methods, e.g. debug() , warning() etc. - which return a reference to a new instance of mstreamt set with the appropriate level. Individual messages are stored in mstreamt - an ostringstream subtype. eomt is used to flush the internal string of mstreamt. A static member eom, of eomt type is provided.
Definition at line 153 of file message.h.
Member Enumeration Documentation
◆ message_levelt
| Enumerator |
|---|
| M_ERROR |
| M_WARNING |
| M_RESULT |
| M_STATUS |
| M_STATISTICS |
| M_PROGRESS |
| M_DEBUG |
Definition at line 167 of file message.h.
Constructor & Destructor Documentation
◆ messaget() [1/2]
◆ messaget() [2/2]
◆ ~messaget()
messaget::~messaget
(
)
virtual |
Member Function Documentation
◆ command()
Create an ECMA-48 SGR (Select Graphic Rendition) command.
Definition at line 328 of file message.h.
◆ conditional_output()
void messaget::conditional_output
(
mstreamt &
message_stream,
)
const
Generate output to message_stream using output_generator if the configured verbosity is at least as high as that of message_stream.
Use whenever generating output involves additional computational effort that should only be spent when such output will actually be displayed.
- Parameters
-
message_stream Output message stream
output_generator Function generating output
Definition at line 149 of file message.cpp.
◆ debug()
◆ error()
◆ eval_verbosity()
unsigned messaget::eval_verbosity
(
const std::string &
user_input,
)
static |
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest.
- Parameters
-
user_input Input string; if empty, the default verbosity is used.
default_verbosity Verbosity to use if no value is provided.
dest message handler the verbosity of which is to be set.
- Returns
- Computed verbosity
Definition at line 115 of file message.cpp.
◆ get_message_handler()
◆ get_mstream()
◆ operator=()
◆ progress()
◆ result()
◆ set_message_handler()
◆ statistics()
mstreamt & messaget::statistics
(
)
const
inline |
◆ status()
◆ warning()
Friends And Related Symbol Documentation
◆ operator<< [1/2]
feed a command into an mstreamt
Definition at line 319 of file message.h.
◆ operator<< [2/2]
Member Data Documentation
◆ blue
render text with blue foreground color
Definition at line 347 of file message.h.
◆ bold
render text with bold font
Definition at line 374 of file message.h.
◆ bright_blue
render text with bright blue foreground color
Definition at line 365 of file message.h.
◆ bright_cyan
render text with bright cyan foreground color
Definition at line 371 of file message.h.
◆ bright_green
render text with bright green foreground color
Definition at line 359 of file message.h.
◆ bright_magenta
render text with bright magenta foreground color
Definition at line 368 of file message.h.
◆ bright_red
render text with bright red foreground color
Definition at line 356 of file message.h.
◆ bright_yellow
render text with bright yellow foreground color
Definition at line 362 of file message.h.
◆ cyan
render text with cyan foreground color
Definition at line 353 of file message.h.
◆ eom
◆ faint
render text with faint font
Definition at line 377 of file message.h.
◆ green
render text with green foreground color
Definition at line 341 of file message.h.
◆ italic
render italic text
Definition at line 380 of file message.h.
◆ magenta
render text with magenta foreground color
Definition at line 350 of file message.h.
◆ message_handler
◆ mstream
◆ quote_begin
Start quoted text.
Renders as a single ‘’on the PLAIN, XML and JSON UIs, and as'on the console handler. The structured UIs deliberately do not emit "<quote>" / "</quote>" tags; see the comment inui_message_handlert::command()` for the rationale.
Definition at line 389 of file message.h.
◆ quote_end
◆ red
render text with red foreground color
Definition at line 338 of file message.h.
◆ reset
return to default formatting, as defined by the terminal
Definition at line 335 of file message.h.
◆ underline
render underlined text
Definition at line 383 of file message.h.
◆ yellow
render text with yellow foreground color
Definition at line 344 of file message.h.
The documentation for this class was generated from the following files: