00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DECAF_LANG_EXCEPTION_EXCEPTION_H_
00018 #define _DECAF_LANG_EXCEPTION_EXCEPTION_H_
00019
00020 #ifdef _WIN32
00021 #pragma warning( disable: 4251 )
00022 #endif
00023
00024 #include <decaf/lang/Throwable.h>
00025 #include <decaf/lang/exceptions/ExceptionDefines.h>
00026 #include <decaf/util/Config.h>
00027 #include <stdarg.h>
00028 #include <sstream>
00029
00030 namespace decaf {
00031 namespace lang {
00032
00033 class ExceptionData;
00034
00035
00036
00037
00038 class DECAF_API Exception : public Throwable {
00039 protected:
00040
00041 ExceptionData* data;
00042
00043 public:
00044
00048 Exception();
00049
00056 Exception(const Exception& ex);
00057
00067 Exception(const std::exception* cause);
00068
00083 Exception(const char* file, const int lineNumber, const char* msg, ...);
00084
00101 Exception(const char* file, const int lineNumber, const std::exception* cause, const char* msg, ...);
00102
00103 virtual ~Exception() throw();
00104
00109 virtual std::string getMessage() const;
00110
00121 virtual const std::exception* getCause() const;
00122
00132 virtual void initCause(const std::exception* cause);
00133
00139 virtual const char* what() const throw ();
00140
00149 virtual void setMessage(const char* msg, ...);
00150
00159 virtual void setMark(const char* file, const int lineNumber);
00160
00168 virtual Exception* clone() const;
00169
00177 virtual std::vector< std::pair< std::string, int> > getStackTrace() const;
00178
00182 virtual void printStackTrace() const;
00183
00190 virtual void printStackTrace(std::ostream& stream) const;
00191
00197 virtual std::string getStackTraceString() const;
00198
00205 Exception& operator =(const Exception& ex);
00206
00207 protected:
00208
00209 virtual void setStackTrace(const std::vector<std::pair<std::string, int> >& trace);
00210
00211 virtual void buildMessage(const char* format, va_list& vargs);
00212
00213 };
00214
00215 }}
00216
00217 #endif