本文整理汇总了C++中TMap::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::Remove方法的具体用法?C++ TMap::Remove怎么用?C++ TMap::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTextures
void FSlateRHIResourceManager::CreateTextures( const TArray< const FSlateBrush* >& Resources )
{
DECLARE_SCOPE_CYCLE_COUNTER(TEXT("Loading Slate Textures"), STAT_Slate, STATGROUP_LoadTime);
TMap<FName,FNewTextureInfo> TextureInfoMap;
const uint32 Stride = GPixelFormats[PF_R8G8B8A8].BlockBytes;
for( int32 ResourceIndex = 0; ResourceIndex < Resources.Num(); ++ResourceIndex )
{
const FSlateBrush& Brush = *Resources[ResourceIndex];
const FName TextureName = Brush.GetResourceName();
if( TextureName != NAME_None && !Brush.HasUObject() && !Brush.IsDynamicallyLoaded() && !ResourceMap.Contains(TextureName) )
{
// Find the texture or add it if it doesnt exist (only load the texture once)
FNewTextureInfo& Info = TextureInfoMap.FindOrAdd( TextureName );
Info.bSrgb = (Brush.ImageType != ESlateBrushImageType::Linear);
// Only atlas the texture if none of the brushes that use it tile it and the image is srgb
Info.bShouldAtlas &= ( Brush.Tiling == ESlateBrushTileType::NoTile && Info.bSrgb && AtlasSize > 0 );
// Texture has been loaded if the texture data is valid
if( !Info.TextureData.IsValid() )
{
uint32 Width = 0;
uint32 Height = 0;
TArray<uint8> RawData;
bool bSucceeded = LoadTexture( Brush, Width, Height, RawData );
Info.TextureData = MakeShareable( new FSlateTextureData( Width, Height, Stride, RawData ) );
const bool bTooLargeForAtlas = (Width >= 256 || Height >= 256 || Width >= AtlasSize || Height >= AtlasSize );
Info.bShouldAtlas &= !bTooLargeForAtlas;
if( !bSucceeded || !ensureMsgf( Info.TextureData->GetRawBytes().Num() > 0, TEXT("Slate resource: (%s) contains no data"), *TextureName.ToString() ) )
{
TextureInfoMap.Remove( TextureName );
}
}
}
}
// Sort textures by size. The largest textures are atlased first which creates a more compact atlas
TextureInfoMap.ValueSort( FCompareFNewTextureInfoByTextureSize() );
for( TMap<FName,FNewTextureInfo>::TConstIterator It(TextureInfoMap); It; ++It )
{
const FNewTextureInfo& Info = It.Value();
FName TextureName = It.Key();
FString NameStr = TextureName.ToString();
checkSlow( TextureName != NAME_None );
FSlateShaderResourceProxy* NewTexture = GenerateTextureResource( Info );
ResourceMap.Add( TextureName, NewTexture );
}
}
示例2: Unbind
void Unbind(UJavascriptDelegate* DelegateObject)
{
static FName NAME_Fire("Fire");
if (WeakObject.IsValid())
{
if (auto p = Cast<UMulticastDelegateProperty>(Property))
{
FScriptDelegate Delegate;
Delegate.BindUFunction(DelegateObject, NAME_Fire);
auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
Target->Remove(Delegate);
}
else if (auto p = Cast<UDelegateProperty>(Property))
{
auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
Target->Clear();
}
}
DelegateObject->JavascriptDelegate = nullptr;
DelegateObject->RemoveFromRoot();
DelegateObjects.Remove(DelegateObject);
if (!bAbandoned)
{
functions.Remove(DelegateObject->UniqueId);
}
}
示例3: LoadAssetRegistry
bool FChunkManifestGenerator::LoadAssetRegistry(const FString& SandboxPath, const TSet<FName>* PackagesToKeep)
{
UE_LOG(LogChunkManifestGenerator, Display, TEXT("Loading asset registry."));
// Load generated registry for each platform
check(Platforms.Num() == 1);
for (auto Platform : Platforms)
{
/*FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
FArchive* AssetRegistryReader = IFileManager::Get().CreateFileReader(*PlatformSandboxPath);*/
FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
FArrayReader FileContents;
if (FFileHelper::LoadFileToArray(FileContents, *PlatformSandboxPath) == false)
{
continue;
}
FArchive* AssetRegistryReader = &FileContents;
TMap<FName, FAssetData*> SavedAssetRegistryData;
TArray<FDependsNode*> DependencyData;
if (AssetRegistryReader)
{
AssetRegistry.LoadRegistryData(*AssetRegistryReader, SavedAssetRegistryData, DependencyData);
}
for (auto& LoadedAssetData : AssetRegistryData)
{
if (PackagesToKeep &&
PackagesToKeep->Contains(LoadedAssetData.PackageName) == false)
{
continue;
}
FAssetData* FoundAssetData = SavedAssetRegistryData.FindRef(LoadedAssetData.ObjectPath);
if ( FoundAssetData )
{
LoadedAssetData.ChunkIDs.Append(FoundAssetData->ChunkIDs);
SavedAssetRegistryData.Remove(LoadedAssetData.ObjectPath);
delete FoundAssetData;
}
}
for (const auto& SavedAsset : SavedAssetRegistryData)
{
if (PackagesToKeep && PackagesToKeep->Contains(SavedAsset.Value->PackageName))
{
AssetRegistryData.Add(*SavedAsset.Value);
}
delete SavedAsset.Value;
}
SavedAssetRegistryData.Empty();
}
return true;
}
示例4: DisassociateSuppress
virtual void DisassociateSuppress(FLogCategoryBase* Destination)
{
FName* Name = Associations.Find(Destination);
if (Name)
{
verify(ReverseAssociations.Remove(*Name, Destination)==1);
verify(Associations.Remove(Destination) == 1);
}
}
示例5: LoadTexture
void FSlateD3DTextureManager::CreateTextures( const TArray< const FSlateBrush* >& Resources )
{
TMap<FName,FNewTextureInfo> TextureInfoMap;
for( int32 ResourceIndex = 0; ResourceIndex < Resources.Num(); ++ResourceIndex )
{
const FSlateBrush& Brush = *Resources[ResourceIndex];
const FName TextureName = Brush.GetResourceName();
if( TextureName != NAME_None && !ResourceMap.Contains(TextureName) )
{
// Find the texture or add it if it doesn't exist (only load the texture once)
FNewTextureInfo& Info = TextureInfoMap.FindOrAdd( TextureName );
Info.bSrgb = (Brush.ImageType != ESlateBrushImageType::Linear);
// Only atlas the texture if none of the brushes that use it tile it
Info.bShouldAtlas &= (Brush.Tiling == ESlateBrushTileType::NoTile && Info.bSrgb );
if( !Info.TextureData.IsValid())
{
uint32 Width = 0;
uint32 Height = 0;
TArray<uint8> RawData;
bool bSucceeded = LoadTexture( Brush, Width, Height, RawData );
const uint32 Stride = 4; // RGBA
Info.TextureData = MakeShareable( new FSlateTextureData( Width, Height, Stride, RawData ) );
const bool bTooLargeForAtlas = (Width >= 256 || Height >= 256);
Info.bShouldAtlas &= !bTooLargeForAtlas;
if( !bSucceeded )
{
TextureInfoMap.Remove( TextureName );
}
}
}
}
TextureInfoMap.ValueSort( FCompareFNewTextureInfoByTextureSize() );
for( TMap<FName,FNewTextureInfo>::TConstIterator It(TextureInfoMap); It; ++It )
{
const FNewTextureInfo& Info = It.Value();
FName TextureName = It.Key();
FString NameStr = TextureName.ToString();
FSlateShaderResourceProxy* NewTexture = GenerateTextureResource( Info );
ResourceMap.Add( TextureName, NewTexture );
}
}
示例6: RemoveEffect
void FGAGameEffectContainer::RemoveEffect(FGAGameEffectHandle& HandleIn)
{
EGAEffectAggregation aggregatiopn = HandleIn.GetEffectRef().GameEffect->EffectAggregation;
UObject* Instigator = HandleIn.GetContextRef().Instigator.Get();
TSharedPtr<FGAGameEffect> effect = ActiveEffects.FindAndRemoveChecked(HandleIn);
if (effect.IsValid())
{
switch (aggregatiopn)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<FGAGameEffectHandle, TSharedPtr<FGAGameEffect>>* effects = InstigatorEffects.Find(Instigator);
TMap<FName, TSet<FGAGameEffectHandle>>* EffectByClass = InstigatorEffectHandles.Find(Instigator);
if (EffectByClass)
{
//Probabaly need another path for removing just single effect from stack.
EffectByClass->Remove(HandleIn.GetEffectSpec()->GetFName());
}
if (effects)
{
effects->FindAndRemoveChecked(HandleIn);
if (effects->Num() == 0)
{
InstigatorEffects.Remove(Instigator);
}
}
break;
}
case EGAEffectAggregation::AggregateByTarget:
{
//TargetEffects.FindAndRemoveChecked(HandleIn);
TSet<FGAGameEffectHandle>* Handles = TargetEffectByType.Find(HandleIn.GetEffectSpec()->GetFName());
//check aggregation type to know which effect to remove exactly ?
TargetEffectByType.Remove(HandleIn.GetEffectSpec()->GetFName());
break;
}
}
for (FGAGameEffectModifier& Modifier : effect->GameEffect->Modifiers)
{
if (Modifier.Attribute.IsValid())
{
FGAAttributeBase* Attribute = OwningComp->GetAttribute(Modifier.Attribute);
if (Attribute)
{
Attribute->RemoveBonus(HandleIn);
}
}
}
UE_LOG(GameAttributesEffects, Log, TEXT("FGAGameEffectContainer:: Removing Effect"))
effect.Reset();
}
}
示例7: WorldDestroyed
void FGameplayDebugger::WorldDestroyed(UWorld* InWorld)
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
bool bIsServer = InWorld && InWorld->GetNetMode() < ENetMode::NM_Client; // (Only work on server)
if (!bIsServer)
{
return;
}
// remove global replicator from level
AllReplicatorsPerWorlds.Remove(InWorld);
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
}
示例8: PostEditUndo
void UActorComponent::PostEditUndo()
{
// Objects marked pending kill don't call PostEditChange() from UObject::PostEditUndo(),
// so they can leave an EditReregisterContexts entry around if they are deleted by an undo action.
if( IsPendingKill() )
{
// The reregister context won't bother attaching components that are 'pending kill'.
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
}
}
else
{
Owner = GetTypedOuter<AActor>();
bCanUseCachedOwner = true;
// Let the component be properly registered, after it was restored.
if (Owner)
{
Owner->AddOwnedComponent(this);
}
TArray<UObject*> Children;
GetObjectsWithOuter(this, Children);
for (UObject* Child : Children)
{
if (UActorComponent* ChildComponent = Cast<UActorComponent>(Child))
{
if (ChildComponent->Owner)
{
ChildComponent->Owner->RemoveOwnedComponent(ChildComponent);
}
ChildComponent->Owner = Owner;
if (Owner)
{
Owner->AddOwnedComponent(ChildComponent);
}
}
}
if (GetWorld())
{
GetWorld()->UpdateActorComponentEndOfFrameUpdateState(this);
}
}
Super::PostEditUndo();
}
示例9: RemoveEffect
void FGAGameEffectContainer::RemoveEffect(FGAGameEffectHandle& HandleIn)
{
EGAEffectAggregation aggregatiopn = HandleIn.GetEffectRef().GameEffect->EffectAggregation;
UObject* Instigator = HandleIn.GetContextRef().Instigator.Get();
TSharedPtr<FGAGameEffect> effect = ActiveEffects.FindAndRemoveChecked(HandleIn);
if (effect.IsValid())
{
switch (aggregatiopn)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<FGAGameEffectHandle, TSharedPtr<FGAGameEffect>>* effects = InstigatorEffects.Find(Instigator);
TMap<UClass*, FGAGameEffectHandle>* EffectByClass = InstigatorEffectHandles.Find(Instigator);
if (EffectByClass)
{
EffectByClass->Remove(HandleIn.GetEffectSpec()->StaticClass());
}
if (effects)
{
effects->FindAndRemoveChecked(HandleIn);
if (effects->Num() == 0)
{
InstigatorEffects.Remove(Instigator);
}
}
break;
}
case EGAEffectAggregation::AggregateByTarget:
{
TargetEffects.FindAndRemoveChecked(HandleIn);
break;
}
}
for (FGAGameEffectModifier& Modifier : effect->GameEffect->Modifiers)
{
if (Modifier.Attribute.IsValid())
{
FGAAttributeBase* Attribute = OwningComp->GetAttribute(Modifier.Attribute);
if (Attribute)
{
Attribute->RemoveBonus(HandleIn);
}
}
}
UE_LOG(GameAttributesEffects, Log, TEXT("FGAGameEffectContainer:: Removing Effect"))
effect.Reset();
}
}
示例10: WriteMergeObjects
void WriteMergeObjects( TFile *target ) {
cout << "Writing the merged data." << endl;
TIterator *nextobj = MergeObjects.MakeIterator();
TObjString *pathname_obj;
while( (pathname_obj = (TObjString *)nextobj->Next()) ) {
TString path,name;
SplitPathName(pathname_obj->String(),&path,&name);
TObject *obj = MergeObjects.GetValue(pathname_obj);
target->cd(path);
obj->Write( name );
delete obj;
}
MergeObjects.Clear();
target->Write();
// Temporarily let multiple root files remain if > 2GB
// Prevent Target_1.root Target_2.root, ... from happening.
// long long max_tree_size = 200000000000LL; // 200 GB
// if(TTree::GetMaxTreeSize() < max_tree_size ) {
// TTree::SetMaxTreeSize(max_tree_size);
// }
nextobj = MergeChains.MakeIterator();
TObjString *pathname_obj;
while( (pathname_obj = (TObjString *)nextobj->Next()) ) {
TString path,name;
SplitPathName(pathname_obj->String(),&path,&name);
TChain *ch = (TChain *)MergeChains.GetValue(pathname_obj);
target->cd(path);
ch->Merge(target,0,"KEEP");
delete ch;
// in case of multiple objects with same pathname, must remove
// this one from the list so we don't get the same (deleted)
// one next time we look up the same name
MergeChains.Remove(pathname_obj);
}
MergeChains.Clear();
InitializedMergeObjects = false;
}
示例11: PostEditUndo
void UActorComponent::PostEditUndo()
{
// Objects marked pending kill don't call PostEditChange() from UObject::PostEditUndo(),
// so they can leave an EditReregisterContexts entry around if they are deleted by an undo action.
if( IsPendingKill() )
{
// The reregister context won't bother attaching components that are 'pending kill'.
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
}
}
Super::PostEditUndo();
}
示例12: DeleteFromEnumerateUserFilesComplete
static void DeleteFromEnumerateUserFilesComplete(bool bWasSuccessful, const FUniqueNetId& UserId)
{
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
check(OnlineSub);
IOnlineUserCloudPtr UserCloud = OnlineSub->GetUserCloudInterface();
UserCloud->ClearOnEnumerateUserFilesCompleteDelegate_Handle(GOnEnumerateUserFilesCompleteDelegateHandle);
GPerCloudDeleteFromEnumerateUserFilesCompleteDelegateHandles.Remove(UserCloud.Get());
if (bWasSuccessful)
{
TArray<FCloudFileHeader> UserFiles;
UserCloud->GetUserFileList(UserId, UserFiles);
for (int32 Idx=0; Idx < UserFiles.Num(); Idx++)
{
UserCloud->DeleteUserFile(UserId, UserFiles[Idx].FileName, true, true);
}
}
}
示例13: PostEditChangeProperty
void UActorComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
}
// The component or its outer could be pending kill when calling PostEditChange when applying a transaction.
// Don't do do a full recreate in this situation, and instead simply detach.
if( IsPendingKill() )
{
// @todo UE4 james should this call UnregsiterComponent instead to remove itself from the RegisteteredComponents array on the owner?
ExecuteUnregisterEvents();
World = NULL;
}
Super::PostEditChangeProperty(PropertyChangedEvent);
}
示例14:
/**
* Virtual destructor, free'ing allocated memory.
*/
FUntypedBulkData::~FUntypedBulkData()
{
check( LockStatus == LOCKSTATUS_Unlocked );
// Free memory.
if( bShouldFreeOnEmpty )
{
FMemory::Free( BulkData );
}
BulkData = NULL;
#if WITH_EDITOR
// Detach from archive.
if( AttachedAr )
{
AttachedAr->DetachBulkData( this, false );
check( AttachedAr == NULL );
}
#endif // WITH_EDITOR
#if TRACK_BULKDATA_USE
BulkDataToObjectMap.Remove( this );
#endif
}
示例15: ConsolidatedPostEditChange
void UActorComponent::ConsolidatedPostEditChange(const FPropertyChangedEvent& PropertyChangedEvent)
{
FComponentReregisterContext* ReregisterContext = EditReregisterContexts.FindRef(this);
if(ReregisterContext)
{
delete ReregisterContext;
EditReregisterContexts.Remove(this);
AActor* MyOwner = GetOwner();
if ( MyOwner && !MyOwner->IsTemplate() && PropertyChangedEvent.ChangeType != EPropertyChangeType::Interactive )
{
MyOwner->RerunConstructionScripts();
}
}
// The component or its outer could be pending kill when calling PostEditChange when applying a transaction.
// Don't do do a full recreate in this situation, and instead simply detach.
if( IsPendingKill() )
{
// @todo UE4 james should this call UnregisterComponent instead to remove itself from the RegisteredComponents array on the owner?
ExecuteUnregisterEvents();
World = NULL;
}
}