Main Page   Class Hierarchy   Compound List   File List   Compound Members  

MapIter Class Template Reference

Map iterator. More...

#include <mmap.h>

List of all members.

Public Methods

 MapIter (const Map< keyclass, valueclass > &map)
void first ()
void next ()
const keyclass& key () const
keyclass& key ()
const valueclass& value () const
valueclass& value ()
int exhausted () const

Protected Attributes

GenHashIter iter


Detailed Description

template<class keyclass, class valueclass> class MapIter

Map iterator.

Usage:

for (MapIter<String,String> iter (myMap); !iter.exhausted(); iter.next())

printf("s=s
", (CONSTR) iter.key(), (CONSTR) iter.value());

, which prints the key-value-pairs of the map to stdout.

See mmap.h for additional macros forMap and forStringMap for somewhat easier iteration. For example:

forStringMap (myMap, iter) { printf("s", (CONSTR) iter.value()); }

, which prints the values in the map to stdout.

Definition at line 433 of file mmap.h.


Member Function Documentation

int exhausted ( ) const [inline]
 

Returns 1 (true) if all the items in the mmap.have been iterated, 0 (false) otherwise.

Definition at line 466 of file mmap.h.

void first ( ) [inline]
 

Points the iterator to the first item in the Map.

Definition at line 438 of file mmap.h.

keyclass & key ( ) [inline]
 

Returns a non-const reference to the key in the current position of the iterator.

Definition at line 451 of file mmap.h.

const keyclass & key ( ) const [inline]
 

Returns a const reference to the key in the current position of the iterator.

Definition at line 446 of file mmap.h.

void next ( ) [inline]
 

Moves the iterator to next item in the Map.

Definition at line 441 of file mmap.h.

valueclass & value ( ) [inline]
 

Returns a non-const reference to the value in the current position of the iterator.

Definition at line 461 of file mmap.h.

const valueclass & value ( ) const [inline]
 

Returns a const reference to the value in the current position of the iterator.

Definition at line 456 of file mmap.h.


The documentation for this class was generated from the following file:
Generated at Tue Dec 4 19:53:30 2001 for MagiC++ by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001