本文整理汇总了C++中TSet::Difference方法的典型用法代码示例。如果您正苦于以下问题:C++ TSet::Difference方法的具体用法?C++ TSet::Difference怎么用?C++ TSet::Difference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSet
的用法示例。
在下文中一共展示了TSet::Difference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiffAgainst
void FDetailsDiff::DiffAgainst(const FDetailsDiff& Newer, TArray< FSingleObjectDiffEntry > &OutDifferences) const
{
TSharedPtr< class IDetailsView > OldDetailsView = DetailsView;
TSharedPtr< class IDetailsView > NewDetailsView = Newer.DetailsView;
const auto& OldSelectedObjects = OldDetailsView->GetSelectedObjects();
const auto& NewSelectedObjects = NewDetailsView->GetSelectedObjects();
check(OldSelectedObjects.Num() == 1);
auto OldProperties = OldDetailsView->GetPropertiesInOrderDisplayed();
auto NewProperties = NewDetailsView->GetPropertiesInOrderDisplayed();
TSet<FPropertySoftPath> OldPropertiesSet;
TSet<FPropertySoftPath> NewPropertiesSet;
auto ToSet = [](const TArray<FPropertyPath>& Array, TSet<FPropertySoftPath>& OutSet)
{
for (const auto& Entry : Array)
{
OutSet.Add(FPropertySoftPath(Entry));
}
};
ToSet(OldProperties, OldPropertiesSet);
ToSet(NewProperties, NewPropertiesSet);
// detect removed properties:
auto RemovedProperties = OldPropertiesSet.Difference(NewPropertiesSet);
for (const auto& RemovedProperty : RemovedProperties)
{
// @todo: (doc) label these as removed, rather than added to a
FSingleObjectDiffEntry Entry(RemovedProperty, EPropertyDiffType::PropertyAddedToA);
OutDifferences.Push(Entry);
}
// detect added properties:
auto AddededProperties = NewPropertiesSet.Difference(OldPropertiesSet);
for (const auto& AddedProperty : AddededProperties)
{
FSingleObjectDiffEntry Entry(AddedProperty, EPropertyDiffType::PropertyAddedToB);
OutDifferences.Push(Entry);
}
// check for changed properties
auto CommonProperties = NewPropertiesSet.Intersect(OldPropertiesSet);
for (const auto& CommonProperty : CommonProperties)
{
// get value, diff:
check(NewSelectedObjects.Num() == 1);
auto OldPoperty = CommonProperty.Resolve(OldSelectedObjects[0].Get());
auto NewProperty = CommonProperty.Resolve(NewSelectedObjects[0].Get());
if (!DiffUtils::Identical(OldPoperty, NewProperty))
{
OutDifferences.Push(FSingleObjectDiffEntry(CommonProperty, EPropertyDiffType::PropertyValueChanged));
}
}
}
示例2:
}
}
{
// make sure that we add any user created classes immediately, generally this will not create anything (because assets have not been discovered yet), but asset discovery
// should be allowed to take place at any time:
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
TArray<FName> ClassNames;
ClassNames.Add(UActorComponent::StaticClass()->GetFName());
TSet<FName> DerivedClassNames;
AssetRegistryModule.Get().GetDerivedClassNames(ClassNames, TSet<FName>(), DerivedClassNames);
const bool bIncludeInFilter = true;
auto InMemoryClassesSet = TSet<FName>(InMemoryClasses);
auto OnDiskClasses = DerivedClassNames.Difference(InMemoryClassesSet);
// GetAssetsByClass call is a cludget to get the full asset paths for the blueprints we care about, Bob T. thinks
// that the Asset Registry could just keep asset paths:
TArray<FAssetData> BlueprintAssetData;
AssetRegistryModule.Get().GetAssetsByClass(UBlueprint::StaticClass()->GetFName(), BlueprintAssetData);
for (auto OnDiskClass : OnDiskClasses)
{
FName AssetPath;
FString FixedString = OnDiskClass.ToString();
FixedString.RemoveFromEnd(TEXT("_C"));
for (auto Blueprint : BlueprintAssetData)
{
if (Blueprint.AssetName.ToString() == FixedString)
{