ScummVM
Common::List< t_T > Class Template Reference

Simple double linked list, modeled after the list template of the standard C++ library. More...

#include <list.h>

Collaboration diagram for Common::List< t_T >:

Public Types

typedef ListInternal::Iterator< t_T > iterator
 
typedef ListInternal::ConstIterator< t_T > const_iterator
 
typedef t_T value_type
 
typedef uint size_type
 

Public Member Functions

 List ()
 
 List (const List< t_T > &list)
 
 ~List ()
 
void insert (iterator pos, const t_T &element)
 Inserts element before pos. More...
 
template<typename iterator2 >
void insert (iterator pos, iterator2 first, iterator2 last)
 Inserts the elements from first to last before pos. More...
 
iterator erase (iterator pos)
 Deletes the element at location pos and returns an iterator pointing to the element after the one which was deleted. More...
 
iterator reverse_erase (iterator pos)
 Deletes the element at location pos and returns an iterator pointing to the element before the one which was deleted. More...
 
iterator erase (iterator first, iterator last)
 Deletes the elements between first and last (including first but not last) and returns an iterator pointing to the element after the one which was deleted (i.e., last). More...
 
void remove (const t_T &val)
 Removes all elements that are equal to val from the list. More...
 
void push_front (const t_T &element)
 Inserts element at the start of the list. More...
 
void push_back (const t_T &element)
 Appends element to the end of the list. More...
 
void pop_front ()
 Removes the first element of the list. More...
 
void pop_back ()
 Removes the last element of the list. More...
 
t_T & front ()
 Returns a reference to the first element of the list. More...
 
const t_T & front () const
 Returns a reference to the first element of the list. More...
 
t_T & back ()
 Returns a reference to the last element of the list. More...
 
const t_T & back () const
 Returns a reference to the last element of the list. More...
 
List< t_T > & operator= (const List< t_T > &list)
 
size_type size () const
 
void clear ()
 
bool empty () const
 
iterator begin ()
 
iterator reverse_begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator reverse_begin () const
 
const_iterator end () const
 

Protected Types

typedef ListInternal::NodeBase NodeBase
 
typedef ListInternal::Node< t_T > Node
 

Protected Member Functions

NodeBase erase (NodeBase *pos)
 
void insert (NodeBase *pos, const t_T &element)
 Inserts element before pos. More...
 

Protected Attributes

NodeBase _anchor
 

Detailed Description

template<typename t_T>
class Common::List< t_T >

Simple double linked list, modeled after the list template of the standard C++ library.

Definition at line 35 of file list.h.

Member Typedef Documentation

◆ const_iterator

template<typename t_T>
typedef ListInternal::ConstIterator<t_T> Common::List< t_T >::const_iterator

Definition at line 44 of file list.h.

◆ iterator

template<typename t_T>
typedef ListInternal::Iterator<t_T> Common::List< t_T >::iterator

Definition at line 43 of file list.h.

◆ Node

template<typename t_T>
typedef ListInternal::Node<t_T> Common::List< t_T >::Node
protected

Definition at line 38 of file list.h.

◆ NodeBase

template<typename t_T>
typedef ListInternal::NodeBase Common::List< t_T >::NodeBase
protected

Definition at line 37 of file list.h.

◆ size_type

template<typename t_T>
typedef uint Common::List< t_T >::size_type

Definition at line 47 of file list.h.

◆ value_type

template<typename t_T>
typedef t_T Common::List< t_T >::value_type

Definition at line 46 of file list.h.

Constructor & Destructor Documentation

◆ List() [1/2]

template<typename t_T>
Common::List< t_T >::List ( )
inline

Definition at line 50 of file list.h.

◆ List() [2/2]

template<typename t_T>
Common::List< t_T >::List ( const List< t_T > &  list)
inline

Definition at line 54 of file list.h.

◆ ~List()

template<typename t_T>
Common::List< t_T >::~List ( )
inline

Definition at line 61 of file list.h.

Member Function Documentation

◆ back() [1/2]

template<typename t_T>
t_T& Common::List< t_T >::back ( )
inline

Returns a reference to the last element of the list.

Definition at line 157 of file list.h.

◆ back() [2/2]

template<typename t_T>
const t_T& Common::List< t_T >::back ( ) const
inline

Returns a reference to the last element of the list.

Definition at line 162 of file list.h.

◆ begin() [1/2]

template<typename t_T>
iterator Common::List< t_T >::begin ( )
inline

Definition at line 210 of file list.h.

◆ begin() [2/2]

template<typename t_T>
const_iterator Common::List< t_T >::begin ( ) const
inline

Definition at line 222 of file list.h.

◆ clear()

template<typename t_T>
void Common::List< t_T >::clear ( )
inline

Definition at line 193 of file list.h.

◆ empty()

template<typename t_T>
bool Common::List< t_T >::empty ( ) const
inline

Definition at line 205 of file list.h.

◆ end() [1/2]

template<typename t_T>
iterator Common::List< t_T >::end ( )
inline

Definition at line 218 of file list.h.

◆ end() [2/2]

template<typename t_T>
const_iterator Common::List< t_T >::end ( ) const
inline

Definition at line 230 of file list.h.

◆ erase() [1/3]

template<typename t_T>
iterator Common::List< t_T >::erase ( iterator  pos)
inline

Deletes the element at location pos and returns an iterator pointing to the element after the one which was deleted.

Definition at line 85 of file list.h.

◆ erase() [2/3]

template<typename t_T>
iterator Common::List< t_T >::erase ( iterator  first,
iterator  last 
)
inline

Deletes the elements between first and last (including first but not last) and returns an iterator pointing to the element after the one which was deleted (i.e., last).

Definition at line 104 of file list.h.

◆ erase() [3/3]

template<typename t_T>
NodeBase Common::List< t_T >::erase ( NodeBase pos)
inlineprotected

Definition at line 235 of file list.h.

◆ front() [1/2]

template<typename t_T>
t_T& Common::List< t_T >::front ( )
inline

Returns a reference to the first element of the list.

Definition at line 147 of file list.h.

◆ front() [2/2]

template<typename t_T>
const t_T& Common::List< t_T >::front ( ) const
inline

Returns a reference to the first element of the list.

Definition at line 152 of file list.h.

◆ insert() [1/3]

template<typename t_T>
void Common::List< t_T >::insert ( iterator  pos,
const t_T &  element 
)
inline

Inserts element before pos.

Definition at line 68 of file list.h.

◆ insert() [2/3]

template<typename t_T>
template<typename iterator2 >
void Common::List< t_T >::insert ( iterator  pos,
iterator2  first,
iterator2  last 
)
inline

Inserts the elements from first to last before pos.

Definition at line 76 of file list.h.

◆ insert() [3/3]

template<typename t_T>
void Common::List< t_T >::insert ( NodeBase pos,
const t_T &  element 
)
inlineprotected

Inserts element before pos.

Definition at line 247 of file list.h.

◆ operator=()

template<typename t_T>
List<t_T>& Common::List< t_T >::operator= ( const List< t_T > &  list)
inline

Definition at line 166 of file list.h.

◆ pop_back()

template<typename t_T>
void Common::List< t_T >::pop_back ( )
inline

Removes the last element of the list.

Definition at line 141 of file list.h.

◆ pop_front()

template<typename t_T>
void Common::List< t_T >::pop_front ( )
inline

Removes the first element of the list.

Definition at line 135 of file list.h.

◆ push_back()

template<typename t_T>
void Common::List< t_T >::push_back ( const t_T &  element)
inline

Appends element to the end of the list.

Definition at line 130 of file list.h.

◆ push_front()

template<typename t_T>
void Common::List< t_T >::push_front ( const t_T &  element)
inline

Inserts element at the start of the list.

Definition at line 125 of file list.h.

◆ remove()

template<typename t_T>
void Common::List< t_T >::remove ( const t_T &  val)
inline

Removes all elements that are equal to val from the list.

Definition at line 115 of file list.h.

◆ reverse_begin() [1/2]

template<typename t_T>
iterator Common::List< t_T >::reverse_begin ( )
inline

Definition at line 214 of file list.h.

◆ reverse_begin() [2/2]

template<typename t_T>
const_iterator Common::List< t_T >::reverse_begin ( ) const
inline

Definition at line 226 of file list.h.

◆ reverse_erase()

template<typename t_T>
iterator Common::List< t_T >::reverse_erase ( iterator  pos)
inline

Deletes the element at location pos and returns an iterator pointing to the element before the one which was deleted.

Definition at line 94 of file list.h.

◆ size()

template<typename t_T>
size_type Common::List< t_T >::size ( ) const
inline

Definition at line 186 of file list.h.

Member Data Documentation

◆ _anchor

template<typename t_T>
NodeBase Common::List< t_T >::_anchor
protected

Definition at line 40 of file list.h.


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