Handles warning messages in a standardized fashion. More...

#include <Warning.h>

Public Member Functions

 Warning (std::ostream &output=std::cerr)
 Construct with a specified output stream.
 
virtual ~Warning ()
 Destructor prints summary, if requested.
 

Public Attributes

std::string prefix
 The prefix printed before each warning message.
 
bool first
 Print first message.
 
bool all
 Print every message.
 
bool summary
 Print a summary of the number of times a message was repeated.
 

Static Public Attributes

static bool verbose = false
 Print debugging messages.
 

Protected Member Functions

void insertion (manipulator m)
 Does the work for the insertion operator.
 

Protected Attributes

std::map< std::string, unsigned > messages
 Warning messages printed so far.
 
std::ostream & output
 The output stream to which messages are sent.
 
std::ostringstream buffer
 The buffer used to store the message until a manipulator is inserted.
 
std::string message
 The text of the message, without variables.
 
ThreadContextcontext
 Multi-thread safe.
 

Friends

template<class T >
Warningoperator<< (Warning &warning, const T &t)
 Print a variable to the output stream.
 
Warningoperator<< (Warning &warning, const char *t)
 Print text to the output stream.
 
Warningoperator<< (Warning &warning, manipulator m)
 Manipulate the output stream.
 

Detailed Description

Handles warning messages in a standardized fashion.

Warning messages can be annoying when they are repeated too many times. This class provides a standard means of handling warning messages. The user can select to:

  • issue a warning only once (the first time it occurs);
  • print a summary of the number of times the warning was issued; and/or
  • issue the warning every time

The documentation for this class was generated from the following files:

Generated using doxygen 1.8.17