插件接口更新
This commit is contained in:
parent
6d58e8e90b
commit
bc0475fd9d
@ -22,14 +22,15 @@ namespace hgl
|
||||
protected:
|
||||
|
||||
LogLevel min_level; ///<最小输出级别
|
||||
UTF16String project_code;
|
||||
Logger *parent; ///<上级输出器
|
||||
|
||||
public:
|
||||
|
||||
Logger(LogLevel l){min_level=l;}
|
||||
Logger(LogLevel l,Logger *pl=nullptr){min_level=l;parent=pl;}
|
||||
virtual ~Logger()=default;
|
||||
|
||||
const LogLevel GetLevel ()const{return min_level;} ///<取得最小输出级别
|
||||
Logger * GetParent (){return parent;} ///<取得上级日志输出器
|
||||
|
||||
virtual void Close()=0; ///<关闭日志
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include<hgl/platform/ExternalModule.h>
|
||||
namespace hgl
|
||||
{
|
||||
struct PlugInInterface;
|
||||
|
||||
/**
|
||||
* 外部插件状态
|
||||
*/
|
||||
@ -27,6 +29,8 @@ namespace hgl
|
||||
|
||||
ExternalModule *pi_module;
|
||||
|
||||
PlugInInterface *plugin_interface;
|
||||
|
||||
public:
|
||||
|
||||
PlugInStatus GetStatus()const{return status;}
|
||||
@ -38,6 +42,8 @@ namespace hgl
|
||||
|
||||
void Free(); ///<释放插件文件
|
||||
bool Load(const OSString &,const OSString &); ///<加载插件
|
||||
|
||||
virtual bool GetInterface(uint,void *) override;
|
||||
};//class ExternalPlugIn:public PlugIn
|
||||
}//namespace hgl
|
||||
#endif//HGL_EXTERNAL_PLUG_IN_INCLUDE
|
||||
|
@ -167,13 +167,12 @@ namespace hgl
|
||||
|
||||
void CloseLog()
|
||||
{
|
||||
if(li)
|
||||
{
|
||||
if(!li)return;
|
||||
|
||||
li->Close();
|
||||
delete li;
|
||||
li=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Log(LogLevel level,const u16char *str,int size)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ namespace hgl
|
||||
{
|
||||
status=PlugInStatus::NONE;
|
||||
pi_module=nullptr;
|
||||
plugin_interface=nullptr;
|
||||
}
|
||||
|
||||
ExternalPlugIn::~ExternalPlugIn()
|
||||
@ -19,6 +20,7 @@ namespace hgl
|
||||
if(!pi_module)return;
|
||||
|
||||
plugin_interface->Close();
|
||||
plugin_interface=nullptr;
|
||||
|
||||
delete pi_module;
|
||||
pi_module=nullptr;
|
||||
@ -44,7 +46,10 @@ namespace hgl
|
||||
{
|
||||
plugin_interface=init_proc();
|
||||
|
||||
if(plugin_interface)
|
||||
if(plugin_interface
|
||||
&&plugin_interface->GetVersion
|
||||
&&plugin_interface->GetIntro
|
||||
&&plugin_interface->GetInterface)
|
||||
{
|
||||
status=PlugInStatus::COMPLETE;
|
||||
|
||||
@ -64,4 +69,11 @@ namespace hgl
|
||||
status=PlugInStatus::LOAD_FAILED;
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool ExternalPlugIn::GetInterface(uint ver,void *interface_data)
|
||||
{
|
||||
if(!plugin_interface)return(false);
|
||||
|
||||
return plugin_interface->GetInterface(ver,interface_data);
|
||||
}
|
||||
}//namespace hgl
|
||||
|
Loading…
x
Reference in New Issue
Block a user