PIP 5.5.3
Platform-Independent Primitives
Public Member Functions | List of all members
PIMapIterator< 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...
 
T & value ()
 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 PIMapIterator< Key, T >

Java-style iterator for PIMap.

This class used to easy serial access keys and values in PIMap with write 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()) {
it.value().append("_!");
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 & PIMapIterator< Key, T >::key ( ) const
inline

Returns current key.

See also
value()

◆ value()

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

Returns current value.

See also
key()

◆ hasNext()

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

Returns true if iterator can jump to next entry.

See also
next()

◆ next()

template<typename Key , typename T >
bool PIMapIterator< 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 PIMapIterator< Key, T >::reset ( )
inline

Reset iterator to initial position.

See also
next()