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
variant_iterator Class Reference

Iterator class for the variant. More...

#include <variant.hpp>

Public Types

enum  TYPE { TYPE_NULL, TYPE_LIST, TYPE_MAP }
 
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 TYPE_NULL variant. More...
 
 variant_iterator (const std::vector< variant >::iterator &iter)
 Constructor for a TYPE_LIST variant. More...
 
 variant_iterator (const std::map< variant, variant >::iterator &iter)
 Constructor for a TYPE_MAP variant. More...
 
 variant_iterator (const variant_iterator &)
 
variant operator* () const
 
variant_iteratoroperator++ ()
 
variant_iterator operator++ (int)
 
variant_iteratoroperator-- ()
 
variant_iterator operator-- (int)
 
variant_iteratoroperator= (const variant_iterator &that)
 
bool operator== (const variant_iterator &that) const
 
bool operator!= (const variant_iterator &that) const
 

Private Attributes

TYPE type_
 
std::vector< variant >::iterator list_iterator_
 
std::map< variant, variant >
::iterator 
map_iterator_
 

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 188 of file variant.hpp.

Member Typedef Documentation

Definition at line 194 of file variant.hpp.

typedef std::bidirectional_iterator_tag variant_iterator::iterator_category

Definition at line 191 of file variant.hpp.

Definition at line 193 of file variant.hpp.

Definition at line 192 of file variant.hpp.

Definition at line 190 of file variant.hpp.

Member Enumeration Documentation

Enumerator
TYPE_NULL 
TYPE_LIST 
TYPE_MAP 

Definition at line 230 of file variant.hpp.

Constructor & Destructor Documentation

variant_iterator::variant_iterator ( )

Constructor for a TYPE_NULL variant.

Definition at line 83 of file variant.cpp.

variant_iterator::variant_iterator ( const std::vector< variant >::iterator &  iter)
explicit

Constructor for a TYPE_LIST variant.

Precondition
iter is not singular.
Parameters
iterIterator to initialize list_iterator_ with.

Definition at line 110 of file variant.cpp.

variant_iterator::variant_iterator ( const std::map< variant, variant >::iterator &  iter)
explicit

Constructor for a TYPE_MAP variant.

Precondition
iter is not singular.
Parameters
iterIterator to initialize map_iterator_ with.

Definition at line 118 of file variant.cpp.

variant_iterator::variant_iterator ( const variant_iterator iter)

Definition at line 90 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, TYPE_MAP, and TYPE_NULL.

Member Function Documentation

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

Definition at line 234 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, TYPE_MAP, and TYPE_NULL.

variant variant_iterator::operator* ( ) const

Definition at line 126 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, and TYPE_MAP.

variant_iterator & variant_iterator::operator++ ( )

Definition at line 140 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, and TYPE_MAP.

variant_iterator variant_iterator::operator++ ( int  )

Definition at line 153 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, and TYPE_MAP.

variant_iterator & variant_iterator::operator-- ( )

Definition at line 167 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, and TYPE_MAP.

variant_iterator variant_iterator::operator-- ( int  )

Definition at line 180 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, and TYPE_MAP.

variant_iterator & variant_iterator::operator= ( const variant_iterator that)

Definition at line 194 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, TYPE_MAP, and TYPE_NULL.

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

Definition at line 216 of file variant.cpp.

References list_iterator_, map_iterator_, type_, TYPE_LIST, TYPE_MAP, and TYPE_NULL.

Member Data Documentation

std::vector<variant>::iterator variant_iterator::list_iterator_
private
std::map<variant,variant>::iterator variant_iterator::map_iterator_
private
TYPE variant_iterator::type_
private

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