[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 2003 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Log: PanicHandler.hpp,v $
|
---|
| 59 | * Revision 1.6 2003/12/24 17:12:21 cargilld
|
---|
| 60 | * Memory management update.
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.5 2003/12/24 15:24:13 cargilld
|
---|
| 63 | * More updates to memory management so that the static memory manager.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.4 2003/05/22 18:15:16 neilg
|
---|
| 66 | * The PanicHandler interface should not inherit from XMemory.
|
---|
| 67 | * The reason for this is that the default implementation does not
|
---|
| 68 | * allocate memory dynamically and if such an inheritance relation existed,
|
---|
| 69 | * a user would have to be very careful about installing a memory
|
---|
| 70 | * handler on their own PanicHandler before handing it to the
|
---|
| 71 | * XMLPlatformUtils::Initialize() method, since otherwise
|
---|
| 72 | * the (uninitialized) XMLPlatformUtils::fgMemoryManager would be used
|
---|
| 73 | * upon construction of their PanicHandler implementation.
|
---|
| 74 | *
|
---|
| 75 | * Revision 1.3 2003/05/15 19:04:35 knoaman
|
---|
| 76 | * Partial implementation of the configurable memory manager.
|
---|
| 77 | *
|
---|
| 78 | * Revision 1.2 2003/03/10 16:05:11 peiyongz
|
---|
| 79 | * assignment operator
|
---|
| 80 | *
|
---|
| 81 | * Revision 1.1 2003/03/09 17:06:16 peiyongz
|
---|
| 82 | * PanicHandler
|
---|
| 83 | *
|
---|
| 84 | * $Id: PanicHandler.hpp,v 1.6 2003/12/24 17:12:21 cargilld Exp $
|
---|
| 85 | *
|
---|
| 86 | */
|
---|
| 87 |
|
---|
| 88 | #ifndef PANICHANDLER_HPP
|
---|
| 89 | #define PANICHANDLER_HPP
|
---|
| 90 |
|
---|
| 91 | #include <xercesc/util/XMemory.hpp>
|
---|
| 92 |
|
---|
| 93 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 94 |
|
---|
| 95 | /**
|
---|
| 96 | * Receive notification of panic.
|
---|
| 97 | *
|
---|
| 98 | * <p>This is the interface, through which the Xercesc reports
|
---|
| 99 | * a panic to the application.
|
---|
| 100 | * </p>
|
---|
| 101 | *
|
---|
| 102 | * <p>Application may implement this interface, instantiate an
|
---|
| 103 | * object of the derivative, and plug it to Xercesc in the
|
---|
| 104 | * invocation to XMLPlatformUtils::Initialize(), if it prefers
|
---|
| 105 | * to handling panic itself rather than Xercesc doing it.
|
---|
| 106 | * </p>
|
---|
| 107 | *
|
---|
| 108 | */
|
---|
| 109 |
|
---|
| 110 | class XMLUTIL_EXPORT PanicHandler
|
---|
| 111 | {
|
---|
| 112 | public:
|
---|
| 113 |
|
---|
| 114 | /** @name Public Types */
|
---|
| 115 | //@{
|
---|
| 116 | enum PanicReasons
|
---|
| 117 | {
|
---|
| 118 | Panic_NoTransService
|
---|
| 119 | , Panic_NoDefTranscoder
|
---|
| 120 | , Panic_CantFindLib
|
---|
| 121 | , Panic_UnknownMsgDomain
|
---|
| 122 | , Panic_CantLoadMsgDomain
|
---|
| 123 | , Panic_SynchronizationErr
|
---|
| 124 | , Panic_SystemInit
|
---|
| 125 |
|
---|
| 126 | , PanicReasons_Count
|
---|
| 127 | };
|
---|
| 128 | //@}
|
---|
| 129 |
|
---|
| 130 | protected:
|
---|
| 131 |
|
---|
| 132 | /** @name hidden Constructors */
|
---|
| 133 | //@{
|
---|
| 134 | /** Default constructor */
|
---|
| 135 | PanicHandler(){};
|
---|
| 136 |
|
---|
| 137 | public:
|
---|
| 138 |
|
---|
| 139 | /** Destructor */
|
---|
| 140 | virtual ~PanicHandler(){};
|
---|
| 141 | //@}
|
---|
| 142 |
|
---|
| 143 | /** @name The virtual panic handler interface */
|
---|
| 144 | //@{
|
---|
| 145 | /**
|
---|
| 146 | * Receive notification of panic
|
---|
| 147 | *
|
---|
| 148 | * This method is called when an unrecoverable error has occurred in the Xerces library.
|
---|
| 149 | *
|
---|
| 150 | * This method must not return normally, otherwise, the results are undefined.
|
---|
| 151 | *
|
---|
| 152 | * Ways of handling this call could include throwing an exception or exiting the process.
|
---|
| 153 | *
|
---|
| 154 | * Once this method has been called, the results of calling any other Xerces API,
|
---|
| 155 | * or using any existing Xerces objects are undefined.
|
---|
| 156 | *
|
---|
| 157 | * @param reason The reason of panic
|
---|
| 158 | *
|
---|
| 159 | */
|
---|
| 160 | virtual void panic(const PanicHandler::PanicReasons reason) = 0;
|
---|
| 161 | //@}
|
---|
| 162 |
|
---|
| 163 | static const char* getPanicReasonString(const PanicHandler::PanicReasons reason);
|
---|
| 164 |
|
---|
| 165 | private:
|
---|
| 166 |
|
---|
| 167 | /* Unimplemented Constructors and operators */
|
---|
| 168 | /* Copy constructor */
|
---|
| 169 | PanicHandler(const PanicHandler&);
|
---|
| 170 |
|
---|
| 171 | /** Assignment operator */
|
---|
| 172 | PanicHandler& operator=(const PanicHandler&);
|
---|
| 173 | };
|
---|
| 174 |
|
---|
| 175 | XERCES_CPP_NAMESPACE_END
|
---|
| 176 |
|
---|
| 177 | #endif
|
---|