/* */ #ifndef _D_EXCEPTION_H_ #define _D_EXCEPTION_H_ #include "common.h" #include #include #include using namespace std; class Exception { private: string msg; protected: Exception* cause; void setMsg(const string& msgsrc, va_list ap) { char buf[1024]; vsnprintf(buf, sizeof(buf), msgsrc.c_str(), ap); msg = buf; } public: Exception(Exception* cause = 0):cause(cause) {} virtual ~Exception() { delete cause; } const string& getMsg() const { return msg; } Exception* getCause() const { return cause; } }; #endif // _D_EXCEPTION_H_