CppUnit project page FAQ CppUnit home page

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

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 #include <cppunit/extensions/TestFactory.h>
00006 #include <map>
00007 #include <string>
00008 
00009 namespace CppUnit {
00010 
00011   class TestSuite;
00012 
00017   class TestFactoryRegistry : public TestFactory
00018   {
00019   public:
00023     TestFactoryRegistry( std::string name = "All Tests" );
00024 
00026     virtual ~TestFactoryRegistry();
00027 
00031     virtual Test *makeTest();
00032 
00036     static TestFactoryRegistry &getRegistry();
00037 
00042     static TestFactoryRegistry &getRegistry( const std::string &name );
00043 
00047     void addTestToSuite( TestSuite *suite );
00048 
00053     void registerFactory( const std::string &name,
00054                           TestFactory *factory );
00055 
00059     void registerFactory( TestFactory *factory );
00060 
00061   private:
00062     TestFactoryRegistry( const TestFactoryRegistry &copy );
00063     void operator =( const TestFactoryRegistry &copy );
00064 
00065   private:
00066     typedef std::map<std::string, TestFactory *> Factories;
00067     Factories m_factories;
00068 
00069     typedef std::map<std::string, TestFactoryRegistry *> NamedRegistries;
00070 
00071     std::string m_name;
00072   };
00073 
00074 
00075 
00076 }  // namespace CppUnit
00077 
00078 
00079 #endif  // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H

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