#include <QoreHashNode.h>
Public Member Functions | |
DLLEXPORT | ConstHashIterator (const QoreHashNode *h) |
initializes the iterator with the passed hash | |
DLLEXPORT | ConstHashIterator (const QoreHashNode &h) |
initializes the iterator with the passed hash | |
DLLEXPORT bool | next () |
moves to the next element, returns false when there are no more elements to iterate | |
DLLEXPORT const char * | getKey () const |
returns the current key | |
DLLEXPORT QoreString * | getKeyString () const |
returns a QoreString for the current key, the caller owns QoreString returned | |
DLLEXPORT const AbstractQoreNode * | getValue () const |
returns the value of the current key | |
DLLEXPORT AbstractQoreNode * | getReferencedValue () const |
returns the value of the current key with an incremented reference count | |
DLLEXPORT bool | first () const |
returns true if on the first key of the hash | |
DLLEXPORT bool | last () const |
returns true if on the last key of the hash |
ConstHashIterator hi(h); while (hi.next()) { QoreStringValueHelper str(hi.getValue()); printf("key: '%s', value: '%s'\n", hi.getKey(), str->getBuffer()); }
DLLEXPORT bool ConstHashIterator::next | ( | ) |
moves to the next element, returns false when there are no more elements to iterate
also moves to the first element if the object has just been initialized after a complete iteration (assuming there is at least one element in the hash)