Qore Programming Language  0.8.11.1
QoreHashNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreHashNode.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2014 David Nichols
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_QOREHASHNODE_H
33 
34 #define _QORE_QOREHASHNODE_H
35 
36 #include <qore/AbstractQoreNode.h>
37 #include <qore/common.h>
38 
39 class HashMember;
40 class LocalVar;
41 
43 
50  friend class HashIterator;
51  friend class ReverseHashIterator;
52  friend class ConstHashIterator;
53  friend class ReverseConstHashIterator;
54  friend class HashAssignmentHelper;
55  friend class hash_assignment_priv;
56  friend class qore_object_private;
57  friend class qore_hash_private;
58 
59 private:
61  DLLLOCAL QoreHashNode(const QoreHashNode&);
62 
64  DLLLOCAL QoreHashNode& operator=(const QoreHashNode&);
65 
66 protected:
68  class qore_hash_private *priv;
69 
71 
77  DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
78 
80 
83  DLLEXPORT virtual AbstractQoreNode* evalImpl(ExceptionSink* xsink) const;
84 
86 
89  DLLLOCAL virtual AbstractQoreNode* evalImpl(bool &needs_deref, ExceptionSink* xsink) const;
90 
92  DLLLOCAL virtual int64 bigIntEvalImpl(ExceptionSink* xsink) const;
93 
95  DLLLOCAL virtual int integerEvalImpl(ExceptionSink* xsink) const;
96 
98  DLLLOCAL virtual bool boolEvalImpl(ExceptionSink* xsink) const;
99 
101  DLLLOCAL virtual double floatEvalImpl(ExceptionSink* xsink) const;
102 
104 
107  DLLEXPORT virtual ~QoreHashNode();
108 
109 public:
111  DLLEXPORT QoreHashNode();
112 
114 
116  DLLEXPORT virtual bool getAsBoolImpl() const;
117 
119 
125  DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
126 
128 
135  DLLEXPORT virtual QoreString* getAsString(bool &del, int foff, ExceptionSink* xsink) const;
136 
138 
140  DLLEXPORT virtual AbstractQoreNode* realCopy() const;
141 
143 
147  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
148 
150 
154  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
155 
157 
159  DLLEXPORT virtual const char* getTypeName() const;
160 
162 
164  DLLEXPORT QoreHashNode* hashRefSelf() const;
165 
167 
169  DLLEXPORT const char* getFirstKey() const;
170 
172 
174  DLLEXPORT const char* getLastKey() const;
175 
177 
181  DLLEXPORT AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists);
182 
184 
188  DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists) const;
189 
191 
198  DLLEXPORT AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink);
199 
201 
208  DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink) const;
209 
211 
217  DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink);
218 
220 
226  DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString& key, ExceptionSink* xsink);
227 
229 
235  DLLEXPORT const AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink) const;
236 
238 
241  DLLEXPORT AbstractQoreNode* getKeyValue(const char* key);
242 
244 
247  DLLEXPORT const AbstractQoreNode* getKeyValue(const char* key) const;
248 
250 
254  DLLEXPORT int64 getKeyAsBigInt(const char* key, bool &found) const;
255 
257 
261  DLLEXPORT bool getKeyAsBool(const char* key, bool &found) const;
262 
264 
266  DLLEXPORT QoreHashNode* copy() const;
267 
269 
277  DLLEXPORT AbstractQoreNode** getKeyValuePtr(const QoreString* key, ExceptionSink* xsink);
278 
280 
285  DLLEXPORT AbstractQoreNode** getKeyValuePtr(const char* key);
286 
288 
295  DLLEXPORT AbstractQoreNode** getExistingValuePtr(const QoreString* key, ExceptionSink* xsink);
296 
298 
302  DLLEXPORT AbstractQoreNode** getExistingValuePtr(const char* key);
303 
305 
310  DLLEXPORT void merge(const QoreHashNode* h, ExceptionSink* xsink);
311 
313 
319  DLLEXPORT void setKeyValue(const QoreString* key, AbstractQoreNode* value, ExceptionSink* xsink);
320 
322 
328  DLLEXPORT void setKeyValue(const QoreString& key, AbstractQoreNode* value, ExceptionSink* xsink);
329 
331 
337  DLLEXPORT void setKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
338 
340 
347 
349 
354  DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value);
355 
357 
363  DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
364 
366 
371  DLLEXPORT void deleteKey(const QoreString* key, ExceptionSink* xsink);
372 
374 
378  DLLEXPORT void deleteKey(const char* key, ExceptionSink* xsink);
379 
381 
385  DLLEXPORT AbstractQoreNode* takeKeyValue(const QoreString* key, ExceptionSink* xsink);
386 
388 
391  DLLEXPORT AbstractQoreNode* takeKeyValue(const char* key);
392 
394 
397  DLLEXPORT QoreListNode* getKeys() const;
398 
400 
403  DLLEXPORT bool compareSoft(const QoreHashNode* h, ExceptionSink* xsink) const;
404 
406 
409  DLLEXPORT bool compareHard(const QoreHashNode* h, ExceptionSink* xsink) const;
410 
412 
414  DLLEXPORT qore_size_t size() const;
415 
417 
419  DLLEXPORT bool empty() const;
420 
422 
426  DLLEXPORT bool existsKey(const char* key) const;
427 
429 
432  DLLEXPORT bool existsKeyValue(const char* key) const;
433 
435 
439  DLLEXPORT void removeKey(const QoreString* key, ExceptionSink* xsink);
440 
442 
446  DLLEXPORT void removeKey(const char* key, ExceptionSink* xsink);
447 
449 
451  DLLLOCAL static const char* getStaticTypeName() {
452  return "hash";
453  }
454 
456  DLLLOCAL static qore_type_t getStaticTypeCode() {
457  return NT_HASH;
458  }
459 
461  DLLLOCAL virtual AbstractQoreNode* parseInit(LocalVar* oflag, int pflag, int& lvids, const QoreTypeInfo*& typeInfo);
462 
463  DLLLOCAL QoreHashNode(bool ne);
464  DLLLOCAL void clear(ExceptionSink* xsink);
465 
467  DLLLOCAL void clearNeedsEval();
468 
470  DLLLOCAL void setNeedsEval();
471 
472  DLLLOCAL AbstractQoreNode* evalKeyValue(const QoreString* key, ExceptionSink* xsink) const;
473 
474  // returns a new hash consisting of just the members of value_list
475  DLLLOCAL QoreHashNode* getSlice(const QoreListNode* value_list, ExceptionSink* xsink) const;
476 
477  // "key" is always passed in the default character encoding
478  DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key) const;
479 
480  // "key" is always passed in the default character encoding
481  DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key, bool& exists) const;
482 
483  DLLLOCAL static void doDuplicateKeyWarning(const char* key);
484 };
485 
486 #include <qore/ReferenceHolder.h>
487 
489 
493 
494 class qhi_priv;
495 
497 
507  friend class HashAssignmentHelper;
508 
509 protected:
510  QoreHashNode* h;
511  qhi_priv* priv;
512 
514  DLLLOCAL HashIterator(const HashIterator&);
515 
517  DLLLOCAL HashIterator& operator=(const HashIterator&);
518 
520  DLLLOCAL void* operator new(size_t);
521 
522 public:
524  DLLEXPORT HashIterator(QoreHashNode* h);
525 
527  DLLEXPORT HashIterator(QoreHashNode& h);
528 
530  DLLEXPORT ~HashIterator();
531 
533 
536  DLLEXPORT bool next();
537 
539 
542  DLLEXPORT bool prev();
543 
545  DLLEXPORT const char* getKey() const;
546 
548  DLLEXPORT QoreString* getKeyString() const;
549 
551  DLLEXPORT AbstractQoreNode* getValue() const;
552 
555 
557 
561  DLLEXPORT void deleteKey(ExceptionSink* xsink);
562 
564 
567  DLLEXPORT AbstractQoreNode** getValuePtr() const;
568 
570  DLLEXPORT AbstractQoreNode* getReferencedValue() const;
571 
573  DLLEXPORT bool first() const;
574 
576  DLLEXPORT bool last() const;
577 
579  DLLEXPORT bool empty() const;
580 
582  DLLEXPORT bool valid() const;
583 };
584 
586 
596 public:
598  DLLEXPORT ReverseHashIterator(QoreHashNode* h);
599 
601  DLLEXPORT ReverseHashIterator(QoreHashNode& h);
602 
604  DLLEXPORT ~ReverseHashIterator();
605 
607 
610  DLLEXPORT bool next();
611 
613 
616  DLLEXPORT bool prev();
617 
619  DLLEXPORT bool first() const;
620 
622  DLLEXPORT bool last() const;
623 };
624 
626 
636 protected:
637  const QoreHashNode* h;
638  qhi_priv* priv;
639 
641  DLLLOCAL ConstHashIterator& operator=(const HashIterator&);
642 
643 public:
645  DLLEXPORT ConstHashIterator(const QoreHashNode* h);
646 
648  DLLEXPORT ConstHashIterator(const QoreHashNode& h);
649 
651  DLLLOCAL ConstHashIterator(const ConstHashIterator&);
652 
654  DLLEXPORT ~ConstHashIterator();
655 
657 
660  DLLEXPORT bool next();
661 
663 
666  DLLEXPORT bool prev();
667 
669  DLLEXPORT const char* getKey() const;
670 
672  DLLEXPORT QoreString* getKeyString() const;
673 
675  DLLEXPORT const AbstractQoreNode* getValue() const;
676 
678  DLLEXPORT AbstractQoreNode* getReferencedValue() const;
679 
681  DLLEXPORT bool first() const;
682 
684  DLLEXPORT bool last() const;
685 
687  DLLEXPORT bool empty() const;
688 
690  DLLEXPORT bool valid() const;
691 
693  DLLEXPORT void reset();
694 };
695 
697 
707 public:
709  DLLEXPORT ReverseConstHashIterator(const QoreHashNode* h);
710 
712  DLLEXPORT ReverseConstHashIterator(const QoreHashNode& h);
713 
715  DLLEXPORT ~ReverseConstHashIterator();
716 
718 
721  DLLEXPORT bool next();
722 
724 
727  DLLEXPORT bool prev();
728 
730  DLLEXPORT bool first() const;
731 
733  DLLEXPORT bool last() const;
734 };
735 
738 private:
741 
743  DLLLOCAL HashAssignmentHelper& operator=(const HashAssignmentHelper&);
744 
746  DLLLOCAL void* operator new(size_t);
747 
748 protected:
750  class hash_assignment_priv *priv;
751 
752 public:
754 
758  DLLLOCAL HashAssignmentHelper(QoreHashNode& n_h, const char* key, bool must_already_exist = false);
759 
761 
765  DLLLOCAL HashAssignmentHelper(QoreHashNode& n_h, const std::string& key, bool must_already_exist = false);
766 
768 
775  DLLLOCAL HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString& key, bool must_already_exist = false);
776 
778 
785  DLLLOCAL HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString* key, bool must_already_exist = false);
786 
788 
790  DLLLOCAL HashAssignmentHelper(HashIterator &hi);
791 
793  DLLLOCAL ~HashAssignmentHelper();
794 
796 
798  DLLLOCAL operator bool() const;
799 
801 
805  DLLLOCAL void assign(AbstractQoreNode* v, ExceptionSink* xsink);
806 
808 
811  DLLLOCAL AbstractQoreNode* swap(AbstractQoreNode* v, ExceptionSink* xsink);
812 
814 
816  DLLLOCAL AbstractQoreNode* operator*() const;
817 };
818 
819 #endif // _QORE_HASH_H
DLLEXPORT bool empty() const
returns true if the hash is empty
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the hash
DLLEXPORT ~HashIterator()
Destroys the iterator.
DLLEXPORT bool compareHard(const QoreHashNode *h, ExceptionSink *xsink) const
does a deep "hard" compare of all hash elements (no type conversions are performed) and returns true ...
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
DLLEXPORT QoreListNode * getKeys() const
returns a QoreListNode of QoreStringNodes representing all keys in the hash, caller owns the referenc...
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:49
use this class to make assignments to hash keys from a pointer to the key value
Definition: QoreHashNode.h:737
DLLEXPORT AbstractQoreNode * getValue() const
returns the value of the current key
DLLEXPORT ReverseConstHashIterator(const QoreHashNode *h)
initializes the iterator with the passed hash
DLLEXPORT bool compareSoft(const QoreHashNode *h, ExceptionSink *xsink) const
does a deep "soft" compare of all hash elements (types may be converted for the comparison) and retur...
DLLLOCAL void assign(AbstractQoreNode *v, ExceptionSink *xsink)
assigns a value to the hash key, dereferences any old value, assumes that the value is already refere...
DLLEXPORT AbstractQoreNode ** getKeyValuePtr(const QoreString *key, ExceptionSink *xsink)
returns a pointer to a pointer of the value of the key so the value may be set or changed externally ...
DLLEXPORT AbstractQoreNode * takeValueAndDelete()
deletes the key from the hash and returns the value, caller owns the reference
DLLEXPORT void setKeyValue(const QoreString *key, AbstractQoreNode *value, ExceptionSink *xsink)
sets the value of "key" to "value"
DLLEXPORT bool next()
moves to the next element in reverse order, returns false when there are no more elements to iterate ...
reverse iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:595
virtual DLLEXPORT ~QoreHashNode()
deletes the object, cannot be called directly (use deref(ExceptionSink*) instead) ...
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate ...
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
DLLEXPORT void merge(const QoreHashNode *h, ExceptionSink *xsink)
appends all key-value pairs of "h" to this hash
DLLEXPORT void deleteKey(ExceptionSink *xsink)
deletes the key from the hash and dereferences the value
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreHashNode.h:456
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
DLLEXPORT AbstractQoreNode * getKeyValueExistence(const char *key, bool &exists)
returns the value of the key (assumed to be in QCS_DEFAULT) if it exists and sets "exists" accordingl...
DLLEXPORT ConstHashIterator(const QoreHashNode *h)
initializes the iterator with the passed hash
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:70
DLLEXPORT int64 getKeyAsBigInt(const char *key, bool &found) const
returns the value of the key as an int64
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenate the verbose string representation of the list (including all contained values) to an exis...
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
DLLEXPORT bool first() const
returns true if on the last key of the hash
DLLEXPORT AbstractQoreNode * takeKeyValue(const QoreString *key, ExceptionSink *xsink)
"takes" the value of the key from the hash and removes the key from the hash and returns the value...
DLLEXPORT const AbstractQoreNode * getValue() const
returns the value of the current key
DLLEXPORT ~ConstHashIterator()
Destroys the iterator.
class qore_hash_private * priv
private implementation of the class
Definition: QoreHashNode.h:68
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
evaluates the object and returns a value (or 0)
DLLEXPORT void reset()
resets the iterator to its initial state
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:67
DLLEXPORT bool next()
moves to the next element in reverse order, returns false when there are no more elements to iterate ...
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:50
DLLEXPORT const char * getLastKey() const
returns the cstring value of the last key in the hash
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
DLLEXPORT QoreHashNode * hashRefSelf() const
returns "this" with an incremented reference count
DLLEXPORT bool prev()
moves to the previous element in reverse order, returns false when there are no more elements to iter...
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
virtual DLLLOCAL int64 bigIntEvalImpl(ExceptionSink *xsink) const
always returns 0
DLLEXPORT bool empty() const
returns true if the hash is empty
DLLLOCAL AbstractQoreNode * swap(AbstractQoreNode *v, ExceptionSink *xsink)
swaps the current value with the new value of the hash key, assumes that the new value is already ref...
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
DLLEXPORT AbstractQoreNode ** getValuePtr() const
returns a pointer to a pointer to the current value so the value of the key may be manipulated extern...
DLLLOCAL AbstractQoreNode * operator*() const
returns the current value of the hash key; the pointer returned is still owned by the hash ...
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
virtual DLLEXPORT AbstractQoreNode * realCopy() const
performs a copy of the hash and returns the new hash
DLLEXPORT const char * getFirstKey() const
returns the cstring value of the first key in the hash
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) with possible type conversion (sof...
const qore_type_t NT_HASH
type value for QoreHashNode
Definition: node_types.h:51
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the value of the current key with an incremented reference count
DLLEXPORT bool last() 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
DLLLOCAL ~HashAssignmentHelper()
destroys the object and does post processing on the new value
DLLLOCAL HashIterator(const HashIterator &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
virtual DLLLOCAL bool boolEvalImpl(ExceptionSink *xsink) const
always returns false
DLLLOCAL void clearNeedsEval()
sets "needs_eval" to false and "value" to true
DLLEXPORT bool prev()
moves to the previous element in reverse order, returns false when there are no more elements to iter...
DLLEXPORT AbstractQoreNode * getKeyValue(const QoreString *key, ExceptionSink *xsink)
returns the value of the key if it exists
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
DLLEXPORT void removeKey(const QoreString *key, ExceptionSink *xsink)
removes the given key from the hash and derefences its value, if any
DLLLOCAL HashIterator & operator=(const HashIterator &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
DLLEXPORT bool last() const
returns true if on the first key of the hash
DLLEXPORT bool existsKeyValue(const char *key) const
returns true if the hash contains the given key and the key has a value (i.e. is not NOTHING) ...
reverse constant iterator class for QoreHashNode, to be only created on the stack ...
Definition: QoreHashNode.h:706
virtual DLLLOCAL int integerEvalImpl(ExceptionSink *xsink) const
always returns 0
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreHashNode.h:451
DLLEXPORT bool empty() const
returns true if the hash has no members, false if not
DLLEXPORT void deleteKey(const QoreString *key, ExceptionSink *xsink)
performs a delete operation on the value of the given key
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
DLLEXPORT qore_size_t size() const
returns the number of members in the hash, executes in constant time
virtual DLLLOCAL double floatEvalImpl(ExceptionSink *xsink) const
always returns 0.0
DLLEXPORT const char * getKey() const
returns the current key
DLLLOCAL ConstHashIterator & operator=(const HashIterator &)
this function is not implemented; it is here as a protected function in order to prohibit it from bei...
DLLLOCAL void setNeedsEval()
sets "needs_eval" to true and "value" to false
DLLEXPORT bool getKeyAsBool(const char *key, bool &found) const
returns the value of the key as a bool
bool value
this is true for values, if false then either the type needs evaluation to produce a value or is a pa...
Definition: AbstractQoreNode.h:160
constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:635
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) without type conversions (hard com...
DLLEXPORT ~ReverseConstHashIterator()
Destroys the iterator.
class hash_assignment_priv * priv
private implementation
Definition: QoreHashNode.h:750
DLLEXPORT QoreString * getKeyString() const
returns a QoreString for the current key, the caller owns QoreString returned
DLLEXPORT AbstractQoreNode * swapKeyValue(const QoreString *key, AbstractQoreNode *value, ExceptionSink *xsink)
sets the value of "key" to "value" and returns the old value (0 if not present or if already 0)...
DLLEXPORT AbstractQoreNode ** getExistingValuePtr(const QoreString *key, ExceptionSink *xsink)
returns a pointer to a pointer of the value of the key only if the key already exists ...
DLLEXPORT QoreHashNode()
creates an empty hash
DLLEXPORT QoreHashNode * copy() const
performs a copy of the hash and returns the new hash
DLLEXPORT QoreString * getKeyString() const
returns a QoreString for the current key, the caller owns QoreString returned
DLLEXPORT ReverseHashIterator(QoreHashNode *h)
initializes the iterator with the passed hash
DLLEXPORT bool first() const
returns true if on the last key of the hash
DLLEXPORT bool first() const
returns true if on the first key of the hash
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
initializes during parsing
DLLEXPORT ~ReverseHashIterator()
Destroys the iterator.
DLLEXPORT const char * getKey() const
returns the current key
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate ...
DLLEXPORT bool existsKey(const char *key) const
returns true if the hash contains the given key
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:51
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the value of the current key with an incremented reference count
iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:506