2 * @file Plugins/pluginmanager.h
3 * @brief Manager for loadable modules (plugins)
5 * Copyright (c) 2011 Enar Vaikene
7 * This file is part of the eVaf C++ cross-platform application development framework.
9 * This file can be used under the terms of the GNU General Public License
10 * version 3.0 as published by the Free Software Foundation and appearing in
11 * the file LICENSE included in the packaging of this file. Please review the
12 * the following information to ensure the GNU General Public License version
13 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 * Alternatively, this file may be used in accordance with the Commercial License
16 * Agreement provided with the Software.
19 #ifndef __PLUGINS_PLUGINMANAGER_H
20 #define __PLUGINS_PLUGINMANAGER_H
22 #include "libplugins.h"
24 #include <version_rc.h>
32 * Library for managing loadable modules (plugins).
34 * The Plugins library adds loadable modules (plugins) support to the eVaf application. A module is one
35 * external library (.so or .dll file) that implements one or more plugins. A plugin is an individual object
36 * that is created and initialized as one entirety.
38 * Modules are loaded and plugins created by the plugin manager. Plugin manager uses the application's
39 * XML file to define which modules should be loaded and which plugins to be created.
44 * Internal implementation of the plugin manager library.
47 class PluginManagerPrivate
;
51 * Expands plugin names for the selected platform.
52 * @param name Name of the plugin
53 * @return Expanded plugin name
55 * This function expands the plugin name so that it becomes valid for the selected platform.
56 * For example, on Linux it adds the prefix "lib" to the beginning and extension ".so" to the end.
58 inline QString
expandPluginName(QString
const & name
)
62 return "lib" + name
+ ".dll";
66 #elif defined Q_OS_LINUX
67 return "lib" + name
+ ".so";
74 * Plugin manager for eVaf applications.
76 class PLUGINS_EXPORT PluginManager
: public QObject
86 virtual ~PluginManager();
89 * Returns the plugin manager's instance
91 static PluginManager
* instance();
94 * Initializes the plugin manager.
95 * @return True if ok; false if initialization failed.
97 * This function initializes the plugin manager. External modules are loaded and plugin objects
98 * created in this function.
103 * Finalizes the plugin manager.
105 * This function finalizes the plugin manager. Plugin objects are destroyed and external modules
106 * unloaded in this function.
114 * Plugins loaded signal.
116 * This signal is emitted when all the modules are loaded and plugin objects created.
118 void pluginsLoaded();
121 * Plugins unloaded signal.
123 * This signal is emitted when all the plugin objects are destroyed and modules unloaded.
125 void pluginsUnloaded();
130 Internal::PluginManagerPrivate
* d
;
134 } // namespace eVaf::Plugins
137 #endif // pluginmanager.h