![]() |
![]() |
![]() |
HOME | DOWNLOAD | DOCS | DEVELOPMENT | LICENSE | CREDITS |
Doubly-linked list template. More...
#include <iLinkedList.h>
Public Member Functions | |
iLinkedList () | |
Default constructor. | |
iLinkedList (const iLinkedList< dType > &list) | |
Copy constructor. | |
~iLinkedList () | |
Destructor. | |
void | append (const dType &newData) |
Inserts an item at the end of the list. | |
void | prepend (const dType &newData) |
Inserts an item at the beginning of the list. | |
void | insert (int i, const dType &newData) |
Inserts an item at the specified index. | |
void | removeFirst () |
Removes the first item in the list. | |
void | removeLast () |
Removes the last item in the list. | |
void | remove (int i) |
Removes the item at the specified index. | |
int | removeAll (dType val) |
Removes all occurences of the specified value. | |
void | replace (int i, const dType &newData) |
Replaces the item at the specified index with a new value. | |
dType & | getFirst () |
Gets a reference to the first item in the list. | |
const dType & | getFirst () const |
Gets a reference to the first item in the list. | |
dType & | getLast () |
Gets a reference to the last item in the list. | |
const dType & | getLast () const |
Gets a reference to the last item in the list. | |
dType & | getItem (int i) |
Gets a reference to the item at the specified index. | |
const dType & | getItem (int i) const |
Gets a reference to the item at the specified index. | |
dType | takeFirst () |
Removes the first item in the list and returns it. | |
dType | takeLast () |
Removes the last item in the list and returns it. | |
dType | takeItem (int i) |
Removes the item at the specified index and returns it. | |
void | reverse () |
Reverses the order of the items in the list. | |
int | countAll (dType val) |
Counts the number of occurences of the specified value. | |
int | getSize () |
Gets the number of items in the list. | |
void | clear () |
Removes all of the items from the list. | |
bool | isMember (const dType &val) |
Checks if the specified value exists in the list. | |
bool | isEmpty () |
Determines whether or not the list is empty. | |
iLinkedList< dType > & | operator= (const iLinkedList< dType > &l) |
Assigns a list to this list. | |
iLinkedList< dType > & | operator+= (const iLinkedList< dType > &l) |
Appends all items from a list to this list. | |
dType & | operator[] (int i) |
Gets a reference to the item at the specified index. | |
const dType & | operator[] (int i) const |
Gets a reference to the item at the specified index. |
Doubly-linked list template.
A few notes about indexes:
1. The list's index begins at zero.
2. You will be required to specify the index of an item in many of the following functions. The index must be in the range of 0 through getSize()-1. If you specify an index less than zero, the first item in the list will be used. Similarly, if you specify an index greater than getSize()-1 (the last item), the last item in the list will be used.
imagen::iLinkedList< dType >::iLinkedList | ( | ) | [inline] |
Default constructor.
Constructs an empty list.
imagen::iLinkedList< dType >::iLinkedList | ( | const iLinkedList< dType > & | list | ) | [inline] |
Copy constructor.
imagen::iLinkedList< dType >::~iLinkedList | ( | ) | [inline] |
Destructor.
void imagen::iLinkedList< dType >::append | ( | const dType & | newData | ) | [inline] |
Inserts an item at the end of the list.
newData | : The item to insert. |
void imagen::iLinkedList< dType >::prepend | ( | const dType & | newData | ) | [inline] |
Inserts an item at the beginning of the list.
newData | : The item to insert. |
void imagen::iLinkedList< dType >::insert | ( | int | i, |
const dType & | newData | ||
) | [inline] |
Inserts an item at the specified index.
i | : The index at which to insert the item. |
newData | : The item to insert. |
void imagen::iLinkedList< dType >::removeFirst | ( | ) | [inline] |
Removes the first item in the list.
void imagen::iLinkedList< dType >::removeLast | ( | ) | [inline] |
Removes the last item in the list.
void imagen::iLinkedList< dType >::remove | ( | int | i | ) | [inline] |
Removes the item at the specified index.
i | : The index of the item to remove. |
int imagen::iLinkedList< dType >::removeAll | ( | dType | val | ) | [inline] |
Removes all occurences of the specified value.
val | : The value to search for. |
void imagen::iLinkedList< dType >::replace | ( | int | i, |
const dType & | newData | ||
) | [inline] |
Replaces the item at the specified index with a new value.
i | : The index of the item to be replaced. |
newData | : The new value of the item. |
dType& imagen::iLinkedList< dType >::getFirst | ( | ) | [inline] |
Gets a reference to the first item in the list.
const dType& imagen::iLinkedList< dType >::getFirst | ( | ) | const [inline] |
Gets a reference to the first item in the list.
This is an overloaded function.
dType& imagen::iLinkedList< dType >::getLast | ( | ) | [inline] |
Gets a reference to the last item in the list.
const dType& imagen::iLinkedList< dType >::getLast | ( | ) | const [inline] |
Gets a reference to the last item in the list.
This is an overloaded function.
dType& imagen::iLinkedList< dType >::getItem | ( | int | i | ) | [inline] |
Gets a reference to the item at the specified index.
i | : The index of the item to get. |
const dType& imagen::iLinkedList< dType >::getItem | ( | int | i | ) | const [inline] |
Gets a reference to the item at the specified index.
This is an overloaded function.
dType imagen::iLinkedList< dType >::takeFirst | ( | ) | [inline] |
Removes the first item in the list and returns it.
dType imagen::iLinkedList< dType >::takeLast | ( | ) | [inline] |
Removes the last item in the list and returns it.
dType imagen::iLinkedList< dType >::takeItem | ( | int | i | ) | [inline] |
Removes the item at the specified index and returns it.
i | : The index of the item to take. |
void imagen::iLinkedList< dType >::reverse | ( | ) | [inline] |
Reverses the order of the items in the list.
This function currently does not work. Calling it will do nothing.
int imagen::iLinkedList< dType >::countAll | ( | dType | val | ) | [inline] |
Counts the number of occurences of the specified value.
val | : The value to search for. |
int imagen::iLinkedList< dType >::getSize | ( | ) | [inline] |
Gets the number of items in the list.
void imagen::iLinkedList< dType >::clear | ( | ) | [inline] |
Removes all of the items from the list.
bool imagen::iLinkedList< dType >::isMember | ( | const dType & | val | ) | [inline] |
Checks if the specified value exists in the list.
val | : The value to look for. |
bool imagen::iLinkedList< dType >::isEmpty | ( | ) | [inline] |
Determines whether or not the list is empty.
iLinkedList<dType>& imagen::iLinkedList< dType >::operator= | ( | const iLinkedList< dType > & | l | ) | [inline] |
Assigns a list to this list.
iLinkedList<dType>& imagen::iLinkedList< dType >::operator+= | ( | const iLinkedList< dType > & | l | ) | [inline] |
Appends all items from a list to this list.
dType& imagen::iLinkedList< dType >::operator[] | ( | int | i | ) | [inline] |
Gets a reference to the item at the specified index.
const dType& imagen::iLinkedList< dType >::operator[] | ( | int | i | ) | const [inline] |
Gets a reference to the item at the specified index.
This is an overloaded function.
![]() |
Generated by
![]() |