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


C++ TOptional::Get方法代码示例

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


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

示例1: GetRotationPoint

FVector2D FSlateDrawElement::GetRotationPoint(const FPaintGeometry& PaintGeometry, const TOptional<FVector2D>& UserRotationPoint, ERotationSpace RotationSpace)
{
	FVector2D RotationPoint(0, 0);

	const FVector2D& LocalSize = PaintGeometry.GetLocalSize();

	switch (RotationSpace)
	{
	case RelativeToElement:
	{
		// If the user did not specify a rotation point, we rotate about the center of the element
		RotationPoint = UserRotationPoint.Get(LocalSize * 0.5f);
	}
		break;
	case RelativeToWorld:
	{
		// its in world space, must convert the point to local space.
		RotationPoint = TransformPoint(Inverse(PaintGeometry.GetAccumulatedRenderTransform()), UserRotationPoint.Get(FVector2D::ZeroVector));
	}
		break;
	default:
		check(0);
		break;
	}

	return RotationPoint;
}
开发者ID:johndpope,项目名称:UE4,代码行数:27,代码来源:DrawElements.cpp

示例2: SetHoveredSound

void SButton::SetHoveredSound(TOptional<FSlateSound> InHoveredSound)
{
	HoveredSound = InHoveredSound.Get(Style->HoveredSlateSound);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:4,代码来源:SButton.cpp

示例3: SetPressedSound

void SButton::SetPressedSound(TOptional<FSlateSound> InPressedSound)
{
	PressedSound = InPressedSound.Get(Style->PressedSlateSound);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:4,代码来源:SButton.cpp

示例4: GenerateExportScript

	FLocalizationConfigurationScript GenerateExportScript(const FLocalizationTargetSettings& Target, const TOptional<FString> CultureName, const TOptional<FString> OutputPathOverride)
	{
		FLocalizationConfigurationScript Script;

		const FString ContentDirRelativeToGameDir = MakePathRelativeToProjectDirectory(FPaths::GameContentDir());

		// GatherTextStep0 - InternationalizationExport
		{
			FConfigSection& ConfigSection = Script.GatherTextStep(0);

			// CommandletClass
			ConfigSection.Add( TEXT("CommandletClass"), TEXT("InternationalizationExport") );

			ConfigSection.Add( TEXT("bExportLoc"), TEXT("true") );

			const FString SourcePath = ContentDirRelativeToGameDir / TEXT("Localization") / Target.Name;
			ConfigSection.Add( TEXT("SourcePath"), SourcePath );

			FString DestinationPath;
			// Overriding output path changes the destination directory for the PO file.
			if (OutputPathOverride.IsSet())
			{
				// The output path for a specific culture is a file path.
				if (CultureName.IsSet())
				{
					DestinationPath = MakePathRelativeToProjectDirectory( FPaths::GetPath(OutputPathOverride.GetValue()) );
				}
				// Otherwise, it is a directory path.
				else
				{
					DestinationPath = MakePathRelativeToProjectDirectory( OutputPathOverride.GetValue() );
				}
			}
			// Use the default PO file's directory path.
			else
			{
				DestinationPath = ContentDirRelativeToGameDir / TEXT("Localization") / Target.Name;
			}
			ConfigSection.Add( TEXT("DestinationPath"), DestinationPath );

			TArray<const FCultureStatistics*> AllCultureStatistics;
			AllCultureStatistics.Add(&Target.NativeCultureStatistics);
			for (const FCultureStatistics& SupportedCultureStatistics : Target.SupportedCulturesStatistics)
			{
				AllCultureStatistics.Add(&SupportedCultureStatistics);
			}

			const auto& AddCultureToGenerate = [&](const int32 Index)
			{
				ConfigSection.Add( TEXT("CulturesToGenerate"), AllCultureStatistics[Index]->CultureName );
			};

			// Export for a specific culture.
			if (CultureName.IsSet())
			{
				const int32 CultureIndex = AllCultureStatistics.IndexOfByPredicate([CultureName](const FCultureStatistics* Culture) { return Culture->CultureName == CultureName.GetValue(); });
				AddCultureToGenerate(CultureIndex);
			}
			// Export for all cultures.
			else
			{
				for (int32 CultureIndex = 0; CultureIndex < AllCultureStatistics.Num(); ++CultureIndex)
				{
					AddCultureToGenerate(CultureIndex);
				}
			}

			// Do not use culture subdirectories if exporting a single culture to a specific directory.
			if (CultureName.IsSet() && OutputPathOverride.IsSet())
			{
				ConfigSection.Add( TEXT("bUseCultureDirectory"), "false" );
			}


			ConfigSection.Add( TEXT("ManifestName"), FPaths::GetCleanFilename(GetManifestPath(Target)) );
			ConfigSection.Add( TEXT("ArchiveName"), FPaths::GetCleanFilename(GetArchivePath(Target, FString())) );
			FString POFileName;
			// The output path for a specific culture is a file path.
			if (CultureName.IsSet() && OutputPathOverride.IsSet())
			{
				POFileName =  FPaths::GetCleanFilename( OutputPathOverride.GetValue() );
			}
			// Use the default PO file's name.
			else
			{
				POFileName = FPaths::GetCleanFilename( GetDefaultPOPath( Target, CultureName.Get( TEXT("") ) ) );
			}
			ConfigSection.Add( TEXT("PortableObjectName"), POFileName );
		}

		Script.Dirty = true;

		return Script;
	}
开发者ID:Codermay,项目名称:Unreal4,代码行数:94,代码来源:LocalizationConfigurationScript.cpp


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