本文整理汇总了C++中CList::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::RemoveAt方法的具体用法?C++ CList::RemoveAt怎么用?C++ CList::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::RemoveAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCbnCloseupSchemas
void CDownloadGroupDlg::OnCbnCloseupSchemas()
{
// Get filters
CList< CString > oList;
for ( int nItem = 0 ; nItem < m_wndFilterList.GetCount() ; nItem++ )
{
CString strFilter;
m_wndFilterList.GetLBText( nItem, strFilter );
if ( oList.Find( strFilter ) == NULL )
oList.AddTail( strFilter );
}
// Remove old schema filters (preserve custom ones)
if ( CSchemaPtr pOldSchema = SchemaCache.Get( m_sOldSchemaURI ) )
{
for ( POSITION pos = pOldSchema->GetFilterIterator(); pos ; )
{
CString strFilter;
BOOL bResult;
pOldSchema->GetNextFilter( pos, strFilter, bResult );
if ( bResult )
{
strFilter.Insert( 0, _T('.') );
while ( POSITION pos = oList.Find( strFilter ) )
oList.RemoveAt( pos );
}
}
}
// Add new schema filters
if ( CSchemaPtr pNewSchema = SchemaCache.Get( m_wndSchemas.GetSelectedURI() ) )
{
for ( POSITION pos = pNewSchema->GetFilterIterator(); pos ; )
{
CString strFilter;
BOOL bResult;
pNewSchema->GetNextFilter( pos, strFilter, bResult );
if ( bResult )
{
strFilter.Insert( 0, _T('.') );
oList.AddTail( strFilter );
}
}
}
// Refill interface filters list
m_wndFilterList.ResetContent();
for ( POSITION pos = oList.GetHeadPosition() ; pos ; )
m_wndFilterList.AddString( oList.GetNext( pos ) );
m_sOldSchemaURI = m_wndSchemas.GetSelectedURI();
}
示例2: OnBnClickedButtonReverseA
/**
* 响应鼠标单击按钮;Reverse
* @param CBCGPGridCtrl* pGridCtrlEdit 输入行
* @param CBCGPGridCtrl* pGridCtrlList 列表
* @param CList<int, int>* plsNb Nb号队列指针
* @return void
*/
void CGridCtrlOperation::OnBnClickedButtonReverseA(CBCGPGridCtrl* pGridCtrlEdit, CBCGPGridCtrl* pGridCtrlList)
{
CList<int, int> ListNb;
CList<int, int>* plsNb = &ListNb;
// 得到索引队列,修改操作、删除操作、颠倒操作
if(false == GetIndexListForChangeOrDeleteOrReverse(pGridCtrlEdit, pGridCtrlList, plsNb))
{
return;
}
CBCGPGridRow* pRow = NULL; // 行
CBCGPGridRow* pRowMax = NULL; // 排序行
CBCGPGridRow* pRowNew = NULL; // 新行
CList<int, int> olsNb;
int iNbStart = -1;
int iNbEnd = -1;
int iRowIndex = -1;
int i, j;
POSITION posMax;
POSITION pos;
int iNbMax;
int iNb;
// 得到Nb队列
for(i = 0; i < plsNb->GetCount(); i++)
{
pos = plsNb->FindIndex(i);
iRowIndex = plsNb->GetAt(pos);
iNb = pGridCtrlList->GetRow(iRowIndex)->GetData();
olsNb.AddTail(iNb);
if(0 == i)
{
iNbStart = iNb;
}
if((plsNb->GetCount() - 1) == i)
{
iNbEnd = iNb;
}
}
// 对Nb排序,由小到大
for(i = 0; i < olsNb.GetCount(); i++)
{
posMax = olsNb.FindIndex(i);
iNbMax = olsNb.GetAt(posMax);
for(j = i + 1; j < olsNb.GetCount(); j++)
{
pos = olsNb.FindIndex(j);
iNb = olsNb.GetAt(pos);
if(iNbStart < iNbEnd)
{
if(iNbMax > iNb)
{
iNbMax = iNb;
posMax = pos;
}
}
else
{
if(iNbMax < iNb)
{
iNbMax = iNb;
posMax = pos;
}
}
}
olsNb.RemoveAt(posMax);
olsNb.AddHead(iNbMax);
}
for(i = 0; i < plsNb->GetCount(); i++)
{
pos = plsNb->FindIndex(i);
iRowIndex = plsNb->GetAt(pos);
pRow = pGridCtrlList->GetRow(iRowIndex);
posMax = olsNb.FindIndex(i);
iNbMax = olsNb.GetAt(posMax);
pRowMax = pGridCtrlList->FindRowByData(iNbMax);
pRowNew = pGridCtrlList->CreateRow(pGridCtrlList->GetColumnCount());
pGridCtrlList->AddRow(pRowNew, FALSE);
pRowNew->SetData(pRow->GetData());
pRowNew->GetItem(0)->SetValue(pRow->GetItem(0)->GetValue());
for(int j = 1; j < pGridCtrlList->GetColumnCount(); j++)
{
COleVariant oVariant = pRow->GetItem(j)->GetValue();
pRowNew->GetItem(j)->SetValue(oVariant);
//.........这里部分代码省略.........
示例3: AssignRankAndCrowdingDistance
void CPopulation::AssignRankAndCrowdingDistance()
{
ASSERT(individuals != NULL);
ASSERT(pProblem != NULL);
int front_size = 0;
int rank = 1;
int orig_index, cur_index;
POSITION pos1, pos2, tmp_pos;
CList<int, int> orig;
CList<int, int> cur;
for (int i=0; i<pProblem->popsize; i++)
orig.AddTail(i);
while (!orig.IsEmpty())
{
pos1 = orig.GetHeadPosition();
orig_index = orig.GetNext(pos1);
if (pos1 == NULL)
{
individuals[orig_index].rank = rank;
individuals[orig_index].crowd_dist = INF;
break;
}
cur.AddHead(orig_index);
front_size = 1;
orig.RemoveHead();
pos1 = orig.GetHeadPosition();
while (pos1 != NULL)
{
int flag = -1;
orig_index = orig.GetAt(pos1);
pos2 = cur.GetHeadPosition();
while (pos2 != NULL)
{
cur_index = cur.GetAt(pos2);
flag = individuals[orig_index].CheckDominance(individuals[cur_index]);
if (flag == 1)
{
orig.AddHead(cur_index);
front_size--;
tmp_pos = pos2;
cur.GetNext(pos2);
cur.RemoveAt(tmp_pos);
}
else if (flag == 0)
{
cur.GetNext(pos2);
}
else if (flag == -1)
{
break;
}
}
if (flag != -1)
{
cur.AddHead(orig_index);
front_size++;
tmp_pos = pos1;
orig.GetNext(pos1);
orig.RemoveAt(tmp_pos);
}
else
{
orig.GetNext(pos1);
}
}
pos2 = cur.GetHeadPosition();
while (pos2 != NULL)
{
cur_index = cur.GetNext(pos2);
individuals[cur_index].rank = rank;
}
AssignCrowdingDistanceList((void*) &cur, front_size);
cur.RemoveAll();
rank++;
}
}
示例4: types
void CHello2Dlg::OnProcessSel(int id)
{
int curch = m_chlist.GetCurSel();
if(m_cmdbase == ID_32773) //data operation
{
CList<double,double> *data = &m_ridlgs[curch]->m_data;
if(m_ridlgs[curch]->show_type == SHOW_ORGDATA)
data = &m_ridlgs[curch]->m_output;
if(id == 1) //show converted result
{
m_ridlgs[curch]->show_type = SHOW_MAINDATA;
}
if(id == 2) //show raw result
{
m_ridlgs[curch]->show_type = SHOW_ORGDATA;
}
if(id == 3) //delete the current record
{
int pos = m_history.GetCurSel();
if((pos >= 0) && (data))
{
POSITION p = data->GetHeadPosition();
while(pos-- > 0 )
data->GetNext(p);
data->RemoveAt(p);
}
}
if(id == 4) //delete all the record
{
data->RemoveAll();
}
if(id == 5) //export all the record
{
CFile cf;
if(!cf.Open(DATAOUT_NAME,CFile::modeCreate|CFile::modeWrite))
return;
//write to txt and open with notepad
if(data && (data->GetCount() > 0))
{
POSITION pos = data->GetHeadPosition();
char r[50];
do{
double v = data->GetAt(pos);
sprintf(r,"%8f\r\n",v);
cf.Write(r,strlen(r));
if(pos == data->GetTailPosition())
break;
data->GetNext(pos);
}while(1);
}
cf.Close();
SHELLEXECUTEINFO execInf;
ZeroMemory (&execInf, sizeof (execInf));
execInf.cbSize = sizeof (SHELLEXECUTEINFO);
execInf.fMask = SEE_MASK_NOCLOSEPROCESS;
execInf.nShow = SW_SHOWNORMAL;
execInf.lpFile = _T("\\windows\\pword.exe");
execInf.lpVerb = _T("open");
execInf.lpParameters = DATAOUT_NAME;
ShellExecuteEx (&execInf);
}
}
if(m_cmdbase == ID_32772)
{
if(id == 1)
{
m_ridlgs[curview]->sidedata = NULL;
}else{
m_ridlgs[curview]->sidedata = &m_ridlgs[id-2]->m_data;
m_ridlgs[curview]->side_ch = id-2;
}
m_ridlgs[curview]->SaveLastConfig();
}
if(m_cmdbase == ID_32771) //channel config
{
if(m_cfgtype == CFGTYPE_BORE)
{
CSetting<PROBECFG> prbset;
prbset.InstallFromFile(PRB_DEFINFO);
if(id == 1)//just close it
{
m_ridlgs[curch]->cfg_now = CFGTYPE_NONE;
for(int i=0;i<sizeof(m_ridlgs)/sizeof(CRunitemDialog*);i++){
if((m_ridlgs[i]->cfg_now == CFGTYPE_BORE) && (i != curch) && (m_ridlgs[i]->side_ch == curch))
{
m_ridlgs[i]->sidedata = NULL;
}
}
}else{
m_ridlgs[curch]->m_prbid = prbset.GetNameAt(id-2);
m_ridlgs[curch]->cfg_now = CFGTYPE_BORE;
//.........这里部分代码省略.........
示例5: FilterDuplicateList
int CFileSizeFilter::FilterDuplicateList( CList<CFileInfo*,CFileInfo*> & FileList)
{
int Count = 0;
bool FilterIt = false;
int Iteration = 0;
POSITION xPos;
// update status and log
g_DupeFileFind.m_DuffStatus.Lock();
g_DupeFileFind.m_DuffStatus.CurrentTaskInfo = m_sName;
g_DupeFileFind.m_DuffStatus.SubProgress2.Min = 0;
g_DupeFileFind.m_DuffStatus.SubProgress2.Max = FileList.GetCount();
g_DupeFileFind.m_DuffStatus.Unlock();
//
//for (i = 0; i < FileList.GetSize(); i++)
xPos = FileList.GetHeadPosition();
while (xPos)
{
switch(m_FilterType)
{
case FT_NOT_EQUAL: // not equal
FilterIt = ( FileList.GetAt(xPos)->Size == m_Value1 );
break;
case FT_EQUAL: // equal
FilterIt = ( FileList.GetAt(xPos)->Size != m_Value1 );
break;
case FT_GREATER_THAN: // greater
FilterIt = ( FileList.GetAt(xPos)->Size <= m_Value1 );
break;
case FT_LESS_THAN: // less
FilterIt = ( FileList.GetAt(xPos)->Size >= m_Value1 );
break;
case FT_BETWEEN: // between
FilterIt = ( FileList.GetAt(xPos)->Size < m_Value1 || FileList.GetAt(xPos)->Size > m_Value2 );
break;
case FT_NOT_BETWEEN: // not between
FilterIt = ( FileList.GetAt(xPos)->Size >= m_Value1 && FileList.GetAt(xPos)->Size <= m_Value2 );
break;
default:
return 0;
}
if (FilterIt)
{
//FileList.ElementAt(i)->Unaccessible = true;
POSITION Pos2 = xPos;
FileList.GetNext(Pos2);
delete FileList.GetAt(xPos);
FileList.RemoveAt(xPos);
//i--;
xPos = Pos2;
Count++;
}
else
{
FileList.GetNext(xPos);
}
Iteration ++;
// update status and log
if ( g_DupeFileFind.m_DuffStatus.LockIfUnlocked() )
{
g_DupeFileFind.m_DuffStatus.SubProgress2.Pos = Iteration;
g_DupeFileFind.m_DuffStatus.Unlock();
}
//
}
return Count;
}