Menu

[r197]: / trunk / cppunit / include / cppunit / Exception.h  Maximize  Restore  History

Download this file

81 lines (56 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef CPPUNIT_EXCEPTION_H
#define CPPUNIT_EXCEPTION_H
#include <cppunit/Portability.h>
#include <cppunit/SourceLine.h>
#include <exception>
#include <string>
namespace CppUnit {
/*! \brief Exceptions thrown by failed assertions.
*
* Exception is an exception that serves
* descriptive strings through its what() method
*/
class Exception : public std::exception
{
public:
class Type
{
public:
Type( std::string type ) : m_type ( type ) {}
bool operator ==( const Type &other ) const
{
return m_type == other.m_type;
}
private:
const std::string m_type;
};
Exception( std::string message = "",
SourceLine sourceLine = SourceLine() );
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
Exception( std::string message,
long lineNumber,
std::string fileName );
#endif
Exception (const Exception& other);
virtual ~Exception () throw();
Exception& operator= (const Exception& other);
const char *what() const throw ();
SourceLine sourceLine() const;
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
long lineNumber() const;
std::string fileName() const;
static const std::string UNKNOWNFILENAME;
static const long UNKNOWNLINENUMBER;
#endif
virtual Exception *clone() const;
virtual bool isInstanceOf( const Type &type ) const;
static Type type();
private:
// VC++ does not recognize call to parent class when prefixed
// with a namespace. This is a workaround.
typedef std::exception SuperClass;
std::string m_message;
SourceLine m_sourceLine;
};
} // namespace CppUnit
#endif // CPPUNIT_EXCEPTION_H
MongoDB Logo MongoDB