class
AbstractManagerNon-templated base for plugin managers.
Contents
See Manager and Plugin management for more information.
Derived classes
-
template<class T>class Manager
- Plugin manager.
Public static variables
- static const int Version
- Plugin version.
Constructors, destructors, conversion operators
- AbstractManager(const AbstractManager&) deleted
- Copying is not allowed.
- AbstractManager(AbstractManager&&) deleted
- Moving is not allowed.
- ~AbstractManager() protected
- Destructor.
Public functions
- auto operator=(const AbstractManager&) -> AbstractManager& deleted
- Copying is not allowed.
- auto operator=(AbstractManager&&) -> AbstractManager& deleted
- Moving is not allowed.
-
auto pluginInterface() const -> std::
string - Plugin interface.
-
auto pluginDirectory() const -> std::
string - Plugin directory.
-
void setPluginDirectory(std::
string directory) - Set another plugin directory.
- void reloadPluginDirectory()
- Reload plugin directory.
-
void setPreferredPlugins(const std::
string& alias, std:: initializer_list<std:: string> plugins) - Set preferred plugins for given alias.
-
auto pluginList() const -> std::
vector<std:: string> - List of all available plugin names.
-
auto aliasList() const -> std::
vector<std:: string> - List of all available alias names.
-
auto metadata(const std::
string& plugin) const -> const PluginMetadata* - Plugin metadata.
-
auto loadState(const std::
string& plugin) const -> LoadState - Load state of a plugin.
-
auto load(const std::
string& plugin) -> LoadState - Load a plugin.
-
auto unload(const std::
string& plugin) -> LoadState - Unload a plugin.
Function documentation
Corrade:: PluginManager:: AbstractManager:: ~AbstractManager() protected
Destructor.
Destroys all plugin instances and unloads all plugins.
std:: string Corrade:: PluginManager:: AbstractManager:: pluginInterface() const
Plugin interface.
Only plugins with the same plugin interface string can be used in this plugin manager.
std:: string Corrade:: PluginManager:: AbstractManager:: pluginDirectory() const
Plugin directory.
void Corrade:: PluginManager:: AbstractManager:: setPluginDirectory(std:: string directory)
Set another plugin directory.
Keeps loaded plugins untouched, removes unloaded plugins which are not existing anymore and adds newly found plugins. The directory is expected to be in UTF-8.
void Corrade:: PluginManager:: AbstractManager:: reloadPluginDirectory()
Reload plugin directory.
Convenience equivalent to setPluginDirectory(pluginDirectory())
.
void Corrade:: PluginManager:: AbstractManager:: setPreferredPlugins(const std:: string& alias,
std:: initializer_list<std:: string> plugins)
Set preferred plugins for given alias.
By default, if more than one plugin provides given alias
, one of them is arbitrarily chosen. With this function it's possible to control the behavior. For given alias
the function goes through the list in plugins
and uses the first plugin that is available. The alias
is expected to exist and be defined by plugins in plugins
. If none of plugins
is available, nothing is done.
Note that after calling setPluginDirectory() or reloadPluginDirectory() this preference gets reset and you may need to call this function again.
std:: vector<std:: string> Corrade:: PluginManager:: AbstractManager:: pluginList() const
List of all available plugin names.
Returns a list of names that correspond to concrete unique static or dynamic plugins.
std:: vector<std:: string> Corrade:: PluginManager:: AbstractManager:: aliasList() const
List of all available alias names.
In addition to everything returned by pluginList() contains also all plugin aliases.
const PluginMetadata* Corrade:: PluginManager:: AbstractManager:: metadata(const std:: string& plugin) const
Plugin metadata.
Returns pointer to plugin metadata or nullptr
, if given plugin is not found.
LoadState Corrade:: PluginManager:: AbstractManager:: loadState(const std:: string& plugin) const
Load state of a plugin.
Returns LoadState::
LoadState Corrade:: PluginManager:: AbstractManager:: load(const std:: string& plugin)
Load a plugin.
Returns LoadState::
If the plugin has any dependencies, they are recursively processed before loading given plugin.
If plugin
is a plugin file path (i.e., ending with a platform-specific extension such as .so
or .dll
), it's loaded from given location and, if the loading succeeds, its basename (without extension) is exposed as an available plugin name. It's expected that a plugin with the same name is not already loaded. The plugin will reside in the plugin list as long as it's loaded or, after calling unload() on it, until next call to setPluginDirectory() or reloadPluginDirectory().
LoadState Corrade:: PluginManager:: AbstractManager:: unload(const std:: string& plugin)
Unload a plugin.
Returns LoadState::