Qore Programming Language - C/C++ Library  0.8.12.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreHashNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreHashNode.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2016 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:
110 
112  DLLEXPORT QoreHashNode();
113 
115 
117  DLLEXPORT virtual bool getAsBoolImpl() const;
118 
120 
126  DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
127 
129 
136  DLLEXPORT virtual QoreString* getAsString(bool &del, int foff, ExceptionSink* xsink) const;
137 
139 
141  DLLEXPORT virtual AbstractQoreNode* realCopy() const;
142 
144 
148  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
149 
151 
155  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
156 
158 
160  DLLEXPORT virtual const char* getTypeName() const;
161 
163 
165  DLLEXPORT QoreHashNode* hashRefSelf() const;
166 
168 
170  DLLEXPORT const char* getFirstKey() const;
171 
173 
175  DLLEXPORT const char* getLastKey() const;
176 
178 
182  DLLEXPORT AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists);
183 
185 
189  DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists) const;
190 
192 
199  DLLEXPORT AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink);
200 
202 
209  DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink) const;
210 
212 
218  DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink);
219 
221 
227  DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString& key, ExceptionSink* xsink);
228 
230 
236  DLLEXPORT const AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink) const;
237 
239 
242  DLLEXPORT AbstractQoreNode* getKeyValue(const char* key);
243 
245 
248  DLLEXPORT const AbstractQoreNode* getKeyValue(const char* key) const;
249 
251 
255  DLLEXPORT int64 getKeyAsBigInt(const char* key, bool &found) const;
256 
258 
262  DLLEXPORT bool getKeyAsBool(const char* key, bool &found) const;
263 
265 
267  DLLEXPORT QoreHashNode* copy() const;
268 
270 
278  DLLEXPORT AbstractQoreNode** getKeyValuePtr(const QoreString* key, ExceptionSink* xsink);
279 
281 
286  DLLEXPORT AbstractQoreNode** getKeyValuePtr(const char* key);
287 
289 
296  DLLEXPORT AbstractQoreNode** getExistingValuePtr(const QoreString* key, ExceptionSink* xsink);
297 
299 
303  DLLEXPORT AbstractQoreNode** getExistingValuePtr(const char* key);
304 
306 
311  DLLEXPORT void merge(const QoreHashNode* h, ExceptionSink* xsink);
312 
314 
320  DLLEXPORT void setKeyValue(const QoreString* key, AbstractQoreNode* value, ExceptionSink* xsink);
321 
323 
329  DLLEXPORT void setKeyValue(const QoreString& key, AbstractQoreNode* value, ExceptionSink* xsink);
330 
332 
338  DLLEXPORT void setKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
339 
341 
348 
350 
355  DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value);
356 
358 
364  DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
365 
367 
372  DLLEXPORT void deleteKey(const QoreString* key, ExceptionSink* xsink);
373 
375 
379  DLLEXPORT void deleteKey(const char* key, ExceptionSink* xsink);
380 
382 
386  DLLEXPORT AbstractQoreNode* takeKeyValue(const QoreString* key, ExceptionSink* xsink);
387 
389 
392  DLLEXPORT AbstractQoreNode* takeKeyValue(const char* key);
393 
395 
398  DLLEXPORT QoreListNode* getKeys() const;
399 
401 
404  DLLEXPORT bool compareSoft(const QoreHashNode* h, ExceptionSink* xsink) const;
405 
407 
410  DLLEXPORT bool compareHard(const QoreHashNode* h, ExceptionSink* xsink) const;
411 
413 
415  DLLEXPORT qore_size_t size() const;
416 
418 
420  DLLEXPORT bool empty() const;
421 
423 
427  DLLEXPORT bool existsKey(const char* key) const;
428 
430 
433  DLLEXPORT bool existsKeyValue(const char* key) const;
434 
436 
440  DLLEXPORT void removeKey(const QoreString* key, ExceptionSink* xsink);
441 
443 
447  DLLEXPORT void removeKey(const char* key, ExceptionSink* xsink);
448 
450 
452  DLLLOCAL static const char* getStaticTypeName() {
453  return "hash";
454  }
455 
457  DLLLOCAL static qore_type_t getStaticTypeCode() {
458  return NT_HASH;
459  }
460 
461  static const qore_type_t TYPE = NT_HASH;
462 
464  DLLLOCAL virtual AbstractQoreNode* parseInit(LocalVar* oflag, int pflag, int& lvids, const QoreTypeInfo*& typeInfo);
465 
466  DLLLOCAL QoreHashNode(bool ne);
467  DLLLOCAL void clear(ExceptionSink* xsink, bool reverse = false);
468 
470  DLLLOCAL void clearNeedsEval();
471 
473  DLLLOCAL void setNeedsEval();
474 
475  DLLLOCAL AbstractQoreNode* evalKeyValue(const QoreString* key, ExceptionSink* xsink) const;
476 
477  // returns a new hash consisting of just the members of value_list
478  DLLLOCAL QoreHashNode* getSlice(const QoreListNode* value_list, ExceptionSink* xsink) const;
479 
480  // "key" is always passed in the default character encoding
481  DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key) const;
482 
483  // "key" is always passed in the default character encoding
484  DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key, bool& exists) const;
485 };
486 
487 #include <qore/ReferenceHolder.h>
488 
490 
494 
495 class qhi_priv;
496 
498 
508  friend class HashAssignmentHelper;
509 
510 protected:
511  QoreHashNode* h;
512  qhi_priv* priv;
513 
515  DLLLOCAL HashIterator(const HashIterator&);
516 
518  DLLLOCAL HashIterator& operator=(const HashIterator&);
519 
521  DLLLOCAL void* operator new(size_t);
522 
523 public:
525  DLLEXPORT HashIterator(QoreHashNode* h);
526 
528  DLLEXPORT HashIterator(QoreHashNode& h);
529 
531  DLLEXPORT ~HashIterator();
532 
534 
537  DLLEXPORT bool next();
538 
540 
543  DLLEXPORT bool prev();
544 
546  DLLEXPORT const char* getKey() const;
547 
549  DLLEXPORT QoreString* getKeyString() const;
550 
552  DLLEXPORT AbstractQoreNode* getValue() const;
553 
556 
558 
562  DLLEXPORT void deleteKey(ExceptionSink* xsink);
563 
565 
568  DLLEXPORT AbstractQoreNode** getValuePtr() const;
569 
571  DLLEXPORT AbstractQoreNode* getReferencedValue() const;
572 
574  DLLEXPORT bool first() const;
575 
577  DLLEXPORT bool last() const;
578 
580  DLLEXPORT bool empty() const;
581 
583  DLLEXPORT bool valid() const;
584 };
585 
587 
597 public:
599  DLLEXPORT ReverseHashIterator(QoreHashNode* h);
600 
602  DLLEXPORT ReverseHashIterator(QoreHashNode& h);
603 
605  DLLEXPORT ~ReverseHashIterator();
606 
608 
611  DLLEXPORT bool next();
612 
614 
617  DLLEXPORT bool prev();
618 
620  DLLEXPORT bool first() const;
621 
623  DLLEXPORT bool last() const;
624 };
625 
627 
637 protected:
638  const QoreHashNode* h;
639  qhi_priv* priv;
640 
642  DLLLOCAL ConstHashIterator& operator=(const HashIterator&);
643 
644 public:
646  DLLEXPORT ConstHashIterator(const QoreHashNode* h);
647 
649  DLLEXPORT ConstHashIterator(const QoreHashNode& h);
650 
652  DLLLOCAL ConstHashIterator(const ConstHashIterator&);
653 
655  DLLEXPORT ~ConstHashIterator();
656 
658 
661  DLLEXPORT bool next();
662 
664 
667  DLLEXPORT bool prev();
668 
670  DLLEXPORT const char* getKey() const;
671 
673  DLLEXPORT QoreString* getKeyString() const;
674 
676  DLLEXPORT const AbstractQoreNode* getValue() const;
677 
679  DLLEXPORT AbstractQoreNode* getReferencedValue() const;
680 
682  DLLEXPORT bool first() const;
683 
685  DLLEXPORT bool last() const;
686 
688  DLLEXPORT bool empty() const;
689 
691  DLLEXPORT bool valid() const;
692 
694  DLLEXPORT void reset();
695 };
696 
698 
708 public:
710  DLLEXPORT ReverseConstHashIterator(const QoreHashNode* h);
711 
713  DLLEXPORT ReverseConstHashIterator(const QoreHashNode& h);
714 
716  DLLEXPORT ~ReverseConstHashIterator();
717 
719 
722  DLLEXPORT bool next();
723 
725 
728  DLLEXPORT bool prev();
729 
731  DLLEXPORT bool first() const;
732 
734  DLLEXPORT bool last() const;
735 };
736 
739 private:
742 
744  DLLLOCAL HashAssignmentHelper& operator=(const HashAssignmentHelper&);
745 
747  DLLLOCAL void* operator new(size_t);
748 
749 protected:
751  class hash_assignment_priv *priv;
752 
753 public:
755 
759  DLLEXPORT HashAssignmentHelper(QoreHashNode& n_h, const char* key, bool must_already_exist = false);
760 
762 
766  DLLEXPORT HashAssignmentHelper(QoreHashNode& n_h, const std::string& key, bool must_already_exist = false);
767 
769 
776  DLLEXPORT HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString& key, bool must_already_exist = false);
777 
779 
786  DLLEXPORT HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString* key, bool must_already_exist = false);
787 
789 
791  DLLEXPORT HashAssignmentHelper(HashIterator &hi);
792 
794  DLLEXPORT ~HashAssignmentHelper();
795 
797 
802  DLLEXPORT void reassign(const char* key, bool must_already_exist = false);
803 
805 
810  DLLEXPORT void reassign(const std::string& key, bool must_already_exist = false);
811 
813 
815  DLLEXPORT operator bool() const;
816 
818 
822  DLLEXPORT void assign(AbstractQoreNode* v, ExceptionSink* xsink);
823 
825 
828  DLLEXPORT AbstractQoreNode* swap(AbstractQoreNode* v, ExceptionSink* xsink);
829 
831 
833  DLLEXPORT AbstractQoreNode* operator*() const;
834 };
835 
836 #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 &quot;hard&quot; 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:738
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 &quot;soft&quot; compare of all hash elements (types may be converted for the comparison) and retur...
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 &quot;key&quot; to &quot;value&quot;
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:596
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 &quot;h&quot; 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:457
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 &quot;exists&quot; 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:71
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)
&quot;takes&quot; 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
DLLEXPORT bool next()
moves to the next element in reverse order, returns false when there are no more elements to iterate ...
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:82
DLLEXPORT ~HashAssignmentHelper()
destroys the object and does post processing on the new value
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 &quot;this&quot; 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
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...
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 AbstractQoreNode * operator*() const
returns the current value of the hash key; the pointer returned is still owned by the 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 (&quot;deep compare&quot; 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 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 &quot;needs_eval&quot; to false and &quot;value&quot; 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 &quot;thread_exit&quot; 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:707
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:452
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:228
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 void reassign(const char *key, bool must_already_exist=false)
reassigns the object to the given key for a new assignment
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 &quot;needs_eval&quot; to true and &quot;value&quot; to false
DLLEXPORT bool getKeyAsBool(const char *key, bool &found) const
returns the value of the key as a bool
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:68
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:636
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality (&quot;deep compare&quot; including all contained values) without type conversions (hard com...
DLLEXPORT ~ReverseConstHashIterator()
Destroys the iterator.
class hash_assignment_priv * priv
private implementation
Definition: QoreHashNode.h:751
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 &quot;key&quot; to &quot;value&quot; 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 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 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 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...
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:507