activemq-cpp-3.6.0
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 
130  virtual void initCause(const std::exception* cause);
131 
137  virtual const char* what() const throw ();
138 
147  virtual void setMessage(const char* msg, ...);
148 
157  virtual void setMark(const char* file, const int lineNumber);
158 
166  virtual Exception* clone() const;
167 
175  virtual std::vector< std::pair< std::string, int> > getStackTrace() const;
176 
180  virtual void printStackTrace() const;
181 
188  virtual void printStackTrace(std::ostream& stream) const;
189 
195  virtual std::string getStackTraceString() const;
196 
203  Exception& operator =(const Exception& ex);
204 
205  protected:
206 
207  virtual void setStackTrace(const std::vector<std::pair<std::string, int> >& trace);
208 
209  virtual void buildMessage(const char* format, va_list& vargs);
210 
211  };
212 
213 }}
214 
215 #endif /*_DECAF_LANG_EXCEPTION_EXCEPTION_H_*/