Simple facility to keep track of errors and warnings.
More...
#include "errors.hh"
|
| Errors (const std::string &errprefix="ERROR", const std::string &warnprefix="WARNING") |
|
void | add_error (const std::string &msg) |
|
void | add_warning (const std::string &msg) |
|
Errors & | operator+= (const Errors &another) |
|
unsigned int | error_count () const |
|
unsigned int | warning_count () const |
|
bool | ok () const |
|
bool | perfect () const |
|
std::string | last_error () const |
|
std::ostream & | print (std::ostream &outf, bool warnings=true) const |
|
void | clear () |
| Tell the calling object to forget all errors and warnings seen so far.
|
|
Simple facility to keep track of errors and warnings.
multovl::Errors::Errors |
( |
const std::string & |
errprefix = "ERROR" , |
|
|
const std::string & |
warnprefix = "WARNING" |
|
) |
| |
|
explicit |
Init the Errors object.
- Parameters
-
errprefix | string to prefix the error messages with, default "ERROR" |
warnprefix | string to prefix the warning messages with, default "WARNING" |
void multovl::Errors::add_error |
( |
const std::string & |
msg | ) |
|
Adds an error message to the calling object.
- Parameters
-
msg | the error message. Does nothing if /msg/ is empty. |
void multovl::Errors::add_warning |
( |
const std::string & |
msg | ) |
|
Adds a warning to the calling object.
- Parameters
-
msg | the warning message. Does nothing if /msg/ is empty. |
unsigned int multovl::Errors::error_count |
( |
| ) |
const |
|
inline |
- Returns
- the number of errors seen so far.
std::string multovl::Errors::last_error |
( |
| ) |
const |
|
inline |
- Returns
- the last error encountered or the empty string if everything was fine.
bool multovl::Errors::ok |
( |
| ) |
const |
|
inline |
- Returns
- true if there have been no errors. There may have been warnings, though.
Errors& multovl::Errors::operator+= |
( |
const Errors & |
another | ) |
|
Adds the content of another Errors object to the calling object.
- Parameters
-
- Returns
- the calling object.
bool multovl::Errors::perfect |
( |
| ) |
const |
|
inline |
- Returns
- true if there have been neither errors nor warnings. Isn't that nice? :-)
std::ostream& multovl::Errors::print |
( |
std::ostream & |
outf, |
|
|
bool |
warnings = true |
|
) |
| const |
Prints the messages to an output stream, one per line.
- Parameters
-
outf | the output stream |
warnings | if true, then print the warnings as well (this is the default) |
unsigned int multovl::Errors::warning_count |
( |
| ) |
const |
|
inline |
- Returns
- the number of warnings seen so far.
The documentation for this class was generated from the following file: