]> vaikene.ee Git - evaf/blobdiff - src/libs/Plugins/ipluginfactory.h
First implementation of the Plugin manager library.
[evaf] / src / libs / Plugins / ipluginfactory.h
diff --git a/src/libs/Plugins/ipluginfactory.h b/src/libs/Plugins/ipluginfactory.h
new file mode 100644 (file)
index 0000000..637aa6b
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ * @file Plugins/ipluginfactory.h
+ * @brief Common plugin factory interface for all the eVaf modules
+ * @author Enar Vaikene
+ *
+ * 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_IPLUGINFACTORY_H
+#define __PLUGINS_IPLUGINFACTORY_H
+
+#include "libplugins.h"
+
+#include <QObject>
+#include <QString>
+
+namespace eVaf {
+namespace Plugins {
+
+/**
+ * Common plugin factory interface for eVaf modules.
+ * @code#include <Plugins/iPluginFactory>
+ *
+ * The iPluginFactory interface is implemented by modules that export more than one
+ * iPlugin interface.
+ *
+ * Modules that implement only one iPlugin interface, use the iPlugin interface object
+ * directly.
+ */
+class PLUGINS_EXPORT iPluginFactory : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    /// Empty constructor
+    iPluginFactory() : QObject() {}
+
+    /// Empty virtual destructor
+    virtual ~iPluginFactory() {}
+
+    /**
+     * Creates the requested iPlugin interface object
+     * @param name Name of the interface
+     * @return The requested iPlugin interface object or 0 if failed
+     *
+     * This function creates the requested iPlugin interface object. Modules can implement more than
+     * one iPlugin interface objects and use names to identify them.
+     *
+     * If the requested interface object cannot be created, this function returns 0.
+     *
+     * The module implementing the iPluginFactory interface is responsible for destroying all the
+     * created iPlugin interface objects.
+     */
+    virtual QObject * create(const QString & name) = 0;
+
+};
+
+} // namespace eVaf::Plugins
+} // namespace eVaf
+
+#endif // ipluginfactory.h