PIP 5.5.3
Platform-Independent Primitives
Public Member Functions | List of all members
PIMapIteratorConst< Key, T > Class Template Reference

Java-style iterator for PIMap. More...

#include <pimap.h>

Public Member Functions

const Key & key () const
 Returns current key. More...
 
const T & value () const
 Returns current value. More...
 
bool hasNext () const
 Returns true if iterator can jump to next entry. More...
 
bool next ()
 Jump to next entry and return true if new position is valid. More...
 
void reset ()
 Reset iterator to initial position. More...
 

Detailed Description

template<typename Key, typename T>
class PIMapIteratorConst< Key, T >

Java-style iterator for PIMap.

This class used to easy serial access keys and values in PIMap with read only permitions. Use constructor to create iterator, or use PIMap::makeIterator()

m[1] = "one";
m[2] = "two";
m[4] = "four";
auto it = m.makeIterator();
while (it.next()) {
piCout << it.key() << it.value();
}
// 1 one
// 2 two
// 4 four
#define piCout
Macro used for conditional (piDebug) output to PICout(StdOut)
Definition: picout.h:35

Member Function Documentation

◆ key()

template<typename Key , typename T >
const Key & PIMapIteratorConst< Key, T >::key ( ) const
inline

Returns current key.

See also
value()

◆ value()

template<typename Key , typename T >
const T & PIMapIteratorConst< Key, T >::value ( ) const
inline

Returns current value.

See also
key()

◆ hasNext()

template<typename Key , typename T >
bool PIMapIteratorConst< Key, T >::hasNext ( ) const
inline

Returns true if iterator can jump to next entry.

See also
next()

◆ next()

template<typename Key , typename T >
bool PIMapIteratorConst< Key, T >::next ( )
inline

Jump to next entry and return true if new position is valid.

See also
hasNext(), reset()

◆ reset()

template<typename Key , typename T >
void PIMapIteratorConst< Key, T >::reset ( )
inline

Reset iterator to initial position.

See also
next()