initial import of handle natives and a few minor API changes
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40252
This commit is contained in:
@@ -465,7 +465,7 @@ HandleError HandleSystem::ReadHandle(Handle_t handle,
|
||||
{
|
||||
return HandleError_Type;
|
||||
}
|
||||
} else {
|
||||
} else if (type) {
|
||||
if (pHandle->type != type)
|
||||
{
|
||||
return HandleError_Type;
|
||||
|
||||
@@ -1141,3 +1141,21 @@ void CPluginManager::RegisterNativesFromCore(sp_nativeinfo_t *natives)
|
||||
{
|
||||
m_natives.push_back(natives);
|
||||
}
|
||||
|
||||
IPlugin *CPluginManager::PluginFromHandle(Handle_t handle, HandleError *err)
|
||||
{
|
||||
IPlugin *pPlugin;
|
||||
HandleError _err;
|
||||
|
||||
if ((_err=g_HandleSys.ReadHandle(handle, g_PluginType, m_MyIdent, (void **)&pPlugin)) != HandleError_None)
|
||||
{
|
||||
pPlugin = NULL;
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
*err = _err;
|
||||
}
|
||||
|
||||
return pPlugin;
|
||||
}
|
||||
|
||||
@@ -236,6 +236,11 @@ public:
|
||||
* Adds natives from core into the native pool.
|
||||
*/
|
||||
void RegisterNativesFromCore(sp_nativeinfo_t *natives);
|
||||
|
||||
/**
|
||||
* Converts a Handle to an IPlugin if possible.
|
||||
*/
|
||||
IPlugin *PluginFromHandle(Handle_t handle, HandleError *err);
|
||||
private:
|
||||
/**
|
||||
* Recursively loads all plugins in the given directory.
|
||||
|
||||
Reference in New Issue
Block a user