00001 #ifndef CPPUNIT_EXCEPTION_H
00002 #define CPPUNIT_EXCEPTION_H
00003
00004 #include <cppunit/Portability.h>
00005 #include <cppunit/Message.h>
00006 #include <cppunit/SourceLine.h>
00007 #include <exception>
00008
00009
00010 CPPUNIT_NS_BEGIN
00011
00012
00019 class CPPUNIT_API Exception : public std::exception
00020 {
00021 public:
00026 Exception( const Message &message = Message(),
00027 const SourceLine &sourceLine = SourceLine() );
00028
00029 #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
00030
00033 Exception( std::string message,
00034 long lineNumber,
00035 std::string fileName );
00036 #endif
00037
00041 Exception( const Exception &other );
00042
00044 virtual ~Exception() throw();
00045
00047 Exception &operator =( const Exception &other );
00048
00050 const char *what() const throw();
00051
00053 SourceLine sourceLine() const;
00054
00056 Message message() const;
00057
00059 void setMessage( const Message &message );
00060
00061 #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
00062
00063 long lineNumber() const;
00064
00066 std::string fileName() const;
00067
00068 static const std::string UNKNOWNFILENAME;
00069 static const long UNKNOWNLINENUMBER;
00070 #endif
00071
00073 virtual Exception *clone() const;
00074
00075 protected:
00076
00077
00078 typedef std::exception SuperClass;
00079
00080 Message m_message;
00081 SourceLine m_sourceLine;
00082 std::string m_whatMessage;
00083 };
00084
00085
00086 CPPUNIT_NS_END
00087
00088
00089 #endif // CPPUNIT_EXCEPTION_H
00090