GetObject改名为GetListObject,以避免和Window的GetObject宏冲突

This commit is contained in:
hyzboy 2019-06-12 16:13:35 +08:00
parent e18ffbd6f4
commit f1ab184896
7 changed files with 31 additions and 15 deletions

View File

@ -149,7 +149,6 @@ private:
return(true);
}
public:
bool Init()

View File

@ -50,6 +50,7 @@ namespace hgl
{
SetLocalMatrix(mat);
}
virtual ~SceneNode()
{
ClearSubNode();

View File

@ -86,7 +86,7 @@ namespace hgl
}
};//template <typename T> class List
template<typename T> T *GetObject(const List<T *> &list,const int index)
template<typename T> T *GetListObject(const List<T *> &list,const int index)
{
T *obj;

View File

@ -208,7 +208,7 @@ namespace hgl
{
int index=Find(flag);
DataPair *obj=GetObject(data_list,index);
DataPair *obj=GetListObject(data_list,index);
if(!obj)
return(false);
@ -223,7 +223,7 @@ namespace hgl
{
int index=Find(key);
DataPair *obj=GetObject(data_list,index);
DataPair *obj=GetListObject(data_list,index);
if(!obj)
return(false);
@ -315,7 +315,7 @@ namespace hgl
{
int index=Find(flag);
DataPair *dp=GetObject(data_list,index);
DataPair *dp=GetListObject(data_list,index);
if(!dp)
return(false);
@ -386,7 +386,7 @@ namespace hgl
if(index<0
||index>=data_list.GetCount())return(false);
data_pool.Release(GetObject(data_list,index));
data_pool.Release(GetListObject(data_list,index));
data_list.DeleteMove(index);
return(true);
@ -424,7 +424,7 @@ namespace hgl
if(FindPos(flag,result))
{
DataPair *dp=GetObject(data_list,result);
DataPair *dp=GetListObject(data_list,result);
if(dp)
dp->right=data;
@ -449,7 +449,7 @@ namespace hgl
template<typename F,typename T,typename DataPair>
bool _Map<F,T,DataPair>::Change(const F &flag,const T &data)
{
DataPair *dp=GetObject(data_list,Find(flag));
DataPair *dp=GetListObject(data_list,Find(flag));
if(!dp)
return(false);

View File

@ -93,7 +93,7 @@ namespace hgl
return count;
}
IDItem *GetItem(int n){return GetObject(data_list,n);} ///<取指定序号的数据
IDItem *GetItem(int n){return GetListObject(data_list,n);} ///<取指定序号的数据
bool Get(int,F &,T &) const; ///<取指定序号的数据
bool GetKey(int,F &); ///<取指定序号的索引
bool GetValue(int,T &); ///<取指定序号的数据
@ -116,7 +116,7 @@ namespace hgl
virtual ~Map()=default;
};//class Map
template<typename T_ID,typename T_U> T_U *GetObject(Map<T_ID,T_U *> &list,const T_ID &id)
template<typename T_ID,typename T_U> T_U *GetListObject(Map<T_ID,T_U *> &list,const T_ID &id)
{
T_U *result;
@ -141,7 +141,7 @@ namespace hgl
void DeleteObject(int index)
{
DeleteObject(GetObject(this->data_list,index));
DeleteObject(GetListObject(this->data_list,index));
}
public:
@ -259,7 +259,7 @@ namespace hgl
{
DeleteObject(index);
DataPair *dp=GetObject(this->data_list,index);
DataPair *dp=GetListObject(this->data_list,index);
if(dp)
dp->right=data;
@ -284,7 +284,7 @@ namespace hgl
{
DeleteObject(index);
DataPair *dp=GetObject(this->data_list,index);
DataPair *dp=GetListObject(this->data_list,index);
if(!dp)
return(false);
@ -327,7 +327,7 @@ namespace hgl
T *operator[](const F &index)const
{
auto *obj=GetObject(this->data_list,this->Find(index));
auto *obj=GetListObject(this->data_list,this->Find(index));
if(obj)
return obj->right;

View File

@ -7,7 +7,8 @@ SET(BASE_TYPE_SOURCE
DataType/Color3f.cpp
DataType/Color4f.cpp
# DataType/FontInfo.cpp
DataType/StringList.cpp)
DataType/StringList.cpp
DataType/Endian.cpp)
SOURCE_GROUP("DataType" FILES ${BASE_TYPE_SOURCE})

View File

@ -0,0 +1,15 @@
#include<hgl/type/DataType.h>
namespace hgl
{
bool CheckSystemEndian()
{
constexpr uint16 db=0xABCD;
#if HGL_ENDIAN == HGL_BIG_ENDIAN
return(*(uint8 *)&db==0xAB);
#else
return(*(uint8 *)&db==0xCD);
#endif//HGL_BIG_ENDIAN
}
}//namespace hgl