CppUnit project page | FAQ | CppUnit home page

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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   virtual ~CppUnitTestPlugIn() {}
    00097 };
    00098
    00099
    00100
    00109 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
    00110
    00114 typedef CppUnitTestPlugIn *(*TestPlugInSignature)();
    00115
    00116
    00120 #define CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( TestPlugInInterfaceType )       \
    00121   CPPUNIT_PLUGIN_EXPORT CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void)  \
    00122   {                                                                            \
    00123     static TestPlugInInterfaceType plugIn;                                     \
    00124     return &plugIn;                                                            \
    00125   }                                                                            \
    00126   typedef char __CppUnitPlugInExportFunctionDummyTypeDef  // dummy typedef so it can end with ';'
    00127
    00128
    00129 // Note: This include should remain after definition of CppUnitTestPlugIn
    00130 #include <cppunit/plugin/TestPlugInDefaultImpl.h>
    00131
    00132
    00141 // Win32
    00142 #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER)
    00143 #if !defined(APIENTRY)
    00144 #define WIN32_LEAN_AND_MEAN
    00145 #define NOGDI
    00146 #define NOUSER
    00147 #define NOKERNEL
    00148 #define NOSOUND
    00149 #define NOMINMAX
    00150 #define BLENDFUNCTION void    // for mingw & gcc
    00151 #include <windows.h>
    00152 #endif
    00153 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN()               \
    00154   BOOL APIENTRY DllMain( HANDLE hModule,              \
    00155                          DWORD  ul_reason_for_call,   \
    00156                          LPVOID lpReserved )          \
    00157   {                                                   \
    00158       return TRUE;                                    \
    00159   }                                                   \
    00160   typedef char __CppUnitPlugInImplementMainDummyTypeDef
    00161
    00162 // Unix
    00163 #elif defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
    00164 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN()               \
    00165   int main( int argc, char *argv[] )                  \
    00166   {                                                   \
    00167     return 0;                                         \
    00168   }                                                   \
    00169   typedef char __CppUnitPlugInImplementMainDummyTypeDef
    00170
    00171
    00172 // Other
    00173 #else     // other platforms don't require anything specifics
    00174 #endif
    00175
    00176
    00177
    00192 #define CPPUNIT_PLUGIN_IMPLEMENT()                                          \
    00193   CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS::TestPlugInDefaultImpl );  \
    00194   CPPUNIT_PLUGIN_IMPLEMENT_MAIN()
    00195
    00196
    00197 #endif // !defined(CPPUNIT_NO_TESTPLUGIN)
    00198
    00199
    00200 #endif // CPPUNIT_PLUGIN_TESTPLUGIN

| hosts this site. |  | Send comments to: CppUnit Developers