本文整理汇总了C++中TMap::GetNext方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::GetNext方法的具体用法?C++ TMap::GetNext怎么用?C++ TMap::GetNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::GetNext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateGameStats
void CStatCounterArray::GenerateGameStats (CGameStats &Stats)
// GenerateGameStats
//
// Adds the list of stats to the target
{
// Loop over all sections
CMapIterator i;
m_Array.Reset(i);
while (m_Array.HasMore(i))
{
TMap<CString, SEntry> *pSection;
CString sSection = m_Array.GetNext(i, &pSection);
// Loop over all stats
CMapIterator j;
pSection->Reset(j);
while (pSection->HasMore(j))
{
SEntry *pEntry;
CString sStat = pSection->GetNext(j, &pEntry);
// Add it
Stats.Insert(sStat,
::strFormatInteger(pEntry->iCount, -1, FORMAT_THOUSAND_SEPARATOR | FORMAT_UNSIGNED),
sSection,
pEntry->sSort);
}
}
}
示例2: GenerateUnique
int CMarkovWordGenerator::GenerateUnique (int iCount, TArray<CString> *retArray)
// GenerateUnique
//
// Generates an array of unique words
{
int i;
TMap<CString, DWORD> Generated;
for (i = 0; i < iCount; i++)
{
int iTriesLeft = 500;
while (iTriesLeft > 0)
{
// Generate a random word
CString sWord = Generate();
// Lookup the word in our map. If we found it,
// try again.
if (Generated.Find(sWord))
{
iTriesLeft--;
continue;
}
// If it is unique, add it
Generated.Insert(sWord, 1);
break;
}
// If we couldn't find a unique word, then quit
if (iTriesLeft == 0)
break;
}
// Add the entries that we generated to the output array
CMapIterator j;
Generated.Reset(j);
int iGeneratedCount = 0;
while (Generated.HasMore(j))
{
DWORD *pDummy;
CString sWord = Generated.GetNext(j, &pDummy);
retArray->Insert(sWord);
iGeneratedCount++;
}
return iGeneratedCount;
}