|
Qore Programming Language
0.9.16
|
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 QoreValue getReferenced() const
returns the value of the current key with an incremented reference count
DLLEXPORT bool empty() const
returns true if the hash is empty
DLLEXPORT int setKeyValue(const char *key, QoreValue value, ExceptionSink *xsink)
sets the value of "key" to "value"
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
defines a Qore-language class
Definition: QoreClass.h:239
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate
constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:563
DLLEXPORT bool ROdereference() const
atomically decrements the reference count
DLLEXPORT QoreHashNode * hashRefSelf() const
returns "this" with an incremented reference count
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
DLLEXPORT AbstractQoreNode * raiseException(const char *err, const char *fmt,...)
appends a Qore-language exception to the list
const DLLEXPORT QoreTypeInfo * getValueTypeInfo() const
returns the value type declaration (only possible if there is no hashdecl set)
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
abstract base class for iterator private data
Definition: QoreIteratorBase.h:68
DLLEXPORT bool is_unique() const
returns true if the reference count is 1
const DLLEXPORT char * getKey() const
returns the current key
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:67
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false,...
DLLEXPORT bool empty() const
returns true if the hash has no members, false if not
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate