CppUnit project page FAQ CppUnit home page

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

TestFactoryRegistry.h

Go to the documentation of this file.
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/extensions/TestFactory.h>
00012 #include <map>
00013 #include <string>
00014 
00015 namespace CppUnit {
00016 
00017 class TestSuite;
00018 
00019 #if CPPUNIT_NEED_DLL_DECL
00020   template class CPPUNIT_API std::map<std::string, TestFactory *>;
00021 #endif
00022 
00023 
00075 class CPPUNIT_API TestFactoryRegistry : public TestFactory
00076 {
00077 public:
00082   TestFactoryRegistry( std::string name = "All Tests" );
00083 
00085   virtual ~TestFactoryRegistry();
00086 
00091   virtual Test *makeTest();
00092 
00098   static TestFactoryRegistry &getRegistry();
00099 
00107   static TestFactoryRegistry &getRegistry( const std::string &name );
00108 
00112   void addTestToSuite( TestSuite *suite );
00113 
00119   void registerFactory( const std::string &name,
00120                         TestFactory *factory );
00121 
00126   void registerFactory( TestFactory *factory );
00127 
00128 private:
00129   TestFactoryRegistry( const TestFactoryRegistry &copy );
00130   void operator =( const TestFactoryRegistry &copy );
00131 
00132 private:
00133   typedef std::map<std::string, TestFactory *> Factories;
00134   Factories m_factories;
00135 
00136   std::string m_name;
00137 };
00138 
00139 
00140 }  // namespace CppUnit
00141 
00142 
00143 #if CPPUNIT_NEED_DLL_DECL
00144 #pragma warning( pop )
00145 #endif
00146 
00147 
00148 #endif  // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H

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