Public Member Functions | Protected Member Functions
pluma::PluginManager Class Reference

Manages loaded plugins. More...

#include <PluginManager.hpp>

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

List of all members.

Public Member Functions

 ~PluginManager ()
 Destructor.
bool load (const std::string &path)
 Load a plugin given it's path.
bool load (const std::string &folder, const std::string &pluginName)
 Load a plugin from a given folder.
int loadFromFolder (const std::string &folder, bool recursive=false)
 Load all plugins from a given folder.
bool unload (const std::string &pluginName)
 Unload a plugin.
void unloadAll ()
 Unload all loaded plugins.
bool addProvider (Provider *provider)
 Directly add a new provider.
void getLoadedPlugins (std::vector< const std::string * > &pluginNames) const
 Get the name of all loaded plugins.
bool isLoaded (const std::string &pluginName) const
 Check if a plug-in is loaded.

Protected Member Functions

 PluginManager ()
 Default constructor.
void registerType (const std::string &type, unsigned int version, unsigned int lowestVersion)
 Register a provider type.
const std::list< Provider * > * getProviders (const std::string &type) const
 Get providers of a certain type.

Detailed Description

Manages loaded plugins.

Definition at line 44 of file PluginManager.hpp.


Constructor & Destructor Documentation

pluma::PluginManager::~PluginManager ( )

Destructor.

pluma::PluginManager::PluginManager ( ) [protected]

Default constructor.

PluginManager cannot be publicly instantiated.


Member Function Documentation

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

Directly add a new provider.

Parameters:
providerProvider.
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.
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
bool pluma::PluginManager::isLoaded ( const std::string &  pluginName) const

Check if a plug-in is loaded.

Parameters:
pluginNamethe plug-in tname o check.
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
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
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
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
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
void pluma::PluginManager::unloadAll ( )

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