LibEngsas
Public Member Functions | Static Public Member Functions | List of all members
EPluginLoader< PluginType > Class Template Reference

Provides functions to load Qt plugins properly. More...

#include <epluginloader.h>

Public Member Functions

PluginType * doLoadPlugin (QString absFilePath, EModuleListWidgetItem *item=NULL)
 Used internally to really load a plugin. More...
 

Static Public Member Functions

static QList< PluginType * > loadPlugins (QString searchPath, EngSaS::ModuleListWidgetItems &log)
 Loads all plugins of type PluginType in a directory. More...
 
static PluginType * loadPlugin (QString name, QString searchPath, EModuleListWidgetItem *item=NULL)
 Loads the first plugin matching PluginType and name in a directory. More...
 

Detailed Description

template<class PluginType>
class EPluginLoader< PluginType >

Provides functions to load Qt plugins properly.

To load your specific plugin type, use

// to load the first matching name plugin:
YourPluginClass *plugin = EPluginLoader<YourPluginClass>::loadPlugin("name", "searchdir");
// to load all plugins:
QList<EModuleListWidgetitem*> log;
QList<YourPluginClass*> plugins = EPluginLoader<YourPluginClass>::loadPlugins("searchdir", log);

If you want to define the search dir not everytime, do something like this:

#ifndef CUSTOMPLUGINLOADER_H
#define CUSTOMPLUGINLOADER_H
#include <epluginloader.h>
template <class PluginType>
class CustomPluginLoader {
public:
static QList<PluginType*> loadPlugins(QList<EModuleListWidgetitem*> &log);
static PluginType* loadPlugin(QString name, EModuleListWidgetitem* item = NULL);
};
template <class PluginType>
QList<PluginType*> CustomPluginLoader<PluginType>::loadPlugins(QList<EModuleListWidgetitem*> &log)
{
}
template <class PluginType>
PluginType* CustomPluginLoader<PluginType>::loadPlugin(QString name, QString &error)
{
return EPluginLoader<PluginType>::loadPlugin(name, "YourDir", log);
}
#endif // CUSTOMPLUGINLOADER_H
Note
Template classes must be implemented in the header file. Otherwise, undefined reference errors appear.

Member Function Documentation

template<class PluginType >
PluginType * EPluginLoader< PluginType >::doLoadPlugin ( QString  absFilePath,
EModuleListWidgetItem item = NULL 
)

Used internally to really load a plugin.

Normally you won't use this function directly, use loadPlugin() or loadPlugins() instead.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class PluginType >
PluginType * EPluginLoader< PluginType >::loadPlugin ( QString  name,
QString  searchPath,
EModuleListWidgetItem item = NULL 
)
static

Loads the first plugin matching PluginType and name in a directory.

The searched directory is searchPath. The information about the loaded or failed plugin is stored in the item.

See Also
loadPlugins() to load all matching plugins.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class PluginType >
QList< PluginType * > EPluginLoader< PluginType >::loadPlugins ( QString  searchPath,
EngSaS::ModuleListWidgetItems log 
)
static

Loads all plugins of type PluginType in a directory.

The searched directory is searchPath. The information about the loaded or failed plugins are stored in the log.

See Also
loadPlugin() to load the first plugin with a specified name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: