Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

DOMTreeErrorReporter.h

Go to the documentation of this file.
00001 #ifndef Impala_Persistency_DOMTreeErrorReporter_h
00002 #define Impala_Persistency_DOMTreeErrorReporter_h
00003 
00004 #include <iostream>
00005 
00006 //#include <xercesc/util/XercesDefs.hpp>
00007 #include <xercesc/sax/SAXParseException.hpp>
00008 #include <xercesc/sax/ErrorHandler.hpp>
00009 //#include <xercesc/dom/DOM.hpp>
00010 #include "Basis/ILog.h"
00011 
00012 
00013 namespace Impala
00014 {
00015 namespace Persistency
00016 {
00017 
00023 class StrX
00024 {
00025 public :
00026 
00027     StrX(const XMLCh* const toTranscode)
00028     {
00029         // Call the private transcoding method
00030         fLocalForm = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(toTranscode);
00031     }
00032 
00033     ~StrX()
00034     {
00035         XERCES_CPP_NAMESPACE_QUALIFIER XMLString::release(&fLocalForm);
00036     }
00037 
00038     const char*
00039     localForm() const
00040     {
00041         return fLocalForm;
00042     }
00043 
00044 private :
00045 
00047     char*   fLocalForm;  
00048 };
00049 
00050 
00051 class DOMTreeErrorReporter : public XERCES_CPP_NAMESPACE_QUALIFIER ErrorHandler
00052 {
00053 public:
00054 
00055     DOMTreeErrorReporter() :
00056         fSawErrors(false)
00057     {
00058     }
00059 
00060     ~DOMTreeErrorReporter()
00061     {
00062     }
00063 
00064     void
00065     warning(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& toCatch)
00066     {
00067     }
00068 
00069     void
00070     error(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& toCatch)
00071     {
00072         fSawErrors = true;
00073         ILOG_ERROR("Error in file \""
00074                    << StrX(toCatch.getSystemId()).localForm()
00075                    << "\", line " << toCatch.getLineNumber()
00076                    << ", column " << toCatch.getColumnNumber()
00077                    << ": " << StrX(toCatch.getMessage()).localForm());
00078     }
00079 
00080     void
00081     fatalError(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& toCatch)
00082     {
00083         fSawErrors = true;
00084         ILOG_ERROR("Fatal Error in file \""
00085                    << StrX(toCatch.getSystemId()).localForm()
00086                    << "\", line " << toCatch.getLineNumber()
00087                    << ", column " << toCatch.getColumnNumber()
00088                    << ": " << StrX(toCatch.getMessage()).localForm());
00089     }
00090 
00091     void
00092     resetErrors()
00093     {
00094         fSawErrors = false;
00095     }
00096 
00097 
00098     bool
00099     getSawErrors() const
00100     {
00101         return fSawErrors;
00102     }
00103 
00107     bool    fSawErrors;
00108 
00109     ILOG_VAR_DEC;
00110 
00111 };
00112 
00113 ILOG_VAR_INIT(DOMTreeErrorReporter, Impala.Persistency);
00114 
00115 
00116 
00117 }//namespace Persistency
00118 }//namespace Impala
00119 
00120 #endif

Generated on Fri Mar 19 09:31:42 2010 for ImpalaSrc by  doxygen 1.5.1