CppUnit project page FAQ CppUnit home page

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Protector.h

Go to the documentation of this file.
00001 #ifndef CPPUNIT_PROTECTOR_H 00002 #define CPPUNIT_PROTECTOR_H 00003 00004 #include <cppunit/SourceLine.h> 00005 00006 CPPUNIT_NS_BEGIN 00007 00008 class Exception; 00009 class Message; 00010 class ProtectorContext; 00011 class TestResult; 00012 00013 00014 class CPPUNIT_API Functor 00015 { 00016 public: 00017 virtual ~Functor(); 00018 00019 virtual bool operator()() const =0; 00020 }; 00021 00022 00047 class CPPUNIT_API Protector 00048 { 00049 public: 00050 virtual ~Protector(); 00051 00052 virtual bool protect( const Functor &functor, 00053 const ProtectorContext &context ) =0; 00054 00055 protected: 00056 void reportError( const ProtectorContext &context, 00057 const Exception &error ) const; 00058 00059 void reportError( const ProtectorContext &context, 00060 const Message &message, 00061 const SourceLine &sourceLine = SourceLine() ) const; 00062 00063 void reportFailure( const ProtectorContext &context, 00064 const Exception &failure ) const; 00065 00066 Message actualMessage( const Message &message, 00067 const ProtectorContext &context ) const; 00068 }; 00069 00070 00076 class CPPUNIT_API ProtectorGuard 00077 { 00078 public: 00080 ProtectorGuard( TestResult *result, 00081 Protector *protector ); 00082 00084 ~ProtectorGuard(); 00085 00086 private: 00087 TestResult *m_result; 00088 }; 00089 00090 CPPUNIT_NS_END 00091 00092 00093 #endif // CPPUNIT_PROTECTOR_H 00094

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers