renamed to DeleteAt instead of DeleteBySerial

This commit is contained in:
2023-07-21 10:48:39 +08:00
parent dbb2229c52
commit 6be7bda668
4 changed files with 16 additions and 16 deletions

View File

@@ -342,7 +342,7 @@ namespace hgl
template<typename K,typename V,typename KVData>
bool _Map<K,V,KVData>::DeleteByKey(const K &flag)
{
return DeleteBySerial(Find(flag));
return DeleteAt(Find(flag));
}
/**
@@ -360,7 +360,7 @@ namespace hgl
for(int i=0;i<count;i++)
{
if(DeleteBySerial(Find(*fp)))
if(DeleteAt(Find(*fp)))
++total;
++fp;
@@ -378,7 +378,7 @@ namespace hgl
template<typename K,typename V,typename KVData>
bool _Map<K,V,KVData>::DeleteByValue(const V &data)
{
return DeleteBySerial(FindByValue(data));
return DeleteAt(FindByValue(data));
}
/**
@@ -387,7 +387,7 @@ namespace hgl
* @return 是否成功
*/
template<typename K,typename V,typename KVData>
bool _Map<K,V,KVData>::DeleteBySerial(int index)
bool _Map<K,V,KVData>::DeleteAt(int index)
{
if(index<0
||index>=data_list.GetCount())return(false);
@@ -405,7 +405,7 @@ namespace hgl
* @return 是否成功
*/
template<typename K,typename V,typename KVData>
bool _Map<K,V,KVData>::DeleteBySerial(int start,int number)
bool _Map<K,V,KVData>::DeleteAt(int start,int number)
{
KVData **dp=data_list.GetData()+start;

View File

@@ -57,8 +57,8 @@ namespace hgl
virtual bool DeleteByKey(const K &); ///<根据索引将指定数据从列表中移除
virtual int DeleteByKey(const K *,const int); ///<根据索引将指定数据从列表中批量移除
virtual bool DeleteByValue(const V &); ///<根据数据将指定数据从列表中移除
virtual bool DeleteBySerial(int); ///<根据序号将指定数据从列表中移除
virtual bool DeleteBySerial(int,int); ///<根据序号将指定数据从列表中移除
virtual bool DeleteAt(int); ///<根据序号将指定数据从列表中移除
virtual bool DeleteAt(int,int); ///<根据序号将指定数据从列表中移除
virtual bool ChangeOrAdd(const K &,const V &); ///<更改一个数据的内容(如不存在则添加)
virtual bool Change(const K &,const V &); ///<更改一个数据的内容(如不存在则更改失效)
virtual void Clear(); ///<清除所有数据
@@ -222,7 +222,7 @@ namespace hgl
{
if(index<0||index>=this->data_list.GetCount())return(false);
SuperClass::DeleteBySerial(index);
SuperClass::DeleteAt(index);
return(true);
}
@@ -242,7 +242,7 @@ namespace hgl
*/
bool DeleteByKey(const K &flag)
{
return DeleteBySerial(SuperClass::Find(flag));
return DeleteAt(SuperClass::Find(flag));
}
/**
@@ -252,7 +252,7 @@ namespace hgl
*/
bool DeleteByValue(V *tp)
{
return DeleteBySerial(this->FindByValue(tp));
return DeleteAt(this->FindByValue(tp));
}
/**
@@ -260,12 +260,12 @@ namespace hgl
* @param index 要删除的数据的序列号
* @return 是否删除成功
*/
bool DeleteBySerial(int index)
bool DeleteAt(int index)
{
if(index<0||index>=this->data_list.GetCount())return(false);
DeleteObject(index);
SuperClass::DeleteBySerial(index);
SuperClass::DeleteAt(index);
return(true);
}

View File

@@ -65,7 +65,7 @@ namespace hgl
if(obj->ref_count<=0)
{
Clear(obj->value);
items.DeleteBySerial(n);
items.DeleteAt(n);
}
}
}
@@ -169,7 +169,7 @@ namespace hgl
{
Clear(obj->value);
items.DeleteBySerial(index);
items.DeleteAt(index);
}
return 0;

View File

@@ -135,7 +135,7 @@ namespace hgl
if(pos>0) //在闲置列表中找
{
active_items.Add(key,new ActiveItem(value));
idle_items.DeleteBySerial(pos);
idle_items.DeleteAt(pos);
return(true);
}
@@ -167,7 +167,7 @@ namespace hgl
if(ai->ref_count==0)
{
idle_items.Add(key,ai->data);
active_items.DeleteBySerial(pos);
active_items.DeleteAt(pos);
}
return;