source: trunk/contrib/cppunit-1.12.2/include/cppunit/plugin/PlugInManager.h @ 876

Last change on this file since 876 was 876, checked in by sam, 9 years ago

contrib: add a precompiled Win32 version of CppUnit and update build system
accordingly.

File size: 3.0 KB
Line 
1#ifndef CPPUNIT_PLUGIN_PLUGINMANAGER_H
2#define CPPUNIT_PLUGIN_PLUGINMANAGER_H
3
4#include <cppunit/Portability.h>
5
6#if !defined(CPPUNIT_NO_TESTPLUGIN)
7
8#if CPPUNIT_NEED_DLL_DECL
9#pragma warning( push )
10#pragma warning( disable: 4251 )  // X needs to have dll-interface to be used by clients of class Z
11#endif
12
13#include <cppunit/plugin/PlugInParameters.h>
14struct CppUnitTestPlugIn;
15
16CPPUNIT_NS_BEGIN
17
18
19class DynamicLibraryManager;
20class TestResult;
21class XmlOutputter;
22
23
24/*! \brief Manges TestPlugIn.
25 */
26class CPPUNIT_API PlugInManager
27{
28public:
29  /*! Constructs a PlugInManager object.
30   */
31  PlugInManager();
32
33  /// Destructor.
34  virtual ~PlugInManager();
35
36  /*! \brief Loads the specified plug-in.
37   *
38   * After being loaded, the CppUnitTestPlugIn::initialize() is called.
39   *
40   * \param libraryFileName Name of the file that contains the TestPlugIn.
41   * \param parameters List of string passed to the plug-in.
42   * \return Pointer on the DynamicLibraryManager associated to the library.
43   *         Valid until the library is unloaded. Never \c NULL.
44   * \exception DynamicLibraryManagerException is thrown if an error occurs during loading.
45   */
46  void load( const std::string &libraryFileName,
47             const PlugInParameters &parameters = PlugInParameters() );
48
49  /*! \brief Unloads the specified plug-in.
50   * \param libraryFileName Name of the file that contains the TestPlugIn passed
51   *                        to a previous call to load().
52   */
53  void unload( const std::string &libraryFileName );
54
55  /*! \brief Gives a chance to each loaded plug-in to register TestListener.
56   *
57   * For each plug-in, call CppUnitTestPlugIn::addListener().
58   */
59  void addListener( TestResult *eventManager );
60
61  /*! \brief Gives a chance to each loaded plug-in to unregister TestListener.
62   * For each plug-in, call CppUnitTestPlugIn::removeListener().
63   */
64  void removeListener( TestResult *eventManager );
65
66  /*! \brief Provides a way for the plug-in to register some XmlOutputterHook.
67   */
68  void addXmlOutputterHooks( XmlOutputter *outputter );
69
70  /*! \brief Called when the XmlOutputter is destroyed.
71   *
72   * Can be used to free some resources allocated by addXmlOutputterHooks().
73   */
74  void removeXmlOutputterHooks();
75
76protected:
77  /*! \brief (INTERNAL) Information about a specific plug-in.
78   */
79  struct PlugInInfo
80  {
81    std::string m_fileName;
82    DynamicLibraryManager *m_manager;
83    CppUnitTestPlugIn *m_interface;
84  };
85
86  /*! Unloads the specified plug-in.
87   * \param plugIn Information about the plug-in.
88   */
89  void unload( PlugInInfo &plugIn );
90
91private:
92  /// Prevents the use of the copy constructor.
93  PlugInManager( const PlugInManager &copy );
94
95  /// Prevents the use of the copy operator.
96  void operator =( const PlugInManager &copy );
97
98private:
99  typedef CppUnitDeque<PlugInInfo> PlugIns;
100  PlugIns m_plugIns;
101};
102
103
104CPPUNIT_NS_END
105
106#if CPPUNIT_NEED_DLL_DECL
107#pragma warning( pop )
108#endif
109
110#endif // !defined(CPPUNIT_NO_TESTPLUGIN)
111
112
113#endif  // CPPUNIT_PLUGIN_PLUGINMANAGER_H
Note: See TracBrowser for help on using the repository browser.