CppUnit project page FAQ

Exception.h
Go to the documentation of this file.
1#ifndef CPPUNIT_EXCEPTION_H
2#define CPPUNIT_EXCEPTION_H
3
5#include <cppunit/Message.h>
7#include <exception>
8
9
11
12
19class CPPUNIT_API Exception : public std::exception
20{
21public:
26 Exception( const Message &message = Message(),
27 const SourceLine &sourceLine = SourceLine() );
28
29#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
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
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
75protected:
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
#define CPPUNIT_API
Definition CppUnitApi.h:27
#define CPPUNIT_NS_END
Definition Portability.h:106
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
Exceptions thrown by failed assertions.
Definition Exception.h:20
std::string m_whatMessage
Definition Exception.h:82
Message m_message
Definition Exception.h:80
SourceLine m_sourceLine
Definition Exception.h:81
std::exception SuperClass
Definition Exception.h:78
Message associated to an Exception.A message is composed of two items:
Definition Message.h:35
Represents a source line location.
Definition SourceLine.h:31

Send comments to:
CppUnit Developers