本文整理汇总了C++中DoublyLinkedList::RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C++ DoublyLinkedList::RemoveAll方法的具体用法?C++ DoublyLinkedList::RemoveAll怎么用?C++ DoublyLinkedList::RemoveAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoublyLinkedList
的用法示例。
在下文中一共展示了DoublyLinkedList::RemoveAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVolume
// RemoveAttribute
status_t
Node::RemoveAttribute(Attribute *attribute)
{
status_t error = (attribute && attribute->GetNode() == this
? B_OK : B_BAD_VALUE);
if (error == B_OK) {
// move all iterators pointing to the attribute to the next attribute
if (GetVolume()->IteratorLock()) {
// set the iterators' current entry
Attribute *nextAttr = fAttributes.GetNext(attribute);
DoublyLinkedList<AttributeIterator> *iterators
= attribute->GetAttributeIteratorList();
for (AttributeIterator *iterator = iterators->First();
iterator;
iterator = iterators->GetNext(iterator)) {
iterator->SetCurrent(nextAttr, true);
}
// Move the iterators from one list to the other, or just remove
// them, if there is no next attribute.
if (nextAttr) {
DoublyLinkedList<AttributeIterator> *nextIterators
= nextAttr->GetAttributeIteratorList();
nextIterators->MoveFrom(iterators);
} else
iterators->RemoveAll();
GetVolume()->IteratorUnlock();
} else
error = B_ERROR;
// remove the attribute
if (error == B_OK) {
error = GetVolume()->NodeAttributeRemoved(GetID(), attribute);
if (error == B_OK) {
fAttributes.Remove(attribute);
attribute->SetNode(NULL);
MarkModified();
}
}
}
return error;
}