本文整理汇总了C++中TMap::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::Reset方法的具体用法?C++ TMap::Reset怎么用?C++ TMap::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::Reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例3: FoliageOverlappingMeshCounts_Debug
void UFoliageStatistics::FoliageOverlappingMeshCounts_Debug(UObject* WorldContextObject, FVector CenterPosition, float Radius, TMap<UStaticMesh*, int32>& OutMeshCounts)
{
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject);
const FSphere Sphere(CenterPosition, Radius);
OutMeshCounts.Reset();
for (TActorIterator<AInstancedFoliageActor> It(World); It; ++It)
{
AInstancedFoliageActor* IFA = *It;
if (!IFA->IsPendingKill())
{
IFA->GetOverlappingMeshCounts(Sphere, OutMeshCounts);
}
}
}
示例4: ExtractFlipbooksFromSprites
void FPaperFlipbookHelpers::ExtractFlipbooksFromSprites(TMap<FString, TArray<UPaperSprite*> >& OutSpriteFlipbookMap, const TArray<UPaperSprite*>& Sprites, const TArray<FString>& InSpriteNames)
{
OutSpriteFlipbookMap.Reset();
// Local copy
check((InSpriteNames.Num() == 0) || (InSpriteNames.Num() == Sprites.Num()));
TArray<FString> SpriteNames = InSpriteNames;
if (InSpriteNames.Num() == 0)
{
SpriteNames.Reset();
for (int32 SpriteIndex = 0; SpriteIndex < Sprites.Num(); ++SpriteIndex)
{
check(Sprites[SpriteIndex] != nullptr);
SpriteNames.Add(Sprites[SpriteIndex]->GetName());
}
}
// Group them
TMap<FString, UPaperSprite*> SpriteNameMap;
TArray<UPaperSprite*> RemainingSprites;
for (int32 SpriteIndex = 0; SpriteIndex < Sprites.Num(); ++SpriteIndex)
{
UPaperSprite* Sprite = Sprites[SpriteIndex];
const FString SpriteName = SpriteNames[SpriteIndex];
SpriteNameMap.Add(SpriteName, Sprite);
int32 SpriteNumber = 0;
FString SpriteBareString;
if (ExtractSpriteNumber(SpriteName, /*out*/ SpriteBareString, /*out*/ SpriteNumber))
{
SpriteBareString = ObjectTools::SanitizeObjectName(SpriteBareString);
OutSpriteFlipbookMap.FindOrAdd(SpriteBareString).Add(Sprite);
}
else
{
RemainingSprites.Add(Sprite);
}
}
// Natural sort using the same method as above
struct FSpriteSortPredicate
{
FSpriteSortPredicate() {}
// Sort predicate operator
bool operator()(UPaperSprite& LHS, UPaperSprite& RHS) const
{
FString LeftString;
int32 LeftNumber;
ExtractSpriteNumber(LHS.GetName(), /*out*/ LeftString, /*out*/ LeftNumber);
FString RightString;
int32 RightNumber;
ExtractSpriteNumber(RHS.GetName(), /*out*/ RightString, /*out*/ RightNumber);
return (LeftString == RightString) ? (LeftNumber < RightNumber) : (LeftString < RightString);
}
};
// Sort sprites
TArray<FString> Keys;
OutSpriteFlipbookMap.GetKeys(Keys);
for (auto SpriteName : Keys)
{
OutSpriteFlipbookMap[SpriteName].Sort(FSpriteSortPredicate());
}
// Create a flipbook from all remaining sprites
// Not sure if this is desirable behavior, might want one flipbook per sprite
if (RemainingSprites.Num() > 0)
{
RemainingSprites.Sort(FSpriteSortPredicate());
const FString DesiredName = GetCleanerSpriteName(RemainingSprites[0]->GetName()) + TEXT("_Flipbook");
const FString SanitizedName = ObjectTools::SanitizeObjectName(DesiredName);
OutSpriteFlipbookMap.Add(SanitizedName, RemainingSprites);
}
}