本文整理汇总了C++中TPtr::AddText方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtr::AddText方法的具体用法?C++ TPtr::AddText怎么用?C++ TPtr::AddText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtr
的用法示例。
在下文中一共展示了TPtr::AddText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LanguageRef
SyncBool TLFileSys::TFileTextDatabase::ImportText_ImportLanguageText(TPtr<TLAsset::TText>& pText, TPtr<TXmlTag>& pImportTag, TRefRef TextRef)
{
/*
<Text TextRef="VolMus">
<eng>Music Volume</eng>
<usa>Music Volume</usa>
<fre>Music Volume</fre>
</Text>
*/
// temporary string to put a cleaner data stirng into
TString TempString;
// Now get the children of the text tag and process them
for ( u32 index=0; index< pImportTag->GetChildren().GetSize(); index++ )
{
TPtr<TXmlTag>& pTextTag = pImportTag->GetChildren().ElementAt(index);
// The child tag name is the language ref
TRef LanguageRef(pTextTag->GetTagName());
if(!LanguageRef.IsValid())
{
TLDebug_Print("Failed to get valid language ref from TTD file");
return SyncFalse;
}
// Now get the text string
const TString& DataString = pTextTag->GetDataString();
// if the data string is dirty (needs line feed conversion etc) then convert it into a new string
Bool IsDataStringDirty = TLString::IsStringDirty( DataString );
if ( IsDataStringDirty )
{
TempString = DataString;
TLString::CleanString( TempString );
}
// final [clean] string
const TString& TextString = IsDataStringDirty ? TempString : DataString;
// And add to the text object
if(!pText->AddText(LanguageRef, TextRef, TextString))
{
TLDebug_Break("Failed to add text string to text object");
}
}
return SyncTrue;
}
示例2:
SyncBool TLFileSys::TFileTextDatabase::GenerateTextAllLanguages(TPtr<TLAsset::TText>&pText, TRefRef TextRef)
{
// Add the text ref as text for each language
TArray<TRef>& SupportedLanguages = TLText::g_pTextManager->GetSupportedLanguages();
// Get the ref as a string
TString TextString;
TextRef.GetString(TextString);
for(u32 uIndex = 0; uIndex < SupportedLanguages.GetSize(); uIndex++)
{
// Get the language
TRef LanguageRef = SupportedLanguages.ElementAt(uIndex);
// Add to the text object
if(!pText->AddText(LanguageRef, TextRef, TextString))
{
TLDebug_Print("Failed to add text string to text object");
}
}
return SyncTrue;
}