CppUnit project page FAQ

TestPlugIn.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_PLUGIN_TESTPLUGIN
2 #define CPPUNIT_PLUGIN_TESTPLUGIN
3 
4 #include <cppunit/Portability.h>
5 
6 #if !defined(CPPUNIT_NO_TESTPLUGIN)
7 
9 
11 
12 
13 class Test;
15 class TestResult;
16 class XmlOutputter;
17 
19 
44 {
58  virtual void initialize( CPPUNIT_NS::TestFactoryRegistry *registry,
59  const CPPUNIT_NS::PlugInParameters &parameters ) =0;
60 
68  virtual void addListener( CPPUNIT_NS::TestResult *eventManager ) =0;
69 
74  virtual void removeListener( CPPUNIT_NS::TestResult *eventManager ) =0;
75 
78  virtual void addXmlOutputterHooks( CPPUNIT_NS::XmlOutputter *outputter ) =0;
79 
84  virtual void removeXmlOutputterHooks() = 0;
85 
94  virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry ) =0;
95 
96  virtual ~CppUnitTestPlugIn() {}
97 };
98 
99 
100 
109 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
110 
114 typedef CppUnitTestPlugIn *(*TestPlugInSignature)();
115 
116 
120 #define CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( TestPlugInInterfaceType ) \
121  CPPUNIT_PLUGIN_EXPORT CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void) \
122  { \
123  static TestPlugInInterfaceType plugIn; \
124  return &plugIn; \
125  } \
126  typedef char __CppUnitPlugInExportFunctionDummyTypeDef // dummy typedef so it can end with ';'
127 
128 
129 // Note: This include should remain after definition of CppUnitTestPlugIn
131 
132 
141 // Win32
142 #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER)
143 #if !defined(APIENTRY)
144 #define WIN32_LEAN_AND_MEAN
145 #define NOGDI
146 #define NOUSER
147 #define NOKERNEL
148 #define NOSOUND
149 #define NOMINMAX
150 #define BLENDFUNCTION void // for mingw & gcc
151 #include <windows.h>
152 #endif
153 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
154  BOOL APIENTRY DllMain( HANDLE, DWORD, LPVOID ) \
155  { \
156  return TRUE; \
157  } \
158  typedef char __CppUnitPlugInImplementMainDummyTypeDef
159 
160 // Unix
161 #elif defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
162 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
163  int main() \
164  { \
165  return 0; \
166  } \
167  typedef char __CppUnitPlugInImplementMainDummyTypeDef
168 
169 
170 // Other
171 #else // other platforms don't require anything specifics
172 #endif
173 
174 
175 
190 #define CPPUNIT_PLUGIN_IMPLEMENT() \
191  CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS::TestPlugInDefaultImpl ); \
192  CPPUNIT_PLUGIN_IMPLEMENT_MAIN()
193 
194 
195 #endif // !defined(CPPUNIT_NO_TESTPLUGIN)
196 
197 
198 #endif // CPPUNIT_PLUGIN_TESTPLUGIN

Send comments to:
CppUnit Developers