CBMC
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
messaget Class Reference

Class that provides messages with a built-in verbosity 'level'. More...

#include <message.h>

+ Inheritance diagram for messaget:
+ Collaboration diagram for messaget:

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

 
 
  messaget (const messaget &other)
 
 
 
 
mstreamtget_mstream (unsigned message_level) const
 
 
 
 
 
 
 
 
  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.
 

Static Public Attributes

 
  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.
 

Protected Attributes

 
 

Friends

 
  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::messaget ( const messagetother )
inline

Definition at line 193 of file message.h.

◆  messaget() [2/2]

messaget::messaget ( message_handlert_message_handler )
inlineexplicit

Definition at line 206 of file message.h.

◆  ~messaget()

messaget::~messaget ( )
virtual

Definition at line 74 of file message.cpp.

Member Function Documentation

◆  command()

static commandt messaget::command ( unsigned  c )
inlinestatic

Create an ECMA-48 SGR (Select Graphic Rendition) command.

Definition at line 328 of file message.h.

◆  conditional_output()

void messaget::conditional_output ( mstreamtmessage_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.

Parameters
message_stream Output message stream
output_generator Function generating output

Definition at line 149 of file message.cpp.

◆  debug()

mstreamt & messaget::debug ( ) const
inline

Definition at line 431 of file message.h.

◆  error()

mstreamt & messaget::error ( ) const
inline

Definition at line 401 of file message.h.

◆  eval_verbosity()

unsigned messaget::eval_verbosity ( const std::string &  user_input,
const message_levelt  default_verbosity,
message_handlertdest 
)
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()

message_handlert & messaget::get_message_handler ( )
inline

Definition at line 183 of file message.h.

◆  get_mstream()

mstreamt & messaget::get_mstream ( unsigned  message_level ) const
inline

Definition at line 395 of file message.h.

◆  operator=()

messaget & messaget::operator= ( const messagetother )
inline

Definition at line 199 of file message.h.

◆  progress()

mstreamt & messaget::progress ( ) const
inline

Definition at line 426 of file message.h.

◆  result()

mstreamt & messaget::result ( ) const
inline

Definition at line 411 of file message.h.

◆  set_message_handler()

virtual void messaget::set_message_handler ( message_handlert_message_handler )
inlinevirtual

Definition at line 178 of file message.h.

◆  statistics()

mstreamt & messaget::statistics ( ) const
inline

Definition at line 421 of file message.h.

◆  status()

mstreamt & messaget::status ( ) const
inline

Definition at line 416 of file message.h.

◆  warning()

mstreamt & messaget::warning ( ) const
inline

Definition at line 406 of file message.h.

Friends And Related Symbol Documentation

◆  operator<< [1/2]

mstreamt & operator<< ( mstreamtm,
const commandtc 
)
friend

feed a command into an mstreamt

Definition at line 319 of file message.h.

◆  operator<< [2/2]

mstreamt & operator<< ( mstreamtm,
eomt   
)
friend

Definition at line 291 of file message.h.

Member Data Documentation

◆  blue

const messaget::commandt messaget::blue
static

render text with blue foreground color

Definition at line 347 of file message.h.

◆  bold

const messaget::commandt messaget::bold
static

render text with bold font

Definition at line 374 of file message.h.

◆  bright_blue

const messaget::commandt messaget::bright_blue
static

render text with bright blue foreground color

Definition at line 365 of file message.h.

◆  bright_cyan

const messaget::commandt messaget::bright_cyan
static

render text with bright cyan foreground color

Definition at line 371 of file message.h.

◆  bright_green

const messaget::commandt messaget::bright_green
static

render text with bright green foreground color

Definition at line 359 of file message.h.

◆  bright_magenta

const messaget::commandt messaget::bright_magenta
static

render text with bright magenta foreground color

Definition at line 368 of file message.h.

◆  bright_red

const messaget::commandt messaget::bright_red
static

render text with bright red foreground color

Definition at line 356 of file message.h.

◆  bright_yellow

const messaget::commandt messaget::bright_yellow
static

render text with bright yellow foreground color

Definition at line 362 of file message.h.

◆  cyan

const messaget::commandt messaget::cyan
static

render text with cyan foreground color

Definition at line 353 of file message.h.

◆  eom

messaget::eomt messaget::eom
static

Definition at line 289 of file message.h.

◆  faint

const messaget::commandt messaget::faint
static

render text with faint font

Definition at line 377 of file message.h.

◆  green

const messaget::commandt messaget::green
static

render text with green foreground color

Definition at line 341 of file message.h.

◆  italic

const messaget::commandt messaget::italic
static

render italic text

Definition at line 380 of file message.h.

◆  magenta

const messaget::commandt messaget::magenta
static

render text with magenta foreground color

Definition at line 350 of file message.h.

◆  message_handler

message_handlert* messaget::message_handler
protected

Definition at line 441 of file message.h.

◆  mstream

mstreamt messaget::mstream
mutableprotected

Definition at line 442 of file message.h.

◆  quote_begin

const messaget::commandt messaget::quote_begin
static

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

const messaget::commandt messaget::quote_end
static

End quoted text.

Counterpart to quote_begin; same per-UI rendering.

Definition at line 393 of file message.h.

◆  red

const messaget::commandt messaget::red
static

render text with red foreground color

Definition at line 338 of file message.h.

◆  reset

const messaget::commandt messaget::reset
static

return to default formatting, as defined by the terminal

Definition at line 335 of file message.h.

◆  underline

const messaget::commandt messaget::underline
static

render underlined text

Definition at line 383 of file message.h.

◆  yellow

const messaget::commandt messaget::yellow
static

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:

AltStyle によって変換されたページ (->オリジナル) /