00001 #ifndef CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
00002 #define CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
00003
00004 #include <cppunit/Portability.h>
00005
00006 #if CPPUNIT_NEED_DLL_DECL
00007 #pragma warning( push )
00008 #pragma warning( disable: 4251) // X needs to have dll-interface to be used by clients of class Z
00009 #endif
00010
00011 #include <set>
00012 #include <cppunit/extensions/TestFactory.h>
00013 #include <string>
00014
00015 CPPUNIT_NS_BEGIN
00016
00017
00018 class TestSuite;
00019
00075 class CPPUNIT_API TestFactoryRegistry : public TestFactory
00076 {
00077 public:
00082 TestFactoryRegistry( std::string name );
00083
00085 virtual ~TestFactoryRegistry();
00086
00091 virtual Test *makeTest();
00092
00102 static TestFactoryRegistry &getRegistry( const std::string &name = "All Tests" );
00103
00107 void addTestToSuite( TestSuite *suite );
00108
00113 void registerFactory( TestFactory *factory );
00114
00121 void unregisterFactory( TestFactory *factory );
00122
00133 void addRegistry( const std::string &name );
00134
00148 static bool isValid();
00149
00155 void registerFactory( const std::string &name,
00156 TestFactory *factory );
00157
00158 private:
00159 TestFactoryRegistry( const TestFactoryRegistry © );
00160 void operator =( const TestFactoryRegistry © );
00161
00162 private:
00163 typedef std::set<TestFactory *, std::less<TestFactory*> > Factories;
00164 Factories m_factories;
00165
00166 std::string m_name;
00167 };
00168
00169
00170 CPPUNIT_NS_END
00171
00172 #if CPPUNIT_NEED_DLL_DECL
00173 #pragma warning( pop )
00174 #endif
00175
00176
00177 #endif // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H