Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE > Class Template Reference

EnumeratorMapContainer is based on some COLLECTION class that represents an associative collection of some sort, i.e. More...

#include <vcf/FoundationKit/Enumerator.h>

Inheritance diagram for VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >:

VCF::Enumerator< COLLECTION_TYPE > VCF::AssociativeEnumerator< KeyType, ValueType, std::map< KeyType, ValueType > > VCF::Map< KeyType, ValueType > List of all members.

Public Member Functions

 EnumeratorMapContainer (COLLECTION &container)
 EnumeratorMapContainer ()
virtual ~EnumeratorMapContainer ()
virtual void initContainer (COLLECTION &container)
virtual Enumerator< COLLECTION_TYPE > * getEnumerator () const
virtual bool hasMoreElements (const bool &backward=false) const
 indicates whether there are any more children to enumerate through
virtual COLLECTION_TYPE nextElement ()
 returns the next element in the enumeration.
virtual COLLECTION_TYPE prevElement ()
 returns the previous element in the enumeration.
virtual void reset (const bool &backward=false) const
 Resets the Enumerator's internal iterator back to the beginning (or end, if backward is true).

Detailed Description

template<class COLLECTION, class COLLECTION_TYPE>
class VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >

EnumeratorMapContainer is based on some COLLECTION class that represents an associative collection of some sort, i.e.

std::map<>

The internal implementation counts on the collection having a common interface to STL's collection classes.

The collection must support forward and reverse iterators

The COLLECTION type specifies the full collection associated with the enumerator.

For example, an enumerator container of Object* using a std::map as it's collection type would look like this:

    EnumeratorMapContainer<std::map<String,Object*>,Object*> objectMapEnumerator;
The COLLECTION_TYPE represents the type of an individual element in the enumerator. In EnumeratorMapContainer the enumeration will only return the value of the maps pair, not the key.


Constructor & Destructor Documentation

template<class COLLECTION, class COLLECTION_TYPE>
VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::EnumeratorMapContainer COLLECTION &  container  )  [inline]
 

template<class COLLECTION, class COLLECTION_TYPE>
VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::EnumeratorMapContainer  )  [inline]
 

template<class COLLECTION, class COLLECTION_TYPE>
virtual VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::~EnumeratorMapContainer  )  [inline, virtual]
 


Member Function Documentation

template<class COLLECTION, class COLLECTION_TYPE>
virtual Enumerator<COLLECTION_TYPE>* VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::getEnumerator  )  const [inline, virtual]
 

template<class COLLECTION, class COLLECTION_TYPE>
virtual bool VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::hasMoreElements const bool &  backward = false  )  const [inline, virtual]
 

indicates whether there are any more children to enumerate through

Parameters:
bool specifies whether the enumeration should be forwards or backwards. The default value is true for enumerating forwards.
Returns:
bool true if there are any elements left to enumerate, otherwise returns false.

Implements VCF::Enumerator< COLLECTION_TYPE >.

template<class COLLECTION, class COLLECTION_TYPE>
virtual void VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::initContainer COLLECTION &  container  )  [inline, virtual]
 

template<class COLLECTION, class COLLECTION_TYPE>
virtual COLLECTION_TYPE VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::nextElement  )  [inline, virtual]
 

returns the next element in the enumeration.

Moves the internal iterator forward

Returns:
COLLECTION_TYPE returns a COLLECTION_TYPE value of whatever type was specified in the template argument to the Enumerator

Implements VCF::Enumerator< COLLECTION_TYPE >.

template<class COLLECTION, class COLLECTION_TYPE>
virtual COLLECTION_TYPE VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::prevElement  )  [inline, virtual]
 

returns the previous element in the enumeration.

Moves the internal iterator backward

Returns:
COLLECTION_TYPE returns a COLLECTION_TYPE value of whatever type was specified in the template argument to the Enumerator

Implements VCF::Enumerator< COLLECTION_TYPE >.

template<class COLLECTION, class COLLECTION_TYPE>
virtual void VCF::EnumeratorMapContainer< COLLECTION, COLLECTION_TYPE >::reset const bool &  backward = false  )  const [inline, virtual]
 

Resets the Enumerator's internal iterator back to the beginning (or end, if backward is true).

Parameters:
bool specifies which direction to reset to

Implements VCF::Enumerator< COLLECTION_TYPE >.


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information