本文整理汇总了C++中TMultiMap::GenerateValueArray方法的典型用法代码示例。如果您正苦于以下问题:C++ TMultiMap::GenerateValueArray方法的具体用法?C++ TMultiMap::GenerateValueArray怎么用?C++ TMultiMap::GenerateValueArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMultiMap
的用法示例。
在下文中一共展示了TMultiMap::GenerateValueArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NullReferencesToObject
/**
* Nulls out references to a given object
*
* @param InObject - Object to null references to
*/
void NullReferencesToObject(UObject* InObject)
{
TArray<UObject*> ReplaceableObjects;
TMap<UObject*, UObject*> ReplacementMap;
ReplacementMap.Add(InObject, NULL);
ReplacementMap.GenerateKeyArray(ReplaceableObjects);
// Find all the properties (and their corresponding objects) that refer to any of the objects to be replaced
TMap< UObject*, TArray<UProperty*> > ReferencingPropertiesMap;
for (FObjectIterator ObjIter; ObjIter; ++ObjIter)
{
UObject* CurObject = *ObjIter;
// Find the referencers of the objects to be replaced
FFindReferencersArchive FindRefsArchive(CurObject, ReplaceableObjects);
// Inform the object referencing any of the objects to be replaced about the properties that are being forcefully
// changed, and store both the object doing the referencing as well as the properties that were changed in a map (so that
// we can correctly call PostEditChange later)
TMap<UObject*, int32> CurNumReferencesMap;
TMultiMap<UObject*, UProperty*> CurReferencingPropertiesMMap;
if (FindRefsArchive.GetReferenceCounts(CurNumReferencesMap, CurReferencingPropertiesMMap) > 0)
{
TArray<UProperty*> CurReferencedProperties;
CurReferencingPropertiesMMap.GenerateValueArray(CurReferencedProperties);
ReferencingPropertiesMap.Add(CurObject, CurReferencedProperties);
for (TArray<UProperty*>::TConstIterator RefPropIter(CurReferencedProperties); RefPropIter; ++RefPropIter)
{
CurObject->PreEditChange(*RefPropIter);
}
}
}
// Iterate over the map of referencing objects/changed properties, forcefully replacing the references and then
// alerting the referencing objects the change has completed via PostEditChange
int32 NumObjsReplaced = 0;
for (TMap< UObject*, TArray<UProperty*> >::TConstIterator MapIter(ReferencingPropertiesMap); MapIter; ++MapIter)
{
++NumObjsReplaced;
UObject* CurReplaceObj = MapIter.Key();
const TArray<UProperty*>& RefPropArray = MapIter.Value();
FArchiveReplaceObjectRef<UObject> ReplaceAr(CurReplaceObj, ReplacementMap, false, true, false);
for (TArray<UProperty*>::TConstIterator RefPropIter(RefPropArray); RefPropIter; ++RefPropIter)
{
FPropertyChangedEvent PropertyEvent(*RefPropIter);
CurReplaceObj->PostEditChangeProperty(PropertyEvent);
}
if (!CurReplaceObj->HasAnyFlags(RF_Transient) && CurReplaceObj->GetOutermost() != GetTransientPackage())
{
if (!CurReplaceObj->RootPackageHasAnyFlags(PKG_CompiledIn))
{
CurReplaceObj->MarkPackageDirty();
}
}
}
}