Gorgon Game Engine
ValueIterator< I_, T_, D_ > Class Template Reference

Generic iterator interface. More...

Inheritance diagram for ValueIterator< I_, T_, D_ >:
[legend]

Public Member Functions

bool Compare (const I_ &iterator) const
 Compares two iterators if they point to the same item. More...
 
T_ Current () const
 Returns current item. More...
 
D_ Distance (const I_ &iterator) const
 Returns the distance to the given iterator. More...
 
bool IsValid () const
 Checks if the iterator is pointing to a valid item. More...
 
bool MoveBy (int amount)
 Moves the iterator by the given amount. More...
 
bool Next ()
 Advances the iterator to the next item. More...
 
 operator bool () const
 Checks if the operator is pointing to a valid item. More...
 
bool operator!= (const I_ &it) const
 Compares this iterator with another. More...
 
T_ operator* () const
 Dereferences the operator to get its value. More...
 
I_ operator+ (D_ offset) const
 Creates a new iterator adding the given offset. More...
 
I_ & operator++ ()
 Moves the iterator to forwards. More...
 
I_ operator++ (int)
 Moves the iterator to forwards. More...
 
I_ & operator+= (D_ offset)
 Moves the D_ by the given offset to forwards. More...
 
D_ operator- (const I_ &iterator) const
 Returns the distance to the given iterator. More...
 
I_ operator- (D_ offset) const
 Creates a new iterator subtracting the given offset. More...
 
I_ & operator-- ()
 Moves the iterator to backwards. More...
 
I_ operator-- (int)
 Moves the iterator to backwards. More...
 
I_ & operator-= (D_ offset)
 Moves the iterator by the given offset to backwards. More...
 
bool operator< (const I_ &iterator) const
 Checks if the current operator is before the given. More...
 
bool operator<= (const I_ &iterator) const
 Checks whether current operator is before or at the same point. More...
 
I_ & operator= (const I_ &iterator)
 Moves this iterator to the item pointed by the given. More...
 
bool operator== (const I_ &iterator) const
 Compares two iterators if they point to the same item. More...
 
bool operator> (const I_ &iterator) const
 Checks whether current operator is after the given. More...
 
bool operator>= (const I_ &iterator) const
 Checks whether current operator is after or at the same point. More...
 
T_ operator[] (D_ ind) const
 Index notation. More...
 
bool Previous ()
 Moves to the previous item. More...
 

Protected Member Functions

 ValueIterator ()
 Cannot be constructed unless overridden. More...
 

Detailed Description

template<class I_, class T_, class D_ = long>
class Gorgon::Containers::ValueIterator< I_, T_, D_ >

Generic iterator interface.

Derive from this class supplying self, type, and distance type Following functions should be implemented for Iterators. They are publicly shaped by this class. These functions are not virtually defined, this allows inlining and reduces memory usage

protected:
T_& current() const ...
bool moveby(int amount) ...
bool isvalid() const ...
bool compare(const I_ &) const ...
void set(const I_ &) ...
D_ distance(const I_ &) const ...
bool isbefore(const I_ &) const ...

Constructor & Destructor Documentation

◆ ValueIterator()

ValueIterator ( )
protected

Cannot be constructed unless overridden.

Member Function Documentation

◆ Compare()

bool Compare ( const I_ &  iterator) const

Compares two iterators if they point to the same item.

◆ Current()

T_ Current ( ) const

Returns current item.

◆ Distance()

D_ Distance ( const I_ &  iterator) const

Returns the distance to the given iterator.

◆ IsValid()

bool IsValid ( ) const

Checks if the iterator is pointing to a valid item.

◆ MoveBy()

bool MoveBy ( int  amount)

Moves the iterator by the given amount.

◆ Next()

bool Next ( )

Advances the iterator to the next item.

◆ operator bool()

operator bool ( ) const
explicit

Checks if the operator is pointing to a valid item.

◆ operator!=()

bool operator!= ( const I_ &  it) const

Compares this iterator with another.

◆ operator*()

T_ operator* ( ) const

Dereferences the operator to get its value.

◆ operator+()

I_ operator+ ( D_  offset) const

Creates a new iterator adding the given offset.

◆ operator++() [1/2]

I_& operator++ ( )

Moves the iterator to forwards.

◆ operator++() [2/2]

I_ operator++ ( int  )

Moves the iterator to forwards.

◆ operator+=()

I_& operator+= ( D_  offset)

Moves the D_ by the given offset to forwards.

◆ operator-() [1/2]

D_ operator- ( const I_ &  iterator) const

Returns the distance to the given iterator.

◆ operator-() [2/2]

I_ operator- ( D_  offset) const

Creates a new iterator subtracting the given offset.

◆ operator--() [1/2]

I_& operator-- ( )

Moves the iterator to backwards.

◆ operator--() [2/2]

I_ operator-- ( int  )

Moves the iterator to backwards.

◆ operator-=()

I_& operator-= ( D_  offset)

Moves the iterator by the given offset to backwards.

◆ operator<()

bool operator< ( const I_ &  iterator) const

Checks if the current operator is before the given.

◆ operator<=()

bool operator<= ( const I_ &  iterator) const

Checks whether current operator is before or at the same point.

◆ operator=()

I_& operator= ( const I_ &  iterator)

Moves this iterator to the item pointed by the given.

◆ operator==()

bool operator== ( const I_ &  iterator) const

Compares two iterators if they point to the same item.

◆ operator>()

bool operator> ( const I_ &  iterator) const

Checks whether current operator is after the given.

◆ operator>=()

bool operator>= ( const I_ &  iterator) const

Checks whether current operator is after or at the same point.

◆ operator[]()

T_ operator[] ( D_  ind) const

Index notation.

◆ Previous()

bool Previous ( )

Moves to the previous item.


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