source: pacpusframework/trunk/3rd/apache-log4cxx/include/log4cxx/helpers/exception.h@ 178

Last change on this file since 178 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 13.1 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_HELPERS_EXCEPTION_H
19#define _LOG4CXX_HELPERS_EXCEPTION_H
20
21#include <exception>
22#include <log4cxx/log4cxx.h>
23#include <log4cxx/logstring.h>
24
25namespace log4cxx
26{
27 namespace helpers
28 {
29 /** The class Exception and its subclasses indicate conditions that a
30 reasonable application might want to catch.
31 */
32 class LOG4CXX_EXPORT Exception : public ::std::exception
33 {
34 public:
35 Exception(const char* msg);
36 Exception(const LogString& msg);
37 Exception(const Exception& src);
38 Exception& operator=(const Exception& src);
39 const char* what() const throw();
40 private:
41 enum { MSG_SIZE = 128 };
42 char msg[MSG_SIZE + 1];
43 }; // class Exception
44
45 /** RuntimeException is the parent class of those exceptions that can be
46 thrown during the normal operation of the process.
47 */
48 class LOG4CXX_EXPORT RuntimeException : public Exception
49 {
50 public:
51 RuntimeException(log4cxx_status_t stat);
52 RuntimeException(const LogString& msg);
53 RuntimeException(const RuntimeException& msg);
54 RuntimeException& operator=(const RuntimeException& src);
55 private:
56 static LogString formatMessage(log4cxx_status_t stat);
57 }; // class RuntimeException
58
59 /** Thrown when an application attempts to use null in a case where an
60 object is required.
61 */
62 class LOG4CXX_EXPORT NullPointerException : public RuntimeException
63 {
64 public:
65 NullPointerException(const LogString& msg);
66 NullPointerException(const NullPointerException& msg);
67 NullPointerException& operator=(const NullPointerException& src);
68 }; // class NullPointerException
69
70 /** Thrown to indicate that a method has been passed
71 an illegal or inappropriate argument.*/
72 class LOG4CXX_EXPORT IllegalArgumentException : public RuntimeException
73 {
74 public:
75 IllegalArgumentException(const LogString& msg);
76 IllegalArgumentException(const IllegalArgumentException&);
77 IllegalArgumentException& operator=(const IllegalArgumentException&);
78 }; // class IllegalArgumentException
79
80 /** Signals that an I/O exception of some sort has occurred. This class
81 is the general class of exceptions produced by failed or interrupted
82 I/O operations.
83 */
84 class LOG4CXX_EXPORT IOException : public Exception
85 {
86 public:
87 IOException();
88 IOException(log4cxx_status_t stat);
89 IOException(const LogString& msg);
90 IOException(const IOException &src);
91 IOException& operator=(const IOException&);
92 private:
93 static LogString formatMessage(log4cxx_status_t stat);
94 };
95
96 class LOG4CXX_EXPORT MissingResourceException : public Exception
97 {
98 public:
99 MissingResourceException(const LogString& key);
100 MissingResourceException(const MissingResourceException &src);
101 MissingResourceException& operator=(const MissingResourceException&);
102 private:
103 static LogString formatMessage(const LogString& key);
104 };
105
106 class LOG4CXX_EXPORT PoolException : public Exception
107 {
108 public:
109 PoolException(log4cxx_status_t stat);
110 PoolException(const PoolException &src);
111 PoolException& operator=(const PoolException&);
112 private:
113 static LogString formatMessage(log4cxx_status_t stat);
114 };
115
116
117 class LOG4CXX_EXPORT MutexException : public Exception
118 {
119 public:
120 MutexException(log4cxx_status_t stat);
121 MutexException(const MutexException &src);
122 MutexException& operator=(const MutexException&);
123 private:
124 static LogString formatMessage(log4cxx_status_t stat);
125 };
126
127 class LOG4CXX_EXPORT InterruptedException : public Exception
128 {
129 public:
130 InterruptedException();
131 InterruptedException(log4cxx_status_t stat);
132 InterruptedException(const InterruptedException &src);
133 InterruptedException& operator=(const InterruptedException&);
134 private:
135 static LogString formatMessage(log4cxx_status_t stat);
136 };
137
138 class LOG4CXX_EXPORT ThreadException
139 : public Exception {
140 public:
141 ThreadException(log4cxx_status_t stat);
142 ThreadException(const LogString& msg);
143 ThreadException(const ThreadException &src);
144 ThreadException& operator=(const ThreadException&);
145 private:
146 static LogString formatMessage(log4cxx_status_t stat);
147 };
148
149 class LOG4CXX_EXPORT TranscoderException : public Exception
150 {
151 public:
152 TranscoderException(log4cxx_status_t stat);
153 TranscoderException(const TranscoderException &src);
154 TranscoderException& operator=(const TranscoderException&);
155 private:
156 static LogString formatMessage(log4cxx_status_t stat);
157 };
158
159 class LOG4CXX_EXPORT IllegalMonitorStateException
160 : public Exception {
161 public:
162 IllegalMonitorStateException(const LogString& msg);
163 IllegalMonitorStateException(const IllegalMonitorStateException& msg);
164 IllegalMonitorStateException& operator=(const IllegalMonitorStateException& msg);
165 };
166
167 /**
168 Thrown when an application tries to create an instance of a class using
169 the newInstance method in class Class, but the specified class object
170 cannot be instantiated because it is an interface or is an abstract class.
171 */
172 class LOG4CXX_EXPORT InstantiationException : public Exception
173 {
174 public:
175 InstantiationException(const LogString& msg);
176 InstantiationException(const InstantiationException& msg);
177 InstantiationException& operator=(const InstantiationException& msg);
178 };
179
180 /**
181 Thrown when an application tries to load in a class through its
182 string name but no definition for the class with the specified name
183 could be found.
184 */
185 class LOG4CXX_EXPORT ClassNotFoundException : public Exception
186 {
187 public:
188 ClassNotFoundException(const LogString& className);
189 ClassNotFoundException(const ClassNotFoundException& msg);
190 ClassNotFoundException& operator=(const ClassNotFoundException& msg);
191 private:
192 static LogString formatMessage(const LogString& className);
193 };
194
195
196 class NoSuchElementException : public Exception {
197 public:
198 NoSuchElementException();
199 NoSuchElementException(const NoSuchElementException&);
200 NoSuchElementException& operator=(const NoSuchElementException&);
201 };
202
203 class IllegalStateException : public Exception {
204 public:
205 IllegalStateException();
206 IllegalStateException(const IllegalStateException&);
207 IllegalStateException& operator=(const IllegalStateException&);
208 };
209
210 /** Thrown to indicate that there is an error in the underlying
211 protocol, such as a TCP error.
212 */
213 class LOG4CXX_EXPORT SocketException : public IOException
214 {
215 public:
216 SocketException(const LogString& msg);
217 SocketException(log4cxx_status_t status);
218 SocketException(const SocketException&);
219 SocketException& operator=(const SocketException&);
220 };
221
222 /** Signals that an error occurred while attempting to connect a socket
223 to a remote address and port. Typically, the connection was refused
224 remotely (e.g., no process is listening on the remote address/port).
225 */
226 class LOG4CXX_EXPORT ConnectException : public SocketException
227 {
228 public:
229 ConnectException(log4cxx_status_t status);
230 ConnectException(const ConnectException& src);
231 ConnectException& operator=(const ConnectException&);
232 };
233
234 class LOG4CXX_EXPORT ClosedChannelException : public SocketException
235 {
236 public:
237 ClosedChannelException();
238 ClosedChannelException(const ClosedChannelException& src);
239 ClosedChannelException& operator=(const ClosedChannelException&);
240 };
241
242 /** Signals that an error occurred while attempting to bind a socket to
243 a local address and port. Typically, the port is in use, or the
244 requested local address could not be assigned.
245 */
246 class LOG4CXX_EXPORT BindException : public SocketException
247 {
248 public:
249 BindException(log4cxx_status_t status);
250 BindException(const BindException&);
251 BindException& operator=(const BindException&);
252 };
253
254 /** Signals that an I/O operation has been interrupted. An
255 InterruptedIOException is thrown to indicate that an input or output
256 transfer has been terminated because the thread performing it was
257 interrupted. The field bytesTransferred indicates how many bytes were
258 successfully transferred before the interruption occurred.
259 */
260 class LOG4CXX_EXPORT InterruptedIOException : public IOException
261 {
262 public:
263 InterruptedIOException(const LogString& msg);
264 InterruptedIOException(const InterruptedIOException&);
265 InterruptedIOException& operator=(const InterruptedIOException&);
266 };
267
268
269 /** Signals that an I/O operation has been interrupted. An
270 InterruptedIOException is thrown to indicate that an input or output
271 transfer has been terminated because the thread performing it was
272 interrupted. The field bytesTransferred indicates how many bytes were
273 successfully transferred before the interruption occurred.
274 */
275 class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
276 {
277 public:
278 SocketTimeoutException();
279 SocketTimeoutException(const SocketTimeoutException&);
280 SocketTimeoutException& operator=(const SocketTimeoutException&);
281 };
282
283
284 } // namespace helpers
285} // namespace log4cxx
286
287#endif // _LOG4CXX_HELPERS_EXCEPTION_H
Note: See TracBrowser for help on using the repository browser.