void UGenerateGatherArchiveCommandlet::AppendArchiveData( TSharedRef< const FInternationalizationArchive > InArchiveToAppend, TSharedRef< FInternationalizationArchive > ArchiveCombined ) { for(TArchiveEntryContainer::TConstIterator It( InArchiveToAppend->GetEntryIterator() ); It; ++It) { const TSharedRef<FArchiveEntry> EntryToAppend = It.Value(); ArchiveCombined->AddEntry( EntryToAppend ); } }
void FJsonInternationalizationArchiveSerializer::GenerateStructuredData( TSharedRef< const FInternationalizationArchive > InInternationalizationArchive, TSharedPtr<FStructuredArchiveEntry> RootElement ) { //Loop through all the unstructured archive entries and build up our structured hierarchy for(TArchiveEntryContainer::TConstIterator It( InInternationalizationArchive->GetEntryIterator() ); It; ++It) { const TSharedRef< FArchiveEntry > UnstructuredArchiveEntry = It.Value(); TArray< FString > NamespaceTokens; // Tokenize the namespace by using '.' as a delimiter int32 NamespaceTokenCount = UnstructuredArchiveEntry->Namespace.ParseIntoArray( NamespaceTokens, *NAMESPACE_DELIMITER, true ); TSharedPtr< FStructuredArchiveEntry > StructuredArchiveEntry = RootElement; //Loop through all the namespace tokens and find the appropriate structured entry, if it does not exist add it. At the end StructuredArchiveEntry // will point to the correct hierarchy entry for a given namespace for( int32 TokenIndex = 0; TokenIndex < NamespaceTokenCount; ++TokenIndex ) { TSharedPtr<FStructuredArchiveEntry> FoundNamespaceEntry; for( int SubNamespaceIndex = 0; SubNamespaceIndex < StructuredArchiveEntry->SubNamespaces.Num(); SubNamespaceIndex++ ) { if( StructuredArchiveEntry->SubNamespaces[SubNamespaceIndex]->Namespace == NamespaceTokens[TokenIndex] ) { FoundNamespaceEntry = StructuredArchiveEntry->SubNamespaces[SubNamespaceIndex]; break; } } if( !FoundNamespaceEntry.IsValid() ) { int32 index = StructuredArchiveEntry->SubNamespaces.Add( MakeShareable( new FStructuredArchiveEntry( NamespaceTokens[TokenIndex] ) ) ); FoundNamespaceEntry = StructuredArchiveEntry->SubNamespaces[index]; } StructuredArchiveEntry = FoundNamespaceEntry; } // We add the unstructured Archive entry to the hierarchy StructuredArchiveEntry->ArchiveEntries.AddUnique( UnstructuredArchiveEntry ); } }