Laxkit
0.0.7.1
|
Independent node type for doubly linked lists. More...
Public Member Functions | |
virtual | ~LinkedList () |
virtual T * | disconnectNode () |
virtual int | connectNode (T *node) |
Insert a node or a node chain after or before this. | |
virtual int | closeNodeLoop () |
Close the loop, if it was open. | |
virtual T * | openNodeLoop (int before) |
Open a closed loop. If after!=0, then cut the loop after *this, else before. |
Protected Attributes | |
T * | next_node |
T * | prev_node |
Independent node type for doubly linked lists.
|
virtual |
Calls disconnectNode(), which results in prev_node and next_node being set to NULL. It does NOT delete adjacent nodes. The containing code should do that with judicious use of disconnectNode() and deletes.
References Laxkit::disconnectNode().
|
virtual |
Close the loop, if it was open.
If it was already closed, return 1. Else return 0 for success.
|
virtual |
Insert a node or a node chain after or before this.
If node is part of a list, not an independent node, then the whole list is added. If node is part of a closed list, then that loop is cut between node and node->prev_node.
Return 0 for success, nonzero for error.
|
virtual |
Open a closed loop. If after!=0, then cut the loop after *this, else before.
Return NULL if loop was already open and nothing was severed. On success return pointer to the severed bit. That is, say you have a-this-b, and you call this->openNodeLoop(0), then a is returned. Else b is returned.
Note that if this is looped to itself, then this is still returned.