本文整理汇总了C++中TArray::Pop方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Pop方法的具体用法?C++ TArray::Pop怎么用?C++ TArray::Pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Pop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DFS_makeVisualizers
void AGraph::DFS_makeVisualizers(TArray<int32>& stack,
int32 vIndex)
{
if (mark[vIndex] == nullptr || mark[vIndex]->visited) return;
markVertex(vIndex);
stack.Push(vIndex);
//generate a visulaizer for an unvisited vertex
auto vertexMesh = makeVertexMeshForVertex(vIndex);
vertexMeshes.Add(vertexMesh);
for (auto v = first(vIndex);
v != nullptr;
v = next(vIndex, v->vertexIndex))
{
bool isBackEdge = v->visited && vIndex < v->vertexIndex;
if (!v->visited || isBackEdge)
{
//generate an edge
auto edgeMesh = makeEdgeMeshForEdge(vIndex, v->vertexIndex);
initializeEdgeMesh(edgeMesh, mark[vIndex], v);
edgeMeshes.Add(edgeMesh);
if (!v->visited)
{
DFS_makeVisualizers(stack, v->vertexIndex);
}
}
}
stack.Pop();
}
示例2: C_WriteCVars
void C_WriteCVars (BYTE **demo_p, DWORD filter, bool compact)
{
FBaseCVar *cvar = CVars;
BYTE *ptr = *demo_p;
if (compact)
{
TArray<FBaseCVar *> cvars;
ptr += sprintf ((char *)ptr, "\\\\%ux", filter);
FilterCompactCVars (cvars, filter);
while (cvars.Pop (cvar))
{
UCVarValue val = cvar->GetGenericRep (CVAR_String);
ptr += sprintf ((char *)ptr, "\\%s", val.String);
}
}
else
{
cvar = CVars;
while (cvar)
{
if ((cvar->Flags & filter) && !(cvar->Flags & (CVAR_NOSAVE|CVAR_IGNORE)))
{
UCVarValue val = cvar->GetGenericRep (CVAR_String);
ptr += sprintf ((char *)ptr, "\\%s\\%s",
cvar->GetName (), val.String);
}
cvar = cvar->m_Next;
}
}
*demo_p = ptr + 1;
}
示例3: AddSweepResults
EConvertQueryResult AddSweepResults(bool& OutHasValidBlockingHit, const UWorld* World, int32 NumHits, PxSweepHit* Hits, float CheckLength, const PxFilterData& QueryFilter, TArray<FHitResult>& OutHits, const FVector& StartLoc, const FVector& EndLoc, const PxGeometry& Geom, const PxTransform& QueryTM, float MaxDistance, bool bReturnFaceIndex, bool bReturnPhysMat)
{
OutHits.Reserve(OutHits.Num() + NumHits);
EConvertQueryResult ConvertResult = EConvertQueryResult::Valid;
bool bHadBlockingHit = false;
const PxVec3 PDir = U2PVector((EndLoc - StartLoc).GetSafeNormal());
for(int32 i=0; i<NumHits; i++)
{
PxSweepHit& PHit = Hits[i];
checkSlow(PHit.flags & PxHitFlag::eDISTANCE);
if(PHit.distance <= MaxDistance)
{
PHit.faceIndex = FindFaceIndex(PHit, PDir);
FHitResult& NewResult = OutHits[OutHits.AddDefaulted()];
if (ConvertQueryImpactHit(World, PHit, NewResult, CheckLength, QueryFilter, StartLoc, EndLoc, &Geom, QueryTM, bReturnFaceIndex, bReturnPhysMat) == EConvertQueryResult::Valid)
{
bHadBlockingHit |= NewResult.bBlockingHit;
}
else
{
// Reject invalid result (this should be rare). Remove from the results.
OutHits.Pop(/*bAllowShrinking=*/ false);
ConvertResult = EConvertQueryResult::Invalid;
}
}
}
// Sort results from first to last hit
OutHits.Sort( FCompareFHitResultTime() );
OutHasValidBlockingHit = bHadBlockingHit;
return ConvertResult;
}
示例4: RebuildBreadcrumbTrail
void SGraphTitleBar::RebuildBreadcrumbTrail()
{
// Build up a stack of graphs so we can pop them in reverse order and create breadcrumbs
TArray<UEdGraph*> Stack;
for (UEdGraph* OuterChain = EdGraphObj; OuterChain != NULL; OuterChain = GetOuterGraph(OuterChain))
{
Stack.Push(OuterChain);
}
BreadcrumbTrail->ClearCrumbs(false);
//Get the last object in the array
UEdGraph* LastObj = NULL;
if( Stack.Num() > 0 )
{
LastObj = Stack[Stack.Num() -1];
}
while (Stack.Num() > 0)
{
UEdGraph* Graph = Stack.Pop();
auto Foo = TAttribute<FText>::Create(TAttribute<FText>::FGetter::CreateStatic<const UEdGraph*>(&SGraphTitleBar::GetTitleForOneCrumb, Graph));
BreadcrumbTrail->PushCrumb(Foo, Graph);
}
}
示例5: HasCircularDependency
bool UAblAbilityTaskDependencyValidator::HasCircularDependency(const TWeakObjectPtr<UAblAbilityTaskValidatorContext>& Context, const UAblAbilityTask* TaskToCheck, const UAblAbilityTask* CurrentTask) const
{
static TArray<const UAblAbilityTask*> Stack;
Stack.Push(CurrentTask);
bool Result = false;
if (CurrentTask->HasDependencies())
{
for (const UAblAbilityTask* Dependency : CurrentTask->GetTaskDependencies())
{
if (Dependency == TaskToCheck)
{
FText ErrorMessage = FText::FormatOrdered(LOCTEXT("AbilityValidatorTaskCirculeDependency", "Circular Dependency Detected for Task {0}, dependency stack:"), TaskToCheck->GetTaskName());
Context->AddError(ErrorMessage);
Result = true;
break;
}
else
{
if (!Stack.Contains(Dependency) && HasCircularDependency(Context, TaskToCheck, Dependency))
{
Context->AddError(FText::FormatOrdered(LOCTEXT("AbilityValidatorTaskCircularDependencyStack", "Task {0} depends on {1}"), CurrentTask->GetTaskName(), Dependency->GetTaskName()));
Result = true;
break;
}
}
}
}
Stack.Pop();
return Result;
}
示例6: PutOnTop
void ASpellDeck::PutOnTop(TArray<UActionCard*> cardsToPut_p)
{
for (auto card : cardsToPut_p)
{
spellDeck.Push(cardsToPut_p.Pop());
}
}
示例7: C_WriteCVars
void cvar_t::C_WriteCVars (byte **demo_p, DWORD filter, bool compact)
{
cvar_t *cvar = ad.GetCVars();
byte *ptr = *demo_p;
if (compact)
{
TArray<cvar_t *> cvars;
ptr += sprintf ((char *)ptr, "\\\\%ux", (unsigned int)filter);
FilterCompactCVars (cvars, filter);
while (cvars.Pop (cvar))
{
ptr += sprintf ((char *)ptr, "\\%s", cvar->cstring());
}
}
else
{
cvar = ad.GetCVars();
while (cvar)
{
if (cvar->m_Flags & filter)
{
ptr += sprintf ((char *)ptr, "\\%s\\%s",
cvar->name(), cvar->cstring());
}
cvar = cvar->m_Next;
}
}
*demo_p = ptr + 1;
}
示例8: MoveTemp
TArray<FChunkPart> FDataStructure::GetFinalDataStructure()
{
if (DataStructure.Top().PartSize == 0)
{
DataStructure.Pop(false);
}
return MoveTemp(DataStructure);
}
示例9: Move
bool FCajunMaster::Move (AActor *actor, ticcmd_t *cmd)
{
fixed_t tryx, tryy;
bool try_ok;
int good;
if (actor->movedir == DI_NODIR)
return false;
if ((unsigned)actor->movedir >= 8)
I_Error ("Weird bot movedir!");
tryx = actor->x + 8*xspeed[actor->movedir];
tryy = actor->y + 8*yspeed[actor->movedir];
try_ok = CleanAhead (actor, tryx, tryy, cmd);
if (!try_ok) //Anything blocking that could be opened etc..
{
if (!spechit.Size ())
return false;
actor->movedir = DI_NODIR;
good = 0;
line_t *ld;
while (spechit.Pop (ld))
{
bool tryit = true;
if (ld->special == Door_LockedRaise && !P_CheckKeys (actor, ld->args[3], false))
tryit = false;
else if (ld->special == Generic_Door && !P_CheckKeys (actor, ld->args[4], false))
tryit = false;
if (tryit &&
(P_TestActivateLine (ld, actor, 0, SPAC_Use) ||
P_TestActivateLine (ld, actor, 0, SPAC_Push)))
{
good |= ld == actor->BlockingLine ? 1 : 2;
}
}
if (good && ((pr_botopendoor() >= 203) ^ (good & 1)))
{
cmd->ucmd.buttons |= BT_USE;
cmd->ucmd.forwardmove = FORWARDRUN;
return true;
}
else
return false;
}
else //Move forward.
cmd->ucmd.forwardmove = FORWARDRUN;
return true;
}
示例10: VerifyAssetTagValidity
void SGameplayTagWidget::VerifyAssetTagValidity()
{
FGameplayTagContainer LibraryTags;
// Create a set that is the library of all valid tags
TArray< TSharedPtr<FGameplayTagNode> > NodeStack;
UGameplayTagsManager& TagsManager = IGameplayTagsModule::Get().GetGameplayTagsManager();
TagsManager.GetFilteredGameplayRootTags(TEXT(""), NodeStack);
while (NodeStack.Num() > 0)
{
TSharedPtr<FGameplayTagNode> CurNode = NodeStack.Pop();
if (CurNode.IsValid())
{
LibraryTags.AddTag(TagsManager.RequestGameplayTag(CurNode->GetCompleteTag()));
NodeStack.Append(CurNode->GetChildTagNodes());
}
}
// Find and remove any tags on the asset that are no longer in the library
for (int32 ContainerIdx = 0; ContainerIdx < TagContainers.Num(); ++ContainerIdx)
{
UObject* OwnerObj = TagContainers[ContainerIdx].TagContainerOwner.Get();
FGameplayTagContainer* Container = TagContainers[ContainerIdx].TagContainer;
if (Container)
{
FGameplayTagContainer EditableContainer = *Container;
FGameplayTagContainer InvalidTags;
for (auto It = Container->CreateConstIterator(); It; ++It)
{
if (!LibraryTags.HasTag(*It, EGameplayTagMatchType::Explicit, EGameplayTagMatchType::Explicit))
{
InvalidTags.AddTag(*It);
}
}
if (InvalidTags.Num() > 0)
{
FString InvalidTagNames;
for (auto InvalidIter = InvalidTags.CreateConstIterator(); InvalidIter; ++InvalidIter)
{
EditableContainer.RemoveTag(*InvalidIter);
InvalidTagNames += InvalidIter->ToString() + TEXT("\n");
}
SetContainer(Container, &EditableContainer, OwnerObj);
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("Objects"), FText::FromString( InvalidTagNames ));
FText DialogText = FText::Format( LOCTEXT("GameplayTagWidget_InvalidTags", "Invalid Tags that have been removed: \n\n{Objects}"), Arguments );
OpenMsgDlgInt( EAppMsgType::Ok, DialogText, LOCTEXT("GameplayTagWidget_Warning", "Warning") );
}
}
}
}
示例11: submitTask
void FPhysXCPUDispatcherSingleThread::submitTask( PxBaseTask& Task )
{
SCOPE_CYCLE_COUNTER(STAT_PhysXSingleThread);
check(IsInGameThread());
TaskStack.Push(&Task);
if (TaskStack.Num() > 1)
{
return;
}
Task.run();
Task.release();
while (TaskStack.Num() > 1)
{
PxBaseTask& ChildTask = *TaskStack.Pop();
ChildTask.run();
ChildTask.release();
}
verify(&Task == TaskStack.Pop() && !TaskStack.Num());
}
示例12: GetDisplayedHierarchyRecursive
void GetDisplayedHierarchyRecursive(TArray< int32 >& TreeAddress, const FSCSEditorTreeNode& Node, TArray< FSCSResolvedIdentifier >& OutResult)
{
FSCSIdentifier Identifier = { Node.GetVariableName(), TreeAddress };
FSCSResolvedIdentifier ResolvedIdentifier = { Identifier, Node.GetComponentTemplate() };
OutResult.Push(ResolvedIdentifier);
const auto& Children = Node.GetChildren();
for (int32 Iter = 0; Iter != Children.Num(); ++Iter)
{
TreeAddress.Push(Iter);
GetDisplayedHierarchyRecursive(TreeAddress, *Children[Iter], OutResult);
TreeAddress.Pop();
}
}
示例13: if
ERenamePinResult UK2Node::RenameUserDefinedPin(const FString& OldName, const FString& NewName, bool bTest)
{
UEdGraphPin* Pin = NULL;
for (int32 PinIdx=0; PinIdx<Pins.Num(); PinIdx++)
{
if (OldName == Pins[PinIdx]->PinName)
{
Pin = Pins[PinIdx];
}
else if(NewName == Pins[PinIdx]->PinName)
{
return ERenamePinResult::ERenamePinResult_NameCollision;
}
}
if(!Pin)
{
return ERenamePinResult::ERenamePinResult_NoSuchPin;
}
if(!bTest)
{
Pin->Modify();
Pin->PinName = NewName;
if(!Pin->DefaultTextValue.IsEmpty())
{
Pin->GetSchema()->TrySetDefaultText(*Pin, Pin->DefaultTextValue);
}
if (Pin->SubPins.Num() > 0)
{
TArray<UEdGraphPin*> PinsToUpdate = Pin->SubPins;
while (PinsToUpdate.Num() > 0)
{
UEdGraphPin* PinToRename = PinsToUpdate.Pop(/*bAllowShrinking=*/ false);
if (PinToRename->SubPins.Num() > 0)
{
PinsToUpdate.Append(PinToRename->SubPins);
}
PinToRename->Modify();
PinToRename->PinName = NewName + PinToRename->PinName.RightChop(OldName.Len());
PinToRename->PinFriendlyName = FText::FromString(NewName + PinToRename->PinFriendlyName.ToString().RightChop(OldName.Len()));
}
}
}
return ERenamePinResult::ERenamePinResult_Success;
}
示例14: TEXT
TArray<FString> USkeleUtilityFunctionLibrary::GetDefaultPlayerNamesFromFile() {
FString filePath = FPaths::GameDir() + "Config/DefaultPlayerNames.ini";
FString fileContents = "";
FFileHelper::LoadFileToString(fileContents, *filePath);
TArray<FString> items;
int32 itemCount = fileContents.ParseIntoArray(items, TEXT(","), true);
if (items.Last().Contains(TEXT("\n"))) {
items.Pop();
}
return items;
}
示例15: Save
bool FXmlFile::Save(const FString& Path)
{
FString Xml;
Xml += TEXT("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") LINE_TERMINATOR;
TArray<const FXmlNode*> NodeStack;
static const TCHAR Tabs[] = TEXT("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
auto Indent = &Tabs[ARRAY_COUNT(Tabs) - 1];
const auto* CurrentNode = GetRootNode();
while (CurrentNode)
{
if (auto Child = CurrentNode->GetFirstChildNode())
{
NodeStack.Push(CurrentNode);
Xml += FString::Printf(TEXT("%s<%s>") LINE_TERMINATOR, Indent, *CurrentNode->GetTag());
CurrentNode = Child;
// Actually increases the indent by one tab
--Indent;
continue;
}
auto Tag = *CurrentNode->GetTag();
Xml += FString::Printf(TEXT("%s<%s>%s</%s>") LINE_TERMINATOR, Indent, Tag, *CurrentNode->GetContent(), Tag);
CurrentNode = CurrentNode->GetNextNode();
while (!CurrentNode && NodeStack.Num() != 0)
{
// Actually decreases the indent by one tab
++Indent;
CurrentNode = NodeStack.Pop();
Xml += FString::Printf(TEXT("%s</%s>") LINE_TERMINATOR, Indent, *CurrentNode->GetTag());
CurrentNode = CurrentNode->GetNextNode();
}
}
TUniquePtr<FArchive> Archive(IFileManager::Get().CreateFileWriter(*Path));
if (!Archive)
{
ErrorMessage = NSLOCTEXT("XmlParser", "FileSaveFail", "Failed to save the file").ToString();
ErrorMessage += FString::Printf(TEXT("\"%s\""), *Path);
return false;
}
FTCHARToUTF8 Converter(*Xml);
Archive->Serialize(const_cast<char*>(Converter.Get()), Converter.Length());
return true;
}