#include <Warnings.hpp>
Public Member Functions | |
void | AddWarning (const std::string &rMessage, const std::string &rFilename, unsigned lineNumber, bool onlyOnce=false) |
std::string | PopWarning () const |
unsigned | GetNumWarnings () |
std::string | GetNextWarningMessage () |
Static Public Member Functions | |
static void | QuietDestroy () |
static Warnings * | Instance () |
Protected Member Functions | |
Warnings () | |
Static Protected Member Functions | |
static void | NoisyDestroy () |
Private Types | |
typedef std::deque< std::pair < std::string, std::string > > | WarningsContainerType |
Private Attributes | |
WarningsContainerType | mWarningMessages |
Static Private Attributes | |
static Warnings * | mpInstance = NULL |
Warnings can be polled with GetNumWarnings() and GetNextWarningMessage(). Warnings can be ignored and destroyed with QuietDestroy(). All warnings left at the close of the test suite (not the individual test), or the close of the executable, will be printed to the screen.
Definition at line 47 of file Warnings.hpp.
typedef std::deque<std::pair<std::string, std::string> > Warnings::WarningsContainerType [private] |
Container type for warnings
Definition at line 53 of file Warnings.hpp.
Warnings::Warnings | ( | ) | [protected] |
Protected constructor. Use Instance() to access the Warnings singleton.
Definition at line 42 of file Warnings.cpp.
Referenced by Instance().
void Warnings::NoisyDestroy | ( | void | ) | [static, protected] |
Protected destroyer (takes the place of a destructor, using the std::atexit directive).
Definition at line 46 of file Warnings.cpp.
References mpInstance, and mWarningMessages.
Referenced by Instance().
void Warnings::QuietDestroy | ( | void | ) | [static] |
Public destroyer (takes the place of a destructor but is called by the user to make sure that no warnings appear)
Definition at line 64 of file Warnings.cpp.
References mpInstance.
void Warnings::AddWarning | ( | const std::string & | rMessage, | |
const std::string & | rFilename, | |||
unsigned | lineNumber, | |||
bool | onlyOnce = false | |||
) |
Make a warning with a message string and add it to the list
rMessage | the message | |
rFilename | which source file threw the exception | |
lineNumber | which line number of the source file threw the exception | |
onlyOnce | whether to only log the first warning thrown from this location |
Definition at line 85 of file Warnings.cpp.
References mWarningMessages.
std::string Warnings::PopWarning | ( | ) | const |
Get the message associated with the exception with file and line number
Warnings * Warnings::Instance | ( | ) | [static] |
Return a pointer to the Warnings object. The object is created the first time this method is called.
Definition at line 73 of file Warnings.cpp.
References mpInstance, NoisyDestroy(), and Warnings().
unsigned Warnings::GetNumWarnings | ( | ) |
How many warnings are in the queue
Definition at line 108 of file Warnings.cpp.
References mWarningMessages.
std::string Warnings::GetNextWarningMessage | ( | ) |
Remove and inspect a warning
Definition at line 113 of file Warnings.cpp.
References EXCEPTION, and mWarningMessages.
Warnings * Warnings::mpInstance = NULL [static, private] |
Pointer to the single instance. For use as singleton
Definition at line 50 of file Warnings.hpp.
Referenced by Instance(), NoisyDestroy(), and QuietDestroy().
Warnings messages. First in pair is the context (line number etc.). Second in pair is the actual warning,
Definition at line 55 of file Warnings.hpp.
Referenced by AddWarning(), GetNextWarningMessage(), GetNumWarnings(), and NoisyDestroy().