本文整理汇总了C++中ListPtr::destroyNode方法的典型用法代码示例。如果您正苦于以下问题:C++ ListPtr::destroyNode方法的具体用法?C++ ListPtr::destroyNode怎么用?C++ ListPtr::destroyNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListPtr
的用法示例。
在下文中一共展示了ListPtr::destroyNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeLastList
void removeLastList(ListPtr listp){ /* Removes 1 Node from the Start of the List */
if(listp->items > 0){
if(listp->items == 1){
popList(listp);
}
else{
listp->Current = listp->Last->previous;
if(listp->Last != NULL){
listp->destroyNode(&(listp->Last->data));
free(listp->Last);
(listp->items)--;
}
listp->Last = listp->Current;
listp->Last->next = (Node*) NULL;
}
}
}
示例2: popList
void popList(ListPtr listp){ /* Removes 1 Node from the End of the List */
if(listp->items > 0){
listp->Current = listp->Head;
listp->Head = listp->Head->next; /* Make Head point to its next and make the previous of new Head be NULL */
if(listp->Head != NULL)
listp->Head->previous = (Node*) NULL;
if(listp->Current != NULL){
listp->destroyNode(&(listp->Current->data));
free(listp->Current);
(listp->items)--;
}
listp->Current = listp->Head;
}
}
示例3: removeCurrentNode
void removeCurrentNode(ListPtr listp){ /* Removes the Node Current points to */
Node* temp;
if(listp->items > 0){
if(listp->items == 1){
popList(listp);
}
else{
if(listp->Current == listp->Last){
removeLastList(listp);
}
else{
if(listp->Current != NULL){
listp->destroyNode(&(listp->Current->data));
temp = listp->Current->next;
listp->Current->previous->next = listp->Current->next; /* Make the previous of the Current have as next the next of Current and vice versa */
listp->Current->next->previous = listp->Current->previous;
free(listp->Current);
listp->Current = temp;
(listp->items)--; //TODO: TEST AND FIX MIDDLE
}
}
}
}
}