本文整理汇总了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;
}
}
示例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);
//.........这里部分代码省略.........
示例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();
}