#include <List.h>
Public Member Functions | |
| T * | addFirst (T *t) |
| Add an element at the list's beginning. | |
| T * | addLast (T *t) |
| Add an element at the list's end. | |
| T * | add (T *t) |
| Add an element at the list's end. | |
| T * | insertBefore (T *item, T *elem) |
| Insert an element before a given element. | |
| T * | insertAfter (T *item, T *elem) |
| Insert an element after a given element. | |
| T * | removeFirst () |
| Remove the first element. | |
| T * | removeLast () |
| Remove the last element. | |
| void | clearAll () |
| Remove and delete all elements from the receiver. | |
| void | clear () |
| Empty the receiver list without freeing the memory of the list elements. | |
| T * | remove (T *i) |
| Remove an element. | |
| T * | remove (ListItem< T > *victim) |
| Remove an element using a cursor. | |
| T * | getNth (int n) const |
| Return the nth element of the list. | |
| ListItem< T > * | position (T *t) const |
| Return the position of a given element. | |
| int | index (T *t) const |
| Return the index of a given element. | |
| T * | first () const |
| Return the first element. | |
| T * | last () const |
| Return the last element. | |
| T * | overwriteNth (int n, T *t) |
| Replace the nth element with a given one. | |
| int | trim (int n) |
| Remove the n elements from the end of the receiver. | |
| int | size () const |
| Get the element count of the list. | |
| int | empty () const |
| Check whether the list is empty. | |
| List () | |
| Default constructor. | |
| ~List () | |
| Destructor (deletes all elements of the list). | |
Protected Attributes | |
| ListItem< T > * | head |
| ListItem< T > * | tail |
Friends | |
| class | ListCursor< T > |
| T* List< T >::addFirst | ( | T * | t | ) | [inline] |
Add an element at the list's beginning.
| t | a pointer to an instance to be added. |
| T* List< T >::addLast | ( | T * | t | ) | [inline] |
Add an element at the list's end.
| t | a pointer to an instance to be added. |
| T* List< T >::add | ( | T * | t | ) | [inline] |
Add an element at the list's end.
| t | a pointer to an instance to be added. |
| T* List< T >::insertBefore | ( | T * | item, | |
| T * | elem | |||
| ) | [inline] |
Insert an element before a given element.
| newElement | the element to add. | |
| element | a pointer to an element of the list. If the receiver does not contain such an element, then item is appended to the list. |
| T* List< T >::insertAfter | ( | T * | item, | |
| T * | elem | |||
| ) | [inline] |
Insert an element after a given element.
| newElement | the element to add. | |
| element | a pointer to an element of the list. If the receiver does not contain such an element, then item is appended to the list. |
| T* List< T >::removeFirst | ( | ) | [inline] |
Remove the first element.
| T* List< T >::removeLast | ( | ) | [inline] |
Remove the last element.
| void List< T >::clearAll | ( | ) | [inline] |
Remove and delete all elements from the receiver.
| void List< T >::clear | ( | ) | [inline] |
Empty the receiver list without freeing the memory of the list elements.
| T* List< T >::remove | ( | T * | i | ) | [inline] |
Remove an element.
| item | a pointer to a list item. |
Remove an element using a cursor.
Note: The cursor is invalid after this operation!
| item | a pointer to a list cursor. |
| T* List< T >::getNth | ( | int | n | ) | const [inline] |
Return the nth element of the list.
| n | points to the elements (starting from 0) to return. |
Return the position of a given element.
| element | a pointer to a list element. |
| int List< T >::index | ( | T * | t | ) | const [inline] |
Return the index of a given element.
| element | a pointer to a list element. |
| T* List< T >::first | ( | ) | const [inline] |
Return the first element.
| T* List< T >::last | ( | ) | const [inline] |
Return the last element.
| T* List< T >::overwriteNth | ( | int | n, | |
| T * | t | |||
| ) | [inline] |
Replace the nth element with a given one.
| n | the index of the element to replace (counted from 0). | |
| element | a pointer to an element. |
| int List< T >::trim | ( | int | n | ) | [inline] |
Remove the n elements from the end of the receiver.
| n | the number of elements to be removed. |
| int List< T >::size | ( | ) | const [inline] |
Get the element count of the list.
| int List< T >::empty | ( | ) | const [inline] |
Check whether the list is empty.
friend class ListCursor< T > [friend] |
1.5.6