activemq-cpp-3.9.5
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
26#include <decaf/util/Config.h>
27#include <stdarg.h>
28#include <sstream>
29
30namespace decaf {
31namespace 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
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
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_*/
Exception(const std::exception *cause)
Constructor.
virtual std::vector< std::pair< std::string, int > > getStackTrace() const
Provides the stack trace for every point where this exception was caught, marked, and rethrown.
virtual void setMark(const char *file, const int lineNumber)
Adds a file/line number to the stack trace.
virtual void initCause(const std::exception *cause)
Initializes the contained cause exception with the one given.
virtual void printStackTrace() const
Prints the stack trace to std::err.
virtual void setMessage(const char *msg,...)
Sets the cause for this exception.
virtual void buildMessage(const char *format, va_list &vargs)
Exception()
Default Constructor.
virtual void setStackTrace(const std::vector< std::pair< std::string, int > > &trace)
Exception(const char *file, const int lineNumber, const char *msg,...)
Constructor - Initializes the file name and line number where this message occurred.
ExceptionData * data
Definition Exception.h:41
Exception(const Exception &ex)
Copy Constructor.
Exception(const char *file, const int lineNumber, const std::exception *cause, const char *msg,...)
Constructor - Initializes the file name and line number where this message occurred.
virtual const char * what() const
Implement method from std::exception.
virtual Exception * clone() const
Clones this exception.
virtual std::string getStackTraceString() const
Gets the stack trace as one contiguous string.
virtual std::string getMessage() const
Gets the message for this exception.
virtual const std::exception * getCause() const
Gets the exception that caused this one to be thrown, this allows for chaining of exceptions in the c...
#define DECAF_API
Definition Config.h:29
Definition ThreadingTypes.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25
Definition ArrayPointer.h:432
#define const
Definition zconf.h:198