Documentation for DynLib & PluginManager
Former-commit-id: 3602bd9a6f24ed4adb38879097ea5679b55e3b99
This commit is contained in:
@@ -24,6 +24,19 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
* \class Nz::PluginManager
|
||||
* \brief Core class that represents a manager for plugin
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Adds a directory
|
||||
*
|
||||
* \param directoryPath Path to the directory
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
*/
|
||||
|
||||
void PluginManager::AddDirectory(const String& directoryPath)
|
||||
{
|
||||
if (!Initialize())
|
||||
@@ -35,6 +48,11 @@ namespace Nz
|
||||
s_directories.insert(File::AbsolutePath(directoryPath));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Initializes the plugin manager
|
||||
* \return true if everything is ok
|
||||
*/
|
||||
|
||||
bool PluginManager::Initialize()
|
||||
{
|
||||
if (s_initialized)
|
||||
@@ -48,11 +66,36 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Mounts the plugin
|
||||
* \return true if mounting was a success
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
* \remark Produces a NazaraError if plugin is not found
|
||||
* \remark Produces a NazaraError if fail to load plugin
|
||||
* \remark Produces a NazaraError if fail to get symbol PluginLoad
|
||||
* \remark Produces a NazaraError if fail to initialize the plugin with PluginLoad
|
||||
*/
|
||||
|
||||
bool PluginManager::Mount(Plugin plugin)
|
||||
{
|
||||
return Mount(s_pluginFiles[plugin]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Mounts the plugin with a path
|
||||
* \return true if mounting was a success
|
||||
*
|
||||
* \param pluginPath Path to the plugin
|
||||
* \param appendExtension Adds the extension to the path or not
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
* \remark Produces a NazaraError if plugin is not found
|
||||
* \remark Produces a NazaraError if fail to load plugin
|
||||
* \remark Produces a NazaraError if fail to get symbol PluginLoad
|
||||
* \remark Produces a NazaraError if fail to initialize the plugin with PluginLoad
|
||||
*/
|
||||
|
||||
bool PluginManager::Mount(const String& pluginPath, bool appendExtension)
|
||||
{
|
||||
if (!Initialize())
|
||||
@@ -119,6 +162,14 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Removes a directory
|
||||
*
|
||||
* \param directoryPath Path to the directory
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
*/
|
||||
|
||||
void PluginManager::RemoveDirectory(const String& directoryPath)
|
||||
{
|
||||
if (!Initialize())
|
||||
@@ -130,11 +181,29 @@ namespace Nz
|
||||
s_directories.erase(File::AbsolutePath(directoryPath));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unmounts the plugin with a path
|
||||
*
|
||||
* \param pluginPath Path to the plugin
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
* \remark Produces a NazaraError if plugin is not loaded
|
||||
*/
|
||||
|
||||
void PluginManager::Unmount(Plugin plugin)
|
||||
{
|
||||
Unmount(s_pluginFiles[plugin]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unmounts the plugin with a path
|
||||
*
|
||||
* \param pluginPath Path to the plugin
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
* \remark Produces a NazaraError if plugin is not loaded
|
||||
*/
|
||||
|
||||
void PluginManager::Unmount(const String& pluginPath)
|
||||
{
|
||||
if (!Initialize())
|
||||
@@ -160,6 +229,10 @@ namespace Nz
|
||||
s_plugins.erase(it);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Uninitializes the plugin manager
|
||||
*/
|
||||
|
||||
void PluginManager::Uninitialize()
|
||||
{
|
||||
if (!s_initialized)
|
||||
|
||||
Reference in New Issue
Block a user