00001
00002
00003
00004
00005
00006
00007 #ifndef M_EXCEPTION_H
00008 #define M_EXCEPTION_H
00009
00010 #include <stdarg.h>
00011 #include <string>
00012
00013 namespace MWidgets
00014 {
00016 #define EXCEPT Exception::PreCreate(__FILE__, __LINE__),throw Exception::Create
00018 #define CATCHEXCEPT(exception,desc) throw( Exception(exception,desc, __FILE__, __LINE__ ) )
00019
00021 class Exception
00022 {
00023 static int tempLine;
00024 static std::string tempSrc;
00025 int line;
00026 std::string src;
00027 std::string desc;
00028 protected:
00029 static char desc_buf[1024];
00030 public:
00035 Exception(const char* d,const char* f,int l);
00041 Exception(Exception right,const char* d,const char* f,int l);
00045 static void PreCreate(char* f,int l);
00048 static Exception Create(char* format,...);
00051 void AddMsg(const char* str);
00054 std::string Msg();
00055 };
00056 };
00057
00058 #endif