Puma Reference Manual Puma: Puma::List Class Reference



Puma::List Class Reference

#include <Puma/List.h>

Inheritance diagram for Puma::List:

Inheritance graph

List of all members.


Detailed Description

Double-linked list implementation.


Public Member Functions

 List ()
 Constructor.
 List (const List &copy)
 Copy-constructor.
 ~List ()
 Destructor.
List & operator= (const List &copy)
 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.


Constructor & Destructor Documentation

Puma::List::List (  )  [inline]

Constructor.

Puma::List::List ( const List &  copy  ) 

Copy-constructor.

Parameters:
copy The list to copy.

Puma::List::~List (  ) 

Destructor.

Destroys the list elements.


Member Function Documentation

List& Puma::List::operator= ( const List &  copy  ) 

Assignment operator.

Parameters:
copy The list to copy.

List& Puma::List::operator+= ( const List &  list  ) 

Append the given list.

Parameters:
list The list to append.

List Puma::List::operator+ ( const List &  list  ) 

Create a new list containing the elements of this list followed by the elements of the given list.

Parameters:
list The other list.

void Puma::List::clear (  ) 

Destroy the list elements.

void Puma::List::append ( ListElement &  element  ) 

Append an element to the list.

Parameters:
element The element.

void Puma::List::prepend ( ListElement &  element  ) 

Prepend an element to the list.

Parameters:
element The element.

void Puma::List::insert ( ListElement *  at,
ListElement &  element 
)

Insert an element at the given list position.

Parameters:
at A list element where to insert the element.
element The element.

void Puma::List::remove ( ListElement *  element  ) 

Remove the given element from the list.

Parameters:
element The list element.

void Puma::List::kill ( ListElement *  from,
ListElement *  to = (ListElement*)0 
) [inline]

Remove and destroy all elements between the given list elements.

Parameters:
from The first list element to kill.
to The last list element to kill.

void Puma::List::cut ( List &  out,
ListElement *  from,
ListElement *  to = (ListElement *) 0 
)

Cut all elements between the given list elements.

Parameters:
out The container for the cutted elements (are appended).
from The first list element to cut.
to The last list element to cut.

List* Puma::List::copy ( ListElement *  from = (ListElement *) 0,
ListElement *  to = (ListElement *) 0 
)

Copy all elements between the given list elements.

Parameters:
from The first list element to cut.
to The last list element to cut.
Returns:
A new list containing the copied elements.

void Puma::List::paste ( ListElement *  at,
const List &  l 
)

Insert copies of the elements of the given list at the given list position.

Parameters:
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.

Parameters:
at The list element before which to paste the list elements.
l The list containing the elements to paste.

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.

Parameters:
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.

Parameters:
at The list element before which to insert the list elements.
l The list containing the elements to insert.

bool Puma::List::empty (  )  const [inline]

Check if the list is empty.

const ListElement* Puma::List::first (  )  const [inline]

Get the first element in the list.

Returns:
The element or NULL if list is empty.

Reimplemented in Puma::Unit.

const ListElement* Puma::List::last (  )  const [inline]

Get the last element in the list.

Returns:
The element or NULL if list is empty.

Reimplemented in Puma::Unit.

const ListElement* Puma::List::next ( const ListElement *  element  )  const [inline]

Get the next element of the given element.

Returns:
The element or NULL if the given element is NULL.

const ListElement* Puma::List::prev ( const ListElement *  element  )  const [inline]

Get the previous element of the given element.

Returns:
The element or NULL if the given element is NULL.




Puma Reference Manual. Created on 11 Jul 2008.