GetObjectFromList改名为GetObjectFromMap
This commit is contained in:
@@ -205,7 +205,7 @@ namespace hgl
|
||||
virtual bool GetLast (T &data)const{return data_array.ReadAt(data,GetCount()-1);} ///<取最后一个数据
|
||||
};//template <typename T> class ArrayList
|
||||
|
||||
template<typename T> T *GetObjectFromList(const ArrayList<T *> &list,const int index)
|
||||
template<typename T> T *GetObjectFromMap(const ArrayList<T *> &list,const int index)
|
||||
{
|
||||
T *obj;
|
||||
|
||||
|
@@ -192,7 +192,7 @@ namespace hgl
|
||||
if(index==-1)
|
||||
return(nullptr);
|
||||
|
||||
KVData *obj=GetObjectFromList(data_list,index);
|
||||
KVData *obj=GetObjectFromMap(data_list,index);
|
||||
|
||||
if(!obj)return(nullptr);
|
||||
return &(obj->value);
|
||||
@@ -209,7 +209,7 @@ namespace hgl
|
||||
{
|
||||
int index=Find(flag);
|
||||
|
||||
KVData *obj=GetObjectFromList(data_list,index);
|
||||
KVData *obj=GetObjectFromMap(data_list,index);
|
||||
|
||||
if(!obj)
|
||||
return(-1);
|
||||
@@ -224,7 +224,7 @@ namespace hgl
|
||||
{
|
||||
int index=Find(key);
|
||||
|
||||
KVData *obj=GetObjectFromList(data_list,index);
|
||||
KVData *obj=GetObjectFromMap(data_list,index);
|
||||
|
||||
if(!obj)
|
||||
return(false);
|
||||
@@ -323,7 +323,7 @@ namespace hgl
|
||||
{
|
||||
int index=Find(flag);
|
||||
|
||||
KVData *dp=GetObjectFromList(data_list,index);
|
||||
KVData *dp=GetObjectFromMap(data_list,index);
|
||||
|
||||
if(!dp)
|
||||
return(false);
|
||||
@@ -394,7 +394,7 @@ namespace hgl
|
||||
if(index<0
|
||||
||index>=data_list.GetCount())return(false);
|
||||
|
||||
data_pool.Release(GetObjectFromList(data_list,index));
|
||||
data_pool.Release(GetObjectFromMap(data_list,index));
|
||||
data_list.DeleteShift(index);
|
||||
|
||||
return(true);
|
||||
@@ -433,7 +433,7 @@ namespace hgl
|
||||
|
||||
if(FindPos(flag,result))
|
||||
{
|
||||
dp=GetObjectFromList(data_list,result);
|
||||
dp=GetObjectFromMap(data_list,result);
|
||||
|
||||
if(dp)
|
||||
{
|
||||
@@ -469,7 +469,7 @@ namespace hgl
|
||||
template<typename K,typename V,typename KVData>
|
||||
bool MapTemplate<K,V,KVData>::Change(const K &flag,const V &data)
|
||||
{
|
||||
KVData *dp=GetObjectFromList(data_list,Find(flag));
|
||||
KVData *dp=GetObjectFromMap(data_list,Find(flag));
|
||||
|
||||
if(!dp)
|
||||
return(false);
|
||||
|
@@ -120,7 +120,7 @@ namespace hgl
|
||||
return count;
|
||||
}
|
||||
|
||||
KVData *GetItem(int n){return GetObjectFromList(data_list,n);} ///<取指定序号的数据
|
||||
KVData *GetItem(int n){return GetObjectFromMap(data_list,n);} ///<取指定序号的数据
|
||||
bool GetBySerial(int,K &,V &) const; ///<取指定序号的数据
|
||||
bool GetKey(int,K &); ///<取指定序号的索引
|
||||
bool GetValue(int,V &); ///<取指定序号的数据
|
||||
@@ -150,7 +150,7 @@ namespace hgl
|
||||
virtual ~Map()=default;
|
||||
};//class Map
|
||||
|
||||
template<typename T_ID,typename T_U> T_U *GetObjectFromList(Map<T_ID,T_U *> &list,const T_ID &id)
|
||||
template<typename T_ID,typename T_U> T_U *GetObjectFromMap(Map<T_ID,T_U *> &list,const T_ID &id)
|
||||
{
|
||||
T_U *result;
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace hgl
|
||||
|
||||
void DeleteObject(int index)
|
||||
{
|
||||
DeleteObject(GetObjectFromList(this->data_list,index));
|
||||
DeleteObject(GetObjectFromMap(this->data_list,index));
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -293,7 +293,7 @@ namespace hgl
|
||||
{
|
||||
DeleteObject(index);
|
||||
|
||||
KVData *dp=GetObjectFromList(this->data_list,index);
|
||||
KVData *dp=GetObjectFromMap(this->data_list,index);
|
||||
|
||||
if(dp)
|
||||
dp->value=data;
|
||||
@@ -318,7 +318,7 @@ namespace hgl
|
||||
{
|
||||
DeleteObject(index);
|
||||
|
||||
KVData *dp=GetObjectFromList(this->data_list,index);
|
||||
KVData *dp=GetObjectFromMap(this->data_list,index);
|
||||
|
||||
if(!dp)
|
||||
return(false);
|
||||
@@ -334,7 +334,7 @@ namespace hgl
|
||||
|
||||
V *operator[](const K &index)const
|
||||
{
|
||||
auto *obj=GetObjectFromList(this->data_list,this->Find(index));
|
||||
auto *obj=GetObjectFromMap(this->data_list,this->Find(index));
|
||||
|
||||
if(obj)
|
||||
return obj->value;
|
||||
|
Reference in New Issue
Block a user