本文整理汇总了C++中TArray::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Remove方法的具体用法?C++ TArray::Remove怎么用?C++ TArray::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateVisibility
void AStealthArea::CalculateVisibility(AGameCharacter* calculatingUnit, TArray<AGameCharacter*>& sightList, TArray<AGameCharacter*>& availableUnits)
{
if (!IsValid(calculatingUnit))
return;
//first get visible units on the outside based on increased radial area
TArray<AActor*> ignoreList;
for (AGameCharacter* gc : availableUnits)
ignoreList.AddUnique(gc);
for (AGameCharacter* gc : availableUnits)
{
if (occupyingUnits.Contains(gc)) //don't account for units in this area yet
continue;
if (gc->GetTeamIndex() == calculatingUnit->GetTeamIndex())
{
sightList.AddUnique(gc);
continue;
}
FVector start = GetActorLocation();
FVector end = gc->GetActorLocation();
if ((start - end).SizeSquared2D() <= FMath::Square(calculatingUnit->sightRadius * 1.15f))
{
FHitResult hit;
FCollisionQueryParams collisionParams;
TArray<AActor*> ignoredActors = ignoreList;
ignoredActors.Remove(gc);
collisionParams.AddIgnoredActors(ignoredActors);
collisionParams.AddIgnoredActor(this);
GetWorld()->LineTraceSingleByChannel(hit, start, end, ECC_Visibility, collisionParams);
if (hit.GetActor() == gc)
{
if (!IsValid(gc->currentStealthArea))
sightList.AddUnique(gc);
}
}
}
//finally add all of the units that are currently in the area
for (AGameCharacter* gc : occupyingUnits)
{
if (IsValid(gc))
sightList.AddUnique(gc);
else
sightList.Remove(gc);
}
}
示例2: CheckOutReferencingPackages
bool FAssetFixUpRedirectors::CheckOutReferencingPackages(TArray<FRedirectorRefs>& RedirectorsToFix, TArray<UPackage*>& InOutReferencingPackagesToSave) const
{
// Prompt to check out all successfully loaded packages
bool bUserAcceptedCheckout = true;
if ( InOutReferencingPackagesToSave.Num() > 0 )
{
if ( ISourceControlModule::Get().IsEnabled() )
{
TArray<UPackage*> PackagesCheckedOutOrMadeWritable;
TArray<UPackage*> PackagesNotNeedingCheckout;
bUserAcceptedCheckout = FEditorFileUtils::PromptToCheckoutPackages( false, InOutReferencingPackagesToSave, &PackagesCheckedOutOrMadeWritable, &PackagesNotNeedingCheckout );
if ( bUserAcceptedCheckout )
{
TArray<UPackage*> PackagesThatCouldNotBeCheckedOut = InOutReferencingPackagesToSave;
for ( auto PackageIt = PackagesCheckedOutOrMadeWritable.CreateConstIterator(); PackageIt; ++PackageIt )
{
PackagesThatCouldNotBeCheckedOut.Remove(*PackageIt);
}
for ( auto PackageIt = PackagesNotNeedingCheckout.CreateConstIterator(); PackageIt; ++PackageIt )
{
PackagesThatCouldNotBeCheckedOut.Remove(*PackageIt);
}
for ( auto PackageIt = PackagesThatCouldNotBeCheckedOut.CreateConstIterator(); PackageIt; ++PackageIt )
{
const FName NonCheckedOutPackageName = (*PackageIt)->GetFName();
for ( auto RedirectorRefsIt = RedirectorsToFix.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
{
FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
if ( RedirectorRefs.ReferencingPackageNames.Contains(NonCheckedOutPackageName) )
{
// We did not check out at least one of the packages we needed to. This redirector can not be fixed up.
RedirectorRefs.FailureReason = FText::Format(LOCTEXT("RedirectorFixupFailed_NotCheckedOut", "Referencing package {0} was not checked out"), FText::FromName(NonCheckedOutPackageName));
RedirectorRefs.bRedirectorValidForFixup = false;
}
}
InOutReferencingPackagesToSave.Remove(*PackageIt);
}
}
}
}
return bUserAcceptedCheckout;
}
示例3: 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);
}
}
示例4: ArrangeWindowToFront
void FSlateWindowHelper::ArrangeWindowToFront( TArray< TSharedRef<SWindow> >& Windows, const TSharedRef<SWindow>& WindowToBringToFront )
{
Windows.Remove(WindowToBringToFront);
if ((Windows.Num() == 0) || WindowToBringToFront->IsTopmostWindow())
{
Windows.Add(WindowToBringToFront);
}
else
{
bool PerformedInsert = false;
for (int WindowIndex = Windows.Num() - 1; WindowIndex >= 0; --WindowIndex)
{
if (!Windows[WindowIndex]->IsTopmostWindow())
{
Windows.Insert(WindowToBringToFront, WindowIndex + 1);
PerformedInsert = true;
break;
}
}
if (!PerformedInsert)
{
Windows.Insert(WindowToBringToFront, 0);
}
}
}
示例5: Track
void FProfilerClientManager::Track( const TArray<ISessionInstanceInfoPtr>& Instances )
{
#if STATS
if (MessageEndpoint.IsValid() && ActiveSessionId.IsValid())
{
TArray<FGuid> ActiveInstances;
Connections.GenerateKeyArray(ActiveInstances);
for (int32 i = 0; i < Instances.Num(); ++i)
{
if (Connections.Find(Instances[i]->GetInstanceId()) == nullptr)
{
Track(Instances[i]->GetInstanceId());
}
else
{
ActiveInstances.Remove(Instances[i]->GetInstanceId());
}
}
for (int32 i = 0; i < ActiveInstances.Num(); ++i)
{
Untrack(ActiveInstances[i]);
}
}
#endif
}
示例6: ExecuteSCCOpenForAdd
void FPathContextMenu::ExecuteSCCOpenForAdd()
{
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// Get a list of package names in the selected paths
TArray<FString> PackageNames;
GetPackageNamesInSelectedPaths(PackageNames);
TArray<FString> PackagesToAdd;
TArray<UPackage*> PackagesToSave;
for ( auto PackageIt = PackageNames.CreateConstIterator(); PackageIt; ++PackageIt )
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(*PackageIt), EStateCacheUsage::Use);
if ( SourceControlState.IsValid() && !SourceControlState->IsSourceControlled() )
{
PackagesToAdd.Add(*PackageIt);
// Make sure the file actually exists on disk before adding it
FString Filename;
if ( !FPackageName::DoesPackageExist(*PackageIt, NULL, &Filename) )
{
UPackage* Package = FindPackage(NULL, **PackageIt);
if ( Package )
{
PackagesToSave.Add(Package);
}
}
}
}
if ( PackagesToAdd.Num() > 0 )
{
// If any of the packages are new, save them now
if ( PackagesToSave.Num() > 0 )
{
const bool bCheckDirty = false;
const bool bPromptToSave = false;
TArray<UPackage*> FailedPackages;
const FEditorFileUtils::EPromptReturnCode Return = FEditorFileUtils::PromptForCheckoutAndSave(PackagesToSave, bCheckDirty, bPromptToSave, &FailedPackages);
if(FailedPackages.Num() > 0)
{
// don't try and add files that failed to save - remove them from the list
for(auto FailedPackageIt = FailedPackages.CreateConstIterator(); FailedPackageIt; FailedPackageIt++)
{
PackagesToAdd.Remove((*FailedPackageIt)->GetName());
}
}
}
if ( PackagesToAdd.Num() > 0 )
{
SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), SourceControlHelpers::PackageFilenames(PackagesToAdd));
}
}
}
示例7: RemoveWindowFromList
void FSlateWindowHelper::RemoveWindowFromList( TArray<TSharedRef<SWindow>>& Windows, const TSharedRef<SWindow>& WindowToRemove )
{
int32 NumRemoved = Windows.Remove(WindowToRemove);
if (NumRemoved == 0)
{
for (int32 ChildIndex=0; ChildIndex < Windows.Num(); ++ChildIndex)
{
RemoveWindowFromList(Windows[ChildIndex]->GetChildWindows(), WindowToRemove) ;
}
}
}
示例8: RemoveSubGroupsFromArray
void AGroupActor::RemoveSubGroupsFromArray(TArray<AGroupActor*>& GroupArray)
{
for(int32 GroupIndex=0; GroupIndex<GroupArray.Num(); ++GroupIndex)
{
AGroupActor* GroupToCheck = GroupArray[GroupIndex];
if(GroupHasParentInArray(GroupToCheck, GroupArray))
{
GroupArray.Remove(GroupToCheck);
--GroupIndex;
}
}
}
示例9: RemoveMountPoint
// This will remove a previously inserted mount point
void RemoveMountPoint(const FString& RootPath, const FString& ContentPath)
{
// Make sure the content path is stored as a relative path, consistent with the other paths we have
FString RelativeContentPath = IFileManager::Get().ConvertToRelativePath(*ContentPath);
// Make sure the path ends in a trailing path separator. We are expecting that in the InternalFilenameToLongPackageName code.
if (!RelativeContentPath.EndsWith(TEXT("/")))
{
RelativeContentPath += TEXT("/");
}
if ( MountPointRootPaths.Remove(RootPath) > 0 )
{
FPathPair Pair(RootPath, RelativeContentPath);
ContentRootToPath.Remove(Pair);
ContentPathToRoot.Remove(Pair);
MountPointRootPaths.Remove(RootPath);
// Let subscribers know that a new content path was mounted
FPackageName::OnContentPathDismounted().Broadcast( RootPath, ContentPath );
}
}
示例10: MarkUnitTestWorldForCleanup
void NUTNet::MarkUnitTestWorldForCleanup(UWorld* CleanupWorld, bool bImmediate/*=false*/)
{
UnitTestWorlds.Remove(CleanupWorld);
PendingUnitWorldCleanup.Add(CleanupWorld);
if (!bImmediate)
{
GEngine->DeferredCommands.AddUnique(TEXT("CleanupUnitTestWorlds"));
}
else
{
CleanupUnitTestWorlds();
}
}
示例11: OnEndOverlap
void ASensor::OnEndOverlap(class AActor* otherActor) {
inMotionRange.Remove(otherActor); /* Remove otherActor from motion tracking */
//UE_LOG(LogNet, Log, TEXT("%s: Someone left (%s)"), *(this->GetName()), *(otherActor->GetName()));
if (!active) return;
fbb.Clear();
UnrealCoojaMsg::MessageBuilder msg(fbb);
msg.add_id(ID);
msg.add_type(UnrealCoojaMsg::MsgType_PIR);
//msg.add_pir()
auto mloc = msg.Finish();
fbb.Finish(mloc);
int sent = 0;
bool successful = socket->SendTo(fbb.GetBufferPointer(), fbb.GetSize(),
sent, *addr);
active = false;
//UE_LOG(LogNet, Log, TEXT("Send to %s: %i-%i"), *(addr->ToString(true)), successful, sent);
}
示例12: CheckFile
/**
* Checks whether the file was completed during last install attempt and adds it to FilesCompleted if so
* @param Filename The filename to check
*/
void CheckFile( const FString& Filename )
{
// If we had resume data, check file size is correct
if( bHasResumeData && FilesStarted.Contains( Filename ) )
{
const FString FullFilename = StagingDir / Filename;
const int64 DiskFileSize = IFileManager::Get().FileSize( *FullFilename );
const int64 CompleteFileSize = BuildManifest->GetFileSize( Filename );
if( DiskFileSize == CompleteFileSize )
{
FilesCompleted.Add( Filename );
}
// Sanity check, if file is larger than we expect, that's bad
else if( DiskFileSize > CompleteFileSize )
{
FilesStarted.Remove( Filename );
}
}
}
示例13: CleanAndSanitizeStruct
static void CleanAndSanitizeStruct(UUserDefinedStruct* StructToClean)
{
check(StructToClean);
if (auto EditorData = Cast<UUserDefinedStructEditorData>(StructToClean->EditorData))
{
EditorData->CleanDefaultInstance();
}
const FString TransientString = FString::Printf(TEXT("TRASHSTRUCT_%s"), *StructToClean->GetName());
const FName TransientName = MakeUniqueObjectName(GetTransientPackage(), UUserDefinedStruct::StaticClass(), FName(*TransientString));
UUserDefinedStruct* TransientStruct = NewObject<UUserDefinedStruct>(GetTransientPackage(), TransientName, RF_Public | RF_Transient);
TArray<UObject*> SubObjects;
GetObjectsWithOuter(StructToClean, SubObjects, true);
SubObjects.Remove(StructToClean->EditorData);
for( auto SubObjIt = SubObjects.CreateIterator(); SubObjIt; ++SubObjIt )
{
UObject* CurrSubObj = *SubObjIt;
CurrSubObj->Rename(NULL, TransientStruct, REN_DontCreateRedirectors);
if( UProperty* Prop = Cast<UProperty>(CurrSubObj) )
{
FKismetCompilerUtilities::InvalidatePropertyExport(Prop);
}
else
{
FLinkerLoad::InvalidateExport(CurrSubObj);
}
}
StructToClean->SetSuperStruct(NULL);
StructToClean->Children = NULL;
StructToClean->Script.Empty();
StructToClean->MinAlignment = 0;
StructToClean->RefLink = NULL;
StructToClean->PropertyLink = NULL;
StructToClean->DestructorLink = NULL;
StructToClean->ScriptObjectReferences.Empty();
StructToClean->PropertyLink = NULL;
StructToClean->ErrorMessage.Empty();
}
示例14: GetEnabledPlugins
void FProjectManager::GetEnabledPlugins(TArray<FString>& OutPluginNames) const
{
// Get the default list of plugin names
GetDefaultEnabledPlugins(OutPluginNames, true);
// Modify that with the list of plugins in the project file
const FProjectDescriptor *Project = GetCurrentProject();
if(Project != NULL)
{
for(const FPluginReferenceDescriptor& Plugin: Project->Plugins)
{
if(Plugin.IsEnabledForPlatform(FPlatformMisc::GetUBTPlatform()))
{
OutPluginNames.AddUnique(Plugin.Name);
}
else
{
OutPluginNames.Remove(Plugin.Name);
}
}
}
}
示例15: InitializeCVarsForActiveDeviceProfile
void UDeviceProfileManager::InitializeCVarsForActiveDeviceProfile()
{
// Find the device profile selector module used in this instance
FString DeviceProfileSelectionModule;
GConfig->GetString( TEXT("DeviceProfileManager"), TEXT("DeviceProfileSelectionModule"), DeviceProfileSelectionModule, GEngineIni );
FString SelectedPlatformDeviceProfileName = GetActiveProfileName();
UE_LOG(LogInit, Log, TEXT("Applying CVar settings loaded from the selected device profile: [%s]"), *SelectedPlatformDeviceProfileName);
// Load the device profile config
FConfigCacheIni::LoadGlobalIniFile(DeviceProfileFileName, TEXT("DeviceProfiles"));
TArray< FString > AvailableProfiles;
GConfig->GetSectionNames( DeviceProfileFileName, AvailableProfiles );
// Look up the ini for this tree as we are far too early to use the UObject system
AvailableProfiles.Remove( TEXT( "DeviceProfiles" ) );
// Next we need to create a hierarchy of CVars from the Selected Device Profile, to it's eldest parent
TMap<FString, FString> CVarsAlreadySetList;
// For each device profile, starting with the selected and working our way up the BaseProfileName tree,
// Find all CVars and set them
FString BaseDeviceProfileName = SelectedPlatformDeviceProfileName;
bool bReachedEndOfTree = BaseDeviceProfileName.IsEmpty();
while( bReachedEndOfTree == false )
{
FString CurrentSectionName = FString::Printf( TEXT("%s %s"), *BaseDeviceProfileName, *UDeviceProfile::StaticClass()->GetName() );
// Check the profile was available.
bool bProfileExists = AvailableProfiles.Contains( CurrentSectionName );
if( bProfileExists )
{
TArray< FString > CurrentProfilesCVars;
GConfig->GetArray( *CurrentSectionName, TEXT("CVars"), CurrentProfilesCVars, DeviceProfileFileName );
// Iterate over the profile and make sure we do not have duplicate CVars
{
TMap< FString, FString > ValidCVars;
for( TArray< FString >::TConstIterator CVarIt(CurrentProfilesCVars); CVarIt; ++CVarIt )
{
FString CVarKey, CVarValue;
if( (*CVarIt).Split( TEXT("="), &CVarKey, &CVarValue ) )
{
if( ValidCVars.Find( CVarKey ) )
{
ValidCVars.Remove( CVarKey );
}
ValidCVars.Add( CVarKey, CVarValue );
}
}
// Empty the current list, and replace with the processed CVars. This removes duplicates
CurrentProfilesCVars.Empty();
for( TMap< FString, FString >::TConstIterator ProcessedCVarIt(ValidCVars); ProcessedCVarIt; ++ProcessedCVarIt )
{
CurrentProfilesCVars.Add( FString::Printf( TEXT("%s=%s"), *ProcessedCVarIt.Key(), *ProcessedCVarIt.Value() ) );
}
}
// Iterate over this profiles cvars and set them if they haven't been already.
for( TArray< FString >::TConstIterator CVarIt(CurrentProfilesCVars); CVarIt; ++CVarIt )
{
FString CVarKey, CVarValue;
if( (*CVarIt).Split( TEXT("="), &CVarKey, &CVarValue ) )
{
if( !CVarsAlreadySetList.Find( CVarKey ) )
{
IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(*CVarKey);
if( CVar )
{
UE_LOG(LogInit, Log, TEXT("Setting Device Profile CVar: [[%s:%s]]"), *CVarKey, *CVarValue);
CVar->Set( *CVarValue, ECVF_SetByDeviceProfile);
CVarsAlreadySetList.Add( CVarKey, CVarValue );
}
else
{
UE_LOG(LogInit, Warning, TEXT("Failed to find a registered CVar that matches the key: [%s]"), *CVarKey);
}
}
}
}
// Get the next device profile name, to look for CVars in, along the tree
FString NextBaseDeviceProfileName;
if( GConfig->GetString( *CurrentSectionName, TEXT("BaseProfileName"), NextBaseDeviceProfileName, DeviceProfileFileName ) )
{
BaseDeviceProfileName = NextBaseDeviceProfileName;
}
else
{
BaseDeviceProfileName.Empty();
}
}
// Check if we have inevitably reached the end of the device profile tree.
bReachedEndOfTree = !bProfileExists || BaseDeviceProfileName.IsEmpty();
//.........这里部分代码省略.........