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