当前位置: 首页>>代码示例>>C++>>正文


C++ TMap::GenerateValueArray方法代码示例

本文整理汇总了C++中TMap::GenerateValueArray方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::GenerateValueArray方法的具体用法?C++ TMap::GenerateValueArray怎么用?C++ TMap::GenerateValueArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TMap的用法示例。


在下文中一共展示了TMap::GenerateValueArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EnumerateEngineInstallations

void FDesktopPlatformWindows::EnumerateEngineInstallations(TMap<FString, FString> &OutInstallations)
{
	// Enumerate the binary installations
	EnumerateLauncherEngineInstallations(OutInstallations);

	// Enumerate the per-user installations
	HKEY hKey;
	if (RegOpenKeyEx(HKEY_CURRENT_USER, InstallationsSubKey, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
	{
		// Get a list of all the directories
		TArray<FString> UniqueDirectories;
		OutInstallations.GenerateValueArray(UniqueDirectories);

		// Enumerate all the installations
		TArray<FString> InvalidKeys;
		for (::DWORD Index = 0;; Index++)
		{
			TCHAR ValueName[256];
			TCHAR ValueData[MAX_PATH];
			::DWORD ValueType = 0;
			::DWORD ValueNameLength = sizeof(ValueName) / sizeof(ValueName[0]);
			::DWORD ValueDataSize = sizeof(ValueData);

			LRESULT Result = RegEnumValue(hKey, Index, ValueName, &ValueNameLength, NULL, &ValueType, (BYTE*)&ValueData[0], &ValueDataSize);
			if(Result == ERROR_SUCCESS)
			{
				int32 ValueDataLength = ValueDataSize / sizeof(TCHAR);
				if(ValueDataLength > 0 && ValueData[ValueDataLength - 1] == 0) ValueDataLength--;

				FString NormalizedInstalledDirectory(ValueDataLength, ValueData);
				FPaths::NormalizeDirectoryName(NormalizedInstalledDirectory);
				FPaths::CollapseRelativeDirectories(NormalizedInstalledDirectory);

				if(IsValidRootDirectory(NormalizedInstalledDirectory) && !UniqueDirectories.Contains(NormalizedInstalledDirectory))
				{
					OutInstallations.Add(ValueName, NormalizedInstalledDirectory);
					UniqueDirectories.Add(NormalizedInstalledDirectory);
				}
				else
				{
					InvalidKeys.Add(ValueName);
				}
			}
			else if(Result == ERROR_NO_MORE_ITEMS)
			{
				break;
			}
		}

		// Remove all the keys which weren't valid
		for(const FString InvalidKey: InvalidKeys)
		{
			RegDeleteValue(hKey, *InvalidKey);
		}

		RegCloseKey(hKey);
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:58,代码来源:DesktopPlatformWindows.cpp

示例2: ResetLoaders

//
// Empty the loaders.
//
void ResetLoaders( UObject* InPkg )
{
	// Make sure we're not in the middle of loading something in the background.
	FlushAsyncLoading();

	// Top level package to reset loaders for.
	UObject*		TopLevelPackage = InPkg ? InPkg->GetOutermost() : NULL;

	// Find loader/ linker associated with toplevel package. We do this upfront as Detach resets LinkerRoot.
	if( TopLevelPackage )
	{
		// Linker to reset/ detach.
		ULinkerLoad* LinkerToReset = ULinkerLoad::FindExistingLinkerForPackage(CastChecked<UPackage>(TopLevelPackage));
		if ( LinkerToReset )
		{
			for (TMap<UPackage*, ULinkerLoad*>::TIterator It(GObjLoaders); It; ++It)
			{
				ULinkerLoad* Linker = It.Value();
				// Detach LinkerToReset from other linker's import table.
				if( Linker->LinkerRoot != TopLevelPackage )
				{
					for( int32 j=0; j<Linker->ImportMap.Num(); j++ )
					{
						if( Linker->ImportMap[j].SourceLinker == LinkerToReset )
						{
							Linker->ImportMap[j].SourceLinker	= NULL;
							Linker->ImportMap[j].SourceIndex	= INDEX_NONE;
						}
					}
				}
				else
				{
					check(Linker == LinkerToReset);
				}
			}
			// Detach linker, also removes from array and sets LinkerRoot to NULL.
			LinkerToReset->Detach(true);
		}
	}
	else
	{
		TArray<ULinkerLoad *> LinkersToDetach;
		GObjLoaders.GenerateValueArray(LinkersToDetach);

		for (int32 Index = 0; Index < LinkersToDetach.Num(); Index++)
		{
			ULinkerLoad* Linker = LinkersToDetach[Index];
			// Detach linker, also removes from array and sets LinkerRoot to NULL.
			Linker->Detach(true);
		}
	}

}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:56,代码来源:Linker.cpp

示例3: ReplaceInstancesOfClass


//.........这里部分代码省略.........
				OldObject->RemoveFromRoot();
				OldObject->MarkPendingKill();

				OldToNewInstanceMap.Add(OldObject, NewUObject);

				if (bIsComponent)
				{
					UActorComponent* Component = Cast<UActorComponent>(NewUObject);
					AActor* OwningActor = Component->GetOwner();
					if (OwningActor)
					{
						OwningActor->ResetOwnedComponents();

						// Check to see if they have an editor that potentially needs to be refreshed
						if (OwningActor->GetClass()->ClassGeneratedBy)
						{
							PotentialEditorsForRefreshing.AddUnique(OwningActor->GetClass()->ClassGeneratedBy);
						}

						// we need to keep track of actor instances that need 
						// their construction scripts re-ran (since we've just 
						// replaced a component they own)
						OwnersToReconstruct.Add(OwningActor);
					}
				}
			}

			// If this original object came from a blueprint and it was in the selected debug set, change the debugging to the new object.
			if ((CorrespondingBlueprint) && (OldBlueprintDebugObject) && (NewUObject))
			{
				CorrespondingBlueprint->SetObjectBeingDebugged(NewUObject);
			}

			if (bLogConversions)
			{
				UE_LOG(LogBlueprint, Log, TEXT("Converted instance '%s' to '%s'"), *OldObject->GetPathName(), *NewUObject->GetPathName());
			}
		}
	}

	GEditor->OnObjectsReplaced().Remove(OnObjectsReplacedHandle);

	// Now replace any pointers to the old archetypes/instances with pointers to the new one
	TArray<UObject*> SourceObjects;
	TArray<UObject*> DstObjects;

	OldToNewInstanceMap.GenerateKeyArray(SourceObjects);
	OldToNewInstanceMap.GenerateValueArray(DstObjects); // Also look for references in new spawned objects.

	SourceObjects.Append(DstObjects);

	FReplaceReferenceHelper::IncludeCDO(OldClass, NewClass, OldToNewInstanceMap, SourceObjects, OriginalCDO);
	FReplaceReferenceHelper::FindAndReplaceReferences(SourceObjects, ObjectsThatShouldUseOldStuff, ObjectsToReplace, OldToNewInstanceMap, ReinstancedObjectsWeakReferenceMap);

	{ BP_SCOPED_COMPILER_EVENT_STAT(EKismetReinstancerStats_ReplacementConstruction);

		// the process of setting up new replacement actors is split into two 
		// steps (this here, is the second)...
		// 
		// the "finalization" here runs the replacement actor's construction-
		// script and is left until late to account for a scenario where the 
		// construction-script attempts to modify another instance of the 
		// same class... if this were to happen above, in the ObjectsToReplace 
		// loop, then accessing that other instance would cause an assert in 
		// UProperty::ContainerPtrToValuePtrInternal() (which appropriatly 
		// complains that the other instance's type doesn't match because it 
		// hasn't been replaced yet... that's why we wait until after 
		// FArchiveReplaceObjectRef to run construction-scripts).
		for (FActorReplacementHelper& ReplacementActor : ReplacementActors)
		{
			ReplacementActor.Finalize(ObjectRemappingHelper.ReplacedObjects);
		}
	}

	SelectedActors->EndBatchSelectOperation();
	if (bSelectionChanged)
	{
		GEditor->NoteSelectionChange();
	}

	if (GEditor)
	{
		// Refresh any editors for objects that we've updated components for
		for (auto BlueprintAsset : PotentialEditorsForRefreshing)
		{
			FBlueprintEditor* BlueprintEditor = static_cast<FBlueprintEditor*>(FAssetEditorManager::Get().FindEditorForAsset(BlueprintAsset, /*bFocusIfOpen =*/false));
			if (BlueprintEditor)
			{
				BlueprintEditor->RefreshEditors();
			}
		}
	}

	// in the case where we're replacing component instances, we need to make 
	// sure to re-run their owner's construction scripts
	for (AActor* ActorInstance : OwnersToReconstruct)
	{
		ActorInstance->RerunConstructionScripts();
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:101,代码来源:KismetReinstanceUtilities.cpp

示例4: DisplayProfileData

	void DisplayProfileData( const TMap< FString, TSharedPtr< struct FProfiledFileStatsFileBase > >& InProfileData )
	{
		TArray< TSharedPtr<FProfiledFileStatsFileBase> > ProfileData;
		InProfileData.GenerateValueArray( ProfileData );

		// Single root data is required for bar visualizer to work properly
		TSharedPtr< FVisualizerEvent > RootEvent( new FVisualizerEvent( 0.0, 1.0, 0.0, 0, TEXT("I/O") ) );

		// Calculate Start time first
		double StartTimeMs = FPlatformTime::Seconds() * 1000.0; // All timings happened before now
		double EndTimeMs = 0.0;

		for( int32 Index = 0; Index < ProfileData.Num(); Index++ )
		{
			TSharedPtr<FProfiledFileStatsFileBase> FileStat = ProfileData[ Index ];
			double FileDurationMs = 0.0;
			for( int32 ChildIndex = 0; ChildIndex < FileStat->Children.Num(); ChildIndex++ )
			{
				TSharedPtr<FProfiledFileStatsOp> FileOpStat = FileStat->Children[ ChildIndex ];
				if( FileOpStat->Duration > 0.0 )
				{
					StartTimeMs = FMath::Min( FileOpStat->StartTime, StartTimeMs );
					EndTimeMs = FMath::Max( FileOpStat->StartTime + FileOpStat->Duration, EndTimeMs );
					FileDurationMs += FileOpStat->Duration;
				}
			}

			// Create an event for each of the files
			TSharedPtr< FVisualizerEvent > FileEvent( new FVisualizerEvent( 0.0, 1.0, FileDurationMs, Index, FileStat->Name ) );
			FileEvent->ParentEvent = RootEvent;
			RootEvent->Children.Add( FileEvent );
		}

		const double TotalTimeMs = EndTimeMs - StartTimeMs;
		RootEvent->DurationMs = TotalTimeMs;

		for( int32 FileIndex = 0; FileIndex < ProfileData.Num(); FileIndex++ )
		{
			TSharedPtr<FProfiledFileStatsFileBase> FileStat = ProfileData[ FileIndex ];
			TSharedPtr<FVisualizerEvent> FileEvent( RootEvent->Children[ FileIndex ] );

			for( int32 ChildIndex = 0; ChildIndex < FileStat->Children.Num(); ChildIndex++ )
			{
				TSharedPtr<FProfiledFileStatsOp> FileOpStat = FileStat->Children[ ChildIndex ];
				if( FileOpStat->Duration > 0.0 )
				{
					FString EventName;
					switch( FileOpStat->Type )
					{
						case FProfiledFileStatsOp::Tell:
							EventName = TEXT("Tell"); break;
						case FProfiledFileStatsOp::Seek:
							EventName = TEXT("Seek"); break;
						case FProfiledFileStatsOp::Read:
							EventName = FString::Printf( TEXT("Read (%lld)"), FileOpStat->Bytes ); break;
						case FProfiledFileStatsOp::Write:
							EventName = FString::Printf( TEXT("Write (%lld)"), FileOpStat->Bytes ); break;
						case FProfiledFileStatsOp::Size:
							EventName = TEXT("Size"); break;
						case FProfiledFileStatsOp::OpenRead:
							EventName = TEXT("OpenRead"); break;
						case FProfiledFileStatsOp::OpenWrite:
							EventName = TEXT("OpenWrite"); break;
						case FProfiledFileStatsOp::Exists:
							EventName = TEXT("Exists"); break;
						case FProfiledFileStatsOp::Delete:
							EventName = TEXT("Delete"); break;
						case FProfiledFileStatsOp::Move:
							EventName = TEXT("Move"); break;
						case FProfiledFileStatsOp::IsReadOnly:
							EventName = TEXT("IsReadOnly"); break;
						case FProfiledFileStatsOp::SetReadOnly:
							EventName = TEXT("SetReadOnly"); break;
						case FProfiledFileStatsOp::GetTimeStamp:
							EventName = TEXT("GetTimeStamp"); break;
						case FProfiledFileStatsOp::SetTimeStamp:
							EventName = TEXT("SetTimeStamp"); break;
						case FProfiledFileStatsOp::Create:
							EventName = TEXT("Create"); break;
						case FProfiledFileStatsOp::Copy:
							EventName = TEXT("Copy"); break;
						case FProfiledFileStatsOp::Iterate:
							EventName = TEXT("Iterate"); break;
						default:
							EventName = TEXT("Unknown"); break;
					}

					const double StartTime = ( FileOpStat->StartTime - StartTimeMs ) / TotalTimeMs;
					const double DurationTime = FileOpStat->Duration / TotalTimeMs;
					TSharedPtr<FVisualizerEvent> ChildEvent( new FVisualizerEvent( StartTime, DurationTime, FileOpStat->Duration, FileIndex, EventName ) );
					ChildEvent->ParentEvent = FileEvent;
					FileEvent->Children.Add( ChildEvent );
				}
			}	
		}

		static FName TaskGraphModule(TEXT("TaskGraph"));
		if (FModuleManager::Get().IsModuleLoaded(TaskGraphModule))
		{
			IProfileVisualizerModule& ProfileVisualizer = FModuleManager::GetModuleChecked<IProfileVisualizerModule>(TaskGraphModule);
//.........这里部分代码省略.........
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:101,代码来源:LevelTick.cpp


注:本文中的TMap::GenerateValueArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。