activemq-cpp-3.8.2
Exception.h
Go to the documentation of this file.
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 #ifndef _DECAF_LANG_EXCEPTION_EXCEPTION_H_
18 #define _DECAF_LANG_EXCEPTION_EXCEPTION_H_
19 
20 #ifdef _WIN32
21 #pragma warning( disable: 4251 )
22 #endif
23 
24 #include <decaf/lang/Throwable.h>
26 #include <decaf/util/Config.h>
27 #include <stdarg.h>
28 #include <sstream>
29 
30 namespace decaf {
31 namespace lang {
32 
33  class ExceptionData;
34 
35  /*
36  * Base class for all exceptions.
37  */
38  class DECAF_API Exception : public Throwable {
39  protected:
40 
41  ExceptionData* data;
42 
43  public:
44 
48  Exception();
49 
56  Exception(const Exception& ex);
57 
67  Exception(const std::exception* cause);
68 
83  Exception(const char* file, const int lineNumber, const char* msg, ...);
84 
101  Exception(const char* file, const int lineNumber, const std::exception* cause, const char* msg, ...);
102 
103  virtual ~Exception() throw();
104 
109  virtual std::string getMessage() const;
110 
121  virtual const std::exception* getCause() const;
122 
132  virtual void initCause(const std::exception* cause);
133 
139  virtual const char* what() const throw ();
140 
149  virtual void setMessage(const char* msg, ...);
150 
159  virtual void setMark(const char* file, const int lineNumber);
160 
168  virtual Exception* clone() const;
169 
177  virtual std::vector< std::pair< std::string, int> > getStackTrace() const;
178 
182  virtual void printStackTrace() const;
183 
190  virtual void printStackTrace(std::ostream& stream) const;
191 
197  virtual std::string getStackTraceString() const;
198 
205  Exception& operator =(const Exception& ex);
206 
207  protected:
208 
209  virtual void setStackTrace(const std::vector<std::pair<std::string, int> >& trace);
210 
211  virtual void buildMessage(const char* format, va_list& vargs);
212 
213  };
214 
215 }}
216 
217 #endif /*_DECAF_LANG_EXCEPTION_EXCEPTION_H_*/
This class represents an error that has occurred.
Definition: Throwable.h:44
Definition: ArrayPointer.h:432
#define DECAF_API
Definition: Config.h:29
Definition: Exception.h:38
#define const
Definition: zconf.h:198
ExceptionData * data
Definition: Exception.h:41
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25