Qore Programming Language  0.9.16
ReverseConstHashIterator Class Reference

reverse constant iterator class for QoreHashNode, to be only created on the stack More...

#include <QoreHashNode.h>

Inheritance diagram for ReverseConstHashIterator:
Collaboration diagram for ReverseConstHashIterator:

Public Member Methods

DLLEXPORT ReverseConstHashIterator (const QoreHashNode &h)
 initializes the iterator with the passed hash
 
DLLEXPORT ReverseConstHashIterator (const QoreHashNode *h)
 initializes the iterator with the passed hash
 
DLLEXPORT ~ReverseConstHashIterator ()
 Destroys the iterator.
 
DLLEXPORT bool first () const
 returns true if on the last key of the hash
 
DLLEXPORT bool last () const
 returns true if on the first key of the hash
 
DLLEXPORT bool next ()
 moves to the next element in reverse order, returns false when there are no more elements to iterate More...
 
DLLEXPORT bool prev ()
 moves to the previous element in reverse order, returns false when there are no more elements to iterate More...
 
- Public Member Methods inherited from ConstHashIterator
DLLLOCAL ConstHashIterator (const ConstHashIterator &)
 copy constructor
 
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 ~ConstHashIterator ()
 Destroys the iterator.
 
DLLEXPORT bool empty () const
 returns true if the hash is empty
 
DLLEXPORT bool first () const
 returns true if on the first key of the hash
 
const DLLEXPORT QoreValue get () const
 returns the value of the current key
 
const DLLEXPORT QoreHashNodegetHash () const
 returns the hash
 
const DLLEXPORT char * getKey () const
 returns the current key
 
DLLEXPORT QoreStringgetKeyString () const
 returns a QoreString for the current key, the caller owns QoreString returned
 
DLLEXPORT QoreValue getReferenced () const
 returns the value of the current key with an incremented reference count
 
const DLLEXPORT QoreTypeInfo * getTypeInfo () const
 returns the type info for the current value
 
DLLEXPORT bool last () const
 returns true if on the last key of the hash
 
DLLEXPORT bool next ()
 moves to the next element, returns false when there are no more elements to iterate More...
 
DLLEXPORT bool prev ()
 moves to the previous element, returns false when there are no more elements to iterate More...
 
DLLEXPORT void reset ()
 resets the iterator to its initial state
 
DLLEXPORT bool valid () const
 returns true if the iterator is currently pointing at a valid element
 

Additional Inherited Members

- Private Member Methods inherited from ConstHashIterator
DLLLOCAL ConstHashIteratoroperator= (const HashIterator &)
 this function is not implemented; it is here as a protected function in order to prohibit it from being used
 

Detailed Description

reverse constant iterator class for QoreHashNode, to be only created on the stack

while (hi.next()) {
QoreStringValueHelper str(hi.get());
printf("key: '%s', value: '%s'\n", hi.getKey(), str->getBuffer());
}

Member Function Documentation

◆ next()

DLLEXPORT bool ReverseConstHashIterator::next ( )

moves to the next element in reverse order, returns false when there are no more elements to iterate

also moves to the last element if the object has just been initialized after a complete iteration (assuming there is at least one element in the hash)

◆ prev()

DLLEXPORT bool ReverseConstHashIterator::prev ( )

moves to the previous element in reverse order, 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)


The documentation for this class was generated from the following file:
ReverseConstHashIterator
reverse constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:640
QoreStringValueHelper
this class is used to safely manage calls to AbstractQoreNode::getStringRepresentation() when a simpl...
Definition: QoreStringNode.h:302
QoreString::getBuffer
const DLLEXPORT char * getBuffer() const
returns the string's buffer; this data should not be changed