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 #elif defined Q_OS_LINUX
63 return "lib" + name
+ ".so";
70 * Plugin manager for eVaf applications.
72 class PLUGINS_EXPORT PluginManager
: public QObject
82 virtual ~PluginManager();
85 * Returns the plugin manager's instance
87 static PluginManager
* instance();
90 * Initializes the plugin manager.
91 * @return True if ok; false if initialization failed.
93 * This function initializes the plugin manager. External modules are loaded and plugin objects
94 * created in this function.
99 * Finalizes the plugin manager.
101 * This function finalizes the plugin manager. Plugin objects are destroyed and external modules
102 * unloaded in this function.
110 * Plugins loaded signal.
112 * This signal is emitted when all the modules are loaded and plugin objects created.
114 void pluginsLoaded();
117 * Plugins unloaded signal.
119 * This signal is emitted when all the plugin objects are destroyed and modules unloaded.
121 void pluginsUnloaded();
126 Internal::PluginManagerPrivate
* d
;
130 } // namespace eVaf::Plugins
133 #endif // pluginmanager.h