Public Member Functions | Protected Member Functions | List of all members
pluma::PluginManager Class Reference

Manages loaded plugins. More...

#include <PluginManager.hpp>

Inheritance diagram for pluma::PluginManager:
pluma::Pluma

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...
 

Detailed Description

Manages loaded plugins.

Definition at line 44 of file PluginManager.hpp.

Constructor & Destructor Documentation

pluma::PluginManager::~PluginManager ( )

Destructor.

Definition at line 43 of file PluginManager.cpp.

pluma::PluginManager::PluginManager ( )
protected

Default constructor.

PluginManager cannot be publicly instantiated.

Definition at line 37 of file PluginManager.cpp.

Member Function Documentation

bool pluma::PluginManager::addProvider ( Provider provider)

Directly add a new provider.

Parameters
providerProvider.

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.

Parameters
pluginNamesA vector to fill with the plugins names.

Definition at line 178 of file PluginManager.cpp.

const std::list< Provider * > * pluma::PluginManager::getProviders ( const std::string &  type) const
protected

Get providers of a certain type.

Parameters
typeProvider type.
Returns
Pointer to the list of providers of that type, or NULL if type is not registered.
See Also
Host::getProviders

Definition at line 194 of file PluginManager.cpp.

bool pluma::PluginManager::isLoaded ( const std::string &  pluginName) const

Check if a plug-in is loaded.

Parameters
pluginNamethe 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.

Parameters
pathPath 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.
Returns
True if the plugin is successfully loaded.
See Also
load(const std::string&, const std::string&)
loadFromFolder
unload
unloadAll

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.

Parameters
folderThe folder path.
pluginNameName 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.
Returns
True if the plugin is successfully loaded.
See Also
load(const std::string&)
loadFromFolder
unload
unloadAll

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.

Parameters
folderPath for the folder where the plug-ins are.
recursiveIf true it will search on sub-folders as well
Returns
Number of successfully loaded plug-ins.
See Also
load(const std::string&, const std::string&)
load(const std::string&)
unload
unloadAll

Definition at line 95 of file PluginManager.cpp.

void pluma::PluginManager::registerType ( const std::string &  type,
unsigned int  version,
unsigned int  lowestVersion 
)
protected

Register a provider type.

Parameters
typeProvider type.
versionCurrent version of that provider type.
lowestVersionLowest compatible version of that provider type.
See Also
Host::registerType

Definition at line 162 of file PluginManager.cpp.

bool pluma::PluginManager::unload ( const std::string &  pluginName)

Unload a plugin.

Parameters
pluginNameName or path of the plugin.
Returns
True if the plugin is successfully unloaded, false if no such plugin exists on the manager.
See Also
load(const std::string&, const std::string&)
load(const std::string&)
loadFromFolder
unloadAll

Definition at line 109 of file PluginManager.cpp.

void pluma::PluginManager::unloadAll ( )

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