Menu

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

Download this file

71 lines (49 with data), 1.5 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
#ifndef CPPUNIT_EXCEPTION_H
#define CPPUNIT_EXCEPTION_H
#include <cppunit/Portability.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 = "",
long lineNumber = UNKNOWNLINENUMBER,
std::string fileName = UNKNOWNFILENAME);
Exception (const Exception& other);
virtual ~Exception () throw();
Exception& operator= (const Exception& other);
const char *what() const throw ();
long lineNumber ();
std::string fileName ();
static const std::string UNKNOWNFILENAME;
static const long UNKNOWNLINENUMBER;
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;
long m_lineNumber;
std::string m_fileName;
};
} // namespace CppUnit
#endif // CPPUNIT_EXCEPTION_H
MongoDB Logo MongoDB