CBMC
|
Class that provides messages with a built-in verbosity 'level'. More...
#include <message.h>
Classes | |
class | commandt |
class | eomt |
class | mstreamt |
Public Types | |
enum | message_levelt { M_ERROR =1 , M_WARNING =2 , M_RESULT =4 , M_STATUS =6 , M_STATISTICS =8 , M_PROGRESS =9 , M_DEBUG =10 } |
Public Member Functions | |
virtual void | set_message_handler (message_handlert &_message_handler) |
message_handlert & | get_message_handler () |
messaget (const messaget &other) | |
messaget & | operator= (const messaget &other) |
messaget (message_handlert &_message_handler) | |
virtual | ~messaget () |
mstreamt & | get_mstream (unsigned message_level) const |
mstreamt & | error () const |
mstreamt & | warning () const |
mstreamt & | result () const |
mstreamt & | status () const |
mstreamt & | statistics () const |
mstreamt & | progress () const |
mstreamt & | debug () const |
void | conditional_output (mstreamt &mstream, const std::function< void(mstreamt &)> &output_generator) const |
Generate output to message_stream using output_generator if the configured verbosity is at least as high as that of message_stream . More... | |
Static Public Member Functions | |
static unsigned | eval_verbosity (const std::string &user_input, const message_levelt default_verbosity, message_handlert &dest) |
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest. More... | |
static commandt | command (unsigned c) |
Create an ECMA-48 SGR (Select Graphic Rendition) command. More... | |
Static Public Attributes | |
static eomt | eom |
static const commandt | reset |
return to default formatting, as defined by the terminal More... | |
static const commandt | red |
render text with red foreground color More... | |
static const commandt | green |
render text with green foreground color More... | |
static const commandt | yellow |
render text with yellow foreground color More... | |
static const commandt | blue |
render text with blue foreground color More... | |
static const commandt | magenta |
render text with magenta foreground color More... | |
static const commandt | cyan |
render text with cyan foreground color More... | |
static const commandt | bright_red |
render text with bright red foreground color More... | |
static const commandt | bright_green |
render text with bright green foreground color More... | |
static const commandt | bright_yellow |
render text with bright yellow foreground color More... | |
static const commandt | bright_blue |
render text with bright blue foreground color More... | |
static const commandt | bright_magenta |
render text with bright magenta foreground color More... | |
static const commandt | bright_cyan |
render text with bright cyan foreground color More... | |
static const commandt | bold |
render text with bold font More... | |
static const commandt | faint |
render text with faint font More... | |
static const commandt | italic |
render italic text More... | |
static const commandt | underline |
render underlined text More... | |
Protected Attributes | |
message_handlert * | message_handler |
mstreamt | mstream |
Friends | |
mstreamt & | operator<< (mstreamt &m, eomt) |
mstreamt & | operator<< (mstreamt &m, const commandt &c) |
feed a command into an mstreamt More... | |
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.
|
inlineexplicit |
|
virtual |
Definition at line 74 of file message.cpp.
|
inlinestatic |
void messaget::conditional_output | ( | mstreamt & | message_stream, |
const std::function< void(mstreamt &)> & | output_generator | ||
) | 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.
message_stream | Output message stream |
output_generator | Function generating output |
Definition at line 139 of file message.cpp.
|
static |
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest.
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. |
Definition at line 105 of file message.cpp.
|
inline |
|
inline |
|
inlinevirtual |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
protected |
|
static |
|
static |
|
static |
|
static |