Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::MapIterator Class Template Reference

Wraps iteration over a map. More...

#include <OgreIteratorWrappers.h>

List of all members.

Public Methods

 MapIterator ()
 MapIterator (typename T::iterator start, typename T::iterator end)
 Constructor. More...

bool hasMoreElements (void)
 Returns true if there are more items in the collection. More...

T::mapped_type getNext (void)
 Returns the next value element in the collection, and advances to the next. More...

T::mapped_type peekNextValue (void)
 Returns the next value element in the collection, without advancing to the next. More...

T::key_type peekNextKey (void)
 Returns the next key element in the collection, without advancing to the next. More...

MapIterator< T > & operator= (MapIterator< T > &rhs)
 Required to overcome intermittent bug. More...


Private Attributes

T::iterator mCurrent
T::iterator mEnd


Detailed Description

template<class T>
class Ogre::MapIterator< T >

Wraps iteration over a map.

Remarks:
This class is here just to allow clients to iterate over an internal map of a class without having to have access to the map itself (typically to iterate you need both the iterator and the end() iterator to test for the end condition, which is messy). No updates are allowed through this interface, it is purely for iterating and reading.

Note that like STL iterators, these iterators are only valid whilst no updates are made to the underlying collection. You should not attempt to use this iterator if a change is made to the collection. In fact, treat this iterator as a transient object, do NOT store it and try to use it repeatedly.


Constructor & Destructor Documentation

template<class T>
Ogre::MapIterator< T >::MapIterator  
 

template<class T>
Ogre::MapIterator< T >::MapIterator typename T::iterator    start,
typename T::iterator    end
[inline]
 

Constructor.

Remarks:
Provide a start and end iterator to initialise.


Member Function Documentation

template<class T>
T::mapped_type Ogre::MapIterator< T >::getNext void    [inline]
 

Returns the next value element in the collection, and advances to the next.

template<class T>
bool Ogre::MapIterator< T >::hasMoreElements void    [inline]
 

Returns true if there are more items in the collection.

template<class T>
MapIterator<T>& Ogre::MapIterator< T >::operator= MapIterator< T > &    rhs [inline]
 

Required to overcome intermittent bug.

template<class T>
T::key_type Ogre::MapIterator< T >::peekNextKey void    [inline]
 

Returns the next key element in the collection, without advancing to the next.

template<class T>
T::mapped_type Ogre::MapIterator< T >::peekNextValue void    [inline]
 

Returns the next value element in the collection, without advancing to the next.


Member Data Documentation

template<class T>
T::iterator Ogre::MapIterator::mCurrent [private]
 

template<class T>
T::iterator Ogre::MapIterator::mEnd [private]
 

Copyright © 2002 by The OGRE Team