The Battle for Wesnoth  1.15.2+dev
Public Types | Public Member Functions | Private Attributes | List of all members
wfl::variant_iterator Class Reference

Iterator class for the variant. More...

#include <variant.hpp>

Public Types

typedef variant value_type
 
typedef std::bidirectional_iterator_tag iterator_category
 
typedef variantreference
 
typedef variantpointer
 
typedef int difference_type
 

Public Member Functions

 variant_iterator ()
 Constructor for a no-op iterator. More...
 
 variant_iterator (const variant_value_base *value, const boost::any &iter)
 Constructor for a generic iterator. More...
 
variant operator* () const
 
variant_iteratoroperator++ ()
 
variant_iterator operator++ (int)
 
variant_iteratoroperator-- ()
 
variant_iterator operator-- (int)
 
bool operator== (const variant_iterator &that) const
 
bool operator!= (const variant_iterator &that) const
 

Private Attributes

VARIANT_TYPE type_
 
const variant_value_basecontainer_
 
boost::any iter_
 

Detailed Description

Iterator class for the variant.

Depending on the type_ the list_iterator_ and the map_iterator_ are a valid iterator or singular. Since most actions on singular iterators result in Undefined Behavior care should be taken when copying the list_iterator_ and map_iterator_.

Definition at line 185 of file variant.hpp.

Member Typedef Documentation

◆ difference_type

Definition at line 192 of file variant.hpp.

◆ iterator_category

typedef std::bidirectional_iterator_tag wfl::variant_iterator::iterator_category

Definition at line 189 of file variant.hpp.

◆ pointer

Definition at line 191 of file variant.hpp.

◆ reference

Definition at line 190 of file variant.hpp.

◆ value_type

Definition at line 188 of file variant.hpp.

Constructor & Destructor Documentation

◆ variant_iterator() [1/2]

wfl::variant_iterator::variant_iterator ( )

Constructor for a no-op iterator.

Definition at line 63 of file variant.cpp.

◆ variant_iterator() [2/2]

wfl::variant_iterator::variant_iterator ( const variant_value_base value,
const boost::any &  iter 
)

Constructor for a generic iterator.

Precondition
iter is not singular.
Parameters
valueA pointer to a variant value representing the container.
iterAn underlying iterator for the underlying container.

Definition at line 70 of file variant.cpp.

Member Function Documentation

◆ operator!=()

bool wfl::variant_iterator::operator!= ( const variant_iterator that) const

Definition at line 137 of file variant.cpp.

References operator==().

◆ operator*()

variant wfl::variant_iterator::operator* ( ) const

Definition at line 77 of file variant.cpp.

References container_, wfl::variant_value_base::deref_iterator(), and iter_.

◆ operator++() [1/2]

variant_iterator & wfl::variant_iterator::operator++ ( )

Definition at line 86 of file variant.cpp.

References container_, iter_, and wfl::variant_value_base::iterator_inc().

◆ operator++() [2/2]

variant_iterator wfl::variant_iterator::operator++ ( int  )

Definition at line 95 of file variant.cpp.

References container_, iter_, and wfl::variant_value_base::iterator_inc().

◆ operator--() [1/2]

variant_iterator & wfl::variant_iterator::operator-- ( )

Definition at line 105 of file variant.cpp.

References container_, iter_, and wfl::variant_value_base::iterator_dec().

◆ operator--() [2/2]

variant_iterator wfl::variant_iterator::operator-- ( int  )

Definition at line 114 of file variant.cpp.

References container_, iter_, and wfl::variant_value_base::iterator_dec().

◆ operator==()

bool wfl::variant_iterator::operator== ( const variant_iterator that) const

Definition at line 124 of file variant.cpp.

References container_, iter_, and wfl::variant_value_base::iterator_equals().

Referenced by operator!=().

Member Data Documentation

◆ container_

const variant_value_base* wfl::variant_iterator::container_
private

Definition at line 218 of file variant.hpp.

Referenced by operator*(), operator++(), operator--(), and operator==().

◆ iter_

boost::any wfl::variant_iterator::iter_
private

Definition at line 219 of file variant.hpp.

Referenced by operator*(), operator++(), operator--(), and operator==().

◆ type_

VARIANT_TYPE wfl::variant_iterator::type_
private

Definition at line 217 of file variant.hpp.


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