]> vaikene.ee Git - evaf/blobdiff - src/libs/Plugins/pluginmanager.h
Added more files to the project.
[evaf] / src / libs / Plugins / pluginmanager.h
diff --git a/src/libs/Plugins/pluginmanager.h b/src/libs/Plugins/pluginmanager.h
new file mode 100644 (file)
index 0000000..2f320f9
--- /dev/null
@@ -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 <version_rc.h>
+
+#include <QObject>
+
+/**
+ * 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