libNuML 1.1.1
Library for reading / writing NuML documents
NUMLErrorLog Class Reference

the error log containing all errors / warnings encountered More...

#include <NUMLErrorLog.h>

Inheritance diagram for NUMLErrorLog:

Public Member Functions

const NUMLErrorgetError (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...
 

Detailed Description

the error log containing all errors / warnings encountered

Constructor & Destructor Documentation

◆ NUMLErrorLog()

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.

◆ ~NUMLErrorLog()

NUMLErrorLog::~NUMLErrorLog ( )
virtual

Destroys this NUMLErrorLog.

Member Function Documentation

◆ add() [1/2]

void NUMLErrorLog::add ( const NUMLError error)

Adds the given NUMLError to the log.

Parameters
errorNUMLError, the error to be logged.

◆ add() [2/2]

void NUMLErrorLog::add ( const std::list< NUMLError > &  errors)

Adds (copies) the NUMLErrors in the given NUMLError list to this NUMLErrorLog.

Parameters
errorslist, a list of NUMLError to be added to the log.

◆ getError()

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.

Parameters
nunsigned int number of the error to retrieve.
Returns
the nth NUMLError in this log.

◆ getNumFailsWithSeverity()

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.

Returns
a count of the number of errors with the given severity code

◆ logError()

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.

Parameters
errorIdan unsigned int, the identification number of the error.
detailsa 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.
linean unsigned int, the line number at which the error occured.
columnan unsigned int, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan 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.

◆ remove()

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.

Parameters
errorIdthe error identifier of the error to be removed.

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