|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
19 * contributor license agreements. See the NOTICE file distributed with |
|
20 * this work for additional information regarding copyright ownership. |
|
21 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
22 * (the "License"); you may not use this file except in compliance with |
|
23 * the License. You may obtain a copy of the License at |
|
24 * |
|
25 * http://www.apache.org/licenses/LICENSE-2.0 |
|
26 * |
|
27 * Unless required by applicable law or agreed to in writing, software |
|
28 * distributed under the License is distributed on an "AS IS" BASIS, |
|
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
30 * See the License for the specific language governing permissions and |
|
31 * limitations under the License. |
|
32 */ |
|
33 |
|
34 /* |
|
35 * $Id: PanicHandler.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|
36 */ |
|
37 |
|
38 #ifndef PANICHANDLER_HPP |
|
39 #define PANICHANDLER_HPP |
|
40 |
|
41 #include <xercesc/util/XMemory.hpp> |
|
42 |
|
43 XERCES_CPP_NAMESPACE_BEGIN |
|
44 |
|
45 /** |
|
46 * Receive notification of panic. |
|
47 * |
|
48 * <p>This is the interface, through which the Xercesc reports |
|
49 * a panic to the application. |
|
50 * </p> |
|
51 * |
|
52 * <p>Application may implement this interface, instantiate an |
|
53 * object of the derivative, and plug it to Xercesc in the |
|
54 * invocation to XMLPlatformUtils::Initialize(), if it prefers |
|
55 * to handling panic itself rather than Xercesc doing it. |
|
56 * </p> |
|
57 * |
|
58 */ |
|
59 |
|
60 class XMLUTIL_EXPORT PanicHandler |
|
61 { |
|
62 public: |
|
63 |
|
64 /** @name Public Types */ |
|
65 //@{ |
|
66 enum PanicReasons |
|
67 { |
|
68 Panic_NoTransService |
|
69 , Panic_NoDefTranscoder |
|
70 , Panic_CantFindLib |
|
71 , Panic_UnknownMsgDomain |
|
72 , Panic_CantLoadMsgDomain |
|
73 , Panic_SynchronizationErr |
|
74 , Panic_SystemInit |
|
75 , Panic_AllStaticInitErr |
|
76 , Panic_MutexErr |
|
77 , PanicReasons_Count |
|
78 }; |
|
79 //@} |
|
80 |
|
81 protected: |
|
82 |
|
83 /** @name hidden Constructors */ |
|
84 //@{ |
|
85 /** Default constructor */ |
|
86 PanicHandler(){}; |
|
87 |
|
88 public: |
|
89 |
|
90 /** Destructor */ |
|
91 virtual ~PanicHandler(){}; |
|
92 //@} |
|
93 |
|
94 /** @name The virtual panic handler interface */ |
|
95 //@{ |
|
96 /** |
|
97 * Receive notification of panic |
|
98 * |
|
99 * This method is called when an unrecoverable error has occurred in the Xerces library. |
|
100 * |
|
101 * This method must not return normally, otherwise, the results are undefined. |
|
102 * |
|
103 * Ways of handling this call could include throwing an exception or exiting the process. |
|
104 * |
|
105 * Once this method has been called, the results of calling any other Xerces API, |
|
106 * or using any existing Xerces objects are undefined. |
|
107 * |
|
108 * @param reason The reason of panic |
|
109 * |
|
110 */ |
|
111 virtual void panic(const PanicHandler::PanicReasons reason) = 0; |
|
112 //@} |
|
113 |
|
114 static const char* getPanicReasonString(const PanicHandler::PanicReasons reason); |
|
115 |
|
116 private: |
|
117 |
|
118 /* Unimplemented Constructors and operators */ |
|
119 /* Copy constructor */ |
|
120 PanicHandler(const PanicHandler&); |
|
121 |
|
122 /** Assignment operator */ |
|
123 PanicHandler& operator=(const PanicHandler&); |
|
124 }; |
|
125 |
|
126 XERCES_CPP_NAMESPACE_END |
|
127 |
|
128 #endif |