PUMA Library Reference Manual
|
#include <Puma/List.h>
Double-linked list implementation.
Public Member Functions | |
List () | |
Constructor. | |
List (const List ©) | |
Copy-constructor. | |
~List () | |
Destructor. | |
List & | operator= (const List ©) |
Assignment operator. | |
List & | operator+= (const List &list) |
Append the given list. | |
List | operator+ (const List &list) |
Create a new list containing the elements of this list followed by the elements of the given list. | |
void | clear () |
Destroy the list elements. | |
void | append (ListElement &element) |
Append an element to the list. | |
void | prepend (ListElement &element) |
Prepend an element to the list. | |
void | insert (ListElement *at, ListElement &element) |
Insert an element at the given list position. | |
void | remove (ListElement *element) |
Remove the given element from the list. | |
void | kill (ListElement *from, ListElement *to=(ListElement *) 0) |
Remove and destroy all elements between the given list elements. | |
void | cut (List &out, ListElement *from, ListElement *to=(ListElement *) 0) |
Cut all elements between the given list elements. | |
List * | copy (ListElement *from=(ListElement *) 0, ListElement *to=(ListElement *) 0) |
Copy all elements between the given list elements. | |
void | paste (ListElement *at, const List &l) |
Insert copies of the elements of the given list at the given list position. | |
void | paste_before (ListElement *at, const List &l) |
Insert copies of the elements of the given list before the given list position. | |
void | move (ListElement *at, List &l) |
Insert the elements of the given list at the given list position. | |
void | move_before (ListElement *at, List &l) |
Insert the elements of the given list before the given list position. | |
bool | empty () const |
Check if the list is empty. | |
const ListElement * | first () const |
Get the first element in the list. | |
const ListElement * | last () const |
Get the last element in the list. | |
const ListElement * | next (const ListElement *element) const |
Get the next element of the given element. | |
const ListElement * | prev (const ListElement *element) const |
Get the previous element of the given element. | |
|
inline |
Constructor.
Puma::List::List | ( | const List & | copy | ) |
Copy-constructor.
copy | The list to copy. |
Puma::List::~List | ( | ) |
Destructor.
Destroys the list elements.
void Puma::List::append | ( | ListElement & | element | ) |
Append an element to the list.
element | The element. |
void Puma::List::clear | ( | ) |
Destroy the list elements.
List * Puma::List::copy | ( | ListElement * | from = (ListElement *) 0, |
ListElement * | to = (ListElement *) 0 ) |
Copy all elements between the given list elements.
from | The first list element to cut. |
to | The last list element to cut. |
void Puma::List::cut | ( | List & | out, |
ListElement * | from, | ||
ListElement * | to = (ListElement *) 0 ) |
Cut all elements between the given list elements.
out | The container for the cutted elements (are appended). |
from | The first list element to cut. |
to | The last list element to cut. |
|
inline |
Check if the list is empty.
return True if the list is empty.
|
inline |
Get the first element in the list.
void Puma::List::insert | ( | ListElement * | at, |
ListElement & | element ) |
Insert an element at the given list position.
at | A list element where to insert the element. |
element | The element. |
|
inline |
Remove and destroy all elements between the given list elements.
from | The first list element to kill. |
to | The last list element to kill. |
|
inline |
Get the last element in the list.
void Puma::List::move | ( | ListElement * | at, |
List & | l ) |
Insert the elements of the given list at the given list position.
The elements are removed from the source list.
at | The list element at which to insert the list elements. |
l | The list containing the elements to insert. |
void Puma::List::move_before | ( | ListElement * | at, |
List & | l ) |
Insert the elements of the given list before the given list position.
The elements are removed from the source list.
at | The list element before which to insert the list elements. |
l | The list containing the elements to insert. |
|
inline |
Get the next element of the given element.
Create a new list containing the elements of this list followed by the elements of the given list.
list | The other list. |
Append the given list.
list | The list to append. |
Assignment operator.
copy | The list to copy. |
void Puma::List::paste | ( | ListElement * | at, |
const List & | l ) |
Insert copies of the elements of the given list at the given list position.
at | The list element at which to paste the list elements. |
l | The list containing the elements to paste. |
void Puma::List::paste_before | ( | ListElement * | at, |
const List & | l ) |
Insert copies of the elements of the given list before the given list position.
at | The list element before which to paste the list elements. |
l | The list containing the elements to paste. |
void Puma::List::prepend | ( | ListElement & | element | ) |
Prepend an element to the list.
element | The element. |
|
inline |
Get the previous element of the given element.
void Puma::List::remove | ( | ListElement * | element | ) |
Remove the given element from the list.
element | The list element. |