#ifndef GLTB_EXCEPTION_H_ #define GLTB_EXCEPTION_H_ #include #ifdef LINUX #include // execinfo.h is a glibc extension #endif namespace gltb { class Exception { public: Exception(std::string description, std::string location) { this->description=description; this->location=location; }; std::string getDescription() { return description; }; std::string getLocation() { return location; } virtual std::string asFormattedText(); private: std::string description; std::string location; }; class TraceableException : public Exception { public: TraceableException(std::string description, std::string location); ~TraceableException(); std::string getBacktrace(); virtual std::string asFormattedText(); private: #if defined LINUX void **exceptionTrace; int exceptionTraceSize; #elif defined WIN32 std::string backtrace; void analyzeStack(); #endif }; class Error : public TraceableException { public: Error(std::string description, std::string location) : TraceableException(description, location) {}; virtual std::string asFormattedText(); }; } #endif /*GLTB_EXCEPTION_H_*/