CppUnit project page | FAQ

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
Exception
Exceptions thrown by failed assertions.Exception is an exception that serves descriptive strings thro...
Definition: Exception.h:19
Protector
Protects one or more test case run.
Definition: Protector.h:47
TestResult
Manages TestListener.A single instance of this class is used when running the test. It is usually created by the test runner (TestRunner).
Definition: TestResult.h:51
SourceLine
Represents a source line location.Used to capture the failure location in assertion.
Definition: SourceLine.h:30
Functor
Definition: Protector.h:14
ProtectorContext
Protector context (Implementation). Implementation detail.
Definition: ProtectorContext.h:17
ProtectorGuard
Scoped protector push to TestResult.
Definition: Protector.h:76
ProtectorGuard::m_result
TestResult * m_result
Definition: Protector.h:87
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:120
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
SourceLine.h
Message
Message associated to an Exception.A message is composed of two items:
Definition: Message.h:38
CPPUNIT_API
#define CPPUNIT_API
Definition: CppUnitApi.h:27

| Send comments to: CppUnit Developers