本文整理汇总了C++中FArchive::HasAnyPortFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ FArchive::HasAnyPortFlags方法的具体用法?C++ FArchive::HasAnyPortFlags怎么用?C++ FArchive::HasAnyPortFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArchive
的用法示例。
在下文中一共展示了FArchive::HasAnyPortFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SerializeForDisplayString
void FTextHistory_Base::SerializeForDisplayString(FArchive& Ar, FTextDisplayStringRef& InOutDisplayString)
{
if(Ar.IsLoading())
{
// We will definitely need to do a rebuild later
Revision = INDEX_NONE;
FString Namespace;
FString Key;
FString SourceStringRaw;
Ar << Namespace;
Ar << Key;
Ar << SourceStringRaw;
// If there was a SourceString, store it in the member variable
if(!SourceStringRaw.IsEmpty())
{
SourceString = MakeShareable(new FString(SourceStringRaw));
}
// Using the deserialized namespace and key, find the DisplayString.
InOutDisplayString = FTextLocalizationManager::Get().GetDisplayString(Namespace, Key, SourceString.Get());
}
else if(Ar.IsSaving())
{
FString Namespace;
FString Key;
const bool FoundNamespaceAndKey = FTextLocalizationManager::Get().FindNamespaceAndKeyFromDisplayString(InOutDisplayString, Namespace, Key);
// If this has no namespace or key, attempt to give it a GUID for a key and register it.
if (!FoundNamespaceAndKey && GIsEditor && (Ar.IsPersistent() && !Ar.HasAnyPortFlags(PPF_Duplicate)))
{
Key = FGuid::NewGuid().ToString();
if (!FTextLocalizationManager::Get().AddDisplayString(InOutDisplayString, Namespace, Key))
{
// Could not add display string, reset namespace and key.
Namespace.Empty();
Key.Empty();
}
}
// Serialize the Namespace
Ar << Namespace;
// Serialize the Key
Ar << Key;
// Serialize the SourceString, or an empty string if there is none
if( SourceString.IsValid() )
{
Ar << *(SourceString);
}
else
{
FString Empty;
Ar << Empty;
}
}
}