From f1a6f0b90eb7766be90afb7e62ec539dfa30f746 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 22 May 2025 01:40:30 +0800 Subject: [PATCH] =?UTF-8?q?GetObjectFromList=E6=94=B9=E5=90=8D=E4=B8=BAGet?= =?UTF-8?q?ObjectFromMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/type/ArrayList.h | 2 +- inc/hgl/type/Map.cpp | 14 +++++++------- inc/hgl/type/Map.h | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/inc/hgl/type/ArrayList.h b/inc/hgl/type/ArrayList.h index ced7639..928197a 100644 --- a/inc/hgl/type/ArrayList.h +++ b/inc/hgl/type/ArrayList.h @@ -205,7 +205,7 @@ namespace hgl virtual bool GetLast (T &data)const{return data_array.ReadAt(data,GetCount()-1);} ///<取最后一个数据 };//template class ArrayList - template T *GetObjectFromList(const ArrayList &list,const int index) + template T *GetObjectFromMap(const ArrayList &list,const int index) { T *obj; diff --git a/inc/hgl/type/Map.cpp b/inc/hgl/type/Map.cpp index bdd428b..8bdf06f 100644 --- a/inc/hgl/type/Map.cpp +++ b/inc/hgl/type/Map.cpp @@ -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 bool MapTemplate::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); diff --git a/inc/hgl/type/Map.h b/inc/hgl/type/Map.h index 49b4980..4a1418b 100644 --- a/inc/hgl/type/Map.h +++ b/inc/hgl/type/Map.h @@ -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 T_U *GetObjectFromList(Map &list,const T_ID &id) + template T_U *GetObjectFromMap(Map &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;