Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

xmlflowexception.hpp

Go to the documentation of this file.
00001 #if !defined(_XMLFLOWEXCEPTION_HPP)
00002 #define _XMLFLOWEXCEPTION_HPP
00003 //============================================================================= 
00004 //
00005 // XDFLengine library
00006 //
00007 //-----------------------------------------------------------------------------
00008 //  XMLFLOWEXCEPTION.HPP
00009 //-----------------------------------------------------------------------------
00015 //_____________________________________________________________________________
00016 //
00017 //  Copyright (C) 2003 Guillaume Baurand. All Rights Reserved.
00018 //
00019 //  This file is part of the XDFLengine project.
00020 //
00021 //  The XDFLengine is free software; you can redistribute it and/or modify
00022 //  it under the terms of the GNU General Public License as published by
00023 //  the Free Software Foundation; either version 2 of the License, or
00024 //  (at your option) any later version.
00025 //
00026 //  This program is distributed in the hope that it will be useful,
00027 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00028 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00029 //  GNU General Public License for more details.
00030 //
00031 //  You should have received a copy of the GNU General Public License
00032 //  along with this program; if not, write to the Free Software
00033 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00034 //  USA.
00035 //
00036 //  For more information, 
00037 //      contact  : guillaume@baurand.net 
00038 //      or visit : http://xdflengine.sourceforge.net
00039 //
00040 //============================================================================= 
00041 
00042 #   include "xercesc/sax/ErrorHandler.hpp"
00043 #   include "xercesc/sax/SAXParseException.hpp"
00044 
00045 #   include "config/commonincs.hpp"
00046 
00047 XERCES_CPP_NAMESPACE_USE;
00048 
00049 BEGIN_XDFLENGINE_NS;
00050 
00051 class XMLStreamBuffer;
00052 class XMLStreamConsumer;
00053 
00054 // XDFLengine exception management aliases
00055 
00056 #define PREP_CATCH_XML_FLOW_ERROR               XMLFlowException* l_pXMLFlowException=0; bool l_boolXMLFlowException=false
00057 #define WATCH_XML_FLOW_ERROR                    try 
00058 #define CATCH_XML_FLOW_ERROR                    catch( XMLFlowException* e_pXMLFlowException)
00059 #define CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN catch( XMLFlowException* e_pXMLFlowException){ l_pXMLFlowException = e_pXMLFlowException; l_boolXMLFlowException=true; goto RELEASE_AND_RETURN; }
00060 #define ON_XML_FLOW_ERROR_THROW                 if( l_boolXMLFlowException) throw l_pXMLFlowException
00061 #define ON_XML_FLOW_ERROR_DO                    if( l_boolXMLFlowException)
00062 #define MAKE_XMLFLOW_EXCEPTION                  l_boolXMLFlowException=true; l_pXMLFlowException=new XMLFlowException
00063 #define THROW_XMLFLOW_EXCEPTION                 XMLFlowException::throwXMLFlowException
00064 
00065 //============================================================================= 
00066 //  CLASS XMLFLOWEXCEPTION
00067 //----------------------------------------------------------------------------- 
00070 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00071 class XDFLENGINE_EXPORT XMLFlowException
00072 {
00073     private: 
00074 
00075         int         m_intErrNumber;             
00076         char*       m_pszErrMessage;            
00077         char*       m_pszErrContext;            
00078         char*       m_pszErrLocalisation;       
00079         char*       m_pszErrCause;              
00080         bool        m_boolFatal;                
00081 
00082     public: 
00083 
00084     // CONSTRUCTOR & DESTRUCTOR
00085 
00086         //_____________________________________________________________________
00087         //  THROWXMLFLOWEXCEPTION
00088         //---------------------------------------------------------------------
00096         //_____________________________________________________________________ 
00097         static void throwXMLFlowException(int p_intNumber, const char* p_pszMessage, const char* p_pszContext, const char* p_pszLocalisation, const char* p_pszCause, bool p_boolFatal);
00098 
00099         //_____________________________________________________________________
00100         //  XMLFLOWEXCEPTION
00101         //---------------------------------------------------------------------
00109         //_____________________________________________________________________         
00110         XMLFlowException(int p_intNumber, const char* p_pszMessage, const char* p_pszContext, const char* p_pszLocalisation, const char* p_pszCause, bool p_boolFatal);
00111 
00112         //_____________________________________________________________________
00113         //  ~XMLFLOWEXCEPTION
00114         //---------------------------------------------------------------------
00116         //_____________________________________________________________________ 
00117         ~XMLFlowException();
00118 
00119         //_____________________________________________________________________
00120         //  ISFATAL
00121         //---------------------------------------------------------------------
00124         //_____________________________________________________________________ 
00125         bool isFatal();
00126 
00127         //_____________________________________________________________________
00128         //  MAKEXML
00129         //---------------------------------------------------------------------
00132         //_____________________________________________________________________ 
00133         XMLFlowException& operator >> (XMLStreamConsumer & p_Output);
00134         
00135         //_____________________________________________________________________
00136         //  GETNUMBER
00137         //---------------------------------------------------------------------
00140         //_____________________________________________________________________     
00141         int getNumber();    
00142 };
00143 
00144 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00145 //=============================================================================
00146 
00147 
00148 //============================================================================= 
00149 //  CLASS PARSEERRORREPORTER
00150 //----------------------------------------------------------------------------- 
00152 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00153 class XDFLENGINE_EXPORT XDFLSaxErrorReporter : public ErrorHandler
00154 {
00155 
00156     private: 
00157 
00158         bool        fSawErrors;         
00159         char*       m_pszParseName;     
00160 
00161 
00162     public: 
00163 
00164         //_____________________________________________________________________
00165         //  PARSEERRORREPORTER
00166         //---------------------------------------------------------------------
00169         //_____________________________________________________________________ 
00170         XDFLSaxErrorReporter ( const char* p_pszParseName);
00171 
00172         //_____________________________________________________________________
00173         //  ~PARSEERRORREPORTER
00174         //---------------------------------------------------------------------
00176         //_____________________________________________________________________ 
00177         ~XDFLSaxErrorReporter();
00178 
00179         //_____________________________________________________________________
00180         //  WARNING
00181         //---------------------------------------------------------------------
00184         //_____________________________________________________________________ 
00185         void warning ( const SAXParseException& toCatch);
00186 
00187         //_____________________________________________________________________
00188         //  ERROR
00189         //---------------------------------------------------------------------
00192         //_____________________________________________________________________ 
00193         void error ( const SAXParseException& toCatch);
00194 
00195         //_____________________________________________________________________
00196         //  FATALERROR
00197         //---------------------------------------------------------------------
00200         //_____________________________________________________________________ 
00201         void fatalError ( const SAXParseException& toCatch);
00202 
00203         //_____________________________________________________________________
00204         //  RESETERRORS
00205         //---------------------------------------------------------------------
00207         //_____________________________________________________________________ 
00208         void resetErrors ();
00209 
00210         //_____________________________________________________________________
00211         //  GETSAWERRORS
00212         //---------------------------------------------------------------------
00214         //_____________________________________________________________________ 
00215         bool getSawErrors ();
00216 };
00217 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00218 //============================================================================= 
00219 
00220 END_XDFLENGINE_NS
00221         
00222 #endif
00223 

Generated on Sat Oct 4 13:20:03 2003 for XDFLengine by doxygen1.3-rc2