本文整理汇总了C++中ListItem::GetNext方法的典型用法代码示例。如果您正苦于以下问题:C++ ListItem::GetNext方法的具体用法?C++ ListItem::GetNext怎么用?C++ ListItem::GetNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItem
的用法示例。
在下文中一共展示了ListItem::GetNext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListItem
void C4Network2ResDlg::Update()
{
// check through own resources and current res list
ListItem *pItem = static_cast<ListItem *>(pClientWindow->GetFirst()), *pNext;
C4Network2Res *pRes; int iResID=-1;
while ((pRes = ::Network.ResList.getRefNextRes(++iResID)))
{
iResID = pRes->getResID();
// resource checking: deleted resource(s) present?
while (pItem && (pItem->GetResID() < iResID))
{
pNext = static_cast<ListItem *>(pItem->GetNext());
delete pItem; pItem = pNext;
}
// same resource present for update?
if (pItem && pItem->GetResID() == iResID)
{
pItem->Update(pRes);
pItem = static_cast<ListItem *>(pItem->GetNext());
}
else
// not present: insert (or add if pItem=NULL)
InsertElement(new ListItem(this, pRes), pItem);
}
// del trailing items
while (pItem)
{
pNext = static_cast<ListItem *>(pItem->GetNext());
delete pItem; pItem = pNext;
}
}
示例2: GetFilename
StdStrBuf C4FileSelDlg::GetSelection(const char *szFixedSelection,
bool fFilenameOnly) const {
StdStrBuf sResult;
if (!IsMultiSelection()) {
// get single selected file for single selection dlg
if (pSelection)
sResult.Copy(fFilenameOnly ? GetFilename(pSelection->GetFilename())
: pSelection->GetFilename());
} else {
// force fixed selection first
if (szFixedSelection) sResult.Append(szFixedSelection);
// get ';'-seperated list for multi selection dlg
for (ListItem *pFileItem =
static_cast<ListItem *>(pFileListBox->GetFirst());
pFileItem; pFileItem = static_cast<ListItem *>(pFileItem->GetNext()))
if (pFileItem->IsChecked()) {
const char *szAppendFilename = pFileItem->GetFilename();
if (fFilenameOnly) szAppendFilename = GetFilename(szAppendFilename);
// prevent adding entries twice (especially those from the fixed
// selection list)
if (!SIsModule(sResult.getData(), szAppendFilename)) {
if (sResult.getLength()) sResult.AppendChar(';');
sResult.Append(szAppendFilename);
}
}
}
return sResult;
}
示例3:
void C4FileSelDlg::SetSelection(const char *szNewSelection,
bool fFilenameOnly) {
// check all selected definitions
for (ListItem *pFileItem = static_cast<ListItem *>(pFileListBox->GetFirst());
pFileItem; pFileItem = static_cast<ListItem *>(pFileItem->GetNext())) {
const char *szFileItemFilename = pFileItem->GetFilename();
if (fFilenameOnly) szFileItemFilename = GetFilename(szFileItemFilename);
pFileItem->SetChecked(SIsModule(szNewSelection, szFileItemFilename));
}
}
示例4: ClientListItem
void C4Network2ClientListBox::Update()
{
// sync with client list
ListItem *pItem = static_cast<ListItem *>(pClientWindow->GetFirst()), *pNext;
const C4Client *pClient = nullptr;
while ((pClient = Game.Clients.getClient(pClient)))
{
// skip host in startup board
if (IsStartup() && pClient->isHost()) continue;
// deleted client(s) present? this will also delete unneeded client connections of previous client
while (pItem && (pItem->GetClientID() < pClient->getID()))
{
pNext = static_cast<ListItem *>(pItem->GetNext());
delete pItem; pItem = pNext;
}
// same present for update?
// need not check for connection ID, because a client item will always be placed before the corresponding connection items
if (pItem && pItem->GetClientID() == pClient->getID())
{
pItem->Update();
pItem = static_cast<ListItem *>(pItem->GetNext());
}
else
// not present: insert (or add if pItem=nullptr)
InsertElement(new ClientListItem(this, pClient->getID()), pItem);
// update connections for client
// but no connections in startup board
if (IsStartup()) continue;
// enumerate client connections
C4Network2Client *pNetClient = pClient->getNetClient();
if (!pNetClient) continue; // local client does not have connections
C4Network2IOConnection *pLastConn = nullptr;
for (int i = 0; i<2; ++i)
{
C4Network2IOConnection *pConn = i ? pNetClient->getMsgConn() : pNetClient->getDataConn();
if (!pConn) continue;
if (pConn == pLastConn) continue; // combined connection: Display only one
pLastConn = pConn;
// del leading items
while (pItem && ((pItem->GetClientID() < pClient->getID()) || ((pItem->GetClientID() == pClient->getID()) && (pItem->GetConnectionID() < i))))
{
pNext = static_cast<ListItem *>(pItem->GetNext());
delete pItem; pItem = pNext;
}
// update connection item
if (pItem && pItem->GetClientID() == pClient->getID() && pItem->GetConnectionID() == i)
{
pItem->Update();
pItem = static_cast<ListItem *>(pItem->GetNext());
}
else
{
// new connection: create it
InsertElement(new ConnectionListItem(this, pClient->getID(), i), pItem);
}
}
}
// del trailing items
while (pItem)
{
pNext = static_cast<ListItem *>(pItem->GetNext());
delete pItem; pItem = pNext;
}
}