defuze.me  Client
exception.hpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #ifndef EXCEPTION_HPP
00012 #define EXCEPTION_HPP
00013 
00014 #include <QString>
00015 #include <QtCore>
00016 
00026 class Exception : public QtConcurrent::Exception
00027 {
00028 public:
00029     Exception();
00030     Exception(unsigned code, const QString msg, const char *file = "unknow file", const int line = 0);
00031     Exception(const Exception& src);
00032     virtual     ~Exception() throw();
00033     void        raise() const;
00034     Exception*  clone() const;
00035 
00039     void        extractCore() throw();
00040 
00044     void        generateCode() throw();
00045 
00048     void        formatOutput() throw();
00049     QString     hexCode() const throw();        
00050     QString     description() const throw();            
00051     QString     msg() const throw();            
00052 
00053 
00054 protected:
00055     QString     _msg, file, module;
00056     unsigned    userCode, code, line;
00057 };
00058 
00059 
00067 #define throw_exception(code, arg) throw Exception(code, arg, __FILE__, __LINE__)
00068 
00069 #endif // EXCEPTION_HPP