CppUnit project page | FAQ | CppUnit home page

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Exception.h
Go to the documentation of this file.

    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   // VC++ does not recognize call to parent class when prefixed
    00077   // with a namespace. This is a workaround.
    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

| hosts this site. |  | Send comments to: CppUnit Developers