Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:24

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_PANICHANDLER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_PANICHANDLER_HPP
0024 
0025 #include <xercesc/util/XMemory.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 /**
0030   * Receive notification of panic.
0031   *
0032   * <p>This is the interface, through which the Xercesc reports
0033   *    a panic to the application. 
0034   * </p>
0035   *
0036   * <p>Application may implement this interface, instantiate an
0037   *    object of the derivative, and plug it to Xercesc in the
0038   *    invocation to XMLPlatformUtils::Initialize(), if it prefers 
0039   *    to handling panic itself rather than Xercesc doing it.
0040   * </p>
0041   *
0042   */
0043 
0044 class XMLUTIL_EXPORT PanicHandler
0045 {
0046 public:
0047 
0048     /** @name Public Types */
0049     //@{
0050     enum PanicReasons
0051     {
0052           Panic_NoTransService
0053         , Panic_NoDefTranscoder
0054         , Panic_CantFindLib
0055         , Panic_UnknownMsgDomain
0056         , Panic_CantLoadMsgDomain
0057         , Panic_SynchronizationErr
0058         , Panic_SystemInit
0059         , Panic_AllStaticInitErr
0060         , Panic_MutexErr
0061         , PanicReasons_Count
0062     };
0063     //@}
0064 
0065 protected:
0066 
0067     /** @name hidden Constructors */
0068     //@{
0069     /** Default constructor */
0070     PanicHandler(){};
0071 
0072 public:
0073 
0074     /** Destructor */
0075     virtual ~PanicHandler(){};   
0076     //@}
0077 
0078     /** @name The virtual panic handler interface */
0079     //@{
0080    /**
0081     * Receive notification of panic
0082     *
0083     * This method is called when an unrecoverable error has occurred in the Xerces library.  
0084     *
0085     * This method must not return normally, otherwise, the results are undefined. 
0086     * 
0087     * Ways of handling this call could include throwing an exception or exiting the process.
0088     *
0089     * Once this method has been called, the results of calling any other Xerces API, 
0090     * or using any existing Xerces objects are undefined.    
0091     *
0092     * @param reason The reason of panic
0093     *
0094     */
0095     virtual void panic(const PanicHandler::PanicReasons reason) = 0;
0096     //@}
0097 
0098     static const char* getPanicReasonString(const PanicHandler::PanicReasons reason);
0099     
0100 private:
0101 
0102     /* Unimplemented Constructors and operators */
0103     /* Copy constructor */
0104     PanicHandler(const PanicHandler&);
0105     
0106     /** Assignment operator */
0107     PanicHandler& operator=(const PanicHandler&);
0108 };
0109 
0110 XERCES_CPP_NAMESPACE_END
0111 
0112 #endif