Main Page   Class Hierarchy   Compound List   File List   Compound Members  

TPtrListT< T > Class Template Reference

A template class implementing a double linked list. More...

#include <TPtrListT.hh>

List of all members.

Public Methods

 TPtrListT ()
 Constructs an empty list.

 TPtrListT (TPtrListT< T > &list)
 Copy constructor.

 ~TPtrListT ()
 Destructor.

void Append (T *a)
 Add an element to the end of the list.

void Apply (void(*fn)(T *, void *), void *d)
 Applies the user defined function to every element in the list.

void Clear ()
 Remove all elements from the list.

void ClearAndDestroy ()
 Remove all elements from the list and calls delete on them.

int Entries () const
 Return the number of entries in the list.

T * First ()
 Return the first element of the list.

void Insert (T *a, int i=0)
 Add an element before the specified entry.

T * Last ()
 Return the last element of the list.

T * Remove (int i=0)
 Remove element at the specified position.

T * RemoveLast ()
 Remove the last element of the list.

void Sort (bool reverse=false)
 Sort all entries in self with the less than operator (<).

T *& operator[] (int i)
 Index operator.

TPtrListT< T > & operator= (const TPtrListT< T > &list)
 Assignment operator.


Detailed Description

template<class T>
class TPtrListT< T >

A template class implementing a double linked list.

Author:
Johan Bolmsjo <johan@nocrew.org>


Member Function Documentation

template<class T>
void TPtrListT< T >::Apply void(*    fn)(T *, void *),
void *    d
 

Applies the user defined function to every element in the list.

Parameters:
fn Function pointer to your function.
d Client data to pass to your function.

template<class T>
void TPtrListT< T >::ClearAndDestroy  
 

Remove all elements from the list and calls delete on them.

Beware of storing duplicate pointers in list!

template<class T>
T* TPtrListT< T >::First   [inline]
 

Return the first element of the list.

Null is returned if the list is empty.

template<class T>
T* TPtrListT< T >::Last   [inline]
 

Return the last element of the list.

Null is returned if the list is empty.

template<class T>
T *& TPtrListT< T >::operator[] int    i
 

Index operator.

Can be used for assignment of list items.

template<class T>
void TPtrListT< T >::Sort bool    reverse = false
 

Sort all entries in self with the less than operator (<).

Parameters:
reverse Sort backwards if true.


The documentation for this class was generated from the following file:
Generated on Sat Feb 15 18:37:16 2003 for Tools by doxygen1.3-rc2