00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef G_EXCEPTION_H
00014 #define G_EXCEPTION_H
00015
00016 #include <exception>
00017 using namespace std;
00018
00019 #include "tools.h"
00020
00025 class g_exception : public exception {
00027 string file;
00029 int line;
00031 string msg;
00032 public:
00039 g_exception( const char* file = "", int line = -1, string msg = "" ) {
00040 set (file, line, msg);
00041 };
00048 void set (const char* file = "", int line = -1, string msg = "") {
00049 this->file = file;
00050 this->line = line;
00051 this->msg = msg;
00052 };
00056 virtual ~g_exception() throw() { };
00061 virtual const char * what() const throw() {
00062 string s ( file + string("[") + MyTools::to_string ( line ) + "] : " + msg );
00063 return s.c_str();
00064 }
00065 };
00066
00067 #endif