CppUnit project page FAQ CppUnit home page

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

TestPlugIn.h

Go to the documentation of this file.
00001 #ifndef CPPUNIT_PLUGIN_TESTPLUGIN 00002 #define CPPUNIT_PLUGIN_TESTPLUGIN 00003 00004 #include <cppunit/Portability.h> 00005 00006 #if !defined(CPPUNIT_NO_TESTPLUGIN) 00007 00008 #include <cppunit/plugin/PlugInParameters.h> 00009 00010 CPPUNIT_NS_BEGIN 00011 00012 00013 class Test; 00014 class TestFactoryRegistry; 00015 class TestResult; 00016 class XmlOutputter; 00017 00018 CPPUNIT_NS_END 00019 00043 struct CppUnitTestPlugIn 00044 { 00058 virtual void initialize( CPPUNIT_NS::TestFactoryRegistry *registry, 00059 const CPPUNIT_NS::PlugInParameters &parameters ) =0; 00060 00068 virtual void addListener( CPPUNIT_NS::TestResult *eventManager ) =0; 00069 00074 virtual void removeListener( CPPUNIT_NS::TestResult *eventManager ) =0; 00075 00078 virtual void addXmlOutputterHooks( CPPUNIT_NS::XmlOutputter *outputter ) =0; 00079 00084 virtual void removeXmlOutputterHooks() = 0; 00085 00094 virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry ) =0; 00095 }; 00096 00097 00098 00107 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn 00108 00112 typedef CppUnitTestPlugIn *(*TestPlugInSignature)(); 00113 00114 00118 #define CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( TestPlugInInterfaceType ) \ 00119 CPPUNIT_PLUGIN_EXPORT CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void) \ 00120 { \ 00121 static TestPlugInInterfaceType plugIn; \ 00122 return &plugIn; \ 00123 } \ 00124 typedef char __CppUnitPlugInExportFunctionDummyTypeDef // dummy typedef so it can end with ';' 00125 00126 00127 // Note: This include should remain after definition of CppUnitTestPlugIn 00128 #include <cppunit/plugin/TestPlugInDefaultImpl.h> 00129 00130 00139 // Win32 00140 #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER) 00141 #if !defined(APIENTRY) 00142 #define WIN32_LEAN_AND_MEAN 00143 #define NOGDI 00144 #define NOUSER 00145 #define NOKERNEL 00146 #define NOSOUND 00147 #define NOMINMAX 00148 #include <windows.h> 00149 #endif 00150 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \ 00151 BOOL APIENTRY DllMain( HANDLE hModule, \ 00152 DWORD ul_reason_for_call, \ 00153 LPVOID lpReserved ) \ 00154 { \ 00155 return TRUE; \ 00156 } \ 00157 typedef char __CppUnitPlugInImplementMainDummyTypeDef 00158 00159 // Unix 00160 #elif defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER) 00161 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \ 00162 int main( int argc, char *argv[] ) \ 00163 { \ 00164 return 0; \ 00165 } \ 00166 typedef char __CppUnitPlugInImplementMainDummyTypeDef 00167 00168 00169 // Other 00170 #else // other platforms don't require anything specifics 00171 #endif 00172 00173 00174 00189 #define CPPUNIT_PLUGIN_IMPLEMENT() \ 00190 CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS::TestPlugInDefaultImpl ); \ 00191 CPPUNIT_PLUGIN_IMPLEMENT_MAIN() 00192 00193 00194 #endif // !defined(CPPUNIT_NO_TESTPLUGIN) 00195 00196 00197 #endif // CPPUNIT_PLUGIN_TESTPLUGIN

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