本文整理汇总了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;
}
示例2: SetHoveredSound
void SButton::SetHoveredSound(TOptional<FSlateSound> InHoveredSound)
{
HoveredSound = InHoveredSound.Get(Style->HoveredSlateSound);
}
示例3: SetPressedSound
void SButton::SetPressedSound(TOptional<FSlateSound> InPressedSound)
{
PressedSound = InPressedSound.Get(Style->PressedSlateSound);
}
示例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;
}