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


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

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


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

示例1: ConsolidatedPostEditChange

void UActorComponent::ConsolidatedPostEditChange(const FPropertyChangedEvent& PropertyChangedEvent)
{
	FComponentReregisterContext* ReregisterContext = nullptr;
	if(EditReregisterContexts.RemoveAndCopyValue(this, ReregisterContext))
	{
		delete ReregisterContext;

		AActor* MyOwner = GetOwner();
		if ( MyOwner && !MyOwner->IsTemplate() && PropertyChangedEvent.ChangeType != EPropertyChangeType::Interactive )
		{
			MyOwner->RerunConstructionScripts();
		}
	}
	else
	{
		// This means there are likely some stale elements left in there now, strip them out
		for (auto It(EditReregisterContexts.CreateIterator()); It; ++It)
		{
			if (!It.Key().IsValid())
			{
				It.RemoveCurrent();
			}
		}
	}

	// The component or its outer could be pending kill when calling PostEditChange when applying a transaction.
	// Don't do do a full recreate in this situation, and instead simply detach.
	if( IsPendingKill() )
	{
		// @todo UE4 james should this call UnregisterComponent instead to remove itself from the RegisteredComponents array on the owner?
		ExecuteUnregisterEvents();
		World = NULL;
	}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:34,代码来源:ActorComponent.cpp

示例2: ParsePlot

FPlot ParsePlot(int32 nPlotID)
{
	FString sValue;

	FString sPlot = FString::FromInt(nPlotID);

	FString aFullPath = FPaths::GameDevelopersDir();
	aFullPath += "Source/JSON/PLO/";
	aFullPath += *sPlot;
	aFullPath += ".json";
	FString JsonStr;
	FFileHelper::LoadFileToString(JsonStr, *aFullPath);

	TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(JsonStr);
	TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());

	FPlot plot;

	if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid())
	{
		plot.ResRefID = nPlotID;

		TMap<FString, TSharedPtr<FJsonValue>> JsonValuesMap = JsonObject->Values;
		TSharedPtr<FJsonValue> rootValues;
		JsonValuesMap.RemoveAndCopyValue("Resource", rootValues);
		TSharedPtr<FJsonObject> rootObject = rootValues->AsObject();

		TMap<FString, TSharedPtr<FJsonValue>> rootValuesMap = rootObject->Values;
		TSharedPtr<FJsonValue> agentValues;
		rootValuesMap.RemoveAndCopyValue("Agent", agentValues);
		TSharedPtr<FJsonObject> agentObject = agentValues->AsObject();

		TMap<FString, TSharedPtr<FJsonValue>> agentValuesMap = agentObject->Values;

		for (auto const& y : agentValuesMap)
		{
			if (y.Key == "ResRefName")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.ResRefName = sValue;
			}
			if (y.Key == "LocalCopy")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.LocalCopy = sValue == "False" ? false : true;
			}
			if (y.Key == "Name")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.Name = sValue;
			}
			if (y.Key == "NameStringID")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.NameStringID = FCString::Atoi(*sValue);
			}
			if (y.Key == "NameRequiresReTranslation")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.NameRequiresReTranslation = sValue == "False" ? false : true;
			}
			if (y.Key == "GUID")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.GUID = sValue;
			}
			if (y.Key == "ScriptURI")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.ScriptURI = FCString::Atoi(*sValue);
			}
			if (y.Key == "Priority")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.Priority = FCString::Atoi(*sValue);
			}
			if (y.Key == "JournalImage")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.JournalImage = sValue;
			}
			if (y.Key == "ParentPlotURI")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.ParentPlotURI = FCString::Atoi(*sValue);
			}
			if (y.Key == "EntryType")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.EntryType = FCString::Atoi(*sValue);
			}
			if (y.Key == "AllowPausing")
			{
				y.Value.Get()->TryGetString(sValue);
				plot.AllowPausing = sValue == "False" ? false : true;
			}
		}

		TSharedPtr<FJsonValue> StatusListValues;
		agentValuesMap.RemoveAndCopyValue("StatusList", StatusListValues);
//.........这里部分代码省略.........
开发者ID:dhk-room101,项目名称:da2ue4,代码行数:101,代码来源:plot_h.cpp

示例3: PostEditUndo

void UActorComponent::PostEditUndo()
{
	// Objects marked pending kill don't call PostEditChange() from UObject::PostEditUndo(),
	// so they can leave an EditReregisterContexts entry around if they are deleted by an undo action.
	if( IsPendingKill() )
	{
		// The reregister context won't bother attaching components that are 'pending kill'. 
		FComponentReregisterContext* ReregisterContext = nullptr;
		if (EditReregisterContexts.RemoveAndCopyValue(this, ReregisterContext))
		{
			delete ReregisterContext;
		}
		else
		{
			// This means there are likely some stale elements left in there now, strip them out
			for (auto It(EditReregisterContexts.CreateIterator()); It; ++It)
			{
				if (!It.Key().IsValid())
				{
					It.RemoveCurrent();
				}
			}
		}
	}
	else
	{
		bIsBeingDestroyed = false;

		Owner = GetTypedOuter<AActor>();
		bCanUseCachedOwner = true;

		// Let the component be properly registered, after it was restored.
		if (Owner)
		{
			Owner->AddOwnedComponent(this);
		}

		TArray<UObject*> Children;
		GetObjectsWithOuter(this, Children);

		for (UObject* Child : Children)
		{
			if (UActorComponent* ChildComponent = Cast<UActorComponent>(Child))
			{
				if (ChildComponent->Owner)
				{
					ChildComponent->Owner->RemoveOwnedComponent(ChildComponent);
				}
				ChildComponent->Owner = Owner;
				if (Owner)
				{
					Owner->AddOwnedComponent(ChildComponent);
				}
			}
		}

		if (GetWorld())
		{
			GetWorld()->UpdateActorComponentEndOfFrameUpdateState(this);
		}
	}
	Super::PostEditUndo();
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:63,代码来源:ActorComponent.cpp


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