Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Sources   Namespace Members   Compound Members   File Members  

MapperErrorHandler Class Reference

Encapsulates DOM and XML error handling for the Mapper program. More...

#include <MapperErrorHandler.h>

Class diagram for MapperErrorHandler:

ErrorHandler

List of all members.


Public Members

 MapperErrorHandler ( const char *name )
The only constructur for a MapperErrorHandler. More...

virtual ~MapperErrorHandler (void)
virtual void fatalError ( const SAXParseException &exception )
Handle a fatal XML parsing error. More...

virtual void error ( const SAXParseException &exception )
Handle an XML parsing error. More...

virtual void warning ( const SAXParseException &exception )
Handle an XML parsing situation which is worrying but not erroneous. More...

virtual void resetErrors (void)
Clear the error handling state. More...

void error ( const error::element_error &e )
Handle an error in a DOM element. More...

void fatalError ( const DOM_DOMException &exception )
Handle a fatal DOM error. More...

void fatalError ( const XMLException &exception )
Handle a fatal XML error. More...

void unexpectedError (void)
Handle an unexpected error. More...

void badOptionArgument ( const char option, const char *optarg )
Handle a bad command-line option argument. More...

void error ( const char *description )
Handle a generic error. More...

void warning ( const char *description )
Report a non serious problem. More...

void report ( const string entity, const unsigned line, const unsigned column, const string &severity, const string &message ) const
Output a formatted message. More...

void report ( const SAXParseException &ex, const string &severity ) const
Output a formatted message describing a parsing exception. More...

void report ( const DOM_DOMException &ex, const string &severity ) const
Output a formatted message describing a DOM exception. More...

unsigned errors
A count of the number of errors encountered so far.

const char* my_name
The name of the program. More...


Detailed Description

Encapsulates DOM and XML error handling for the Mapper program.

An object of this class is used by other code that detects errors, so the error detection code can be separate from the error handling code. This class implements error handling by writing error messages to standard error output and maintaining a count of the number of errors.

Definition at line 53 of file MapperErrorHandler.h.


Member Function Documentation

MapperErrorHandler::MapperErrorHandler (const char * name)

The only constructur for a MapperErrorHandler.

Postconditions:
 assert( this->my_name == name );
 assert( this->errors == 0 );

Definition at line 46 of file MapperErrorHandler.cpp.

MapperErrorHandler::~MapperErrorHandler (void) [virtual]

Definition at line 62 of file MapperErrorHandler.cpp.

void MapperErrorHandler::fatalError (const SAXParseException & exception) [virtual]

Handle a fatal XML parsing error.

This member function handles the situation by issuing an error report using the report member function, and incrementing the errors count.

Definition at line 133 of file MapperErrorHandler.cpp.

void MapperErrorHandler::error (const SAXParseException & exception) [virtual]

Handle an XML parsing error.

This member function handles the situation by issuing an error report using the report member function, and incrementing the errors count.

Definition at line 123 of file MapperErrorHandler.cpp.

void MapperErrorHandler::warning (const SAXParseException & exception) [virtual]

Handle an XML parsing situation which is worrying but not erroneous.

This member function handles the situation by issuing a warning using the report member function.

Definition at line 114 of file MapperErrorHandler.cpp.

void MapperErrorHandler::resetErrors (void) [virtual]

Clear the error handling state.

Postconditions:
 assert( this->errors == 0 );

Definition at line 143 of file MapperErrorHandler.cpp.

void MapperErrorHandler::error (const error::element_error & e)

Handle an error in a DOM element.

This member function handles the error by writing the message describing the error to cerr (standard error output), and showing the location of the element by showing the element tag and the element tags of all the elements enclosing that element.

This is the lowest-level error handling function for a DOM element error. Consider using one of the more specialised member functions, if possible.

Parameters:
e   a description of the error

Definition at line 177 of file MapperErrorHandler.cpp.

void MapperErrorHandler::fatalError (const DOM_DOMException & exception)

Handle a fatal DOM error.

This member function handles the error by writing a message describing the error to cerr (standard error output).

Definition at line 150 of file MapperErrorHandler.cpp.

void MapperErrorHandler::fatalError (const XMLException & exception)

Handle a fatal XML error.

This member function handles the situation by issuing an error report using the report member function, and incrementing the errors count.

Definition at line 161 of file MapperErrorHandler.cpp.

void MapperErrorHandler::unexpectedError (void)

Handle an unexpected error.

This member function hanles the error by writing a report to cerr (standard error output) and incrementing the errors count.

Definition at line 188 of file MapperErrorHandler.cpp.

void MapperErrorHandler::badOptionArgument (const char option, const char * optarg)

Handle a bad command-line option argument.

This member function handles the error by writing a report to cerr (standard error output) and incrementing the errors count.

Parameters:
option   the command optoin
optarg   the erroneous option argument

Definition at line 214 of file MapperErrorHandler.cpp.

void MapperErrorHandler::error (const char * message)

Handle a generic error.

This member function handles the error by writing a report to cerr (standard error output) and incrementing the errors count.

Parameters:
description   a description of the error

Definition at line 195 of file MapperErrorHandler.cpp.

void MapperErrorHandler::warning (const char * message)

Report a non serious problem.

The report is written to cerr (standard error output).

Parameters:
description   a description of the error

Definition at line 205 of file MapperErrorHandler.cpp.

void MapperErrorHandler::report (const string entity, const unsigned line, const unsigned column, const string & severity, const string & message) const

Output a formatted message.

Parameters:
entity   the name of the entity (file or URL) to which this message pertains
line   the line number of the entity to which this message pertains, or (unsigned)(-1) if the line numerb is unknown
column   the column number of the entity to which this message pertains, or (unsigned)(-1) if the line numerb is unknown
severity   a description of the severity of the situation being reported
message   the situation being reported

Definition at line 69 of file MapperErrorHandler.cpp.

void MapperErrorHandler::report (const SAXParseException & ex, const string & severity) const

Output a formatted message describing a parsing exception.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This member function uses information provided by the exception object to report an appropriate message.

Parameters:
ex   the exception
severity   the severity of the exception

Definition at line 91 of file MapperErrorHandler.cpp.

void MapperErrorHandler::report (const DOM_DOMException & ex, const string & severity) const

Output a formatted message describing a DOM exception.

Parameters:
ex   the exception
severity   the severity of the exception

Member Data Documentation

unsigned MapperErrorHandler::errors

A count of the number of errors encountered so far.

Definition at line 78 of file MapperErrorHandler.h.

const char* MapperErrorHandler::my_name

The name of the program.

Used in some error messages.

Definition at line 84 of file MapperErrorHandler.h.


The documentation for this class was generated from the following files:
Generated at Sun Jul 14 20:38:15 2002 for Mapper by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999