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 | Private Attributes | List of all members
util::iterator_extend< Value, Container, Deref, Key > Class Template Reference

This is an iterator class that extends an existing iterator by overriding dereference. More...

#include <iterator.hpp>

Public Types

typedef Container::iterator base_iter_type
 
typedef Value value_type
 
typedef value_typepointer
 
typedef value_typereference
 
typedef
base_iter_type::difference_type 
difference_type
 
typedef
base_iter_type::iterator_category 
iterator_category
 

Public Member Functions

 iterator_extend ()
 Default constructor. More...
 
 iterator_extend (const base_iter_type &iter)
 Initialized constructor. More...
 
bool operator== (const iterator_extend &that) const
 
bool operator!= (const iterator_extend &that) const
 
bool operator< (const iterator_extend &that) const
 
bool operator> (const iterator_extend &that) const
 
bool operator<= (const iterator_extend &that) const
 
bool operator>= (const iterator_extend &that) const
 
reference operator* () const
 
pointer operator-> () const
 
iterator_extendoperator++ ()
 
iterator_extendoperator-- ()
 
iterator_extend operator++ (int)
 
iterator_extend operator-- (int)
 
iterator_extendoperator+= (difference_type n)
 
iterator_extendoperator-= (difference_type n)
 
iterator_extend operator+ (difference_type n) const
 
iterator_extend operator- (difference_type n) const
 
difference_type operator- (const iterator_extend &that) const
 
difference_type operator- (const const_iterator_extend< Value, Container, Deref, Key > &that) const
 
reference operator[] (difference_type n) const
 
const base_iter_typeget (const Key &) const
 

Private Attributes

base_iter_type iter_
 The underlying base iterator. More...
 

Detailed Description

template<typename Value, class Container, class Deref, class Key>
class util::iterator_extend< Value, Container, Deref, Key >

This is an iterator class that extends an existing iterator by overriding dereference.

Access to the underlying iterator is controlled, promoting a black-box approach.

The expected use of this class is as a typedef. If used in conjunction with a typedef of const_iterator_extend (with the same template parameters), you get conversion to your const iterator.

Value = Intended value_type (result of dereferencing). Container = The container whose iterator is being extended. Deref = A class whose member static const Value& eval(const Container::const_iterator &) can be used for dereferencing. (The const's might seem odd, but they allow the same class to be used for const_iterator_extend.) A const_cast will be used to convert the return value to Value&. Key = A class that unlocks the underlying iterator. (This way the underlying iterator is not exposed to everyone.) If Key is accessible, then the underlying iterator can be obtained via get(const Key &).

Definition at line 49 of file iterator.hpp.

Member Typedef Documentation

template<typename Value, class Container, class Deref, class Key>
typedef Container::iterator util::iterator_extend< Value, Container, Deref, Key >::base_iter_type

Definition at line 53 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
typedef base_iter_type::difference_type util::iterator_extend< Value, Container, Deref, Key >::difference_type

Definition at line 59 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
typedef base_iter_type::iterator_category util::iterator_extend< Value, Container, Deref, Key >::iterator_category

Definition at line 60 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
typedef value_type* util::iterator_extend< Value, Container, Deref, Key >::pointer

Definition at line 57 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
typedef value_type& util::iterator_extend< Value, Container, Deref, Key >::reference

Definition at line 58 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
typedef Value util::iterator_extend< Value, Container, Deref, Key >::value_type

Definition at line 56 of file iterator.hpp.

Constructor & Destructor Documentation

template<typename Value, class Container, class Deref, class Key>
util::iterator_extend< Value, Container, Deref, Key >::iterator_extend ( )
inline
template<typename Value, class Container, class Deref, class Key>
util::iterator_extend< Value, Container, Deref, Key >::iterator_extend ( const base_iter_type iter)
inlineexplicit

Initialized constructor.

Definition at line 65 of file iterator.hpp.

Member Function Documentation

template<typename Value, class Container, class Deref, class Key>
const base_iter_type& util::iterator_extend< Value, Container, Deref, Key >::get ( const Key &  ) const
inline
template<typename Value, class Container, class Deref, class Key>
bool util::iterator_extend< Value, Container, Deref, Key >::operator!= ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
reference util::iterator_extend< Value, Container, Deref, Key >::operator* ( ) const
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend util::iterator_extend< Value, Container, Deref, Key >::operator+ ( difference_type  n) const
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend& util::iterator_extend< Value, Container, Deref, Key >::operator++ ( )
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend util::iterator_extend< Value, Container, Deref, Key >::operator++ ( int  )
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend& util::iterator_extend< Value, Container, Deref, Key >::operator+= ( difference_type  n)
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend util::iterator_extend< Value, Container, Deref, Key >::operator- ( difference_type  n) const
inline
template<typename Value, class Container, class Deref, class Key>
difference_type util::iterator_extend< Value, Container, Deref, Key >::operator- ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
difference_type util::iterator_extend< Value, Container, Deref, Key >::operator- ( const const_iterator_extend< Value, Container, Deref, Key > &  that) const
inline

Definition at line 92 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
iterator_extend& util::iterator_extend< Value, Container, Deref, Key >::operator-- ( )
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend util::iterator_extend< Value, Container, Deref, Key >::operator-- ( int  )
inline
template<typename Value, class Container, class Deref, class Key>
iterator_extend& util::iterator_extend< Value, Container, Deref, Key >::operator-= ( difference_type  n)
inline
template<typename Value, class Container, class Deref, class Key>
pointer util::iterator_extend< Value, Container, Deref, Key >::operator-> ( ) const
inline

Definition at line 79 of file iterator.hpp.

template<typename Value, class Container, class Deref, class Key>
bool util::iterator_extend< Value, Container, Deref, Key >::operator< ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
bool util::iterator_extend< Value, Container, Deref, Key >::operator<= ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
bool util::iterator_extend< Value, Container, Deref, Key >::operator== ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
bool util::iterator_extend< Value, Container, Deref, Key >::operator> ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
bool util::iterator_extend< Value, Container, Deref, Key >::operator>= ( const iterator_extend< Value, Container, Deref, Key > &  that) const
inline
template<typename Value, class Container, class Deref, class Key>
reference util::iterator_extend< Value, Container, Deref, Key >::operator[] ( difference_type  n) const
inline

Definition at line 94 of file iterator.hpp.

Member Data Documentation

template<typename Value, class Container, class Deref, class Key>
base_iter_type util::iterator_extend< Value, Container, Deref, Key >::iter_
private

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