X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Flibs%2FPlugins%2Fpluginmanager.h;fp=src%2Flibs%2FPlugins%2Fpluginmanager.h;h=2f320f97b54d0eab2ce57ccae5256976686e8846;hb=441d1b38e0900f56891f495a94a08dc8d48e0a32;hp=0000000000000000000000000000000000000000;hpb=f0483301fd77c091eb2e2cc3b4ac3b397a01d998;p=evaf diff --git a/src/libs/Plugins/pluginmanager.h b/src/libs/Plugins/pluginmanager.h new file mode 100644 index 0000000..2f320f9 --- /dev/null +++ b/src/libs/Plugins/pluginmanager.h @@ -0,0 +1,111 @@ +/** + * @file plugins/pluginmanager.h + * @brief Manager for loadable modules (plugins) + * + * Copyright (c) 2011 Enar Vaikene + * + * This file is part of the eVaf C++ cross-platform application development framework. + * + * This file can be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * the following information to ensure the GNU General Public License version + * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * Alternatively, this file may be used in accordance with the Commercial License + * Agreement provided with the Software. + */ + +#ifndef __PLUGINS_PLUGINMANAGER_H +#define __PLUGINS_PLUGINMANAGER_H + +#include "libplugins.h" + +#include + +#include + +/** + * Library for managing loadable modules (plugins). + * + * The Plugins library adds loadable modules (plugins) support to the eVaf application. A module is one + * external library (.so or .dll file) that implements one or more plugins. A plugin is an individual object + * that is created and initialized as one entirety. + * + * Modules are loaded and plugins created by the plugin manager. Plugin manager uses the application's + * XML file to define which modules should be loaded and which plugins to be created. + */ +namespace Plugins { + +/** + * Internal implementation of the plugin manager library. + */ +namespace Internal { + class PluginManagerPrivate; +} + +/** + * Plugin manager for eVaf applications. + */ +class PLUGINS_EXPORT PluginManager : public QObject +{ + Q_OBJECT + +public: + + /// Ctr. + PluginManager(); + + /// Dtr. + virtual ~PluginManager(); + + /** + * Returns the plugin manager's instance + */ + static PluginManager * instance(); + + /** + * Initializes the plugin manager. + * @return True if ok; false if initialization failed. + * + * This function initializes the plugin manager. External modules are loaded and plugin objects + * created in this function. + */ + bool init(); + + /** + * Finalizes the plugin manager. + * + * This function finalizes the plugin manager. Plugin objects are destroyed and external modules + * unloaded in this function. + */ + void done(); + + +signals: + + /** + * Plugins loaded signal. + * + * This signal is emitted when all the modules are loaded and plugin objects created. + */ + void pluginsLoaded(); + + /** + * Plugins unloaded signal. + * + * This signal is emitted when all the plugin objects are destroyed and modules unloaded. + */ + void pluginsUnloaded(); + + +private: + + Internal::PluginManagerPrivate * dl; + +}; + +} // namespace Plugins + + +#endif // pluginmanager.h