Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:55

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLINTERNALERRORHANDLER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLINTERNALERRORHANDLER_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 #include <xercesc/sax/ErrorHandler.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 class XMLInternalErrorHandler : public ErrorHandler
0031 {
0032 public:
0033     // -----------------------------------------------------------------------
0034     //  Constructors and Destructor
0035     // -----------------------------------------------------------------------
0036     XMLInternalErrorHandler(ErrorHandler* userHandler = 0) :
0037        fSawWarning(false),
0038        fSawError(false),
0039        fSawFatal(false),
0040        fUserErrorHandler(userHandler)
0041     {
0042     }
0043 
0044     ~XMLInternalErrorHandler()
0045     {
0046     }
0047 
0048     // -----------------------------------------------------------------------
0049     //  Implementation of the error handler interface
0050     // -----------------------------------------------------------------------
0051     void warning(const SAXParseException& toCatch);
0052     void error(const SAXParseException& toCatch);
0053     void fatalError(const SAXParseException& toCatch);
0054     void resetErrors();
0055 
0056     // -----------------------------------------------------------------------
0057     //  Getter methods
0058     // -----------------------------------------------------------------------
0059     bool getSawWarning() const;
0060     bool getSawError() const;
0061     bool getSawFatal() const;
0062 
0063     // -----------------------------------------------------------------------
0064     //  Private data members
0065     //
0066     //  fSawWarning
0067     //      This is set if we get any warning, and is queryable via a getter
0068     //      method.
0069     //
0070     //  fSawError
0071     //      This is set if we get any errors, and is queryable via a getter
0072     //      method.
0073     //
0074     //  fSawFatal
0075     //      This is set if we get any fatal, and is queryable via a getter
0076     //      method.
0077     //
0078     //  fUserErrorHandler
0079     //      This is the error handler from user
0080     // -----------------------------------------------------------------------
0081     bool    fSawWarning;
0082     bool    fSawError;
0083     bool    fSawFatal;
0084     ErrorHandler* fUserErrorHandler;
0085 
0086 private:
0087     // -----------------------------------------------------------------------
0088     //  Unimplemented constructors and operators
0089     // -----------------------------------------------------------------------
0090     XMLInternalErrorHandler(const XMLInternalErrorHandler&);
0091     XMLInternalErrorHandler& operator=(const XMLInternalErrorHandler&);
0092 };
0093 
0094 inline bool XMLInternalErrorHandler::getSawWarning() const
0095 {
0096     return fSawWarning;
0097 }
0098 
0099 inline bool XMLInternalErrorHandler::getSawError() const
0100 {
0101     return fSawError;
0102 }
0103 
0104 inline bool XMLInternalErrorHandler::getSawFatal() const
0105 {
0106     return fSawFatal;
0107 }
0108 
0109 inline void XMLInternalErrorHandler::warning(const SAXParseException& toCatch)
0110 {
0111     fSawWarning = true;
0112     if (fUserErrorHandler)
0113         fUserErrorHandler->warning(toCatch);
0114 }
0115 
0116 inline void XMLInternalErrorHandler::error(const SAXParseException& toCatch)
0117 {
0118     fSawError = true;
0119     if (fUserErrorHandler)
0120         fUserErrorHandler->error(toCatch);
0121 }
0122 
0123 inline void XMLInternalErrorHandler::fatalError(const SAXParseException& toCatch)
0124 {
0125     fSawFatal = true;
0126     if (fUserErrorHandler)
0127         fUserErrorHandler->fatalError(toCatch);
0128 }
0129 
0130 inline void XMLInternalErrorHandler::resetErrors()
0131 {
0132     fSawWarning = false;
0133     fSawError = false;
0134     fSawFatal = false;
0135 }
0136 
0137 XERCES_CPP_NAMESPACE_END
0138 
0139 #endif