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


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

本文整理汇总了C++中TArray::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Contains方法的具体用法?C++ TArray::Contains怎么用?C++ TArray::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TArray的用法示例。


在下文中一共展示了TArray::Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ValidateUnitTestSettings

bool UUnitTest::ValidateUnitTestSettings(bool bCDOCheck/*=false*/)
{
	bool bSuccess = true;

	// The unit test must specify some ExpectedResult values
	UNIT_ASSERT(ExpectedResult.Num() > 0);


	TArray<EUnitTestVerification> ExpectedResultList;

	ExpectedResult.GenerateValueArray(ExpectedResultList);

	// Unit tests should not expect unreliable results, without being marked as unreliable
	UNIT_ASSERT(!ExpectedResultList.Contains(EUnitTestVerification::VerifiedUnreliable) || bUnreliable);

	// Unit tests should never expect 'needs-update' as a valid unit test result
	// @todo JohnB: It might make sense to allow this in the future, if you want to mark unit tests as 'needs-update' before running,
	//				so that you can skip running those unit tests
	UNIT_ASSERT(!ExpectedResultList.Contains(EUnitTestVerification::VerifiedNeedsUpdate));


	// Every unit test must specify a timeout value
	UNIT_ASSERT(UnitTestTimeout > 0);

	return bSuccess;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:26,代码来源:UnitTest.cpp

示例2: CreateCookerFileOrderString

FString FChunkManifestGenerator::CreateCookerFileOrderString(const TMap<FName, FAssetData*>& InAssetData, const TArray<FName>& InMaps)
{
	FString FileOrderString;
	TArray<FAssetData*> TopLevelNodes;

	for (auto Asset : InAssetData)
	{
		auto PackageName = Asset.Value->PackageName;
		TArray<FName> Referencers;
		AssetRegistry.GetReferencers(PackageName, Referencers);

		bool bIsTopLevel = true;
		bool bIsMap = InMaps.Contains(PackageName);

		if (!bIsMap && Referencers.Num() > 0)
		{
			for (auto ReferencerName : Referencers)
			{
				if (InAssetData.Contains(ReferencerName))
				{
					bIsTopLevel = false;
					break;
				}
			}
		}

		if (bIsTopLevel)
		{
			if (bIsMap)
			{
				TopLevelNodes.Insert(Asset.Value, 0);
			}
			else
			{
				TopLevelNodes.Insert(Asset.Value, TopLevelNodes.Num());
			}
		}
	}

	TArray<FName> FileOrder;
	TArray<FName> EncounteredNames;
	for (auto Asset : TopLevelNodes)
	{
		AddAssetToFileOrderRecursive(Asset, FileOrder, EncounteredNames, InAssetData, InMaps);
	}

	int32 CurrentIndex = 0;
	for (auto PackageName : FileOrder)
	{
		auto Asset = InAssetData[PackageName];
		bool bIsMap = InMaps.Contains(Asset->PackageName);
		auto Filename = FPackageName::LongPackageNameToFilename(Asset->PackageName.ToString(), bIsMap ? FPackageName::GetMapPackageExtension() : FPackageName::GetAssetPackageExtension());

		ConvertFilenameToPakFormat(Filename);
		auto Line = FString::Printf(TEXT("\"%s\" %i\n"), *Filename, CurrentIndex++);
		FileOrderString.Append(Line);
	}

	return FileOrderString;
}
开发者ID:VZout,项目名称:Team6UnrealEngine,代码行数:60,代码来源:ChunkManifestGenerator.cpp

示例3: PanoramicQuality

void FStereoPanoramaManager::PanoramicQuality(const TArray<FString>& Args)
{
	if (Args.Contains(TEXT("preview")))
	{
		UE_LOG(LogStereoPanorama, Display, TEXT(" ... setting 'preview' quality"));

		FStereoPanoramaManager::HorizontalAngularIncrement->Set(TEXT("5"));
		FStereoPanoramaManager::VerticalAngularIncrement->Set(TEXT("60"));
		FStereoPanoramaManager::CaptureHorizontalFOV->Set(TEXT("60"));
		FStereoPanoramaManager::StepCaptureWidth->Set(TEXT("720"));
	}
	else if (Args.Contains(TEXT("average")))
	{
		UE_LOG(LogStereoPanorama, Display, TEXT(" ... setting 'average' quality"));
		
		FStereoPanoramaManager::HorizontalAngularIncrement->Set(TEXT("2"));
		FStereoPanoramaManager::VerticalAngularIncrement->Set(TEXT("30"));
		FStereoPanoramaManager::CaptureHorizontalFOV->Set(TEXT("30"));
		FStereoPanoramaManager::StepCaptureWidth->Set(TEXT("1440"));
	}
	else if (Args.Contains(TEXT("improved")))
	{
		UE_LOG(LogStereoPanorama, Display, TEXT(" ... setting 'improved' quality"));
		
		FStereoPanoramaManager::HorizontalAngularIncrement->Set(TEXT("0.5"));
		FStereoPanoramaManager::VerticalAngularIncrement->Set(TEXT("22.5"));
		FStereoPanoramaManager::CaptureHorizontalFOV->Set(TEXT("22.5"));
		FStereoPanoramaManager::StepCaptureWidth->Set(TEXT("1440"));
	}
	else
	{
		UE_LOG(LogStereoPanorama, Warning, TEXT("No quality setting found; options are 'preview | average | improved'"));
	}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:34,代码来源:StereoPanoramaManager.cpp

示例4: Visit

		virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory)
		{
			FString NewName(FilenameOrDirectory);
			// change the root and rename paths/files
			NewName.RemoveFromStart(SourceRoot);
			NewName = NewName.Replace(TEXT("PLUGIN_NAME"), *PluginName, ESearchCase::CaseSensitive);
			NewName = FPaths::Combine(DestRoot, *NewName);

			if (bIsDirectory)
			{
				// create new directory structure
				if (!PlatformFile.CreateDirectoryTree(*NewName) && !PlatformFile.DirectoryExists(*NewName))
				{
					return false;
				}
			}
			else
			{
				FString NewExt = FPaths::GetExtension(FilenameOrDirectory);

				if (!IgnoredFileTypes.Contains(NewExt))
				{
					// Delete destination file if it exists
					if (PlatformFile.FileExists(*NewName))
					{
						PlatformFile.DeleteFile(*NewName);
					}

					// If file of specified extension - open the file as text and replace PLUGIN_NAME in there before saving
					if (NameReplacementFileTypes.Contains(NewExt))
					{
						FString OutFileContents;
						if (!FFileHelper::LoadFileToString(OutFileContents, FilenameOrDirectory))
						{
							return false;
						}

						OutFileContents = OutFileContents.Replace(TEXT("PLUGIN_NAME"), *PluginName, ESearchCase::CaseSensitive);

						if (!FFileHelper::SaveStringToFile(OutFileContents, *NewName))
						{
							return false;
						}
					}
					else
					{
						// Copy file from source
						if (!PlatformFile.CopyFile(*NewName, FilenameOrDirectory))
						{
							// Not all files could be copied
							return false;
						}
					}
				}
			}
			return true; // continue searching
		}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:57,代码来源:PluginHelpers.cpp

示例5: GatherLightingAttachmentGroupPrimitives

void FPrimitiveSceneInfo::GatherLightingAttachmentGroupPrimitives(TArray<FPrimitiveSceneInfo*, SceneRenderingAllocator>& OutChildSceneInfos)
{
#if ENABLE_NAN_DIAGNOSTIC
	// local function that returns full name of object
	auto GetObjectName = [](const UPrimitiveComponent* InPrimitive)->FString
	{
		return (InPrimitive) ? InPrimitive->GetFullName() : FString(TEXT("Unknown Object"));
	};

	// verify that the current object has a valid bbox before adding it
	const float& BoundsRadius = this->Proxy->GetBounds().SphereRadius;
	if (ensureMsgf(!FMath::IsNaN(BoundsRadius) && FMath::IsFinite(BoundsRadius),
		TEXT("%s had an ill-formed bbox and was skipped during shadow setup, contact DavidH."), *GetObjectName(this->ComponentForDebuggingOnly)))
	{
		OutChildSceneInfos.Add(this);
	}
	else
	{
		// return, leaving the TArray empty
		return;
	}

#else 
	// add self at the head of this queue
	OutChildSceneInfos.Add(this);
#endif

	if (!LightingAttachmentRoot.IsValid() && Proxy->LightAttachmentsAsGroup())
	{
		const FAttachmentGroupSceneInfo* AttachmentGroup = Scene->AttachmentGroups.Find(PrimitiveComponentId);

		if (AttachmentGroup)
		{
			
			for (int32 ChildIndex = 0, ChildIndexMax = AttachmentGroup->Primitives.Num(); ChildIndex < ChildIndexMax; ChildIndex++)
			{
				FPrimitiveSceneInfo* ShadowChild = AttachmentGroup->Primitives[ChildIndex];
#if ENABLE_NAN_DIAGNOSTIC
				// Only enqueue objects with valid bounds using the normality of the SphereRaduis as criteria.

				const float& ShadowChildBoundsRadius = ShadowChild->Proxy->GetBounds().SphereRadius;

				if (ensureMsgf(!FMath::IsNaN(ShadowChildBoundsRadius) && FMath::IsFinite(ShadowChildBoundsRadius),
					TEXT("%s had an ill-formed bbox and was skipped during shadow setup, contact DavidH."), *GetObjectName(ShadowChild->ComponentForDebuggingOnly)))
				{
					checkSlow(!OutChildSceneInfos.Contains(ShadowChild))
				    OutChildSceneInfos.Add(ShadowChild);
				}
#else
				// enqueue all objects.
				checkSlow(!OutChildSceneInfos.Contains(ShadowChild))
			    OutChildSceneInfos.Add(ShadowChild);
#endif
			}
		}
	}
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:57,代码来源:PrimitiveSceneInfo.cpp

示例6: RemovePinsFromOldPins

void UAnimGraphNode_BlendListBase::RemovePinsFromOldPins(TArray<UEdGraphPin*>& OldPins, int32 RemovedArrayIndex)
{
	TArray<FString> RemovedPropertyNames;
	TArray<FString> NewPinNames;

	// Store new pin names to compare with old pin names
	for (int32 NewPinIndx = 0; NewPinIndx < Pins.Num(); NewPinIndx++)
	{
		NewPinNames.Add(Pins[NewPinIndx]->PinName);
	}

	// don't know which pins are removed yet so find removed pins comparing NewPins and OldPins
	for (int32 OldPinIdx = 0; OldPinIdx < OldPins.Num(); OldPinIdx++)
	{
		FString& OldPinName = OldPins[OldPinIdx]->PinName;
		if (!NewPinNames.Contains(OldPinName))
		{
			int32 UnderscoreIndex = OldPinName.Find(TEXT("_"));
			if (UnderscoreIndex != INDEX_NONE)
			{
				FString PropertyName = OldPinName.Left(UnderscoreIndex);
				RemovedPropertyNames.Add(PropertyName);
			}
		}
	}

	for (int32 PinIdx = 0; PinIdx < OldPins.Num(); PinIdx++)
	{
		// Separate the pin name into property name and index
		FString PropertyName;
		int32 ArrayIndex = -1;
		FString& OldPinName = OldPins[PinIdx]->PinName;

		int32 UnderscoreIndex = OldPinName.Find(TEXT("_"));
		if (UnderscoreIndex != INDEX_NONE)
		{
			PropertyName = OldPinName.Left(UnderscoreIndex);
			ArrayIndex = FCString::Atoi(*(OldPinName.Mid(UnderscoreIndex + 1)));

			if (RemovedPropertyNames.Contains(PropertyName))
			{
				// if array index is matched, removes pins 
				// and if array index is greater than removed index, decrease index
				if (ArrayIndex == RemovedArrayIndex)
				{
					OldPins.RemoveAt(PinIdx);
					--PinIdx;
				}
				else
					if (ArrayIndex > RemovedArrayIndex)
					{
						OldPinName = FString::Printf(TEXT("%s_%d"), *PropertyName, ArrayIndex - 1);
					}
			}
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:57,代码来源:AnimGraphNode_BlendListBase.cpp

示例7: IsNavLocationInPathDistance

bool UEnvQueryGenerator_PathingGrid::IsNavLocationInPathDistance(const class ARecastNavMesh* NavMesh,
		const struct FNavLocation& NavLocation, const TArray<NavNodeRef>& NodeRefs) const
{
#if ENVQUERY_CLUSTER_SEARCH
	const NavNodeRef ClusterRef = NavMesh->GetClusterRef(NavLocation.NodeRef);
	return NodeRefs.Contains(ClusterRef);
#else
	return NodeRefs.Contains(NavLocation.NodeRef);
#endif
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:10,代码来源:EnvQueryGenerator_PathingGrid.cpp

示例8: GetCost

int32 AMod::GetCost(bool bNeededCost /* = false */, APlayerCharacter* buyer /* = nullptr */)
{
	if (!bNeededCost)
		return cost;
	else
	{
		if (!IsValid(buyer))
			return cost;

		//array of mods we need for this mod
		TArray<TSubclassOf<AMod> > recipeMods;
		GetRecipe(recipeMods);

		//get an array of mods that the character has
		TArray<AMod*> mods = buyer->GetMods();

		//see if they have the correct recipe and enough credits
		int32 neededCredits = cost;
		for (int32 j = 0; j < mods.Num(); j++)
		{
			if (recipeMods.Contains(mods[j]->GetClass()))
				neededCredits -= mods[j]->cost;
		}

		return neededCredits;
	}
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:27,代码来源:Mod.cpp

示例9: IsImportTypeMetaDataValid

bool FFbxImportUIDetails::IsImportTypeMetaDataValid(EFBXImportType& ImportType, FString& MetaData)
{
	TArray<FString> Types;
	MetaData.ParseIntoArray(&Types, TEXT("|"), 1);
	switch(ImportType)
	{
		case FBXIT_StaticMesh:
			return Types.Contains(TEXT("StaticMesh")) || Types.Contains(TEXT("Mesh"));
		case FBXIT_SkeletalMesh:
			return Types.Contains(TEXT("SkeletalMesh")) || Types.Contains(TEXT("Mesh"));
		case FBXIT_Animation:
			return Types.Contains(TEXT("Animation"));
		default:
			return false;
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:16,代码来源:FbxImportUIDetails.cpp

示例10: PointOverlapsNeighborsAlongCongruentAxes

bool PointOverlapsNeighborsAlongCongruentAxes(FVector point, TArray<UDoNNavigationVolumeComponent*> currentVolumeNeighbors, TArray<UDoNNavigationVolumeComponent*> destinationVolumeNeighbors, UDoNNavigationVolumeComponent* destination, bool currentVolOverlapsDestX, bool currentVolOverlapsDestY, bool currentVolOverlapsDestZ)
{
	bool overlaps = false;

	for (UDoNNavigationVolumeComponent* neighbor : currentVolumeNeighbors)
	{
		if (neighbor == destination)
			continue;

		bool overlapsX = PointOverlapsVolumeAxis('X', point, neighbor);
		bool overlapsY = PointOverlapsVolumeAxis('Y', point, neighbor);
		bool overlapsZ = PointOverlapsVolumeAxis('Z', point, neighbor);

		if ((overlapsX == true && currentVolOverlapsDestX == true && overlapsY == true && currentVolOverlapsDestY == true) ||
			(overlapsX == true && currentVolOverlapsDestX == true && overlapsZ == true && currentVolOverlapsDestZ == true) ||
			(overlapsY == true && currentVolOverlapsDestY == true && overlapsZ == true && currentVolOverlapsDestZ == true)
			)
		{
			if (!destinationVolumeNeighbors.Contains(neighbor))
				continue;
			
			/*
			neighbor->ShapeColor = FColor::Red;
			neighbor->SetVisibility(true);
			neighbor->SetHiddenInGame(false);
			*/
			overlaps = true;
			break;
		}		
	}

	return overlaps;
}
开发者ID:Helical-Games,项目名称:DonAINavigation,代码行数:33,代码来源:DEPRECATED_VolumeAdaptiveBuilder.cpp

示例11: FComponentReregisterContext

FGlobalComponentReregisterContext::FGlobalComponentReregisterContext(const TArray<AActor*>& InParentActors)
{
	ActiveGlobalReregisterContextCount++;

	// wait until resources are released
	FlushRenderingCommands();

	// Detach only actor components that are children of the actors list provided
	for(TObjectIterator<UActorComponent> ComponentIt;ComponentIt;++ComponentIt)
	{
		bool bShouldReregister=false;
		UPrimitiveComponent* PrimitiveComponent = Cast<UPrimitiveComponent>(*ComponentIt);
		if (PrimitiveComponent && PrimitiveComponent->ReplacementPrimitive.Get())
		{
			UPrimitiveComponent* ReplacementPrimitive = PrimitiveComponent->ReplacementPrimitive.Get();
			AActor* ParentActor = Cast<AActor>(ReplacementPrimitive->GetOuter());
			if (ParentActor && InParentActors.Contains(ParentActor))
			{
				bShouldReregister = true;
			}
		}
		if( bShouldReregister )
		{
			new(ComponentContexts) FComponentReregisterContext(*ComponentIt);		
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:27,代码来源:ActorComponent.cpp

示例12: ExcludeBonesWithNoParents

void FAnimationRuntime::ExcludeBonesWithNoParents(const TArray<int32> & BoneIndices, const FReferenceSkeleton& RefSkeleton, TArray<int32> & FilteredRequiredBones)
{
	// Filter list, we only want bones that have their parents present in this array.
	FilteredRequiredBones.Empty(BoneIndices.Num());

	for (int32 Index=0; Index<BoneIndices.Num(); Index++)
	{
		const int32& BoneIndex = BoneIndices[Index];
		// Always add root bone.
		if( BoneIndex == 0 )
		{
			FilteredRequiredBones.Add(BoneIndex);
		}
		else
		{
			const int32 ParentBoneIndex = RefSkeleton.GetParentIndex(BoneIndex);
			if( FilteredRequiredBones.Contains(ParentBoneIndex) )
			{
				FilteredRequiredBones.Add(BoneIndex);
			}
			else
			{
				UE_LOG(LogAnimation, Warning, TEXT("ExcludeBonesWithNoParents: Filtering out bone (%s) since parent (%s) is missing"), 
					*RefSkeleton.GetBoneName(BoneIndex).ToString(), *RefSkeleton.GetBoneName(ParentBoneIndex).ToString());
			}
		}
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:28,代码来源:AnimationRuntime.cpp

示例13: FindSimpleCycleForComponentInner

bool FFindStronglyConnected::FindSimpleCycleForComponentInner( TArray<UObject*>& Dest, const TArray<UObject*>& Component, UObject* Node )
{
	Stack.Push(Node);
	TArray<UObject*> Refs;
	Edges.MultiFind(Node, Refs);

	for (int32 Index = 0; Index < Refs.Num(); Index++)
	{
		UObject* Other = Refs[Index];
		if (!Component.Contains(Other))
		{
			continue;
		}
		if (Stack.Contains(Other))
		{
			while (1)
			{
				UObject* Out = Stack.Pop();
				Dest.Add(Out);
				if (Out == Other)
				{
					return true;
				}
			}
		}
		if (FindSimpleCycleForComponentInner(Dest, Component, Other))
		{
			return true;
		}
	}
	check(0);
	return false;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:33,代码来源:FindStronglyConnected.cpp

示例14: StaticDedicatedServerCheck

/** Checks the command line for the presence of switches to indicate running as "dedicated server only" */
int32 CORE_API StaticDedicatedServerCheck()
{
	static int32 HasServerSwitch = -1;
	if (HasServerSwitch == -1)
	{
		const FString CmdLine = FString(FCommandLine::Get()).Trim();
		const TCHAR* TCmdLine = *CmdLine;

		TArray<FString> Tokens;
		TArray<FString> Switches;
		FCommandLine::Parse(TCmdLine, Tokens, Switches);

		HasServerSwitch = (Switches.Contains(TEXT("SERVER")) || Switches.Contains(TEXT("RUN=SERVER"))) ? 1 : 0;
	}
	return HasServerSwitch;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:17,代码来源:CoreMisc.cpp

示例15: NotifyConsoleCommandRequest

bool UUnitTest::NotifyConsoleCommandRequest(FString CommandContext, FString Command)
{
	bool bHandled = false;
	static TArray<FString> BadCmds = TArrayBuilder<FString>()
		.Add("exit");

	// Don't execute commands that crash
	if (BadCmds.Contains(Command))
	{
		bHandled = true;

		UNIT_LOG(ELogType::OriginConsole,
					TEXT("Can't execute command '%s', it's in the 'bad commands' list (i.e. probably crashes)"), *Command);
	}

	if (!bHandled)
	{
		if (CommandContext == TEXT("Global"))
		{
			UNIT_LOG_BEGIN(this, ELogType::OriginConsole);
			bHandled = GEngine->Exec(NULL, *Command, *GLog);
			UNIT_LOG_END();
		}
	}

	return bHandled;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:27,代码来源:UnitTest.cpp


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