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 <cppunit/portability/CppUnitSet.h>
00012
#include <cppunit/extensions/TestFactory.h>
00013
#include <string>
00014
00015
CPPUNIT_NS_BEGIN
00016
00017
00018
class TestSuite;
00019
00020
#if CPPUNIT_NEED_DLL_DECL
00021
00022
#endif
00023
00024
00080 class CPPUNIT_API TestFactoryRegistry :
public TestFactory
00081 {
00082
public:
00087 TestFactoryRegistry( std::string name );
00088
00090
virtual ~TestFactoryRegistry();
00091
00096
virtual Test *
makeTest();
00097
00107
static TestFactoryRegistry &getRegistry(
const std::string &name =
"All Tests" );
00108
00112
void addTestToSuite(
TestSuite *suite );
00113
00118
void registerFactory(
TestFactory *factory );
00119
00126
void unregisterFactory(
TestFactory *factory );
00127
00138
void addRegistry(
const std::string &name );
00139
00153
static bool isValid();
00154
00160
void registerFactory(
const std::string &name,
00161
TestFactory *factory );
00162
00163
private:
00164 TestFactoryRegistry(
const TestFactoryRegistry © );
00165
void operator =(
const TestFactoryRegistry © );
00166
00167
private:
00168 typedef CppUnitSet<TestFactory *, std::less<TestFactory*> > Factories;
00169 Factories m_factories;
00170
00171 std::string m_name;
00172 };
00173
00174
00175
CPPUNIT_NS_END
00176
00177
#if CPPUNIT_NEED_DLL_DECL
00178
#pragma warning( pop )
00179
#endif
00180
00181
00182
#endif // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H