swift
|
Base class for all contexts that provide plugin support. More...
Public Member Functions | |
IPluginManager (QObject *parent=nullptr) | |
Constructor. | |
virtual void | collectPlugins () |
Looks for all available plugins. | |
QString | getPluginConfigId (const QString &identifier) |
If the plugin specifies its config plugin, its identifier can be obtained using this method. You can get the plugin config instance later, using getPluginById() . | |
template<class T > | |
T * | getPluginById (const QString &identifier) |
Loads the given plugin (if necessary), casts it to the desired type and returns its instance. Returns nullptr on failure. | |
Protected Member Functions | |
virtual swift::misc::CSequence< QString > | acceptedIids () const =0 |
Returns the list of valid IIDs for the implementation. | |
virtual const QString & | pluginDirectory () const |
Where to look for plugins, absolute path. Default implementation returns plugins in the application dir. | |
virtual bool | isValid (const QJsonObject &metadata) const |
Defines whether the given plugin is valid or not, based on its metadata. The default implementation checks if all values common for all plugins (i.e. MetaData and identifier) are present and valid. It also checks if each plugin meets one of the specified in acceptedIids() IIDs. Override custom plugin validation in the subclass if needed. | |
QString | pluginIdentifier (const QJsonObject &metadata) const |
Gets the plugin identifier from the metadata. | |
QString | getIdByPlugin (const QObject *instance) const |
Gets plugin identifier by its instance. | |
const swift::misc::CSequence< QJsonObject > & | getPlugins () const |
Gets direct access to all plugins' metadata. | |
Base class for all contexts that provide plugin support.
It is responsible for locating, validating and loading plugins.
Definition at line 23 of file pluginmanager.h.