#include <LinkedList.h>
This makes enumeration, enqueueing and dequeueing fast, but looking up items by their position slow.
Definition at line 33 of file LinkedList.h.
Public Member Functions | |
void | Append (ITEMTYPE *Item) |
Appends an item to the list. | |
virtual int | Compare (const ITEMTYPE *Item1, const ITEMTYPE *Item2) const |
Compares two items and returns -1, if the first is less than the second, 0, if both items are equal and 1, if the first is more than the second. | |
ContainingList () | |
Creates a new list. | |
bool | Delete (ITEMTYPE *Item, int(*compare)(const ITEMTYPE *Item1, const ITEMTYPE *Item2)) |
Deletes an item that is equal to a given item from the list. | |
bool | Delete (ITEMTYPE *Item) |
Deletes an item that is equal to a given item from the list. | |
bool | Delete (long nr) |
Deletes an given item from the list. | |
void | DeleteAll () |
Deletes all items from the list. | |
void | DeleteDirectly (ITEMTYPE *Item) |
Deletes a given item from the list without looking it up. | |
bool | DeleteFirst () |
Deletes the first item from the list. | |
bool | DeleteLast () |
Deletes the last item from the list. | |
ITEMTYPE * | Get (const ITEMTYPE *SearchItem, int(*compare)(const ITEMTYPE *Item1, const ITEMTYPE *Item2)) const |
Returns an item that is equal to a given item. | |
ITEMTYPE * | Get (const ITEMTYPE *SearchItem) const |
Returns an item that is equal to a given item. | |
ITEMTYPE * | Get (long nr) const |
Returns the item at a given position. | |
long | GetCount () const |
Returns the number of items in the list. | |
ITEMTYPE * | GetFirst () const |
Returns the first item of the list. | |
ITEMTYPE * | GetLast () const |
Returns the last item of the list. | |
void | Insert (ITEMTYPE *Item, long nr) |
Inserts an item before a given position. | |
bool | IsEmpty () const |
Returns, if there are no items in the list. | |
void | Prepend (ITEMTYPE *Item) |
Prepends an item to the list. | |
void | Reverse () |
Turns around the order of all items in the list. | |
void | Sort (int(*compare)(const ITEMTYPE *Item1, const ITEMTYPE *Item2)) |
Sorts the items in the list according to a given comparison function. | |
void | Sort () |
Sorts the items in the list according to the Compare method. | |
ITEMTYPE * | Unlink (ITEMTYPE *Item, int(*compare)(const ITEMTYPE *Item1, const ITEMTYPE *Item2)) |
Removes an item that is equal to a given item from the list. | |
ITEMTYPE * | Unlink (ITEMTYPE *Item) |
Removes an item that is equal to a given item from the list. | |
ITEMTYPE * | Unlink (long nr) |
Removes an item at a given position. | |
void | UnlinkAll () |
Removes all items from the list without freeing them or returning them. | |
ITEMTYPE * | UnlinkDirectly (ITEMTYPE *Item) |
Removes a given item from the list without looking it up. | |
ITEMTYPE * | UnlinkFirst () |
Removes the first item of the list. | |
ITEMTYPE * | UnlinkLast () |
Removes the last item of the list. | |
virtual | ~ContainingList () |
Destroys the list. | |
Private Attributes | |
long | Count |
The number of items in the list. | |
ITEMTYPE * | First |
The first list item. | |
ITEMTYPE * | Last |
The next list item. |
|
Creates a new list.
|
|
Destroys the list. When deleting the list, all contained items are also freed. |
|
Appends an item to the list.
|
|
Compares two items and returns -1, if the first is less than the second, 0, if both items are equal and 1, if the first is more than the second. This method is used for comparison method like Delete and Get, if you specify an item to look up. Override this method to provide your own comparison.
|
|
Deletes an item that is equal to a given item from the list. The item is searched, removed from the list and freed.
|
|
Deletes an item that is equal to a given item from the list. The item is searched using the class's compare method, so override it to set your own comparison. After that, the item is removed from the list and freed.
|
|
Deletes an given item from the list. The item is removed from the list and freed.
|
|
Deletes all items from the list. All items are removed from the list and freed. |
|
Deletes a given item from the list without looking it up. Use this method to increase performance, but only, if you are sure that the item is in the list. If not, that list will remain inconsistent. The item is removed from the list an freed.
|
|
Deletes the first item from the list. The item is removed from the list and freed.
|
|
Deletes the last item from the list. The item is removed from the list and freed.
|
|
Returns an item that is equal to a given item.
|
|
Returns an item that is equal to a given item. The item is searched using the class's compare method, so override it to set your own comparison. After that, the item is removed from the list and freed.
|
|
Returns the item at a given position.
|
|
Returns the number of items in the list.
|
|
Returns the first item of the list.
|
|
Returns the last item of the list.
|
|
Inserts an item before a given position.
|
|
Returns, if there are no items in the list.
|
|
Prepends an item to the list.
|
|
Turns around the order of all items in the list. The whole list has the reverse order afterwards, but is not harmed at all in any other way. All items remain the same. |
|
Sorts the items in the list according to a given comparison function. The whole list has a sorted order afterwards, but is not harmed at all in any other way. All items remain the same.
|
|
Sorts the items in the list according to the Compare method. The whole list has a sorted order afterwards, but is not harmed at all in any other way. All items remain the same. |
|
Removes an item that is equal to a given item from the list. The item is not freed, but returned.
|
|
Removes an item that is equal to a given item from the list. The item is searched using the class's compare method, so override it to set your own comparison. Afterwards, the item is not freed, but returned.
|
|
Removes an item at a given position. The item is not freed, but returned.
|
|
Removes all items from the list without freeing them or returning them.
|
|
Removes a given item from the list without looking it up. Use this method to increase performance, but only, if you are sure that the item is in the list. If not, that list will become inconsistent. Afterwards, the item is not freed, but returned.
|
|
Removes the first item of the list. The item is not freed, but returned.
|
|
Removes the last item of the list. The item is not freed, but returned.
|
|
The number of items in the list.
Definition at line 40 of file LinkedList.h. |
|
The first list item.
Definition at line 45 of file LinkedList.h. |
|
The next list item.
Definition at line 57 of file LinkedList.h. |