2003-11-03 17:22:45 +01:00
|
|
|
/*
|
2004-12-05 22:56:09 +01:00
|
|
|
Xerces Error Handler for Pyrogenesis (and the GUI)
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
--Overview--
|
|
|
|
|
|
|
|
This is a class that that will let us output
|
|
|
|
Xerces C++ Parser errors in our own Log
|
2004-12-05 22:56:09 +01:00
|
|
|
or whatever, fit to Pyrogenesis and foremost
|
2003-11-03 17:22:45 +01:00
|
|
|
the GUI.
|
|
|
|
|
|
|
|
--More info--
|
|
|
|
|
|
|
|
http://xml.apache.org/xerces-c/apiDocs/classErrorHandler.html
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_XERCESERRORHANDLER
|
|
|
|
#define INCLUDED_XERCESERRORHANDLER
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2004-06-09 14:45:42 +02:00
|
|
|
#include "XML.h"
|
|
|
|
|
2003-11-03 17:22:45 +01:00
|
|
|
#include <iostream>
|
|
|
|
|
2003-11-24 03:18:41 +01:00
|
|
|
/**
|
|
|
|
* Adapter function that catches Xerces Reading Exceptions
|
2004-12-05 22:56:09 +01:00
|
|
|
* and lets us output them in Pyrogenesis CLogFile.
|
2003-11-24 03:18:41 +01:00
|
|
|
*
|
|
|
|
* Used for all Xerces C++ Parser reading.
|
|
|
|
*
|
|
|
|
* @see http://xml.apache.org/xerces-c/apiDocs/classErrorHandler.html
|
|
|
|
*/
|
2003-11-06 12:54:46 +01:00
|
|
|
class CXercesErrorHandler : public XERCES_CPP_NAMESPACE::ErrorHandler
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
public:
|
2003-11-06 12:54:46 +01:00
|
|
|
CXercesErrorHandler() :
|
2003-11-03 17:22:45 +01:00
|
|
|
fSawErrors(false)
|
2003-11-24 03:18:41 +01:00
|
|
|
{}
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
~CXercesErrorHandler()
|
2003-11-24 03:18:41 +01:00
|
|
|
{}
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
/** @name Implementation of the error handler interface */
|
2003-11-03 17:22:45 +01:00
|
|
|
// -----------------------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* Sends warning exceptions here.
|
|
|
|
*/
|
2003-11-05 23:34:38 +01:00
|
|
|
void warning(const XERCES_CPP_NAMESPACE::SAXParseException& toCatch);
|
2003-11-24 03:18:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends error exceptions here.
|
|
|
|
*/
|
2003-11-05 23:34:38 +01:00
|
|
|
void error(const XERCES_CPP_NAMESPACE::SAXParseException& toCatch);
|
2003-11-24 03:18:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends fatal error exceptions here.
|
|
|
|
*/
|
2003-11-05 23:34:38 +01:00
|
|
|
void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException& toCatch);
|
2003-11-24 03:18:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets fSawError to false.
|
|
|
|
*/
|
2003-11-03 17:22:45 +01:00
|
|
|
void resetErrors();
|
|
|
|
|
2003-11-24 03:18:41 +01:00
|
|
|
//@}
|
2003-11-03 17:22:45 +01:00
|
|
|
// -----------------------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
/** @name Access Functions */
|
2003-11-03 17:22:45 +01:00
|
|
|
// -----------------------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @return true if Errors Occured
|
|
|
|
*/
|
2007-05-02 14:07:08 +02:00
|
|
|
bool GetSawErrors() const { return fSawErrors; }
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2003-11-24 03:18:41 +01:00
|
|
|
//@}
|
2003-11-03 17:22:45 +01:00
|
|
|
private:
|
|
|
|
// -----------------------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
/** @name Private data members */
|
2003-11-03 17:22:45 +01:00
|
|
|
// -----------------------------------------------------------------------
|
2003-11-24 03:18:41 +01:00
|
|
|
//@{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is set if we get any errors, and is queryable via an access
|
|
|
|
* function. Its used by the main code to suppress output if there are
|
|
|
|
* errors.
|
|
|
|
*
|
|
|
|
* @see getSawErrors()
|
|
|
|
*/
|
2003-11-03 17:22:45 +01:00
|
|
|
bool fSawErrors;
|
|
|
|
|
2003-11-24 03:18:41 +01:00
|
|
|
//@}
|
|
|
|
};
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2003-11-24 18:13:37 +01:00
|
|
|
#endif
|