Pluma plugins management. More...
#include <Pluma.hpp>
Public Member Functions | |
Pluma () | |
Default Constructor. More... | |
template<typename ProviderType > | |
void | acceptProviderType () |
Tell Pluma to accept a certain type of providers. More... | |
template<typename ProviderType > | |
void | getProviders (std::vector< ProviderType * > &providers) |
Get the stored providers of a certain type. More... | |
template<typename ProviderType > | |
void | acceptProviderType () |
template<typename ProviderType > | |
void | getProviders (std::vector< ProviderType * > &providers) |
bool | load (const std::string &path) |
Load a plugin given it's path. More... | |
bool | load (const std::string &folder, const std::string &pluginName) |
Load a plugin from a given folder. More... | |
int | loadFromFolder (const std::string &folder, bool recursive=false) |
Load all plugins from a given folder. More... | |
bool | unload (const std::string &pluginName) |
Unload a plugin. More... | |
void | unloadAll () |
Unload all loaded plugins. More... | |
bool | addProvider (Provider *provider) |
Directly add a new provider. More... | |
void | getLoadedPlugins (std::vector< const std::string * > &pluginNames) const |
Get the name of all loaded plugins. More... | |
bool | isLoaded (const std::string &pluginName) const |
Check if a plug-in is loaded. More... | |
Protected Member Functions | |
void | registerType (const std::string &type, unsigned int version, unsigned int lowestVersion) |
Register a provider type. More... | |
const std::list< Provider * > * | getProviders (const std::string &type) const |
Get providers of a certain type. More... | |
Pluma plugins management.
Pluma is the main class of Pluma library. Allows hosting applications to load/unload dlls in runtime (plugins), and to get providers of shared interface objects.
Example:
It is also possible to add local providers, providers that are defined directly on the host application. That can be useful to provide and use default implementations of certain interfaces, along with plugin implementations.
void pluma::Pluma::acceptProviderType | ( | ) |
Tell Pluma to accept a certain type of providers.
A Pluma object is able to accept multiple types of providers. When a plugin is loaded, it tries to register it's providers implementations. Those are only accepted by the host application if it's accepting providers of that kind.
ProviderType | type of provider. |
|
inherited |
Directly add a new provider.
provider | Provider. |
Definition at line 168 of file PluginManager.cpp.
|
inherited |
Get the name of all loaded plugins.
pluginNames | A vector to fill with the plugins names. |
Definition at line 178 of file PluginManager.cpp.
void pluma::Pluma::getProviders | ( | std::vector< ProviderType * > & | providers | ) |
Get the stored providers of a certain type.
Providers are added at the end of the providers vector.
ProviderType | type of provider to be returned. |
[out] | providers | Vector to fill with the existing providers. |
|
protectedinherited |
Get providers of a certain type.
type | Provider type. |
Definition at line 194 of file PluginManager.cpp.
|
inherited |
Check if a plug-in is loaded.
pluginName | the plug-in tname o check. |
Definition at line 188 of file PluginManager.cpp.
|
inherited |
Load a plugin given it's path.
path | Path for the plugin, including plugin name. File extension may be included, but is discouraged for better cross platform code. If file extension isn't present on the path, Pluma will deduce it from the operating system. |
Definition at line 49 of file PluginManager.cpp.
|
inherited |
Load a plugin from a given folder.
folder | The folder path. |
pluginName | Name of the plugin. File extension may be included, but is discouraged for better cross platform code. If file extension is omitted, Pluma will deduce it from the operating system. |
Definition at line 85 of file PluginManager.cpp.
|
inherited |
Load all plugins from a given folder.
folder | Path for the folder where the plug-ins are. |
recursive | If true it will search on sub-folders as well |
Definition at line 95 of file PluginManager.cpp.
|
protectedinherited |
Register a provider type.
type | Provider type. |
version | Current version of that provider type. |
lowestVersion | Lowest compatible version of that provider type. |
Definition at line 162 of file PluginManager.cpp.
|
inherited |
Unload a plugin.
pluginName | Name or path of the plugin. |
Definition at line 109 of file PluginManager.cpp.
|
inherited |
Unload all loaded plugins.
Definition at line 122 of file PluginManager.cpp.