ome-common  5.5.0
Public Member Functions | Private Attributes | List of all members
ome::common::xml::ErrorReporter Class Reference

Xerces error handler reporting errors to an ostream. More...

#include <ome/common/xml/ErrorReporter.h>

+ Inheritance diagram for ome::common::xml::ErrorReporter:
+ Collaboration diagram for ome::common::xml::ErrorReporter:

Public Member Functions

 ErrorReporter (std::ostream &stream=std::cerr)
 Construct an ErrorReporter. More...
 
 ~ErrorReporter ()
 The destructor.
 
void warning (const xercesc::SAXParseException &toCatch)
 Log a warning. More...
 
void error (const xercesc::SAXParseException &toCatch)
 Log an error. More...
 
void fatalError (const xercesc::SAXParseException &toCatch)
 Log a fatal error. More...
 
void resetErrors ()
 Reset error status. More...
 
 operator bool () const
 Has an error been encountered? More...
 

Private Attributes

std::ostream & stream
 The output stream to use.
 
bool saw_error
 Has an error been encountered?
 

Detailed Description

Xerces error handler reporting errors to an ostream.

Encountered Xerces xercesc::SAXParseException exceptions are logged to the specified ostream. Xerces exceptions don't derive from any of the standard exception classes, and don't use standard strings, making them difficult to catch and process. If an error is encountered, this class will evaluate to true.

Constructor & Destructor Documentation

◆ ErrorReporter()

ome::common::xml::ErrorReporter::ErrorReporter ( std::ostream &  stream = std::cerr)

Construct an ErrorReporter.

Parameters
streamthe stream to output exception details to.

Member Function Documentation

◆ error()

void ome::common::xml::ErrorReporter::error ( const xercesc::SAXParseException &  toCatch)

Log an error.

Parameters
toCatchthe exception to log.

References saw_error, and stream.

◆ fatalError()

void ome::common::xml::ErrorReporter::fatalError ( const xercesc::SAXParseException &  toCatch)

Log a fatal error.

Parameters
toCatchthe exception to log.

References saw_error.

◆ operator bool()

ome::common::xml::ErrorReporter::operator bool ( ) const
inline

Has an error been encountered?

Returns
true if an error has been encountered, otherwise false.

References saw_error.

◆ resetErrors()

void ome::common::xml::ErrorReporter::resetErrors ( )

Reset error status.

Forget any errors which have been previously encountered. The class will subsequently evaluate to true.

References saw_error.

◆ warning()

void ome::common::xml::ErrorReporter::warning ( const xercesc::SAXParseException &  toCatch)

Log a warning.

Parameters
toCatchthe exception to log.

References stream.


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