00001 #ifndef _EXCEPTION_H_ 00002 #define _EXCEPTION_H_ 00003 00004 #include <string> 00005 00006 namespace cganim 00007 { 00009 class Exception 00010 { 00011 public: 00012 00014 Exception(const std::string& name = "") 00015 : m_name(name) 00016 {} 00017 00019 virtual const std::string& What() const throw() 00020 { return m_name; } 00021 00022 private: 00023 00025 const std::string m_name; 00026 }; 00027 00029 class LogicException: public Exception 00030 { 00031 public: 00032 00033 LogicException(const std::string& name = "") 00034 : Exception(name) 00035 { 00036 } 00037 }; 00038 00039 00040 00042 class IOException: public Exception 00043 { 00044 public: 00045 00046 IOException(const std::string& name = "") 00047 : Exception(name) 00048 { 00049 } 00050 }; 00051 00052 00054 class InvalidFileException: public IOException 00055 { 00056 public: 00057 00058 InvalidFileException(const std::string& name = "") 00059 : IOException(name) 00060 { 00061 } 00062 }; 00063 } 00064 #endif