libSBML C# API  libSBML 5.13.0 C# API
libsbmlcs.XMLErrorLog Class Reference
Inheritance diagram for libsbmlcs.XMLErrorLog:
[legend]

Detailed Description

{core}

Log of diagnostics reported during XML processing.

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(unsigned int n) . 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)
 
void add (SWIGTYPE_p_std__vectorT_XMLError_p_t errors)
 
void changeErrorSeverity (int originalSeverity, int targetSeverity, string package)
 Changes the severity override for errors in the log that have a given severity. More...
 
void changeErrorSeverity (int originalSeverity, int targetSeverity)
 Changes the severity override for errors in the log that have a given severity. 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...
 
int getSeverityOverride ()
 Returns the current override. More...
 
bool isSeverityOverridden ()
 Returns a boolean indicating whether or not the severity has been overridden. 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...
 
void printErrors (OStream stream, long severity)
 Prints the errors or warnings with given severity stored in this error log. More...
 
void setSeverityOverride (int severity)
 Set the severity override. More...
 
string toString ()
 Writes all errors contained in this log to a string and returns it. More...
 
void unsetSeverityOverride ()
 Usets an existing override. More...
 
 XMLErrorLog ()
 
 XMLErrorLog (XMLErrorLog other)
 

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

§ XMLErrorLog() [1/2]

libsbmlcs.XMLErrorLog.XMLErrorLog ( )

§ XMLErrorLog() [2/2]

libsbmlcs.XMLErrorLog.XMLErrorLog ( XMLErrorLog  other)

Member Function Documentation

§ add() [1/2]

void libsbmlcs.XMLErrorLog.add ( XMLError  error)

§ add() [2/2]

void libsbmlcs.XMLErrorLog.add ( SWIGTYPE_p_std__vectorT_XMLError_p_t  errors)

§ changeErrorSeverity() [1/2]

void libsbmlcs.XMLErrorLog.changeErrorSeverity ( int  originalSeverity,
int  targetSeverity,
string  package 
)

Changes the severity override for errors in the log that have a given severity.

This method searches through the list of errors in the log, comparing each one's severity to the value of originalSeverity. For each error encountered with that severity logged by the named package, the severity of the error is reset to targetSeverity.

The severity override mechanism in XMLErrorLog is intended to help applications handle error conditions in ways that may be more convenient for those applications. It is possible to use the mechanism to override the severity code of errors logged by libSBML, and even to disable error logging completely. An override stays in effect until the override is changed again by the calling application.

Parameters
originalSeveritythe severity code to match
targetSeveritythe severity code to use as the new severity
packagea string, the name of an SBML Level 3 package extension to use to narrow the search for errors. A value of 'all' signifies to match against errors logged from any package; a value of a package nickname such as 'comp' signifies to limit consideration to errors from just that package. If no value is provided, 'all' is the default.
Documentation note:
The native C++ implementation of this method defines a default argument value. In the documentation generated for different libSBML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java and C#, 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 libSBML 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.
See also
isSeverityOverridden()
getSeverityOverride()
setSeverityOverride()
unsetSeverityOverride()

§ changeErrorSeverity() [2/2]

void libsbmlcs.XMLErrorLog.changeErrorSeverity ( int  originalSeverity,
int  targetSeverity 
)

Changes the severity override for errors in the log that have a given severity.

This method searches through the list of errors in the log, comparing each one's severity to the value of originalSeverity. For each error encountered with that severity logged by the named package, the severity of the error is reset to targetSeverity.

The severity override mechanism in XMLErrorLog is intended to help applications handle error conditions in ways that may be more convenient for those applications. It is possible to use the mechanism to override the severity code of errors logged by libSBML, and even to disable error logging completely. An override stays in effect until the override is changed again by the calling application.

Parameters
originalSeveritythe severity code to match
targetSeveritythe severity code to use as the new severity
packagea string, the name of an SBML Level 3 package extension to use to narrow the search for errors. A value of 'all' signifies to match against errors logged from any package; a value of a package nickname such as 'comp' signifies to limit consideration to errors from just that package. If no value is provided, 'all' is the default.
Documentation note:
The native C++ implementation of this method defines a default argument value. In the documentation generated for different libSBML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java and C#, 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 libSBML 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.
See also
isSeverityOverridden()
getSeverityOverride()
setSeverityOverride()
unsetSeverityOverride()

§ clearLog()

void libsbmlcs.XMLErrorLog.clearLog ( )

Deletes all errors from this log.

§ Dispose()

virtual void libsbmlcs.XMLErrorLog.Dispose ( )
virtual

Reimplemented in libsbmlcs.SBMLErrorLog.

§ Equals()

override bool libsbmlcs.XMLErrorLog.Equals ( Object  sb)

§ getError()

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()

§ GetHashCode()

override int libsbmlcs.XMLErrorLog.GetHashCode ( )

§ getNumErrors()

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(unsigned int n) .

Returns
the number of errors that have been logged.

§ getSeverityOverride()

int libsbmlcs.XMLErrorLog.getSeverityOverride ( )

Returns the current override.

The severity override mechanism in XMLErrorLog is intended to help applications handle error conditions in ways that may be more convenient for those applications. It is possible to use the mechanism to override the severity code of errors logged by libSBML, and even to disable error logging completely. An override stays in effect until the override is changed again by the calling application.

Returns
a severity override code. The possible values are drawn from the set of integer constants whose names begin with the prefix LIBSBML_OVERRIDE_:
See also
isSeverityOverridden()
setSeverityOverride()
unsetSeverityOverride()
changeErrorSeverity()

§ isSeverityOverridden()

bool libsbmlcs.XMLErrorLog.isSeverityOverridden ( )

Returns a boolean indicating whether or not the severity has been overridden.

The severity override mechanism in XMLErrorLog is intended to help applications handle error conditions in ways that may be more convenient for those applications. It is possible to use the mechanism to override the severity code of errors logged by libSBML, and even to disable error logging completely. An override stays in effect until the override is changed again by the calling application.

Returns
true if an error severity override has been set, false otherwise.
See also
getSeverityOverride()
setSeverityOverride()
unsetSeverityOverride()
changeErrorSeverity()

§ operator!=()

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

§ operator==()

static bool libsbmlcs.XMLErrorLog.operator== ( XMLErrorLog  lhs,
XMLErrorLog  rhs 
)
static

§ printErrors() [1/3]

void libsbmlcs.XMLErrorLog.printErrors ( OStream  stream)

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

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

The format of the output is:

  N error(s):
    line NNN: (id) message

If no errors have occurred, i.e., getNumErrors() == 0, then no output will be produced.

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
Documentation note:
The native C++ implementation of this method defines a default argument value. In the documentation generated for different libSBML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java and C#, 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 libSBML 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.

§ printErrors() [2/3]

void libsbmlcs.XMLErrorLog.printErrors ( )

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

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

The format of the output is:

  N error(s):
    line NNN: (id) message

If no errors have occurred, i.e., getNumErrors() == 0, then no output will be produced.

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
Documentation note:
The native C++ implementation of this method defines a default argument value. In the documentation generated for different libSBML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java and C#, 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 libSBML 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.

§ printErrors() [3/3]

void libsbmlcs.XMLErrorLog.printErrors ( OStream  stream,
long  severity 
)

Prints the errors or warnings with given severity stored in this error log.

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

The format of the output is:

   N error(s):
     line NNN: (id) message

If no errors with that severity was found, then no output will be produced.

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
severitythe severity of the errors sought.

§ setSeverityOverride()

void libsbmlcs.XMLErrorLog.setSeverityOverride ( int  severity)

Set the severity override.

The severity override mechanism in XMLErrorLog is intended to help applications handle error conditions in ways that may be more convenient for those applications. It is possible to use the mechanism to override the severity code of errors logged by libSBML, and even to disable error logging completely. An override stays in effect until the override is changed again by the calling application.

Parameters
severityan override code indicating what to do. If the value is LIBSBML_OVERRIDE_DISABLED (the default setting) all errors logged will be given the severity specified in their usual definition. If the value is LIBSBML_OVERRIDE_WARNING, then all errors will be logged as warnings. If the value is LIBSBML_OVERRIDE_DONT_LOG, no error will be logged, regardless of their severity.
See also
isSeverityOverridden()
getSeverityOverride()
unsetSeverityOverride()
changeErrorSeverity()

§ toString()

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()

§ unsetSeverityOverride()

void libsbmlcs.XMLErrorLog.unsetSeverityOverride ( )

Usets an existing override.

The severity override mechanism in XMLErrorLog is intended to help applications handle error conditions in ways that may be more convenient for those applications. It is possible to use the mechanism to override the severity code of errors logged by libSBML, and even to disable error logging completely. An override stays in effect until the override is changed again by the calling application.

See also
getSeverityOverride()
setSeverityOverride()
isSeverityOverridden()
changeErrorSeverity()

Member Data Documentation

§ swigCMemOwn

bool libsbmlcs.XMLErrorLog.swigCMemOwn
protected