| Qore Programming Language - C/C++ Library 1.0.8

QoreHashNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 QoreHashNode.h
4
5 Qore Programming Language
6
7 Copyright (C) 2003 - 2021 Qore Technologies, s.r.o.
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 LocalVar;
40 class QoreString;
41 class TypedHashDecl;
42
44
50 class QoreHashNode : public AbstractQoreNode {
51 friend class HashIterator;
52 friend class ReverseHashIterator;
53 friend class ConstHashIterator;
54 friend class ReverseConstHashIterator;
55 friend class HashAssignmentHelper;
56 friend class hash_assignment_priv;
57 friend class qore_object_private;
58 friend class qore_hash_private;
59
60 private:
62 DLLLOCAL QoreHashNode(const QoreHashNode&);
63
65 DLLLOCAL QoreHashNode& operator=(const QoreHashNode&);
66
67 protected:
69 class qore_hash_private *priv;
70
72
78 DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
79
81
84 DLLLOCAL virtual QoreValue evalImpl(bool &needs_deref, ExceptionSink* xsink) const;
85
87
90 DLLEXPORT virtual ~QoreHashNode();
91
92 public:
94 DLLEXPORT QoreHashNode();
95
97
99 DLLEXPORT QoreHashNode(const TypedHashDecl* hd, ExceptionSink* xsink);
100
102
104 DLLEXPORT QoreHashNode(const QoreTypeInfo* valueTypeInfo);
105
107
109 DLLEXPORT virtual bool getAsBoolImpl() const;
110
112
118 DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
119
121
128 DLLEXPORT virtual QoreString* getAsString(bool &del, int foff, ExceptionSink* xsink) const;
129
131
133 DLLEXPORT virtual AbstractQoreNode* realCopy() const;
134
136
140 DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
141
143
147 DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
148
150
152 DLLEXPORT virtual const char* getTypeName() const;
153
155
157 DLLEXPORT QoreHashNode* hashRefSelf() const;
158
160
162 DLLEXPORT const char* getFirstKey() const;
163
165
167 DLLEXPORT const char* getLastKey() const;
168
170
176 DLLEXPORT QoreValue getKeyValueExistence(const char* key, bool& exists, ExceptionSink* xsink) const;
177
179
184 DLLEXPORT QoreValue getKeyValueExistence(const char* key, bool& exists) const;
185
187
192 DLLEXPORT QoreValue getKeyValue(const char* key, ExceptionSink* xsink) const;
193
195
199 DLLEXPORT QoreValue getKeyValue(const char* key) const;
200
202
208 DLLEXPORT QoreValue getKeyValueExistence(const QoreString& key, bool& exists, ExceptionSink* xsink) const;
209
211
216 DLLEXPORT QoreValue getKeyValueExistence(const QoreString& key, bool& exists) const;
217
219
224 DLLEXPORT QoreValue getKeyValue(const QoreString& key, ExceptionSink* xsink) const;
225
227
233 DLLEXPORT int64 getKeyAsBigInt(const char* key, bool &found) const;
234
236
242 DLLEXPORT bool getKeyAsBool(const char* key, bool &found) const;
243
245
247 DLLEXPORT QoreHashNode* copy() const;
248
249 DLLEXPORT QoreValue& getKeyValueReference(const char* key);
250
252
257 DLLEXPORT void merge(const QoreHashNode* h, ExceptionSink* xsink);
258
260
271 DLLEXPORT int setKeyValue(const char* key, QoreValue value, ExceptionSink* xsink);
272
274
285 DLLEXPORT int setKeyValue(const QoreString& key, QoreValue value, ExceptionSink* xsink);
286
288
293 DLLEXPORT void deleteKey(const QoreString* key, ExceptionSink* xsink);
294
296
300 DLLEXPORT void deleteKey(const char* key, ExceptionSink* xsink);
301
303 DLLEXPORT QoreValue takeKeyValue(const char* key);
304
306
309 DLLEXPORT QoreListNode* getKeys() const;
310
312
317 DLLEXPORT QoreListNode* getValues() const;
318
320
323 DLLEXPORT bool compareSoft(const QoreHashNode* h, ExceptionSink* xsink) const;
324
326
329 DLLEXPORT bool compareHard(const QoreHashNode* h, ExceptionSink* xsink) const;
330
332
334 DLLEXPORT size_t size() const;
335
337
339 DLLEXPORT bool empty() const;
340
342
346 DLLEXPORT bool existsKey(const char* key) const;
347
349
352 DLLEXPORT bool existsKeyValue(const char* key) const;
353
355
359 DLLEXPORT void removeKey(const QoreString* key, ExceptionSink* xsink);
360
362
366 DLLEXPORT void removeKey(const char* key, ExceptionSink* xsink);
367
369
371 DLLEXPORT const TypedHashDecl* getHashDecl() const;
372
374
376 DLLEXPORT const QoreTypeInfo* getValueTypeInfo() const;
377
379
381 DLLEXPORT const QoreTypeInfo* getTypeInfo() const;
382
384
386 DLLLOCAL static const char* getStaticTypeName() {
387 return "hash";
388 }
389
391 DLLLOCAL static qore_type_t getStaticTypeCode() {
392 return NT_HASH;
393 }
394
395 static const qore_type_t TYPE = NT_HASH;
396
398 DLLLOCAL virtual int parseInit(QoreValue& val, QoreParseContext& parse_context);
399
400 DLLLOCAL QoreHashNode(bool ne);
401 DLLLOCAL void clear(ExceptionSink* xsink, bool reverse = false);
402
404 DLLLOCAL void clearNeedsEval();
405
407 DLLLOCAL void setNeedsEval();
408
409 // returns a new hash consisting of just the members of value_list
410 DLLLOCAL QoreHashNode* getSlice(const QoreListNode* value_list, ExceptionSink* xsink) const;
411 };
412
413 #include <qore/ReferenceHolder.h>
414
416
419 typedef ReferenceHolder<QoreHashNode> QoreHashNodeHolder;
420
421 class qhi_priv;
422
424
433 class HashIterator {
434 friend class HashAssignmentHelper;
435 friend class qhi_priv;
436
437 protected:
438 QoreHashNode* h;
439 qhi_priv* priv;
440
442 DLLLOCAL HashIterator(const HashIterator&);
443
445 DLLLOCAL HashIterator& operator=(const HashIterator&);
446
448 DLLLOCAL void* operator new(size_t);
449
450 public:
452 DLLEXPORT HashIterator(QoreHashNode* h);
453
455 DLLEXPORT HashIterator(QoreHashNode& h);
456
458 DLLEXPORT ~HashIterator();
459
461
464 DLLEXPORT bool next();
465
467
470 DLLEXPORT bool prev();
471
473 DLLEXPORT const char* getKey() const;
474
476 DLLEXPORT QoreString* getKeyString() const;
477
479 DLLEXPORT QoreValue get() const;
480
482 DLLEXPORT const QoreTypeInfo* getTypeInfo() const;
483
485
489 DLLEXPORT void deleteKey(ExceptionSink* xsink);
490
492 DLLEXPORT QoreValue removeKeyValue();
493
495 DLLEXPORT QoreValue getReferenced() const;
496
498 DLLEXPORT QoreHashNode* getHash() const;
499
501 DLLEXPORT bool first() const;
502
504 DLLEXPORT bool last() const;
505
507 DLLEXPORT bool empty() const;
508
510 DLLEXPORT bool valid() const;
511 };
512
514
523 class ReverseHashIterator : public HashIterator {
524 public:
526 DLLEXPORT ReverseHashIterator(QoreHashNode* h);
527
529 DLLEXPORT ReverseHashIterator(QoreHashNode& h);
530
532 DLLEXPORT ~ReverseHashIterator();
533
535
538 DLLEXPORT bool next();
539
541
544 DLLEXPORT bool prev();
545
547 DLLEXPORT bool first() const;
548
550 DLLEXPORT bool last() const;
551 };
552
554
563 class ConstHashIterator {
564 protected:
565 const QoreHashNode* h;
566 qhi_priv* priv;
567
569 DLLLOCAL ConstHashIterator& operator=(const HashIterator&);
570
571 public:
573 DLLEXPORT ConstHashIterator(const QoreHashNode* h);
574
576 DLLEXPORT ConstHashIterator(const QoreHashNode& h);
577
579 DLLLOCAL ConstHashIterator(const ConstHashIterator&);
580
582 DLLEXPORT ~ConstHashIterator();
583
585
588 DLLEXPORT bool next();
589
591
594 DLLEXPORT bool prev();
595
597 DLLEXPORT const char* getKey() const;
598
600 DLLEXPORT QoreString* getKeyString() const;
601
603 DLLEXPORT const QoreValue get() const;
604
606 DLLEXPORT const QoreTypeInfo* getTypeInfo() const;
607
609 DLLEXPORT QoreValue getReferenced() const;
610
612 DLLEXPORT const QoreHashNode* getHash() const;
613
615 DLLEXPORT bool first() const;
616
618 DLLEXPORT bool last() const;
619
621 DLLEXPORT bool empty() const;
622
624 DLLEXPORT bool valid() const;
625
627 DLLEXPORT void reset();
628 };
629
631
640 class ReverseConstHashIterator : public ConstHashIterator {
641 public:
643 DLLEXPORT ReverseConstHashIterator(const QoreHashNode* h);
644
646 DLLEXPORT ReverseConstHashIterator(const QoreHashNode& h);
647
649 DLLEXPORT ~ReverseConstHashIterator();
650
652
655 DLLEXPORT bool next();
656
658
661 DLLEXPORT bool prev();
662
664 DLLEXPORT bool first() const;
665
667 DLLEXPORT bool last() const;
668 };
669
671 class HashAssignmentHelper {
672 friend class hash_assignment_priv;
673 public:
675
679 DLLEXPORT HashAssignmentHelper(QoreHashNode& n_h, const char* key, bool must_already_exist = false);
680
682
686 DLLEXPORT HashAssignmentHelper(QoreHashNode& n_h, const std::string& key, bool must_already_exist = false);
687
689
696 DLLEXPORT HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString& key, bool must_already_exist = false);
697
699
706 DLLEXPORT HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString* key, bool must_already_exist = false);
707
709
711 DLLEXPORT HashAssignmentHelper(HashIterator &hi);
712
714 DLLEXPORT ~HashAssignmentHelper();
715
717
722 DLLEXPORT void reassign(const char* key, bool must_already_exist = false);
723
725
730 DLLEXPORT void reassign(const std::string& key, bool must_already_exist = false);
731
733
735 DLLEXPORT operator bool() const;
736
738
742 DLLEXPORT void assign(QoreValue v, ExceptionSink* xsink);
743
745
748 DLLEXPORT QoreValue swap(QoreValue v, ExceptionSink* xsink);
749
751
755 DLLEXPORT QoreValue get() const;
756
758
760 DLLEXPORT QoreValue operator*() const;
761
762 protected:
764 class hash_assignment_priv *priv;
765
766 private:
767 DLLLOCAL HashAssignmentHelper(const HashAssignmentHelper&) = delete;
768 DLLLOCAL HashAssignmentHelper& operator=(const HashAssignmentHelper&) = delete;
769 DLLLOCAL void* operator new(size_t) = delete;
770 };
771
772 #endif // _QORE_HASH_H
QoreHashNode::compareSoft
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...
QoreHashNode::derefImpl
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the hash
HashIterator::~HashIterator
DLLEXPORT ~HashIterator()
Destroys the iterator.
QoreHashNode::getKeyAsBigInt
DLLEXPORT int64 getKeyAsBigInt(const char *key, bool &found) const
returns the value of the key as an int64
ConstHashIterator::valid
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
HashIterator::first
DLLEXPORT bool first() const
returns true if on the first key of the hash
HashAssignmentHelper::operator*
DLLEXPORT QoreValue operator*() const
returns the current value of the hash key; any pointer returned is still owned by the hash ...
ConstHashIterator::prev
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
HashIterator::empty
DLLEXPORT bool empty() const
returns true if the hash is empty
QoreHashNode
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
ConstHashIterator::getTypeInfo
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type info for the current value
ConstHashIterator::getKeyString
DLLEXPORT QoreString * getKeyString() const
returns a QoreString for the current key, the caller owns QoreString returned
HashAssignmentHelper
use this class to make assignments to hash keys from a pointer to the key value
Definition: QoreHashNode.h:671
QoreHashNode::getValues
DLLEXPORT QoreListNode * getValues() const
returns a QoreListNode of AbstractQoreNode pointers representing all values in the hash; caller owns ...
QoreHashNode::getKeyAsBool
DLLEXPORT bool getKeyAsBool(const char *key, bool &found) const
returns the value of the key as a bool
ReverseConstHashIterator::ReverseConstHashIterator
DLLEXPORT ReverseConstHashIterator(const QoreHashNode *h)
initializes the iterator with the passed hash
ReverseHashIterator::last
DLLEXPORT bool last() const
returns true if on the first key of the hash
ReverseConstHashIterator::next
DLLEXPORT bool next()
moves to the next element in reverse order, returns false when there are no more elements to iterate ...
ReverseHashIterator
reverse iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:523
QoreHashNode::~QoreHashNode
virtual DLLEXPORT ~QoreHashNode()
deletes the object, cannot be called directly (use deref(ExceptionSink*) instead) ...
HashIterator::next
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate ...
HashAssignmentHelper::HashAssignmentHelper
DLLEXPORT HashAssignmentHelper(QoreHashNode &n_h, const char *key, bool must_already_exist=false)
constructor taking a const char*
QoreHashNode::is_equal_soft
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...
QoreHashNode::compareHard
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 ...
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
QoreHashNode::merge
DLLEXPORT void merge(const QoreHashNode *h, ExceptionSink *xsink)
appends all key-value pairs of "h" to this hash
HashIterator::last
DLLEXPORT bool last() const
returns true if on the last key of the hash
QoreHashNode::setKeyValue
DLLEXPORT int setKeyValue(const char *key, QoreValue value, ExceptionSink *xsink)
sets the value of "key" to "value"
HashIterator::deleteKey
DLLEXPORT void deleteKey(ExceptionSink *xsink)
deletes the key from the hash and dereferences the value
QoreHashNode::getStaticTypeCode
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreHashNode.h:391
HashIterator::getHash
DLLEXPORT QoreHashNode * getHash() const
returns the hash
QoreHashNode::getFirstKey
DLLEXPORT const char * getFirstKey() const
returns the cstring value of the first key in the hash
ConstHashIterator::first
DLLEXPORT bool first() const
returns true if on the first key of the hash
ConstHashIterator::ConstHashIterator
DLLEXPORT ConstHashIterator(const QoreHashNode *h)
initializes the iterator with the passed hash
ConstHashIterator::getReferenced
DLLEXPORT QoreValue getReferenced() const
returns the value of the current key with an incremented reference count
QoreHashNode::evalImpl
virtual DLLLOCAL QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
optionally evaluates the argument
QoreHashNode::hashRefSelf
DLLEXPORT QoreHashNode * hashRefSelf() const
returns "this" with an incremented reference count
HashIterator::getKeyString
DLLEXPORT QoreString * getKeyString() const
returns a QoreString for the current key, the caller owns QoreString returned
ConstHashIterator::getKey
DLLEXPORT const char * getKey() const
returns the current key
HashAssignmentHelper::swap
DLLEXPORT QoreValue swap(QoreValue v, ExceptionSink *xsink)
swaps the current value with the new value of the hash key, assumes that the new value is already ref...
HashAssignmentHelper::assign
DLLEXPORT void assign(QoreValue v, ExceptionSink *xsink)
assigns a value to the hash key, dereferences any old value, assumes that the value is already refere...
ConstHashIterator::~ConstHashIterator
DLLEXPORT ~ConstHashIterator()
Destroys the iterator.
QoreHashNode::getAsString
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...
QoreHashNode::priv
class qore_hash_private * priv
private implementation of the class
Definition: QoreHashNode.h:69
ConstHashIterator::reset
DLLEXPORT void reset()
resets the iterator to its initial state
ReverseHashIterator::next
DLLEXPORT bool next()
moves to the next element in reverse order, returns false when there are no more elements to iterate ...
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:81
HashAssignmentHelper::~HashAssignmentHelper
DLLEXPORT ~HashAssignmentHelper()
destroys the object and does post processing on the new value
QoreHashNode::getValueTypeInfo
DLLEXPORT const QoreTypeInfo * getValueTypeInfo() const
returns the value type declaration (only possible if there is no hashdecl set)
QoreHashNode::getHashDecl
DLLEXPORT const TypedHashDecl * getHashDecl() const
returns the hash&#39;s type declaration, if any
ReverseHashIterator::prev
DLLEXPORT bool prev()
moves to the previous element in reverse order, returns false when there are no more elements to iter...
QoreListNode
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
QoreHashNode::getTypeInfo
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type info structure for the current value; also works for hashes derived from a TypedHash...
QoreHashNode::parseInit
virtual DLLLOCAL int parseInit(QoreValue &val, QoreParseContext &parse_context)
initializes during parsing
ReverseConstHashIterator::last
DLLEXPORT bool last() const
returns true if on the first key of the hash
HashIterator::prev
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
HashIterator::getReferenced
DLLEXPORT QoreValue getReferenced() const
returns the value of the current key with an incremented reference count
QoreHashNode::realCopy
virtual DLLEXPORT AbstractQoreNode * realCopy() const
performs a copy of the hash and returns the new hash
NT_HASH
const qore_type_t NT_HASH
type value for QoreHashNode
Definition: node_types.h:51
QoreHashNode::takeKeyValue
DLLEXPORT QoreValue takeKeyValue(const char *key)
removes the value from the hash and returns the value removed, if any
QoreHashNode::getKeyValue
DLLEXPORT QoreValue getKeyValue(const char *key, ExceptionSink *xsink) const
returns the value of the given key
HashIterator::HashIterator
DLLLOCAL HashIterator(const HashIterator &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
QoreHashNode::existsKeyValue
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) ...
QoreValue
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:267
QoreHashNode::getKeyValueExistence
DLLEXPORT QoreValue getKeyValueExistence(const char *key, bool &exists, ExceptionSink *xsink) const
returns the value of the given key
QoreHashNode::clearNeedsEval
DLLLOCAL void clearNeedsEval()
sets "needs_eval" to false and "value" to true
ConstHashIterator::empty
DLLEXPORT bool empty() const
returns true if the hash is empty
QoreHashNode::empty
DLLEXPORT bool empty() const
returns true if the hash has no members, false if not
ReverseConstHashIterator::prev
DLLEXPORT bool prev()
moves to the previous element in reverse order, returns false when there are no more elements to iter...
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
QoreHashNode::removeKey
DLLEXPORT void removeKey(const QoreString *key, ExceptionSink *xsink)
removes the given key from the hash and derefences its value, if any
HashIterator::operator=
DLLLOCAL HashIterator & operator=(const HashIterator &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
HashIterator::removeKeyValue
DLLEXPORT QoreValue removeKeyValue()
removes the key value and returns the value returned
HashIterator::valid
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
QoreHashNode::size
DLLEXPORT size_t size() const
returns the number of members in the hash, executes in constant time
ReverseConstHashIterator
reverse constant iterator class for QoreHashNode, to be only created on the stack ...
Definition: QoreHashNode.h:640
QoreHashNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreHashNode.h:386
int64
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:260
QoreHashNode::deleteKey
DLLEXPORT void deleteKey(const QoreString *key, ExceptionSink *xsink)
performs a delete operation on the value of the given key
QoreHashNode::getLastKey
DLLEXPORT const char * getLastKey() const
returns the cstring value of the last key in the hash
ReverseHashIterator::first
DLLEXPORT bool first() const
returns true if on the last key of the hash
QoreHashNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
TypedHashDecl
typed hash declaration
Definition: TypedHashDecl.h:44
QoreHashNode::getKeys
DLLEXPORT QoreListNode * getKeys() const
returns a QoreListNode of QoreStringNode pointers representing all keys in the hash, caller owns the reference count returned
ReverseConstHashIterator::first
DLLEXPORT bool first() const
returns true if on the last key of the hash
HashAssignmentHelper::reassign
DLLEXPORT void reassign(const char *key, bool must_already_exist=false)
reassigns the object to the given key for a new assignment
ConstHashIterator::operator=
DLLLOCAL ConstHashIterator & operator=(const HashIterator &)
this function is not implemented; it is here as a protected function in order to prohibit it from bei...
QoreHashNode::setNeedsEval
DLLLOCAL void setNeedsEval()
sets "needs_eval" to true and "value" to false
QoreHashNode::copy
DLLEXPORT QoreHashNode * copy() const
performs a copy of the hash and returns the new hash
qore_type_t
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:70
ConstHashIterator::getHash
DLLEXPORT const QoreHashNode * getHash() const
returns the hash
AbstractQoreNode::value
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:330
ConstHashIterator
constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:563
common.h
ReverseConstHashIterator::~ReverseConstHashIterator
DLLEXPORT ~ReverseConstHashIterator()
Destroys the iterator.
HashAssignmentHelper::priv
class hash_assignment_priv * priv
private implementation
Definition: QoreHashNode.h:764
ConstHashIterator::last
DLLEXPORT bool last() const
returns true if on the last key of the hash
QoreHashNode::QoreHashNode
DLLEXPORT QoreHashNode()
creates an empty hash
QoreHashNode::is_equal_hard
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...
QoreHashNode::existsKey
DLLEXPORT bool existsKey(const char *key) const
returns true if the hash contains the given key
HashIterator::getKey
DLLEXPORT const char * getKey() const
returns the current key
ReverseHashIterator::ReverseHashIterator
DLLEXPORT ReverseHashIterator(QoreHashNode *h)
initializes the iterator with the passed hash
HashIterator::getTypeInfo
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type info for the current value
QoreHashNode::getAsBoolImpl
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
ReverseHashIterator::~ReverseHashIterator
DLLEXPORT ~ReverseHashIterator()
Destroys the iterator.
ConstHashIterator::next
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate ...
ReferenceHolder
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:52
HashIterator
iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:433