本文整理汇总了C++中TSharedRef::AddReference方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::AddReference方法的具体用法?C++ TSharedRef::AddReference怎么用?C++ TSharedRef::AddReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedRef
的用法示例。
在下文中一共展示了TSharedRef::AddReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoExport
//.........这里部分代码省略.........
}
NewPortableObject.SetProjectName( FPaths::GetBaseFilename( ManifestName ) );
NewPortableObject.CreateNewHeader();
{
for(TManifestEntryBySourceTextContainer::TConstIterator ManifestIter = InternationalizationManifest->GetEntriesBySourceTextIterator(); ManifestIter; ++ManifestIter)
{
// Gather relevant info from manifest entry.
const TSharedRef<FManifestEntry>& ManifestEntry = ManifestIter.Value();
const FString& Namespace = ManifestEntry->Namespace;
const FLocItem& Source = ManifestEntry->Source;
// For each context, we may need to create a different or even multiple PO entries.
for( auto ContextIter = ManifestEntry->Contexts.CreateConstIterator(); ContextIter; ++ContextIter )
{
const FContext& Context = *ContextIter;
// Create the typical PO entry from the archive entry which matches the exact same namespace, source, and key metadata, if it exists.
{
const TSharedPtr<FArchiveEntry> ArchiveEntry = InternationalizationArchive->FindEntryBySource( Namespace, Source, Context.KeyMetadataObj );
if( ArchiveEntry.IsValid() )
{
const FString ConditionedArchiveSource = ConditionArchiveStrForPo(ArchiveEntry->Source.Text);
const FString ConditionedArchiveTranslation = ConditionArchiveStrForPo(ArchiveEntry->Translation.Text);
TSharedRef<FPortableObjectEntry> PoEntry = MakeShareable( new FPortableObjectEntry );
//@TODO: We support additional metadata entries that can be translated. How do those fit in the PO file format? Ex: isMature
PoEntry->MsgId = ConditionedArchiveSource;
PoEntry->MsgCtxt = ConditionIdentityForPOMsgCtxt(Namespace, Context.Key, Context.KeyMetadataObj);
PoEntry->MsgStr.Add( ConditionedArchiveTranslation );
const FString PORefString = ConvertSrcLocationToPORef( Context.SourceLocation );
PoEntry->AddReference(PORefString); // Source location.
PoEntry->AddExtractedComment( GetConditionedKeyForExtractedComment(Context.Key) ); // "Notes from Programmer" in the form of the Key.
if (ShouldAddSourceLocationsAsComments)
{
PoEntry->AddExtractedComment(GetConditionedReferenceForExtractedComment(PORefString)); // "Notes from Programmer" in the form of the Source Location, since this comes in handy too and OneSky doesn't properly show references, only comments.
}
TArray<FString> InfoMetaDataStrings;
if (Context.InfoMetadataObj.IsValid())
{
for (auto InfoMetaDataPair : Context.InfoMetadataObj->Values)
{
const FString KeyName = InfoMetaDataPair.Key;
const TSharedPtr<FLocMetadataValue> Value = InfoMetaDataPair.Value;
InfoMetaDataStrings.Add(GetConditionedInfoMetaDataForExtractedComment(KeyName, Value->AsString()));
}
}
if (InfoMetaDataStrings.Num())
{
PoEntry->AddExtractedComments(InfoMetaDataStrings);
}
NewPortableObject.AddEntry( PoEntry );
}
}
// If we're exporting for something other than the native culture, we'll need to create PO entries for archive entries based on the native archive's translation.
if (CultureName != NativeCultureName)
{
TSharedPtr<FArchiveEntry> NativeArchiveEntry;
// Find the native archive entry which matches the exact same namespace, source, and key metadata, if it exists.
示例2: DoExport
//.........这里部分代码省略.........
{
UE_LOG( LogInternationalizationExportCommandlet, Error, TEXT("Skipping export of loc language %s because it is not recognized."), *LocLang );
continue;
}
PortableObj.SetProjectName( FPaths::GetBaseFilename( ManifestName ) );
PortableObj.CreateNewHeader();
{
for(TManifestEntryBySourceTextContainer::TConstIterator ManifestIter = InternationalizationManifest->GetEntriesBySourceTextIterator(); ManifestIter; ++ManifestIter)
{
// Gather relevant info from manifest entry.
const TSharedRef<FManifestEntry>& ManifestEntry = ManifestIter.Value();
const FString& Namespace = ManifestEntry->Namespace;
const FLocItem& Source = ManifestEntry->Source;
for( auto ContextIter = ManifestEntry->Contexts.CreateConstIterator(); ContextIter; ++ContextIter )
{
{
const TSharedPtr<FArchiveEntry> ArchiveEntry = InternationalizationArchive->FindEntryBySource( Namespace, Source, ContextIter->KeyMetadataObj );
if( ArchiveEntry.IsValid() )
{
const FString ConditionedArchiveSource = ConditionArchiveStrForPo(ArchiveEntry->Source.Text);
const FString ConditionedArchiveTranslation = ConditionArchiveStrForPo(ArchiveEntry->Translation.Text);
TSharedRef<FPortableObjectEntry> PoEntry = MakeShareable( new FPortableObjectEntry );
//@TODO: We support additional metadata entries that can be translated. How do those fit in the PO file format? Ex: isMature
PoEntry->MsgId = ConditionedArchiveSource;
//@TODO: Take into account optional entries and entries that differ by keymetadata. Ex. Each optional entry needs a unique msgCtxt
PoEntry->MsgCtxt = Namespace;
PoEntry->MsgStr.Add( ConditionedArchiveTranslation );
FString PORefString = ConvertSrcLocationToPORef( ContextIter->SourceLocation );
PoEntry->AddReference( PORefString ); // Source location.
PoEntry->AddExtractedComment( ContextIter->Key ); // "Notes from Programmer" in the form of the Key.
PoEntry->AddExtractedComment( PORefString ); // "Notes from Programmer" in the form of the Source Location, since this comes in handy too and OneSky doesn't properly show references, only comments.
PortableObj.AddEntry( PoEntry );
}
}
if (CultureName != NativeCultureName)
{
TSharedPtr<FArchiveEntry> NativeArchiveEntry;
for (const auto& NativeArchive : NativeArchives)
{
const TSharedPtr<FArchiveEntry> PotentialNativeArchiveEntry = NativeArchive->FindEntryBySource( Namespace, Source, ContextIter->KeyMetadataObj );
if (PotentialNativeArchiveEntry.IsValid())
{
NativeArchiveEntry = PotentialNativeArchiveEntry;
break;
}
}
if (NativeArchiveEntry.IsValid())
{
if (!NativeArchiveEntry->Source.IsExactMatch(NativeArchiveEntry->Translation))
{
const TSharedPtr<FArchiveEntry> ArchiveEntry = InternationalizationArchive->FindEntryBySource( Namespace, NativeArchiveEntry->Translation, NativeArchiveEntry->KeyMetadataObj );
const FString ConditionedArchiveSource = ConditionArchiveStrForPo(ArchiveEntry->Source.Text);
const FString ConditionedArchiveTranslation = ConditionArchiveStrForPo(ArchiveEntry->Translation.Text);
TSharedRef<FPortableObjectEntry> PoEntry = MakeShareable( new FPortableObjectEntry );
//@TODO: We support additional metadata entries that can be translated. How do those fit in the PO file format? Ex: isMature
PoEntry->MsgId = ConditionedArchiveSource;
//@TODO: Take into account optional entries and entries that differ by keymetadata. Ex. Each optional entry needs a unique msgCtxt