Qore Programming Language  0.8.11.1
Public Member Functions | List of all members
ReverseHashIterator Class Reference

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

#include <QoreHashNode.h>

Inheritance diagram for ReverseHashIterator:
Inheritance graph
[legend]
Collaboration diagram for ReverseHashIterator:
Collaboration graph
[legend]

Public Member Functions

DLLEXPORT ReverseHashIterator (QoreHashNode *h)
 initializes the iterator with the passed hash
 
DLLEXPORT ReverseHashIterator (QoreHashNode &h)
 initializes the iterator with the passed hash
 
DLLEXPORT ~ReverseHashIterator ()
 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 Functions inherited from HashIterator
DLLEXPORT HashIterator (QoreHashNode *h)
 initializes the iterator with the passed hash
 
DLLEXPORT HashIterator (QoreHashNode &h)
 initializes the iterator with the passed hash
 
DLLEXPORT ~HashIterator ()
 Destroys the iterator.
 
DLLEXPORT void deleteKey (ExceptionSink *xsink)
 deletes the key from the hash and dereferences the value More...
 
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
 
DLLEXPORT const char * getKey () const
 returns the current key
 
DLLEXPORT QoreStringgetKeyString () const
 returns a QoreString for the current key, the caller owns QoreString returned
 
DLLEXPORT AbstractQoreNodegetReferencedValue () const
 returns the value of the current key with an incremented reference count
 
DLLEXPORT AbstractQoreNodegetValue () const
 returns the value of the current key
 
DLLEXPORT AbstractQoreNode ** getValuePtr () const
 returns a pointer to a pointer to the current value so the value of the key may be manipulated externally More...
 
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 AbstractQoreNodetakeValueAndDelete ()
 deletes the key from the hash and returns the value, caller owns the reference
 
DLLEXPORT bool valid () const
 returns true if the iterator is currently pointing at a valid element
 

Additional Inherited Members

- Protected Member Functions inherited from HashIterator
DLLLOCAL HashIterator (const HashIterator &)
 this function is not implemented; it is here as a private function in order to prohibit it from being used
 
DLLLOCAL void * operator new (size_t)
 this function is not implemented; it is here as a private function in order to prohibit it from being used
 
DLLLOCAL HashIteratoroperator= (const HashIterator &)
 this function is not implemented; it is here as a private function in order to prohibit it from being used
 

Detailed Description

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

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

Member Function Documentation

DLLEXPORT bool ReverseHashIterator::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)

DLLEXPORT bool ReverseHashIterator::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: