CppUnit project page FAQ

Exception.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_EXCEPTION_H
2 #define CPPUNIT_EXCEPTION_H
3 
4 #include <cppunit/Portability.h>
5 #include <cppunit/Message.h>
6 #include <cppunit/SourceLine.h>
7 #include <exception>
8 
9 
11 
12 
19 class CPPUNIT_API Exception : public std::exception
20 {
21 public:
26  Exception( const Message &message = Message(),
27  const SourceLine &sourceLine = SourceLine() );
28 
29 #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
30 
33  Exception( std::string message,
34  long lineNumber,
35  std::string fileName );
36 #endif
37 
41  Exception( const Exception &other );
42 
44  virtual ~Exception() throw();
45 
47  Exception &operator =( const Exception &other );
48 
50  const char *what() const throw();
51 
53  SourceLine sourceLine() const;
54 
56  Message message() const;
57 
59  void setMessage( const Message &message );
60 
61 #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
62 
63  long lineNumber() const;
64 
66  std::string fileName() const;
67 
68  static const std::string UNKNOWNFILENAME;
69  static const long UNKNOWNLINENUMBER;
70 #endif
71 
73  virtual Exception *clone() const;
74 
75 protected:
76  // VC++ does not recognize call to parent class when prefixed
77  // with a namespace. This is a workaround.
78  typedef std::exception SuperClass;
79 
82  std::string m_whatMessage;
83 };
84 
85 
87 
88 
89 #endif // CPPUNIT_EXCEPTION_H
90 

Send comments to:
CppUnit Developers