00001 #ifndef CPPUNIT_EXCEPTION_H
00002 #define CPPUNIT_EXCEPTION_H
00003
00004 #include <exception>
00005 #include <string>
00006
00007 namespace CppUnit {
00008
00014 class Exception : public std::exception
00015 {
00016 public:
00017
00018 class Type
00019 {
00020 public:
00021 Type( std::string type ) : m_type ( type ) {}
00022
00023 bool operator ==( const Type &other ) const
00024 {
00025 return m_type == other.m_type;
00026 }
00027 private:
00028 const std::string m_type;
00029 };
00030
00031
00032 Exception( std::string message = "",
00033 long lineNumber = UNKNOWNLINENUMBER,
00034 std::string fileName = UNKNOWNFILENAME);
00035 Exception (const Exception& other);
00036
00037 virtual ~Exception () throw();
00038
00039 Exception& operator= (const Exception& other);
00040
00041 const char *what() const throw ();
00042
00043 long lineNumber ();
00044 std::string fileName ();
00045
00046 static const std::string UNKNOWNFILENAME;
00047 static const long UNKNOWNLINENUMBER;
00048
00049 virtual Exception *clone() const;
00050
00051 virtual bool isInstanceOf( const Type &type ) const;
00052
00053 static Type type();
00054
00055 private:
00056
00057
00058 typedef std::exception SuperClass;
00059
00060 std::string m_message;
00061 long m_lineNumber;
00062 std::string m_fileName;
00063 };
00064
00065
00066 }
00067
00068 #endif // CPPUNIT_EXCEPTION_H
00069