libNuML 1.1.1
Library for reading / writing NuML documents
|
the error log containing all errors / warnings encountered More...
#include <NUMLErrorLog.h>
Public Member Functions | |
const NUMLError * | getError (unsigned int n) const |
Returns the nth NUMLError in this log. More... | |
unsigned int | getNumFailsWithSeverity (unsigned int severity) |
Returns the number of errors that have been logged with the given severity code. More... | |
NUMLErrorLog () | |
Creates a new, empty NUMLErrorLog. More... | |
virtual | ~NUMLErrorLog () |
Destroys this NUMLErrorLog. More... | |
void | logError (const unsigned int errorId=0, const unsigned int level=NUML_DEFAULT_LEVEL, const unsigned int version=NUML_DEFAULT_VERSION, const std::string &details="", const unsigned int line=0, const unsigned int column=0, const unsigned int severity=LIBNUML_SEV_ERROR, const unsigned int category=LIBNUML_CAT_NUML) |
Convenience function that combines creating an NUMLError object and adding it to the log. More... | |
void | add (const NUMLError &error) |
Adds the given NUMLError to the log. More... | |
void | add (const std::list< NUMLError > &errors) |
Adds (copies) the NUMLErrors in the given NUMLError list to this NUMLErrorLog. More... | |
void | remove (const unsigned int errorId) |
Removes an error having errorId from the NUMLError list. More... | |
the error log containing all errors / warnings encountered
LIBNUML_CPP_NAMESPACE_BEGIN NUMLErrorLog::NUMLErrorLog | ( | ) |
Creates a new, empty NUMLErrorLog.
Most of the methods are internal.
A few visible ones are at the end.
|
virtual |
Destroys this NUMLErrorLog.
void NUMLErrorLog::add | ( | const NUMLError & | error | ) |
void NUMLErrorLog::add | ( | const std::list< NUMLError > & | errors | ) |
Adds (copies) the NUMLErrors in the given NUMLError list to this NUMLErrorLog.
errors | list, a list of NUMLError to be added to the log. |
const NUMLError * NUMLErrorLog::getError | ( | unsigned int | n | ) | const |
Returns the nth NUMLError in this log.
Callers should first inquire about the number of items in the log by using the NUMLErrorLog::getNumErrors() method. (This method is inherited from the parent class, XMLErrorLog). Attempting to using an error index number that exceed the number of errors in the log will result in a NULL being returned.
n | unsigned int number of the error to retrieve. |
n
th NUMLError in this log. unsigned int NUMLErrorLog::getNumFailsWithSeverity | ( | unsigned int | severity | ) |
Returns the number of errors that have been logged with the given severity code.
Returns number of errors that are logged with severity Error.
LibNUML associates severity levels with every NUMLError object to provide an indication of how serious the problem is. Severities range from informational diagnostics to fatal (irrecoverable) errors. Given an NUMLError object instance, a caller can interrogate it for its severity level using methods such as NUMLError::getSeverity(), NUMLError::isFatal(), and so on. The present method encapsulates iteration and interrogation of all objects in an NUMLErrorLog, making it easy to check for the presence of error objects with specific severity levels.
void NUMLErrorLog::logError | ( | const unsigned int | errorId = 0 , |
const unsigned int | level = NUML_DEFAULT_LEVEL , |
||
const unsigned int | version = NUML_DEFAULT_VERSION , |
||
const std::string & | details = "" , |
||
const unsigned int | line = 0 , |
||
const unsigned int | column = 0 , |
||
const unsigned int | severity = LIBNUML_SEV_ERROR , |
||
const unsigned int | category = LIBNUML_CAT_NUML |
||
) |
Convenience function that combines creating an NUMLError object and adding it to the log.
errorId | an unsigned int, the identification number of the error. |
details | a string containing additional details about the error. If the error code in errorId is one that is recognized by NUMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error. |
line | an unsigned int, the line number at which the error occured. |
column | an unsigned int, the column number at which the error occured. |
severity | an integer indicating severity of the error. |
category | an integer indicating the category to which the error belongs. |
@docnote The native C++ implementation of this method defines a default argument value. In the documentation generated for different libNUML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libNUML documentation will be identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.
void NUMLErrorLog::remove | ( | const unsigned int | errorId | ) |
Removes an error having errorId from the NUMLError list.
Only the first item will be removed if there are multiple errors with the given errorId.
errorId | the error identifier of the error to be removed. |