summaryrefslogtreecommitdiff
path: root/src/cppunit/ProtectorChain.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-16 21:59:22 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-16 21:59:22 +0000
commit2a31073734be6e44e477079699578820282b7345 (patch)
tree70b18c3fc851173fe5fd69a7d844640ab6b780d2 /src/cppunit/ProtectorChain.h
parent251c1ff8aecaa608ef9e6041c2691d369430bf7b (diff)
downloadcppunit-2a31073734be6e44e477079699578820282b7345.tar.gz
Include/cppunit/Protector.
include/cppunit/Protector.h: * src/cppunit/Protector.cpp: added. Base class for protectors. * src/cppunit/DefaultProtector.h: * src/cppunit/DefaultProtector.cpp: added. Implementation of the default protector used to catch std::exception and any other exception. * src/cppunit/ProtectorChain.h: * src/cppunit/ProtectorChain.cpp: added. Implementation of a chain of protector, allowing catching custom exception and implementation of expected exception. * src/cppunit/TestCase.cpp: * src/cppunit/TestResult.cpp: updated to use protector.
Diffstat (limited to 'src/cppunit/ProtectorChain.h')
-rw-r--r--src/cppunit/ProtectorChain.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cppunit/ProtectorChain.h b/src/cppunit/ProtectorChain.h
new file mode 100644
index 0000000..7c947b6
--- /dev/null
+++ b/src/cppunit/ProtectorChain.h
@@ -0,0 +1,47 @@
+#ifndef CPPUNIT_PROTECTORCHAIN_H
+#define CPPUNIT_PROTECTORCHAIN_H
+
+#include <cppunit/Protector.h>
+#include <cppunit/portability/CppUnitDeque.h>
+
+#if CPPUNIT_NEED_DLL_DECL
+#pragma warning( push )
+#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
+#endif
+
+
+CPPUNIT_NS_BEGIN
+
+
+class CPPUNIT_API ProtectorChain : public Protector
+{
+public:
+ ~ProtectorChain();
+
+ void push( Protector *protector );
+
+ void pop();
+
+ int count() const;
+
+ bool protect( const Functor &functor,
+ const ProtectorContext &context );
+
+private:
+ class ProtectFunctor;
+
+private:
+ typedef CppUnitDeque<Protector *> Protectors;
+ Protectors m_protectors;
+
+ typedef CppUnitDeque<Functor *> Functors;
+};
+
+
+CPPUNIT_NS_END
+
+#if CPPUNIT_NEED_DLL_DECL
+#pragma warning( pop )
+#endif
+
+#endif // CPPUNIT_PROTECTORCHAIN_H \ No newline at end of file