CppUnit project page FAQ

TestFactoryRegistry.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
2 #define CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
3 
4 #include <cppunit/Portability.h>
5 
6 #if CPPUNIT_NEED_DLL_DECL
7 #pragma warning( push )
8 #pragma warning( disable: 4251) // X needs to have dll-interface to be used by clients of class Z
9 #endif
10 
11 #include <set>
13 #include <string>
14 
16 
17 
18 class TestSuite;
19 
76 {
77 public:
82  TestFactoryRegistry( std::string name );
83 
85  virtual ~TestFactoryRegistry();
86 
91  virtual Test *makeTest();
92 
102  static TestFactoryRegistry &getRegistry( const std::string &name = "All Tests" );
103 
107  void addTestToSuite( TestSuite *suite );
108 
113  void registerFactory( TestFactory *factory );
114 
121  void unregisterFactory( TestFactory *factory );
122 
133  void addRegistry( const std::string &name );
134 
148  static bool isValid();
149 
155  void registerFactory( const std::string &name,
156  TestFactory *factory );
157 
158 private:
160  void operator =( const TestFactoryRegistry &copy );
161 
162 private:
163  typedef std::set<TestFactory *, std::less<TestFactory*> > Factories;
165 
166  std::string m_name;
167 };
168 
169 
171 
172 #if CPPUNIT_NEED_DLL_DECL
173 #pragma warning( pop )
174 #endif
175 
176 
177 #endif // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
#define CPPUNIT_API
Definition: CppUnitApi.h:27
#define CPPUNIT_NS_END
Definition: Portability.h:106
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:105
Abstract Test factory.
Definition: TestFactory.h:14
virtual Test * makeTest()=0
Registry for TestFactory.
Definition: TestFactoryRegistry.h:76
TestFactoryRegistry(const TestFactoryRegistry &copy)
Factories m_factories
Definition: TestFactoryRegistry.h:164
std::set< TestFactory *, std::less< TestFactory * > > Factories
Definition: TestFactoryRegistry.h:163
std::string m_name
Definition: TestFactoryRegistry.h:166
Base class for all test objects.
Definition: Test.h:26
A Composite of Tests.
Definition: TestSuite.h:41

Send comments to:
CppUnit Developers