csList< T, MemoryAllocator > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Static Public Attributes | Protected Member Functions
csList< T, MemoryAllocator > Class Template Reference

A lightweight double-linked list template. More...

`#include <csutil/list.h>`

List of all members.

## Classes
class | Iterator
| Iterator for the list. More...
struct | ListElement
| Template which describes the data stored in the linked list For example a list of ints uses ListElement<int>. More...
## Public Member Functions
| csList ()
| Default constructor.
| csList (const MemoryAllocator &alloc)
| Construct with allocator setup.
| csList (const csList< T, MemoryAllocator > &other)
| Copy constructor.
void | Delete (Iterator &it)
| Remove specific item by iterator.
bool | Delete (const T &item)
| Remove specified item.
void | DeleteAll ()
| Empty an list.
T & | Front () const
| Return first element of the list.
void | InsertAfter (Iterator &it, const T &item)
| Insert an item after the item the iterator is set to.
void | InsertBefore (Iterator &it, const T &item)
| Insert an item before the item the iterator is set to.
T & | Last () const
| Return last element of the list.
void | MoveAfter (const Iterator &it, const Iterator &item)
| Move an item (as iterator item ) after the item the iterator it is set to.
void | MoveBefore (const Iterator &it, const Iterator &item)
| Move an item (as iterator item) before the item the iterator it is set to.
void | MoveToBack (const Iterator &item)
| Move an item (as iterator item) to the front of the list.
void | MoveToFront (const Iterator &item)
| Move an item (as iterator item) to the front of the list.
csList & | operator= (const csList< T, MemoryAllocator > &other)
| Assignment, deep-copy.
bool | PopBack ()
| Deletes the last element of the list.
bool | PopFront ()
| Deletes the first element of the list.
Iterator | PushBack (const T &item)
| Add an item last in list. Copy T into the listdata.
Iterator | PushFront (const T &item)
| Add an item first in list. Copy T into the listdata.
| ~csList ()
| Destructor.
## Static Public Attributes
static const size_t | allocSize = sizeof (ListElement)
| This is the size of the memory block the wrapper list uses to store the actual data.
## Protected Member Functions
void | Delete (ListElement *el)
| Remove specific item by explicit ref.

## Detailed Description

### template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>
class csList< T, MemoryAllocator >

A lightweight double-linked list template.

Copies the elements into the list for storages. Assumes that type T supports copy construction.

Definition at line 36 of file list.h.

## Constructor & Destructor Documentation

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

csList< T, MemoryAllocator >::csList | ( |  | ) | `[inline]`

Default constructor.

Definition at line 80 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

csList< T, MemoryAllocator >::csList | ( | const MemoryAllocator & | alloc | ) | `[inline]`

Construct with allocator setup.

Definition at line 83 of file list.h.

template<class T, class MemoryAllocator>

csList< T, MemoryAllocator >::csList | ( | const csList< T, MemoryAllocator > & | other | ) | `[inline]`

Copy constructor.

Deep copy of list.

Definition at line 321 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

csList< T, MemoryAllocator >::~csList | ( |  | ) | `[inline]`

Destructor.

Definition at line 90 of file list.h.

## Member Function Documentation

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::Delete | ( | ListElement * | el | ) | `[inline, protected]`

Remove specific item by explicit ref.

Definition at line 569 of file list.h.

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::Delete | ( | Iterator & | it | ) | `[inline]`

Remove specific item by iterator.

Definition at line 541 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

bool csList< T, MemoryAllocator >::Delete | ( | const T & | item | ) | `[inline]`

Remove specified item.

Remarks:
  Slow!

Definition at line 264 of file list.h.

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::DeleteAll | ( |  | ) | `[inline]`

Empty an list.

Delete all elements.

Definition at line 349 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

T& csList< T, MemoryAllocator >::Front | ( |  | ) | const`[inline]`

Return first element of the list.

Definition at line 283 of file list.h.

template<class T, class MemoryAllocator >

void csList< T, MemoryAllocator >::InsertAfter | ( | Iterator & | it,
|  | const T & | item
| ) |  | `[inline]`

Insert an item after the item the iterator is set to.

Definition at line 392 of file list.h.

template<class T, class MemoryAllocator >

void csList< T, MemoryAllocator >::InsertBefore | ( | Iterator & | it,
|  | const T & | item
| ) |  | `[inline]`

Insert an item before the item the iterator is set to.

Definition at line 409 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

T& csList< T, MemoryAllocator >::Last | ( |  | ) | const`[inline]`

Return last element of the list.

Definition at line 286 of file list.h.

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::MoveAfter | ( | const Iterator & | it,
|  | const Iterator & | item
| ) |  | `[inline]`

Move an item (as iterator item ) after the item the iterator it is set to.

Definition at line 427 of file list.h.

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::MoveBefore | ( | const Iterator & | it,
|  | const Iterator & | item
| ) |  | `[inline]`

Move an item (as iterator item) before the item the iterator it is set to.

Definition at line 484 of file list.h.

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::MoveToBack | ( | const Iterator & | item | ) | `[inline]`

Move an item (as iterator item) to the front of the list.

Definition at line 458 of file list.h.

template<class T , class MemoryAllocator >

void csList< T, MemoryAllocator >::MoveToFront | ( | const Iterator & | item | ) | `[inline]`

Move an item (as iterator item) to the front of the list.

Definition at line 515 of file list.h.

template<class T, class MemoryAllocator>

csList< T, MemoryAllocator > & csList< T, MemoryAllocator >::operator= | ( | const csList< T, MemoryAllocator > & | other | ) | `[inline]`

Assignment, deep-copy.

Definition at line 334 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

bool csList< T, MemoryAllocator >::PopBack | ( |  | ) | `[inline]`

Deletes the last element of the list.

Definition at line 299 of file list.h.

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

bool csList< T, MemoryAllocator >::PopFront | ( |  | ) | `[inline]`

Deletes the first element of the list.

Definition at line 290 of file list.h.

template<class T, class MemoryAllocator >

csList< T, MemoryAllocator >::Iterator csList< T, MemoryAllocator >::PushBack | ( | const T & | item | ) | `[inline]`

Add an item last in list. Copy T into the listdata.

Add one item last in the list.

Definition at line 366 of file list.h.

template<class T, class MemoryAllocator >

csList< T, MemoryAllocator >::Iterator csList< T, MemoryAllocator >::PushFront | ( | const T & | item | ) | `[inline]`

Add an item first in list. Copy T into the listdata.

Add one item first in the list.

Definition at line 380 of file list.h.

## Member Data Documentation

template<class T, class MemoryAllocator = CS::Memory::AllocatorMalloc>

const size_t csList< T, MemoryAllocator >::allocSize = sizeof (ListElement)`[static]`

This is the size of the memory block the wrapper list uses to store the actual data.

It is published to make fixed-size allocators possible.

Definition at line 77 of file list.h.

The documentation for this class was generated from the following file:

- csutil/list.h