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