Evo C++ Library v0.5.1
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
EnumMapIterator< T > Struct Template Reference

#include <evo/enum.h>

Inheritance diagram for EnumMapIterator< T >:
Inheritance graph
[legend]

Detailed Description

template<class T>
struct evo::EnumMapIterator< T >

Expanded EnumIterator used with enum traits.

Template Parameters
TEnum traits type to use
Example
#include <evo/enum.h>
#include <evo/io.h>
using namespace evo;
enum Color {
cUNKNOWN,
cBLUE,
cGREEN,
cRED,
cENUM_END
};
// Must be sorted and match enum values above
"blue",
"green",
"red"
);
int main() {
Console& c = con();
for (ColorEnum::Iter iter; iter; ++iter)
c.out << iter.value_str() << NL;
return 0;
}

Output:

blue
green
red

Public Types

typedef EnumIterator< typename T::Type,(int) T::FIRST,(int) T::LAST > BaseType
 
typedef T EnumType
 
typedef EnumMapIterator< T > This
 

Public Member Functions

 EnumMapIterator ()
 
 EnumMapIterator (const This &src)
 
 EnumMapIterator (EnumType value)
 
 EnumMapIterator (IteratorPos pos)
 
 operator SafeBoolType () const
 Safe (explicit) evaluation as bool type. More...
 
bool operator! () const
 Check whether iterator is at end. More...
 
bool operator!= (const This &oth) const
 Inequality operator to compare with another iterator to same enum. More...
 
EnumType operator* () const
 Dereference iterator to get current enum value. More...
 
Thisoperator++ ()
 Pre increment operator, moves to next enum value or end. More...
 
This operator++ (int)
 Post increment operator, moves to next enum value or end. More...
 
Thisoperator-- ()
 Pre decrement operator, moves to previous enum value or end. More...
 
This operator-- (int)
 Post decrement operator, moves to previous enum value or end. More...
 
Thisoperator= (const This &src)
 
Thisoperator= (EnumType value)
 
Thisoperator= (IteratorPos pos)
 
bool operator== (const This &oth) const
 Equality operator to compare with another iterator to same enum. More...
 
EnumType value () const
 Get current enum value. More...
 
int value_num (int endvalue=0) const
 Get current enum number value. More...
 
SubString value_str () const
 Get current enum string value. More...
 

Static Public Attributes

static const T FIRST
 
static const T LAST
 

Protected Member Functions

void next ()
 
void prev ()
 
void setpos (IteratorPos pos)
 

Protected Attributes

bool end_
 
EnumType value_
 

Member Typedef Documentation

◆ BaseType

typedef EnumIterator<typename T::Type, (int)T::FIRST, (int)T::LAST> BaseType

◆ EnumType

typedef T EnumType

◆ This

typedef EnumMapIterator<T> This

Constructor & Destructor Documentation

◆ EnumMapIterator() [1/4]

EnumMapIterator ( )
inline

◆ EnumMapIterator() [2/4]

EnumMapIterator ( const This src)
inline

◆ EnumMapIterator() [3/4]

EnumMapIterator ( EnumType  value)
inline

◆ EnumMapIterator() [4/4]

EnumMapIterator ( IteratorPos  pos)
inline

Member Function Documentation

◆ next()

void next ( )
inlineprotectedinherited

◆ operator SafeBoolType()

operator SafeBoolType ( ) const
inlineinherited

Safe (explicit) evaluation as bool type.

  • This is called when object is directly evaluated as a bool, and is equivalent to: !operator!()
  • See SafeBool

◆ operator!()

bool operator! ( ) const
inlineinherited

Check whether iterator is at end.

Returns
Whether at end

◆ operator!=()

bool operator!= ( const This oth) const
inlineinherited

Inequality operator to compare with another iterator to same enum.

Parameters
othOther iterator to compare to
Returns
Whether inequal

◆ operator*()

EnumType operator* ( ) const
inlineinherited

Dereference iterator to get current enum value.

Returns
Current enum value

◆ operator++() [1/2]

This& operator++ ( )
inlineinherited

Pre increment operator, moves to next enum value or end.

Returns
This

◆ operator++() [2/2]

This operator++ ( int  )
inlineinherited

Post increment operator, moves to next enum value or end.

Returns
Iterator copy before increment

◆ operator--() [1/2]

This& operator-- ( )
inlineinherited

Pre decrement operator, moves to previous enum value or end.

Returns
This

◆ operator--() [2/2]

This operator-- ( int  )
inlineinherited

Post decrement operator, moves to previous enum value or end.

Returns
Iterator copy before decrement

◆ operator=() [1/3]

This& operator= ( const This src)
inline

◆ operator=() [2/3]

This& operator= ( EnumType  value)
inline

◆ operator=() [3/3]

This& operator= ( IteratorPos  pos)
inline

◆ operator==()

bool operator== ( const This oth) const
inlineinherited

Equality operator to compare with another iterator to same enum.

Parameters
othOther iterator to compare to
Returns
Whether equal

◆ prev()

void prev ( )
inlineprotectedinherited

◆ setpos()

void setpos ( IteratorPos  pos)
inlineprotectedinherited

◆ value()

EnumType value ( ) const
inlineinherited

Get current enum value.

Returns
Current enum value

◆ value_num()

int value_num ( int  endvalue = 0) const
inlineinherited

Get current enum number value.

Returns
Current enum number value

◆ value_str()

SubString value_str ( ) const
inline

Get current enum string value.

Returns
Current enum string value, null if at end

Member Data Documentation

◆ end_

bool end_
protectedinherited

◆ FIRST

const T FIRST
staticinherited

◆ LAST

const T LAST
staticinherited

◆ value_

EnumType value_
protectedinherited

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