插件引擎改进(未完成)
This commit is contained in:
@@ -37,7 +37,7 @@ namespace hgl
|
||||
virtual ~ExternalPlugIn();
|
||||
|
||||
void Free(); ///<释放插件文件
|
||||
bool Load(const UTF16String &,const OSString &); ///<加载插件
|
||||
bool Load(const OSString &,const OSString &); ///<加载插件
|
||||
};//class ExternalPlugIn:public PlugIn
|
||||
}//namespace hgl
|
||||
#endif//HGL_EXTERNAL_PLUG_IN_INCLUDE
|
||||
|
@@ -2,7 +2,6 @@
|
||||
#define HGL_PLUGIN_INCLUDE
|
||||
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/plugin/PlugInInterface.h>
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
@@ -15,18 +14,16 @@ namespace hgl
|
||||
uint ref_count;
|
||||
|
||||
uint ver;
|
||||
UTF16String name;
|
||||
OSString name;
|
||||
UTF16String intro;
|
||||
|
||||
OSString filename; ///<插件文件名
|
||||
|
||||
PlugInInterface *plugin_interface;
|
||||
|
||||
public:
|
||||
|
||||
const uint GetVersion ()const{return ver;} ///<取得插件版本
|
||||
const OSString & GetName ()const{return name;} ///<取得插件名称
|
||||
const UTF16String & GetIntro ()const{return intro;} ///<取得插件介绍
|
||||
const UTF16String & GetName ()const{return name;} ///<取得插件名称
|
||||
|
||||
public:
|
||||
|
||||
@@ -34,13 +31,14 @@ namespace hgl
|
||||
{
|
||||
ref_count=0;
|
||||
ver=0;
|
||||
plugin_interface=nullptr;
|
||||
}
|
||||
|
||||
virtual ~PlugIn();
|
||||
|
||||
uint add_ref(){return ++ref_count;}
|
||||
uint release_ref(){return --ref_count;}
|
||||
|
||||
virtual bool GetInterface(uint,void *)=0;
|
||||
};//class PlugIn
|
||||
}//namespace hgl
|
||||
#endif//HGL_PLUGIN_INCLUDE
|
||||
|
@@ -12,7 +12,7 @@ namespace hgl
|
||||
typedef bool (*GetPlugInInterfacePROC)(uint32,void *); ///<取得插件接口
|
||||
typedef void (*SetPlugInInterfacePROC)(void *,void *); ///<设置插件接口
|
||||
|
||||
typedef bool (*LoadInterfaceByNamePROC)(const u16char *,uint32,void *); ///<取得接口
|
||||
typedef bool (*LoadInterfaceByNamePROC)(const char *,uint32,void *); ///<取得接口
|
||||
typedef bool (*LoadInterfaceByIndexPROC)(uint32,uint32,void *); ///<取得接口
|
||||
|
||||
struct PlugInInterface
|
||||
|
@@ -9,15 +9,15 @@ namespace hgl
|
||||
/**
|
||||
* 插件管理
|
||||
*/
|
||||
class PlugInManage:public ResManage<UTF16String,PlugIn>
|
||||
class PlugInManage:public ResManage<OSString,PlugIn>
|
||||
{
|
||||
UTF16String name; ///<插件类目名称(必须符合代码名称规则)
|
||||
OSString name; ///<插件类目名称(必须符合代码名称规则)
|
||||
|
||||
OSStringList findpath; ///<插件查找目录
|
||||
OSStringList findpath; ///<插件查找目录
|
||||
|
||||
public:
|
||||
|
||||
PlugInManage(const UTF16String &n)
|
||||
PlugInManage(const OSString &n)
|
||||
{
|
||||
name=n;
|
||||
}
|
||||
@@ -25,13 +25,13 @@ namespace hgl
|
||||
virtual ~PlugInManage();
|
||||
|
||||
bool RegistryPlugin(PlugIn *); ///<注册一个内置插件
|
||||
uint UnregistryPlugin(const UTF16String &); ///<释放一个内置插件
|
||||
uint UnregistryPlugin(const OSString &); ///<释放一个内置插件
|
||||
|
||||
bool AddFindPath (const OSString &path); ///<添加一个插件查找目录
|
||||
|
||||
PlugIn *LoadPlugin (const UTF16String &,const OSString &); ///<加载一个外部插件,明确指定全路径文件名
|
||||
PlugIn *LoadPlugin (const UTF16String &); ///<加载一个外部插件,自行查找
|
||||
bool UnloadPlugin(const UTF16String &); ///<释放一个外部插件
|
||||
PlugIn *LoadPlugin (const OSString &,const OSString &); ///<加载一个外部插件,明确指定全路径文件名
|
||||
PlugIn *LoadPlugin (const OSString &); ///<加载一个外部插件,自行查找
|
||||
bool UnloadPlugin(const OSString &); ///<释放一个外部插件
|
||||
};//class PlugInManage:public ResManage<UTF16String,PlugIn>
|
||||
|
||||
/**
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include<hgl/type/Set.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/thread/ThreadMutex.h>
|
||||
#include<hgl/LogInfo.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef HGL_TYPE_LRU_CACHE_CPP
|
||||
#define HGL_TYPE_LRU_CACHE_CPP
|
||||
|
||||
#include<hgl/LogInfo.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef HGL_STACK_CPP
|
||||
#define HGL_STACK_CPP
|
||||
|
||||
#include<hgl/LogInfo.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
|
Reference in New Issue
Block a user