• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/home/pascal/depot/filedata/src/g_exception.h

00001 //
00002 // C++ Interface: g_exception
00003 //
00004 // Description:
00005 //    defines a generic exception class
00006 //
00007 // Author: ICARE CGTD/UDEV Nicolas PASCAL <nicolas.pascal@icare.univ-lille1.fr>, (C) 2009
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
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

Generated on Thu Feb 14 2013 17:59:03 for filedata.kdevelop by  doxygen 1.7.1