CppUnit project page FAQ

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 
7 
8 class Exception;
9 class Message;
10 class ProtectorContext;
11 class TestResult;
12 
13 
15 {
16 public:
17  virtual ~Functor();
18 
19  virtual bool operator()() const =0;
20 };
21 
22 
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 
77 {
78 public:
80  ProtectorGuard( TestResult *result,
81  Protector *protector );
82 
84  ~ProtectorGuard();
85 
86 private:
87  ProtectorGuard( const ProtectorGuard& ); /* not copyable */
88  ProtectorGuard& operator=( const ProtectorGuard& ); /* not assignable */
90 };
91 
93 
94 
95 #endif // CPPUNIT_PROTECTOR_H
96 
#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
Definition: Protector.h:15
virtual bool operator()() const =0
Message associated to an Exception.A message is composed of two items:
Definition: Message.h:35
Protector context (Implementation). Implementation detail.
Definition: ProtectorContext.h:18
Scoped protector push to TestResult.
Definition: Protector.h:77
TestResult * m_result
Definition: Protector.h:89
ProtectorGuard(const ProtectorGuard &)
ProtectorGuard & operator=(const ProtectorGuard &)
Protects one or more test case run.
Definition: Protector.h:48
virtual bool protect(const Functor &functor, const ProtectorContext &context)=0
Represents a source line location.
Definition: SourceLine.h:31
Manages TestListener.
Definition: TestResult.h:48

Send comments to:
CppUnit Developers