libSBML C# API  libSBML 5.8.0 C# API
 All Classes Namespaces Files Functions Variables Properties Pages
libsbmlcs.XMLErrorLog Class Reference
Inheritance diagram for libsbmlcs.XMLErrorLog:
[legend]

Detailed Description

Log of errors and other events encountered while processing an XML file or data stream.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

The error log is a list. The XML layer of libSBML maintains an error log associated with a given XML document or data stream. When an operation results in an error, or when there is something wrong with the XML content, the problem is reported as an XMLError object stored in the XMLErrorLog list. Potential problems range from low-level issues (such as the inability to open a file) to XML syntax errors (such as mismatched tags or other problems).

A typical approach for using this error log is to first use getNumErrors() to inquire how many XMLError object instances it contains, and then to iterate over the list of objects one at a time using getError(long n) const. Indexing in the list begins at 0.

In normal circumstances, programs using libSBML will actually obtain an SBMLErrorLog rather than an XMLErrorLog. The former is subclassed from XMLErrorLog and simply wraps commands for working with SBMLError objects rather than the low-level XMLError objects. Classes such as SBMLDocument use the higher-level SBMLErrorLog.

Public Member Functions

void add (XMLError error)
 Logs the given XMLError. More...
 
void clearLog ()
 Deletes all errors from this log. More...
 
virtual void Dispose ()
 
override bool Equals (Object sb)
 
XMLError getError (long n)
 Returns the nth XMLError object in this log. More...
 
override int GetHashCode ()
 
long getNumErrors ()
 Returns the number of errors that have been logged. More...
 
void printErrors (OStream stream)
 Prints all the errors or warnings stored in this error log. More...
 
void printErrors ()
 Prints all the errors or warnings stored in this error log. More...
 
string toString ()
 Writes all errors contained in this log to a string and returns it. More...
 
 XMLErrorLog ()
 Creates a new empty XMLErrorLog. More...
 

Static Public Member Functions

static bool operator!= (XMLErrorLog lhs, XMLErrorLog rhs)
 
static bool operator== (XMLErrorLog lhs, XMLErrorLog rhs)
 

Protected Attributes

bool swigCMemOwn
 

Constructor & Destructor Documentation

libsbmlcs.XMLErrorLog.XMLErrorLog ( )

Creates a new empty XMLErrorLog.

Member Function Documentation

void libsbmlcs.XMLErrorLog.add ( XMLError  error)

Logs the given XMLError.

Parameters
errorXMLError, the error to be logged.
void libsbmlcs.XMLErrorLog.clearLog ( )

Deletes all errors from this log.

virtual void libsbmlcs.XMLErrorLog.Dispose ( )
virtual

Reimplemented in libsbmlcs.SBMLErrorLog.

override bool libsbmlcs.XMLErrorLog.Equals ( Object  sb)
XMLError libsbmlcs.XMLErrorLog.getError ( long  n)

Returns the nth XMLError object in this log.

Index n is counted from 0. Callers should first inquire about the number of items in the log by using the method getNumErrors(). Attempts to use an error index number that exceeds the actual number of errors in the log will result in a null being returned.

Parameters
nthe index number of the error to retrieve (with 0 being the first error).
Returns
the nth XMLError in this log, or null if n is greater than or equal to getNumErrors().
See Also
getNumErrors()
override int libsbmlcs.XMLErrorLog.GetHashCode ( )
long libsbmlcs.XMLErrorLog.getNumErrors ( )

Returns the number of errors that have been logged.

To retrieve individual errors from the log, callers may use XMLErrorLog::getError(long n) .

Returns
the number of errors that have been logged.
static bool libsbmlcs.XMLErrorLog.operator!= ( XMLErrorLog  lhs,
XMLErrorLog  rhs 
)
static
static bool libsbmlcs.XMLErrorLog.operator== ( XMLErrorLog  lhs,
XMLErrorLog  rhs 
)
static
void libsbmlcs.XMLErrorLog.printErrors ( OStream  stream)

Prints all the errors or warnings stored in this error log.

It prints the text to the stream given by the optional parameter stream. If no parameter is given, it prints the output to the standard error stream.

If no errors have occurred, i.e., getNumErrors() == 0, no output will be sent to the stream.

The format of the output is: N error(s): line NNN: (id) message

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
void libsbmlcs.XMLErrorLog.printErrors ( )

Prints all the errors or warnings stored in this error log.

It prints the text to the stream given by the optional parameter stream. If no parameter is given, it prints the output to the standard error stream.

If no errors have occurred, i.e., getNumErrors() == 0, no output will be sent to the stream.

The format of the output is: N error(s): line NNN: (id) message

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
string libsbmlcs.XMLErrorLog.toString ( )

Writes all errors contained in this log to a string and returns it.

This method uses printErrors() to format the diagnostic messages. Please consult that method for information about the organization of the messages in the string returned by this method.

Returns
a string containing all logged errors and warnings.
See Also
printErrors()

Member Data Documentation

bool libsbmlcs.XMLErrorLog.swigCMemOwn
protected