The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
utils::smart_list< Data >::iterator_base< Value, Reversed > Class Template Reference

The base for the list's iterator classes. More...

Public Types

typedef Value value_type
 
typedef value_typepointer
 
typedef value_typereference
 
typedef
std::bidirectional_iterator_tag 
iterator_category
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 ~iterator_base ()
 Destructor (Not virtual, since the derived classes are mere shells.) More...
 
iterator_baseoperator= (const iterator_base &that)
 
bool operator== (const iterator_base &that) const
 
bool operator!= (const iterator_base &that) const
 
reference operator* () const
 
pointer operator-> () const
 
iterator_baseoperator++ ()
 
iterator_baseoperator-- ()
 
iterator_base operator++ (int)
 
iterator_base operator-- (int)
 
bool derefable () const
 Test for being in a list, rather than past-the-end (or unassigned). More...
 

Protected Member Functions

 iterator_base ()
 Default constructor. More...
 
 iterator_base (node_t *ptr)
 Initialized constructor. More...
 
template<class V , bool R>
 iterator_base (const iterator_base< V, R > &that)
 Conversion constructors. More...
 
 iterator_base (const iterator_base &that)
 Copy constructor (the default overrides the conversion template). More...
 

Private Types

typedef smart_list< Data >::node_t node_t
 

Private Member Functions

void advance (bool reverse)
 Advances our pointer to an unflagged node, possibly in the reverse direction. More...
 
void inc (bool reverse)
 Advances our pointer one step, possibly in the reverse direction. More...
 
void skip_flagged (bool reverse=Reversed)
 Make sure we are not pointing to a flagged node. More...
 
void refer () const
 Add a reference. More...
 

Static Private Member Functions

static bool derefable (node_t *ptr)
 Test for being in a list, rather than past-the-end (or unassigned). More...
 
static void unref (node_t *old_ptr)
 Remove a reference. More...
 

Private Attributes

node_tptr_
 

Friends

class smart_list< Data >
 

Detailed Description

template<class Data>
template<class Value, bool Reversed>
class utils::smart_list< Data >::iterator_base< Value, Reversed >

The base for the list's iterator classes.

Value is the value type of this iterator. Reversed is true for the reverse iterators. The actual iterators must have neither data nor destructors.

Definition at line 83 of file smart_list.hpp.

Member Typedef Documentation

template<class Data>
template<class Value, bool Reversed>
typedef ptrdiff_t utils::smart_list< Data >::iterator_base< Value, Reversed >::difference_type

Definition at line 94 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
typedef std::bidirectional_iterator_tag utils::smart_list< Data >::iterator_base< Value, Reversed >::iterator_category

Definition at line 93 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
typedef smart_list<Data>::node_t utils::smart_list< Data >::iterator_base< Value, Reversed >::node_t
private

Definition at line 86 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
typedef value_type* utils::smart_list< Data >::iterator_base< Value, Reversed >::pointer

Definition at line 91 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
typedef value_type& utils::smart_list< Data >::iterator_base< Value, Reversed >::reference

Definition at line 92 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
typedef Value utils::smart_list< Data >::iterator_base< Value, Reversed >::value_type

Definition at line 90 of file smart_list.hpp.

Constructor & Destructor Documentation

template<class Data>
template<class Value, bool Reversed>
utils::smart_list< Data >::iterator_base< Value, Reversed >::iterator_base ( )
inlineprotected

Default constructor.

Definition at line 98 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
utils::smart_list< Data >::iterator_base< Value, Reversed >::iterator_base ( node_t ptr)
inlineexplicitprotected

Initialized constructor.

Definition at line 100 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
template<class V , bool R>
utils::smart_list< Data >::iterator_base< Value, Reversed >::iterator_base ( const iterator_base< V, R > &  that)
inlineprotected

Conversion constructors.

Definition at line 104 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
utils::smart_list< Data >::iterator_base< Value, Reversed >::iterator_base ( const iterator_base< Value, Reversed > &  that)
inlineprotected

Copy constructor (the default overrides the conversion template).

Definition at line 107 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
utils::smart_list< Data >::iterator_base< Value, Reversed >::~iterator_base ( )
inline

Destructor (Not virtual, since the derived classes are mere shells.)

Definition at line 112 of file smart_list.hpp.

Member Function Documentation

template<class Data >
template<class Value , bool Reversed>
void utils::smart_list< Data >::iterator_base< Value, Reversed >::advance ( bool  reverse)
inlineprivate

Advances our pointer to an unflagged node, possibly in the reverse direction.

This will advance at least one step, and will not stop on a flagged node. In addition, this takes care of updating reference counts. (This is the code shared by increments and decrements.)

Definition at line 782 of file smart_list.hpp.

Referenced by utils::smart_list< Data >::iterator_base< Data, false >::operator++(), and utils::smart_list< Data >::iterator_base< Data, false >::operator--().

template<class Data>
template<class Value, bool Reversed>
bool utils::smart_list< Data >::iterator_base< Value, Reversed >::derefable ( ) const
inline

Test for being in a list, rather than past-the-end (or unassigned).

Definition at line 159 of file smart_list.hpp.

Referenced by utils::smart_list< Data >::iterator_base< Data, false >::derefable(), utils::smart_list< Data >::smart_list(), and utils::smart_list< Data >::splice().

template<class Data>
template<class Value, bool Reversed>
static bool utils::smart_list< Data >::iterator_base< Value, Reversed >::derefable ( node_t ptr)
inlinestaticprivate

Test for being in a list, rather than past-the-end (or unassigned).

Definition at line 164 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
void utils::smart_list< Data >::iterator_base< Value, Reversed >::inc ( bool  reverse)
inlineprivate

Advances our pointer one step, possibly in the reverse direction.

Definition at line 168 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
bool utils::smart_list< Data >::iterator_base< Value, Reversed >::operator!= ( const iterator_base< Value, Reversed > &  that) const
inline

Definition at line 132 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
reference utils::smart_list< Data >::iterator_base< Value, Reversed >::operator* ( ) const
inline

Definition at line 135 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
iterator_base& utils::smart_list< Data >::iterator_base< Value, Reversed >::operator++ ( )
inline

Definition at line 139 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
iterator_base utils::smart_list< Data >::iterator_base< Value, Reversed >::operator++ ( int  )
inline

Definition at line 141 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
iterator_base& utils::smart_list< Data >::iterator_base< Value, Reversed >::operator-- ( )
inline

Definition at line 140 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
iterator_base utils::smart_list< Data >::iterator_base< Value, Reversed >::operator-- ( int  )
inline

Definition at line 149 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
pointer utils::smart_list< Data >::iterator_base< Value, Reversed >::operator-> ( ) const
inline

Definition at line 136 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
iterator_base& utils::smart_list< Data >::iterator_base< Value, Reversed >::operator= ( const iterator_base< Value, Reversed > &  that)
inline

Definition at line 115 of file smart_list.hpp.

template<class Data>
template<class Value, bool Reversed>
bool utils::smart_list< Data >::iterator_base< Value, Reversed >::operator== ( const iterator_base< Value, Reversed > &  that) const
inline

Definition at line 131 of file smart_list.hpp.

template<class Data >
template<class Value , bool Reversed>
void utils::smart_list< Data >::iterator_base< Value, Reversed >::refer ( ) const
inlineprivate

Add a reference.

Add a reference to that to which we point.

Definition at line 809 of file smart_list.hpp.

Referenced by utils::smart_list< Data >::iterator_base< Data, false >::iterator_base(), and utils::smart_list< Data >::iterator_base< Data, false >::operator=().

template<class Data >
template<class Value , bool Reversed>
void utils::smart_list< Data >::iterator_base< Value, Reversed >::skip_flagged ( bool  reverse = Reversed)
inlineprivate

Make sure we are not pointing to a flagged node.

Definition at line 800 of file smart_list.hpp.

Referenced by utils::smart_list< Data >::iterator_base< Data, false >::iterator_base().

template<class Data >
template<class Value , bool Reversed>
void utils::smart_list< Data >::iterator_base< Value, Reversed >::unref ( node_t old_ptr)
inlinestaticprivate

Friends And Related Function Documentation

template<class Data>
template<class Value, bool Reversed>
friend class smart_list< Data >
friend

Definition at line 85 of file smart_list.hpp.

Member Data Documentation

template<class Data>
template<class Value, bool Reversed>
node_t* utils::smart_list< Data >::iterator_base< Value, Reversed >::ptr_
private

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