]> vaikene.ee Git - evaf/blob - src/libs/Plugins/ipluginfactory.h
Added Qt plugin macros to Plugins::iPlugin and Plugins::iPluginFactory for proper...
[evaf] / src / libs / Plugins / ipluginfactory.h
1 /**
2 * @file Plugins/ipluginfactory.h
3 * @brief Common plugin factory interface for all the eVaf modules
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #ifndef __PLUGINS_IPLUGINFACTORY_H
21 #define __PLUGINS_IPLUGINFACTORY_H
22
23 #include "libplugins.h"
24
25 #include <QObject>
26 #include <QString>
27
28 namespace eVaf {
29 namespace Plugins {
30
31 /**
32 * Common plugin factory interface for eVaf modules.
33 * @code#include <Plugins/iPluginFactory>@endcode
34 *
35 * The iPluginFactory interface is implemented by modules that export more than one
36 * iPlugin interface.
37 *
38 * Modules that implement only one iPlugin interface, use the iPlugin interface object
39 * directly.
40 */
41 class PLUGINS_EXPORT iPluginFactory : public QObject
42 {
43 Q_OBJECT
44
45 public:
46
47 /// Empty constructor
48 iPluginFactory() : QObject() {}
49
50 /// Empty virtual destructor
51 virtual ~iPluginFactory() {}
52
53 /**
54 * Creates the requested iPlugin interface object
55 * @param name Name of the interface
56 * @return The requested iPlugin interface object or 0 if failed
57 *
58 * This function creates the requested iPlugin interface object. Modules can implement more than
59 * one iPlugin interface objects and use names to identify them.
60 *
61 * If the requested interface object cannot be created, this function returns 0.
62 *
63 * The module implementing the iPluginFactory interface is responsible for destroying all the
64 * created iPlugin interface objects.
65 */
66 virtual QObject * create(const QString & name) = 0;
67
68 };
69
70 } // namespace eVaf::Plugins
71 } // namespace eVaf
72
73 Q_DECLARE_INTERFACE(eVaf::Plugins::iPluginFactory, "eVaf.Plugins.iPluginFactory/1.0")
74
75 #endif // ipluginfactory.h