当前位置: 首页>>代码示例>>C++>>正文


C++ TArray::Pop方法代码示例

本文整理汇总了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();
}
开发者ID:pokelege,项目名称:ProjectTap_Code,代码行数:33,代码来源:Graph.cpp

示例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;
}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:33,代码来源:c_cvars.cpp

示例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;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:35,代码来源:CollisionConversions.cpp

示例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);
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:26,代码来源:SGraphTitleBar.cpp

示例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;
}
开发者ID:zpzsoft,项目名称:zpzsoft.github.io,代码行数:34,代码来源:ablAbilityTaskValidator.cpp

示例6: PutOnTop

void ASpellDeck::PutOnTop(TArray<UActionCard*> cardsToPut_p)
{
	for (auto card : cardsToPut_p)
	{
		spellDeck.Push(cardsToPut_p.Pop());
	}
}
开发者ID:cakeller43,项目名称:Kellers-TCG,代码行数:7,代码来源:SpellDeck.cpp

示例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;
}
开发者ID:seanmleonard,项目名称:odamex,代码行数:31,代码来源:c_cvars.cpp

示例8: MoveTemp

	TArray<FChunkPart> FDataStructure::GetFinalDataStructure()
	{
		if (DataStructure.Top().PartSize == 0)
		{
			DataStructure.Pop(false);
		}
		return MoveTemp(DataStructure);
	}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:8,代码来源:DataScanner.cpp

示例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;
}
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:57,代码来源:b_move.cpp

示例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") );
			}
		}
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:57,代码来源:SGameplayTagWidget.cpp

示例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());
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:20,代码来源:PhysXSupport.cpp

示例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();
	}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:13,代码来源:SCSDiff.cpp

示例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;
}
开发者ID:mysheng8,项目名称:UnrealEngine,代码行数:49,代码来源:K2Node.cpp

示例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;
}
开发者ID:skeletoncrew,项目名称:skeletonwarsem2,代码行数:15,代码来源:SkeleUtilityFunctionLibrary.cpp

示例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;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:48,代码来源:XmlFile.cpp


注:本文中的TArray::Pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。