Manages loaded plugins. More...
#include <PluginManager.hpp>
Public Member Functions | |
~PluginManager () | |
Destructor. More... | |
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 | |
PluginManager () | |
Default constructor. More... | |
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... | |
Manages loaded plugins.
Definition at line 44 of file PluginManager.hpp.
pluma::PluginManager::~PluginManager | ( | ) |
Destructor.
Definition at line 43 of file PluginManager.cpp.
|
protected |
Default constructor.
PluginManager cannot be publicly instantiated.
Definition at line 37 of file PluginManager.cpp.
bool pluma::PluginManager::addProvider | ( | Provider * | provider | ) |
Directly add a new provider.
provider | Provider. |
Definition at line 168 of file PluginManager.cpp.
void pluma::PluginManager::getLoadedPlugins | ( | std::vector< const std::string * > & | pluginNames | ) | const |
Get the name of all loaded plugins.
pluginNames | A vector to fill with the plugins names. |
Definition at line 178 of file PluginManager.cpp.
|
protected |
Get providers of a certain type.
type | Provider type. |
Definition at line 194 of file PluginManager.cpp.
bool pluma::PluginManager::isLoaded | ( | const std::string & | pluginName | ) | const |
Check if a plug-in is loaded.
pluginName | the plug-in tname o check. |
Definition at line 188 of file PluginManager.cpp.
bool pluma::PluginManager::load | ( | const std::string & | path | ) |
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.
bool pluma::PluginManager::load | ( | const std::string & | folder, |
const std::string & | pluginName | ||
) |
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.
int pluma::PluginManager::loadFromFolder | ( | const std::string & | folder, |
bool | recursive = false |
||
) |
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.
|
protected |
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.
bool pluma::PluginManager::unload | ( | const std::string & | pluginName | ) |
Unload a plugin.
pluginName | Name or path of the plugin. |
Definition at line 109 of file PluginManager.cpp.
void pluma::PluginManager::unloadAll | ( | ) |
Unload all loaded plugins.
Definition at line 122 of file PluginManager.cpp.