MoSync 3.3
MAUtil::List< Type > Class Template Reference

A generic, dynamic list container. More...

#include <MAUtil/List.h>

List of all members.

Classes

class  ConstListIterator
 A constant iterator for a list container. More...
class  ListIterator
 An iterator for a list container. More...
class  ListNode
 A node in a list container. More...

Public Member Functions

 List ()
 Constructs an empty list.
void addFirst (const Type &data)
void addLast (const Type &data)
ListIterator insert (ListIterator iterator, const Type &data)
ListIterator remove (ListIterator iterator)
ListIterator begin ()
ListIterator end ()
ConstListIterator begin () const
ConstListIterator end () const
int size () const

Friends

class ListIterator
class ConstListIterator

Detailed Description

template<typename Type>
class MAUtil::List< Type >

A generic, dynamic list container.

You can retrieve either a ListIterator or ConstListIterator to iterate through the list.


Constructor & Destructor Documentation

template<typename Type >
MAUtil::List< Type >::List ( ) [inline]

Constructs an empty list.


Member Function Documentation

template<typename Type >
void MAUtil::List< Type >::addFirst ( const Type &  data) [inline]

Adds an element to the beginning of the list.

References MAUtil::List< Type >::ListNode::mPrev, and NULL.

template<typename Type >
void MAUtil::List< Type >::addLast ( const Type &  data) [inline]

Adds an element to the end of the list.

References MAUtil::List< Type >::ListNode::mNext, and NULL.

template<typename Type >
ListIterator MAUtil::List< Type >::insert ( ListIterator  iterator,
const Type &  data 
) [inline]

Inserts an element at a specific position in the list.

Parameters:
iteratorAn iterator pointing to the element after which the element is to be added. The iterator is invalidated by this operation.
dataThe element to be inserted.
Returns:
A new iterator pointing to the newly added element.

References MAUtil::List< Type >::ListNode::mNext, MAUtil::List< Type >::ListNode::mPrev, and NULL.

template<typename Type >
ListIterator MAUtil::List< Type >::remove ( ListIterator  iterator) [inline]

Removes an element from list.

Parameters:
iteratorAn iterator pointing to the element to be removed. The iterator is invalidated by this operation.
Returns:
A new iterator pointing to the element following the removed.

References MAUtil::List< Type >::ListIterator, MAUtil::List< Type >::ListNode::mNext, MAUtil::List< Type >::ListNode::mPrev, and NULL.

template<typename Type >
ListIterator MAUtil::List< Type >::begin ( ) [inline]

Returns an iterator pointing to the first element in the list.

References MAUtil::List< Type >::ListIterator.

template<typename Type >
ListIterator MAUtil::List< Type >::end ( ) [inline]

Returns an iterator pointing beyond the last element of the list.

References MAUtil::List< Type >::ListIterator.

template<typename Type >
ConstListIterator MAUtil::List< Type >::begin ( ) const [inline]
template<typename Type >
ConstListIterator MAUtil::List< Type >::end ( ) const [inline]
template<typename Type >
int MAUtil::List< Type >::size ( ) const [inline]

Returns the number of elements in the list.


Friends And Related Function Documentation

template<typename Type >
friend class ListIterator [friend]
template<typename Type >
friend class ConstListIterator [friend]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines