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


C++ TSet::Intersect方法代码示例

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


在下文中一共展示了TSet::Intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
		}
	}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:59,代码来源:DetailsDiff.cpp


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