32 #ifndef _QORE_QOREHASHITERATOR_H 34 #define _QORE_QOREHASHITERATOR_H 47 DLLLOCAL
virtual ~QoreHashIterator() {
54 xsink->
raiseException(
"ITERATOR-ERROR",
"the %s is not pointing at a valid element; make sure %s::next() returns True before calling this method", getName(), getName());
70 DLLLOCAL QoreHashIterator(
const QoreHashIterator& old) :
ConstHashIterator(*this), pairHash(0) {
83 pairHash->
deref(xsink);
111 pairHash->
deref(xsink);
125 DLLLOCAL
bool empty()
const {
126 return !h || h->
empty();
129 DLLLOCAL
bool next() {
135 DLLLOCAL
bool prev() {
141 DLLLOCAL
virtual const char* getName()
const {
return "HashIterator"; }
143 DLLLOCAL
virtual const QoreTypeInfo* getElementType()
const {
150 class QoreHashReverseIterator :
public QoreHashIterator {
152 DLLLOCAL QoreHashReverseIterator(
const QoreHashNode* h) : QoreHashIterator(h) {
155 DLLLOCAL QoreHashReverseIterator() {
158 DLLLOCAL QoreHashReverseIterator(
const QoreHashReverseIterator& old) : QoreHashIterator(old) {
161 DLLLOCAL
virtual const char* getName()
const {
162 return "HashReverseIterator";
166 #endif // _QORE_QOREHASHITERATOR_H DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
DLLEXPORT int setKeyValue(const char *key, QoreValue value, ExceptionSink *xsink)
sets the value of "key" to "value"
DLLEXPORT QoreValue getReferenced() const
returns the value of the current key with an incremented reference count
DLLEXPORT QoreHashNode * hashRefSelf() const
returns "this" with an incremented reference count
DLLEXPORT const char * getKey() const
returns the current key
DLLEXPORT AbstractQoreNode * raiseException(const char *err, const char *fmt,...)
appends a Qore-language exception to the list
DLLEXPORT bool ROdereference() const
atomically decrements the reference count
abstract base class for iterator private data
Definition: QoreIteratorBase.h:68
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DLLEXPORT const QoreTypeInfo * getValueTypeInfo() const
returns the value type declaration (only possible if there is no hashdecl set)
defines a Qore-language class
Definition: QoreClass.h:239
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:67
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
DLLEXPORT bool empty() const
returns true if the hash is empty
DLLEXPORT bool empty() const
returns true if the hash has no members, false if not
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false, otherwise does nothing
DLLEXPORT bool is_unique() const
returns true if the reference count is 1
constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:563
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate ...