• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetRestoreFilename

TMap<FString, FString> PackageAutoSaverJson::LoadRestoreFile()
{
	TMap<FString, FString> PackagesThatCanBeRestored;

	const FString Filename = GetRestoreFilename(false);
	FArchive* const FileAr = IFileManager::Get().CreateFileReader(*Filename);
	if(!FileAr)
	{
		// File doesn't exist; nothing to restore
		return PackagesThatCanBeRestored;
	}

	bool bJsonLoaded = false;
	TSharedPtr<FJsonObject> RootObject = MakeShareable(new FJsonObject);
	{
		TSharedRef<FJsonReader> Reader = FJsonReaderFactory::Create(FileAr);
		bJsonLoaded = FJsonSerializer::Deserialize(Reader, RootObject);		
		FileAr->Close();
	}

	if(!bJsonLoaded || !RootObject->GetBoolField(TagRestoreEnabled))
	{
		// File failed to load, or the restore is disabled; nothing to restore
		return PackagesThatCanBeRestored;
	}

	TArray< TSharedPtr<FJsonValue> > PackagesThatCanBeRestoredArray = RootObject->GetArrayField(TagPackages);
	for(auto It = PackagesThatCanBeRestoredArray.CreateConstIterator(); It; ++It)
	{
		TSharedPtr<FJsonObject> EntryObject = (*It)->AsObject();

		const FString PackagePathName = EntryObject->GetStringField(TagPackagePathName);
		const FString AutoSavePath = EntryObject->GetStringField(TagAutoSavePath);
		PackagesThatCanBeRestored.Add(PackagePathName, AutoSavePath);
	}

	return PackagesThatCanBeRestored;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:38,代码来源:PackageAutoSaver.cpp


示例2: HandleTicker

bool FRawProfilerSession::HandleTicker( float DeltaTime )
{
#if	0
	StatsThreadStats;
	Stream;

	enum
	{
		MAX_NUM_DATA_PER_TICK = 30
	};
	int32 NumDataThisTick = 0;

	// Add the data to the mini-view.
	for( int32 FrameIndex = CurrentMiniViewFrame; FrameIndex < Stream.FramesInfo.Num(); ++FrameIndex )
	{
		const FStatsFrameInfo& StatsFrameInfo = Stream.FramesInfo[FrameIndex];
		// Convert from cycles to ms.
		TMap<uint32, float> ThreadMS;
		for( auto InnerIt = StatsFrameInfo.ThreadCycles.CreateConstIterator(); InnerIt; ++InnerIt )
		{
			ThreadMS.Add( InnerIt.Key(), StatMetaData->ConvertCyclesToMS( InnerIt.Value() ) );
		}

		// Pass the reference to the stats' metadata.
		// @TODO yrx 2014-04-03 Figure out something better later.
		OnAddThreadTime.ExecuteIfBound( FrameIndex, ThreadMS, StatMetaData );

		//CurrentMiniViewFrame++;
		NumDataThisTick++;
		if( NumDataThisTick > MAX_NUM_DATA_PER_TICK )
		{
			break;
		}
	}
#endif // 0

	return true;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:38,代码来源:ProfilerSession.cpp


示例3: BOOST_AUTO_TEST_CASE_TEMPLATE

/**
 * insert
 */                                        
BOOST_AUTO_TEST_CASE_TEMPLATE(stest_insert, TMap, test_types) {
    // insert x values, insert them again, check values
    using char_tt = typename TMap::char_type; 
    
    const size_t nb_values = 100000;
    TMap set;
    typename TMap::iterator it;
    bool inserted;
    
    for(size_t i = 0; i < nb_values; i++) {
        std::tie(it, inserted) = set.insert(utils::get_key<char_tt>(i));
        
        BOOST_CHECK_EQUAL(it.key(), (utils::get_key<char_tt>(i)));
        BOOST_CHECK(inserted);
    }
    BOOST_CHECK_EQUAL(set.size(), nb_values);
    
    for(size_t i = 0; i < nb_values; i++) {
        std::tie(it, inserted) = set.insert(utils::get_key<char_tt>(i));
        
        BOOST_CHECK_EQUAL(it.key(), (utils::get_key<char_tt>(i)));
        BOOST_CHECK(!inserted);
    }
    
    for(size_t i = 0; i < nb_values; i++) {
        it = set.find(utils::get_key<char_tt>(i));
        
        BOOST_CHECK(it != set.end());
        BOOST_CHECK_EQUAL(it.key(), (utils::get_key<char_tt>(i)));
    }
    
    for(auto it = set.begin(); it != set.end(); ++it) {
        auto it_find = set.find(it.key());
        
        BOOST_CHECK(it_find != set.end());
        BOOST_CHECK_EQUAL(it_find.key(), it.key());
    }
}
开发者ID:LinJM,项目名称:hat-trie,代码行数:41,代码来源:trie_set_tests.cpp


示例4: ldvcellValidaObj

void ldvcellValidaObj(RayCell c, const TMap & map, Objetos_t & obj, int nivelMech){
  THex * infoCell = NULL;
  THex * infoCellAlt = NULL;
  Objetos_t objCell, objCellAlt;
  
  // Vemos los objetos en el hexagono
  infoCell = map.getHex( c.p );
  if( infoCell != NULL && (infoCell->nivel + 2) > nivelMech ){
    if( infoCell->objeto == 2 )
      objCell.bosqueDenso++;
    else if( infoCell->humo )
      objCell.humo++;
    else if( infoCell->objeto == 1 )
      objCell.bosqueDisperso++;
  }
  
  // Vemos los objetos en el Hexagono alternativo
  // En caso de existir
  if( c.alt != NULL ){
    infoCellAlt = map.getHex( *c.alt );
    if( infoCellAlt != NULL && (infoCellAlt->nivel + 2) > nivelMech){
      if( infoCellAlt->objeto == 2 )
	objCellAlt.bosqueDenso++;
      else if( infoCellAlt->humo )
	objCellAlt.humo++;
      else if( infoCellAlt->objeto == 1 )
	objCellAlt.bosqueDisperso++;
    }
  }

  // Comparamos a ver que Hexagono penaliza mas
  if(objCell.bosqueDenso > 0 || objCellAlt.bosqueDenso > 0)
    obj.bosqueDenso++;
  else if(objCell.humo > 0 || objCellAlt.humo > 0)
    obj.humo++;
  else if(objCell.bosqueDisperso > 0 || objCellAlt.bosqueDisperso > 0)
    obj.bosqueDisperso++;  
}
开发者ID:Josan-Coba,项目名称:agico,代码行数:38,代码来源:LdVyC.cpp


示例5: CustomizeChildren

void FCameraFilmbackSettingsCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
	// Retrieve structure's child properties
	uint32 NumChildren;
	StructPropertyHandle->GetNumChildren( NumChildren );	
	TMap<FName, TSharedPtr< IPropertyHandle > > PropertyHandles;	
	for( uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex )
	{
		TSharedRef<IPropertyHandle> ChildHandle = StructPropertyHandle->GetChildHandle( ChildIndex ).ToSharedRef();
		const FName PropertyName = ChildHandle->GetProperty()->GetFName();

		PropertyHandles.Add(PropertyName, ChildHandle);
	}
	
	// Retrieve special case properties
	SensorWidthHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraFilmbackSettings, SensorWidth));
	SensorHeightHandle = PropertyHandles.FindChecked(GET_MEMBER_NAME_CHECKED(FCameraFilmbackSettings, SensorHeight));

	for( auto Iter(PropertyHandles.CreateConstIterator()); Iter; ++Iter  )
	{
		IDetailPropertyRow& SettingsRow = ChildBuilder.AddChildProperty(Iter.Value().ToSharedRef());
	}	
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:23,代码来源:CameraFilmbackSettingsCustomization.cpp


示例6: VerifyFormatVersions

	void VerifyFormatVersions(TMap<FString, uint16>& ReceivedFormatVersionMap)
	{
		for (auto Pair : ReceivedFormatVersionMap)
		{
			auto* Found = FormatVersionMap.Find(Pair.Key);
			if (Found)
			{
				GFailedDueToShaderFormatVersion = true;
				FCString::Snprintf(GErrorExceptionDescription, sizeof(GErrorExceptionDescription), TEXT("Mismatched shader version for format %s; did you forget to build ShaderCompilerWorker?"), *Pair.Key, *Found, Pair.Value);

				checkf(Pair.Value == *Found, TEXT("Exiting due to mismatched shader version for format %s, version %d from ShaderCompilerWorker, received %d! Did you forget to build ShaderCompilerWorker?"), *Pair.Key, *Found, Pair.Value);
			}
		}
	}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:14,代码来源:ShaderCompileWorker.cpp


示例7:

bool FD3DGPUProfiler::FinishProfiling(TMap<int32, double>& OutEventIdToTimestampMap, ID3D11DeviceContext* Direct3DDeviceIMContext)
{
	bool bSuccess = true;

	check(CurrentGPUProfile);

	// Get the disjoint timestamp query result.
	CurrentGPUProfile->DisjointQuery.EndTracking();
	D3D11_QUERY_DATA_TIMESTAMP_DISJOINT DisjointQueryResult = CurrentGPUProfile->DisjointQuery.GetResult();
	if(DisjointQueryResult.Disjoint)
	{
		bSuccess = false;
	}
	else
	{
		// Read back the timestamp query results.
		for(int32 EventIndex = 0;EventIndex < CurrentGPUProfile->EventTimestampQueries.Num();++EventIndex)
		{
			TRefCountPtr<ID3D11Query> EventTimestampQuery = CurrentGPUProfile->EventTimestampQueries[EventIndex];

			uint64 EventTimestamp;
			const double StartTime = FPlatformTime::Seconds();
			HRESULT QueryGetDataResult;
			while(true)
			{
				QueryGetDataResult = Direct3DDeviceIMContext->GetData(EventTimestampQuery,&EventTimestamp,sizeof(EventTimestamp),0);
				if(QueryGetDataResult == S_FALSE && (FPlatformTime::Seconds() - StartTime) < 0.5)
				{
					FPlatformProcess::Sleep(0.005f);
				}
				else
				{
					break;
				}
			}
			if(QueryGetDataResult != S_OK)
			{
				bSuccess = false;
				break;
			}
			else
			{
				OutEventIdToTimestampMap.Add(EventIndex,(double)EventTimestamp / (double)DisjointQueryResult.Frequency);
			}
		}
	}

	CurrentGPUProfile.Reset();
	return bSuccess;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:50,代码来源:D3D11RHI.cpp


示例8: FindDataSample

bool FindDataSample(const TMap &lookup, TObjArray &sampleinfis){
        //
        // Find Data sample in the list of samples
        //
        TObjArray *entry = dynamic_cast<TObjArray *>(lookup.GetValue(g_sample.Data()));
        if(!entry){
                printf("Sample %s not found in the list of samples", g_sample.Data());
                return false;
        }
        // Copy to output container
        sampleinfis.SetOwner(kFALSE);
        for(int ival = 0; ival < 4; ival++) sampleinfis.AddAt(entry->At(ival), ival);
        return true;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:14,代码来源:runGridpPb.C


示例9: Accessor

void UJavascriptEditorLibrary::GetHeightmapDataToMemory(ULandscapeInfo* LandscapeInfo, int32 MinX, int32 MinY, int32 MaxX, int32 MaxY)
{
	const int32 SizeX = (1 + MaxX - MinX);
	const int32 SizeY = (1 + MaxY - MinY);

	if (SizeX * SizeY * 2 == FArrayBufferAccessor::GetSize())
	{
		auto Buffer = (uint16*)FArrayBufferAccessor::GetData();

		FHeightmapAccessor<false> Accessor(LandscapeInfo);

		TMap<FIntPoint, uint16> Data;
		Accessor.GetData(MinX, MinY, MaxX, MaxY, Data);

		FMemory::Memzero(Buffer, SizeX * SizeY * 2);

		for (auto it = Data.CreateConstIterator(); it; ++it)
		{
			const auto& Point = it.Key();
			Buffer[Point.X + Point.Y * SizeX] = it.Value();
		}
	}
}
开发者ID:Grinkers,项目名称:Unreal.js,代码行数:23,代码来源:JavascriptEditorLibrary.cpp


示例10: assert

ALWAYS_INLINE
typename std::enable_if<
  std::is_base_of<BaseMap, TMap>::value, Object>::type
BaseMap::php_differenceByKey(const Variant& it) {
  if (!it.isObject()) {
    SystemLib::throwInvalidArgumentExceptionObject(
               "Parameter it must be an instance of Iterable");
  }
  ObjectData* obj = it.getObjectData();
  TMap* target = BaseMap::Clone<TMap>(this);
  auto ret = Object::attach(target);
  if (obj->isCollection()) {
    if (isMapCollection(obj->collectionType())) {
      auto map = static_cast<BaseMap*>(obj);
      auto* eLimit = map->elmLimit();
      for (auto* e = map->firstElm(); e != eLimit; e = nextElm(e, eLimit)) {
        if (e->hasIntKey()) {
          target->remove((int64_t)e->ikey);
        } else {
          assert(e->hasStrKey());
          target->remove(e->skey);
        }
      }
      return ret;
    }
  }
  for (ArrayIter iter(obj); iter; ++iter) {
    Variant k = iter.first();
    if (k.isInteger()) {
      target->remove(k.toInt64());
    } else {
      assert(k.isString());
      target->remove(k.getStringData());
    }
  }
  return ret;
}
开发者ID:gamer7569,项目名称:hhvm,代码行数:37,代码来源:ext_collections-map.cpp


示例11: TEXT

void FGlobalShaderMapId::AppendKeyString(FString& KeyString) const
{
	TMap<const TCHAR*,FCachedUniformBufferDeclaration> ReferencedUniformBuffers;

	for (int32 ShaderIndex = 0; ShaderIndex < ShaderTypeDependencies.Num(); ShaderIndex++)
	{
		KeyString += TEXT("_");
		const FShaderTypeDependency& ShaderTypeDependency = ShaderTypeDependencies[ShaderIndex];
		KeyString += ShaderTypeDependency.ShaderType->GetName();

		// Add the type's source hash so that we can invalidate cached shaders when .usf changes are made
		KeyString += ShaderTypeDependency.SourceHash.ToString();

		// Add the serialization history to the key string so that we can detect changes to global shader serialization without a corresponding .usf change
		ShaderTypeDependency.ShaderType->GetSerializationHistory().AppendKeyString(KeyString);

		const TMap<const TCHAR*,FCachedUniformBufferDeclaration>& ReferencedUniformBufferStructsCache = ShaderTypeDependency.ShaderType->GetReferencedUniformBufferStructsCache();

		// Gather referenced uniform buffers
		for (TMap<const TCHAR*,FCachedUniformBufferDeclaration>::TConstIterator It(ReferencedUniformBufferStructsCache); It; ++It)
		{
			ReferencedUniformBuffers.Add(It.Key(), It.Value());
		}
	}

	{
		TArray<uint8> TempData;
		FSerializationHistory SerializationHistory;
		FMemoryWriter Ar(TempData, true);
		FShaderSaveArchive SaveArchive(Ar, SerializationHistory);

		// Save uniform buffer member info so we can detect when layout has changed
		SerializeUniformBufferInfo(SaveArchive, ReferencedUniformBuffers);

		SerializationHistory.AppendKeyString(KeyString);
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:37,代码来源:GlobalShader.cpp


示例12: GetWorld

// Called when the game starts or when spawned
void AGridV1::BeginPlay()
{
	Super::BeginPlay();

	int32 HalfX = GridSize.X / 2;
	int32 HalfY = GridSize.Y / 2;
	int32 HalfZ = GridSize.Z / 2;

	FActorSpawnParameters param;
	param.Owner = this;

	for (int32 x = -HalfX; x < HalfX; x++)
	{
		for (int32 y = -HalfY; y < HalfY; y++)
		{
			for (int32 z = -HalfZ; z < HalfZ; z++)
			{
				ACellV1* cell = GetWorld()->SpawnActor<ACellV1>(FVector(x, y, z) * VoxelSize * CellSize, FRotator(), param);
				cell->GridPosition = FInt3(x, y, z);
				cell->Grid = this;
				cell->FutureData = Async<TMap<FInt3, uint16>>(EAsyncExecution::ThreadPool, []()
				{
					TMap<FInt3, uint16> ret;
					for (int32 i = 0; i < 32; i++)
						for (int32 j = 0; j < 32; j++)
							for (int32 k = 0; k < 32; k++)
								ret.Add(FInt3(i, j, k), 1);
					return ret;
				});
				cell->OngoingLoading = true;

				cell->Mesh->SetMaterial(0, Material);
				Data.Add(FInt3(x, y, z), cell);
			}
		}
	}
}
开发者ID:kkitsune,项目名称:VoxelGameUE,代码行数:38,代码来源:GridV1.cpp


示例13: UE_LOG

void FDirectoryWatchRequestLinux::UnwatchDirectoryTree(const FString & RootAbsolutePath)
{
	UE_LOG(LogDirectoryWatcher, VeryVerbose, TEXT("Unwatching tree '%s'"), *RootAbsolutePath);
	// remove the watch for the folder and all subfolders
	// since it is expected that there will be a lot of them, just create a new TMap
	TMap<FString, int32, FDefaultSetAllocator, FCaseSensitiveLookupKeyFuncs<int32>> NewPathsToWatchDescriptors;
	for (auto MapIt = PathsToWatchDescriptors.CreateIterator(); MapIt; ++MapIt)
	{
		if (!MapIt->Key.StartsWith(RootAbsolutePath, ESearchCase::CaseSensitive))
		{
			NewPathsToWatchDescriptors.Add(MapIt->Key, MapIt->Value);
		}
		else
		{
			UE_LOG(LogDirectoryWatcher, VeryVerbose, TEXT("- Removing a watch %d for '%s'"), MapIt->Value, *MapIt->Key);

			// delete the descriptor
			int RetVal = inotify_rm_watch(FileDescriptor, MapIt->Value);

			// why check for RootAbsolutePath? Because this function may be called when root path has been deleted, and inotify_rm_watch() will fail
			// removing a watch on a deleted file... yay for API symmetry. Just "leak" the watch descriptor without the warning
			if (RetVal == -1 || MapIt->Key != RootAbsolutePath)
			{
				int ErrNo = errno;
				UE_LOG(LogDirectoryWatcher, Error, TEXT("inotify_rm_watch cannot remove descriptor %d for folder '%s' (errno = %d, %s)"),
					MapIt->Value,
					*MapIt->Key,
					ErrNo,
					ANSI_TO_TCHAR(strerror(ErrNo))
				);
			}
			WatchDescriptorsToPaths.Remove(MapIt->Value);
		}
	}

	PathsToWatchDescriptors = NewPathsToWatchDescriptors;
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:37,代码来源:DirectoryWatchRequestLinux.cpp


示例14: r3blandsim

void r3blandsim(
  const Int_t n_neutrons,
  const Int_t n_events,
  const string neuland_geo_file,
  const string input_file,
  const string basename
){

  // Output files
  const TString out_file = "r3bsim." + basename + ".root";
  const TString par_file = "r3bpar." + basename + ".root";

  // Constant configuration
  const TString  target = "LiH";
  const TString  fMC   = "TGeant3";
  const TString  fGene = "ascii";
  const Bool_t   fEventDisplay = kTRUE;
  const Bool_t   fUserPList = kTRUE;
  const Bool_t   fR3BMagnet = kTRUE;
  const Double_t fMeasCurrent = 2500.; 

  // Geometry
  TMap geometry;
  geometry.Add(new TObjString("TARGET"),        new TObjString("target_" + target + ".geo.root"));
  geometry.Add(new TObjString("ALADIN"),        new TObjString("aladin_v13a.geo.root"));
  geometry.Add(new TObjString("CRYSTALBALL"),   new TObjString("cal_v13a.geo.root"));
  geometry.Add(new TObjString("DCH"),           new TObjString("dch_v13a.geo.root"));
  geometry.Add(new TObjString("SCINTNEULAND"),  new TObjString(TString(neuland_geo_file)));


  // Load the Main Simulation macro
  const TString macro_r3ball = TString(getenv("VMCWORKDIR")) + TString("/macros/r3b/r3ball.C");
  gROOT->LoadMacro(macro_r3ball.Data());

  // Main Sim function call
  r3ball( n_events, geometry, target, fEventDisplay, fMC, fGene, fUserPList, fR3BMagnet, fMeasCurrent, out_file, par_file, input_file);
}
开发者ID:MohammadAlTurany,项目名称:R3BRoot,代码行数:37,代码来源:r3blandsim.c


示例15: GatherMods

float FGAEffectModifiersContainer::GatherMods(const FGameplayTagContainer& TagsIn, const TMap<FGAGameEffectHandle, TArray<FGAGameEffectModifier>>& Data)
{
	//possible optimization when needed - create separate thread.

	float ModifierVal = 0;
	float Add = 0;
	float Multiply = 1;
	float Subtract = 0;
	float Divide = 1;
	float PercentageAdd = 0;
	float PercentageSubtract = 0;
	for (auto It = Data.CreateConstIterator(); It; ++It)
	{
		for (const FGAGameEffectModifier& Test : It->Value)
		{
			if (TagsIn.MatchesAll(Test.RequiredTags, false))
			{
				switch (Test.ModType)
				{
				case EGAAttributeMod::Add:
					Add += Test.Value;
					break;
				case EGAAttributeMod::Multiply:
					Multiply += Test.Value;
					break;
				case EGAAttributeMod::Subtract:
					Subtract += Test.Value;
					break;
				case EGAAttributeMod::Divide:
					Divide += Test.Value;
					break;
				case EGAAttributeMod::PercentageAdd:
					PercentageAdd += Test.Value;
					break;
				case EGAAttributeMod::PercentageSubtract:
					PercentageSubtract += Test.Value;
					break;
				default:
					break;
				}
			}
		}
	}
	ModifierVal = ((Add - Subtract) * Multiply) / Divide;
	ModifierVal = ModifierVal + (ModifierVal * PercentageAdd);
	ModifierVal = ModifierVal - (ModifierVal * PercentageSubtract);
	SCOPE_CYCLE_COUNTER(STAT_GatherModifiers);
	return ModifierVal;
}
开发者ID:MatrIsCool,项目名称:ActionRPGGame,代码行数:49,代码来源:GAGameEffect.cpp


示例16: CheckForUnsafeStates

//==========================================================================
//
// CheckForUnsafeStates
//
// Performs a quick analysis to find potentially bad states.
// This is not perfect because it cannot track jumps by function.
// For such cases a runtime check in the relevant places is also present.
//
//==========================================================================
static void CheckForUnsafeStates(PClassActor *obj)
{
	static ENamedName weaponstates[] = { NAME_Ready, NAME_Deselect, NAME_Select, NAME_Fire, NAME_AltFire, NAME_Hold, NAME_AltHold, NAME_Flash, NAME_AltFlash, NAME_None };
	static ENamedName pickupstates[] = { NAME_Pickup, NAME_Drop, NAME_Use, NAME_None };
	TMap<FState *, bool> checked;
	ENamedName *test;

	if (obj->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
	{
		if (obj->Size == RUNTIME_CLASS(AWeapon)->Size) return;	// This class cannot have user variables.
		test = weaponstates;
	}
	else if (obj->IsDescendantOf(RUNTIME_CLASS(ACustomInventory)))
	{
		if (obj->Size == RUNTIME_CLASS(ACustomInventory)->Size) return;	// This class cannot have user variables.
		test = pickupstates;
	}
	else return;	// something else derived from AStateProvider. We do not know what this may be.

	for (; *test != NAME_None; test++)
	{
		FState *state = obj->FindState(*test);
		while (state != nullptr && checked.CheckKey(state) == nullptr)	// have we checked this state already. If yes, we can stop checking the current chain.
		{
			checked[state] = true;
			if (state->ActionFunc && state->ActionFunc->Unsafe)
			{
				// If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash.
				auto owner = FState::StaticFindStateOwner(state);
				GetStateSource(state).Message(MSG_ERROR, TEXTCOLOR_RED "Unsafe state call in state %s.%d which accesses user variables, reached by %s.%s.\n",
					owner->TypeName.GetChars(), state - owner->OwnedStates, obj->TypeName.GetChars(), FName(*test).GetChars());
			}
			state = state->NextState;
		}
	}
}
开发者ID:dwing4g,项目名称:gzdoom,代码行数:45,代码来源:thingdef.cpp


示例17: ASSERT

void CStatCounterArray::Insert (const CString &sStat, int iCount, const CString &sSection, const CString &sSort)

//	Insert
//
//	Adds the given stat. If the stat already exists (by name) the counts are added

	{
	if (iCount == 0)
		return;

	ASSERT(!sStat.IsBlank());
	ASSERT(!sSection.IsBlank());

	//	First look for the section

	TMap<CString, SEntry> *pSection = m_Array.Find(sSection);
	if (pSection == NULL)
		pSection = m_Array.Insert(sSection);

	//	Next look for the entry

	SEntry *pEntry = pSection->Find(sStat);
	if (pEntry == NULL)
		{
		pEntry = pSection->Insert(sStat);
		pEntry->iCount = iCount;
		pEntry->sSort = sSort;
		}
	else
		{
		if (iCount > pEntry->iCount)
			pEntry->sSort = sSort;

		pEntry->iCount += iCount;
		}
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:36,代码来源:CPlayerGameStats.cpp


示例18: GenerateUnique

int CMarkovWordGenerator::GenerateUnique (int iCount, TArray<CString> *retArray)

//	GenerateUnique
//
//	Generates an array of unique words

	{
	int i;
	TMap<CString, DWORD> Generated;

	for (i = 0; i < iCount; i++)
		{
		int iTriesLeft = 500;

		while (iTriesLeft > 0)
			{
			//	Generate a random word

			CString sWord = Generate();

			//	Lookup the word in our map. If we found it,
			//	try again.

			if (Generated.Find(sWord))
				{
				iTriesLeft--;
				continue;
				}

			//	If it is unique, add it

			Generated.Insert(sWord, 1);
			break;
			}

		//	If we couldn't find a unique word, then quit

		if (iTriesLeft == 0)
			break;
		}

	//	Add the entries that we generated to the output array

	CMapIterator j;
	Generated.Reset(j);
	int iGeneratedCount = 0;
	while (Generated.HasMore(j))
		{
		DWORD *pDummy;
		CString sWord = Generated.GetNext(j, &pDummy);
		retArray->Insert(sWord);
		iGeneratedCount++;
		}

	return iGeneratedCount;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:56,代码来源:CMarkovWordGenerator.cpp


示例19: NewClass

FHotReloadClassReinstancer::FHotReloadClassReinstancer(UClass* InNewClass, UClass* InOldClass, TMap<UObject*, UObject*>& OutReconstructedCDOsMap, TSet<UBlueprint*>& InBPSetToRecompile, TSet<UBlueprint*>& InBPSetToRecompileBytecodeOnly)
	: NewClass(nullptr)
	, bNeedsReinstancing(false)
	, CopyOfPreviousCDO(nullptr)
	, ReconstructedCDOsMap(OutReconstructedCDOsMap)
	, BPSetToRecompile(InBPSetToRecompile)
	, BPSetToRecompileBytecodeOnly(InBPSetToRecompileBytecodeOnly)
{
	ensure(InOldClass);
	ensure(!HotReloadedOldClass && !HotReloadedNewClass);
	HotReloadedOldClass = InOldClass;
	HotReloadedNewClass = InNewClass ? InNewClass : InOldClass;

	// If InNewClass is NULL, then the old class has not changed after hot-reload.
	// However, we still need to check for changes to its constructor code (CDO values).
	if (InNewClass)
	{
		SetupNewClassReinstancing(InNewClass, InOldClass);

		TMap<UObject*, UObject*> ClassRedirects;
		ClassRedirects.Add(InOldClass, InNewClass);

		for (TObjectIterator<UBlueprint> BlueprintIt; BlueprintIt; ++BlueprintIt)
		{
			FArchiveReplaceObjectRef<UObject> ReplaceObjectArch(*BlueprintIt, ClassRedirects, false, true, true);
			if (ReplaceObjectArch.GetCount())
			{
				EnlistDependentBlueprintToRecompile(*BlueprintIt, true);
			}
		}
	}
	else
	{
		RecreateCDOAndSetupOldClassReinstancing(InOldClass);
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:36,代码来源:HotReloadClassReinstancer.cpp


示例20: ReadLauncherInstallationList

void FDesktopPlatformBase::EnumerateLauncherEngineInstallations(TMap<FString, FString> &OutInstallations)
{
	// Cache the launcher install list if necessary
	ReadLauncherInstallationList();

	// We've got a list of launcher installations. Filter it by the engine installations.
	for(TMap<FString, FString>::TConstIterator Iter(LauncherInstallationList); Iter; ++Iter)
	{
		FString AppName = Iter.Key();
		if(AppName.RemoveFromStart(TEXT("UE_"), ESearchCase::CaseSensitive))
		{
			OutInstallations.Add(AppName, Iter.Value());
		}
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:15,代码来源:DesktopPlatformBase.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TMarker类代码示例发布时间:2022-05-31
下一篇:
C++ TMXTiledMap类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap