本文整理汇总了C++中StructureSet::singleStructure方法的典型用法代码示例。如果您正苦于以下问题:C++ StructureSet::singleStructure方法的具体用法?C++ StructureSet::singleStructure怎么用?C++ StructureSet::singleStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructureSet
的用法示例。
在下文中一共展示了StructureSet::singleStructure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: merge
bool StructureSet::merge(const StructureSet& other)
{
if (other.isThin()) {
if (other.singleStructure())
return add(other.singleStructure());
return false;
}
OutOfLineList* list = other.structureList();
if (list->m_length >= 2) {
if (isThin()) {
OutOfLineList* myNewList = OutOfLineList::create(
list->m_length + !!singleStructure());
if (singleStructure()) {
myNewList->m_length = 1;
myNewList->list()[0] = singleStructure();
}
set(myNewList);
}
bool changed = false;
for (unsigned i = 0; i < list->m_length; ++i)
changed |= addOutOfLine(list->list()[i]);
return changed;
}
ASSERT(list->m_length);
return add(list->list()[0]);
}
示例2: exclude
void StructureSet::exclude(const StructureSet& other)
{
if (other.isThin()) {
if (other.singleStructure())
remove(other.singleStructure());
return;
}
if (isThin()) {
if (!singleStructure())
return;
if (other.contains(singleStructure()))
clear();
return;
}
OutOfLineList* list = structureList();
for (unsigned i = 0; i < list->m_length; ++i) {
if (!other.containsOutOfLine(list->list()[i]))
continue;
list->list()[i--] = list->list()[--list->m_length];
}
if (!list->m_length)
clear();
}
示例3: isSubsetOf
bool StructureSet::isSubsetOf(const StructureSet& other) const
{
if (isThin()) {
if (!singleStructure())
return true;
return other.contains(singleStructure());
}
if (other.isThin()) {
if (!other.singleStructure())
return false;
OutOfLineList* list = structureList();
if (list->m_length >= 2)
return false;
if (list->list()[0] == other.singleStructure())
return true;
return false;
}
OutOfLineList* list = structureList();
for (unsigned i = 0; i < list->m_length; ++i) {
if (!other.containsOutOfLine(list->list()[i]))
return false;
}
return true;
}
示例4: filter
void StructureSet::filter(const StructureSet& other)
{
if (other.isThin()) {
if (!other.singleStructure() || !contains(other.singleStructure()))
clear();
else {
clear();
set(other.singleStructure());
}
return;
}
ContainsOutOfLine containsOutOfLine(other);
genericFilter(containsOutOfLine);
}