X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Flibs%2FPlugins%2Fiplugin.h;fp=src%2Flibs%2FPlugins%2Fiplugin.h;h=1cc2b8e54f82d21dc551d9498e158f64a51b67c1;hb=441d1b38e0900f56891f495a94a08dc8d48e0a32;hp=0000000000000000000000000000000000000000;hpb=f0483301fd77c091eb2e2cc3b4ac3b397a01d998;p=evaf diff --git a/src/libs/Plugins/iplugin.h b/src/libs/Plugins/iplugin.h new file mode 100644 index 0000000..1cc2b8e --- /dev/null +++ b/src/libs/Plugins/iplugin.h @@ -0,0 +1,94 @@ +/** + * @file plugins/iplugin.h + * @brief Common 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_IPLUGIN_H +#define __PLUGINS_IPLUGIN_H + +#include "libplugins.h" + +#include +#include + +namespace eVaf { +namespace Plugins { + +/** + * Common interface for all the eVaf modules. + * + * @code#include @endcode + * + * The iPlugin interface is the common interface implemented by all the eVaf modules. + */ +class PLUGINS_EXPORT iPlugin : public QObject +{ + Q_OBJECT + +public: + + /// Empty constructor + iPlugin() : QObject() {} + + /// Empty virtual destructor + virtual ~iPlugin() {} + + /** + * Initializes the module that implements the iPlugin interface + * @param args Arguments for the initialization + * @return True if ok; false if initialization failed + * + * The plugin manager calls the init() function for every eVaf module during the initialization + * of the application. Modules implementing the iPlugin interface shall allocate and initialize + * all the required resources in the init() function. + * + * Modules can assume that the init() function is always called once after loading the module + * and creating the interface object. Every init() function call is followed by a done() + * function call during the finalization of the application. Modules can be initialized + * multiple times without destroying the interface object, but init() function calls are + * always followed by a done() function call. + * + * When the init() function returns true, then the initialization of the module shall be completed + * and all the interfaces and other resources published by the module safe to use. + * + */ + virtual bool init(const QString & args) = 0; + + /** + * Finalizes the module. + * + * The plugin manager calls the done() function for every eVaf module during the finalization + * of the application. Modules implementing the iPlugin interface shall finalize and release + * all the resources in the done() function. + */ + virtual void done() = 0; + + /** + * Ready flag. + * @return True if the module is ready. + * + * The ready flag indicates that the module is initialized and all the published interfaces + * and resources safe to use. + */ + virtual bool isReady() const = 0; + +}; + +} // namespace eVaf::Plugins +} // namespace eVaf + +#endif // iplugin.h