improved PlugInManage
This commit is contained in:
parent
e17d3d6b9f
commit
0862db3d03
@ -47,7 +47,6 @@ namespace hgl
|
|||||||
bool GetLocalAppdataPath(OSString &); ///<取得当前用户应用程序数据存放路径
|
bool GetLocalAppdataPath(OSString &); ///<取得当前用户应用程序数据存放路径
|
||||||
|
|
||||||
bool GetOSLibararyPath(OSString &); ///<取得操作系统共用动态库路径
|
bool GetOSLibararyPath(OSString &); ///<取得操作系统共用动态库路径
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filename 要查找的文件名称
|
* @param filename 要查找的文件名称
|
||||||
|
@ -17,12 +17,8 @@ namespace hgl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PlugInManage(const OSString &n)
|
PlugInManage(const OSString &n);
|
||||||
{
|
virtual ~PlugInManage()=default;
|
||||||
name=n;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~PlugInManage();
|
|
||||||
|
|
||||||
bool RegistryPlugin(PlugIn *); ///<注册一个内置插件
|
bool RegistryPlugin(PlugIn *); ///<注册一个内置插件
|
||||||
uint UnregistryPlugin(const OSString &); ///<释放一个内置插件
|
uint UnregistryPlugin(const OSString &); ///<释放一个内置插件
|
||||||
|
@ -204,6 +204,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
|
|
||||||
T * get ()const{return sd?sd->data:0;}
|
T * get ()const{return sd?sd->data:0;}
|
||||||
|
const T * const_get ()const{return sd?sd->data:0;}
|
||||||
virtual bool valid ()const{return sd;}
|
virtual bool valid ()const{return sd;}
|
||||||
int use_count ()const{return sd?sd->count:-1;}
|
int use_count ()const{return sd?sd->count:-1;}
|
||||||
bool only ()const{return sd?sd->count==1:true;}
|
bool only ()const{return sd?sd->count==1:true;}
|
||||||
|
@ -19,7 +19,9 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
if(!pi_module)return;
|
if(!pi_module)return;
|
||||||
|
|
||||||
plugin_interface->Close();
|
if(plugin_interface->Close)
|
||||||
|
plugin_interface->Close();
|
||||||
|
|
||||||
plugin_interface=nullptr;
|
plugin_interface=nullptr;
|
||||||
|
|
||||||
delete pi_module;
|
delete pi_module;
|
||||||
@ -74,6 +76,9 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
if(!plugin_interface)return(false);
|
if(!plugin_interface)return(false);
|
||||||
|
|
||||||
|
if(!plugin_interface->GetInterface)
|
||||||
|
return(false);
|
||||||
|
|
||||||
return plugin_interface->GetInterface(ver,interface_data);
|
return plugin_interface->GetInterface(ver,interface_data);
|
||||||
}
|
}
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
@ -5,6 +5,29 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
using namespace filesystem;
|
using namespace filesystem;
|
||||||
|
|
||||||
|
PlugInManage::PlugInManage(const OSString &n)
|
||||||
|
{
|
||||||
|
name=OS_TEXT("CMP.")+n;
|
||||||
|
|
||||||
|
OSString pn;
|
||||||
|
|
||||||
|
if(filesystem::GetCurrentPath(pn))
|
||||||
|
{
|
||||||
|
AddFindPath(pn);
|
||||||
|
|
||||||
|
pn=MergeFilename(pn,OS_TEXT("Plug-ins"));
|
||||||
|
AddFindPath(pn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(filesystem::GetCurrentProgramPath(pn))
|
||||||
|
{
|
||||||
|
AddFindPath(pn);
|
||||||
|
|
||||||
|
pn=MergeFilename(pn,OS_TEXT("Plug-ins"));
|
||||||
|
AddFindPath(pn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool PlugInManage::RegistryPlugin(PlugIn *pi)
|
bool PlugInManage::RegistryPlugin(PlugIn *pi)
|
||||||
{
|
{
|
||||||
if(!pi)return(false);
|
if(!pi)return(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user