CppUnit project page
FAQ
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
cppunit
Protector.h
Go to the documentation of this file.
1
#ifndef CPPUNIT_PROTECTOR_H
2
#define CPPUNIT_PROTECTOR_H
3
4
#include <
cppunit/SourceLine.h
>
5
6
CPPUNIT_NS_BEGIN
7
8
class
Exception
;
9
class
Message
;
10
class
ProtectorContext
;
11
class
TestResult
;
12
13
14
class
CPPUNIT_API
Functor
15
{
16
public
:
17
virtual
~
Functor
();
18
19
virtual
bool
operator()()
const
=0;
20
};
21
22
47
class
CPPUNIT_API
Protector
48
{
49
public
:
50
virtual
~
Protector
();
51
52
virtual
bool
protect(
const
Functor
&functor,
53
const
ProtectorContext
&context ) =0;
54
55
protected
:
56
void
reportError(
const
ProtectorContext
&context,
57
const
Exception
&error )
const
;
58
59
void
reportError(
const
ProtectorContext
&context,
60
const
Message
&message,
61
const
SourceLine
&sourceLine =
SourceLine
() )
const
;
62
63
void
reportFailure(
const
ProtectorContext
&context,
64
const
Exception
&failure )
const
;
65
66
Message
actualMessage(
const
Message
&message,
67
const
ProtectorContext
&context )
const
;
68
};
69
70
76
class
CPPUNIT_API
ProtectorGuard
77
{
78
public
:
80
ProtectorGuard
(
TestResult
*result,
81
Protector
*protector );
82
84
~
ProtectorGuard
();
85
86
private
:
87
TestResult
*
m_result
;
88
};
89
90
CPPUNIT_NS_END
91
92
93
#endif // CPPUNIT_PROTECTOR_H
94
Send comments to:
CppUnit Developers