Qore Programming Language: include/qore/QoreHashNode.h (6585) Source File

Qore Programming Language 0.8.11

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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 2003 - 2013 David Nichols
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef _QORE_QOREHASHNODE_H
25
26 #define _QORE_QOREHASHNODE_H
27
28 #include <qore/AbstractQoreNode.h>
29 #include <qore/common.h>
30
31 class HashMember;
32 class LocalVar;
33
35
41 class QoreHashNode : public AbstractQoreNode {
42 friend class HashIterator;
43 friend class ReverseHashIterator;
44 friend class ConstHashIterator;
45 friend class ReverseConstHashIterator;
46 friend class HashAssignmentHelper;
47 friend class hash_assignment_priv;
48 friend class qore_object_private;
49 friend class qore_hash_private;
50
51 private:
53 DLLLOCAL QoreHashNode(const QoreHashNode&);
54
56 DLLLOCAL QoreHashNode& operator=(const QoreHashNode&);
57
58 protected:
60 class qore_hash_private *priv;
61
63
69 DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
70
72
75 DLLEXPORT virtual AbstractQoreNode* evalImpl(ExceptionSink* xsink) const;
76
78
81 DLLLOCAL virtual AbstractQoreNode* evalImpl(bool &needs_deref, ExceptionSink* xsink) const;
82
84 DLLLOCAL virtual int64 bigIntEvalImpl(ExceptionSink* xsink) const;
85
87 DLLLOCAL virtual int integerEvalImpl(ExceptionSink* xsink) const;
88
90 DLLLOCAL virtual bool boolEvalImpl(ExceptionSink* xsink) const;
91
93 DLLLOCAL virtual double floatEvalImpl(ExceptionSink* xsink) const;
94
96
99 DLLEXPORT virtual ~QoreHashNode();
100
101 public:
103 DLLEXPORT QoreHashNode();
104
106
108 DLLEXPORT virtual bool getAsBoolImpl() const;
109
111
117 DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
118
120
127 DLLEXPORT virtual QoreString* getAsString(bool &del, int foff, ExceptionSink* xsink) const;
128
130
132 DLLEXPORT virtual AbstractQoreNode* realCopy() const;
133
135
139 DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
140
142
146 DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
147
149
151 DLLEXPORT virtual const char* getTypeName() const;
152
154
156 DLLEXPORT QoreHashNode* hashRefSelf() const;
157
159
161 DLLEXPORT const char* getFirstKey() const;
162
164
166 DLLEXPORT const char* getLastKey() const;
167
169
173 DLLEXPORT AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists);
174
176
180 DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists) const;
181
183
190 DLLEXPORT AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink);
191
193
200 DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink) const;
201
203
209 DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink);
210
212
218 DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString& key, ExceptionSink* xsink);
219
221
227 DLLEXPORT const AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink) const;
228
230
233 DLLEXPORT AbstractQoreNode* getKeyValue(const char* key);
234
236
239 DLLEXPORT const AbstractQoreNode* getKeyValue(const char* key) const;
240
242
246 DLLEXPORT int64 getKeyAsBigInt(const char* key, bool &found) const;
247
249
253 DLLEXPORT bool getKeyAsBool(const char* key, bool &found) const;
254
256
258 DLLEXPORT QoreHashNode* copy() const;
259
261
269 DLLEXPORT AbstractQoreNode** getKeyValuePtr(const QoreString* key, ExceptionSink* xsink);
270
272
277 DLLEXPORT AbstractQoreNode** getKeyValuePtr(const char* key);
278
280
287 DLLEXPORT AbstractQoreNode** getExistingValuePtr(const QoreString* key, ExceptionSink* xsink);
288
290
294 DLLEXPORT AbstractQoreNode** getExistingValuePtr(const char* key);
295
297
302 DLLEXPORT void merge(const QoreHashNode* h, ExceptionSink* xsink);
303
305
311 DLLEXPORT void setKeyValue(const QoreString* key, AbstractQoreNode* value, ExceptionSink* xsink);
312
314
320 DLLEXPORT void setKeyValue(const QoreString& key, AbstractQoreNode* value, ExceptionSink* xsink);
321
323
329 DLLEXPORT void setKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
330
332
338 DLLEXPORT AbstractQoreNode* swapKeyValue(const QoreString* key, AbstractQoreNode* value, ExceptionSink* xsink);
339
341
346 DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value);
347
349
355 DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
356
358
363 DLLEXPORT void deleteKey(const QoreString* key, ExceptionSink* xsink);
364
366
370 DLLEXPORT void deleteKey(const char* key, ExceptionSink* xsink);
371
373
377 DLLEXPORT AbstractQoreNode* takeKeyValue(const QoreString* key, ExceptionSink* xsink);
378
380
383 DLLEXPORT AbstractQoreNode* takeKeyValue(const char* key);
384
386
389 DLLEXPORT QoreListNode* getKeys() const;
390
392
395 DLLEXPORT bool compareSoft(const QoreHashNode* h, ExceptionSink* xsink) const;
396
398
401 DLLEXPORT bool compareHard(const QoreHashNode* h, ExceptionSink* xsink) const;
402
404
406 DLLEXPORT qore_size_t size() const;
407
409
411 DLLEXPORT bool empty() const;
412
414
418 DLLEXPORT bool existsKey(const char* key) const;
419
421
424 DLLEXPORT bool existsKeyValue(const char* key) const;
425
427
431 DLLEXPORT void removeKey(const QoreString* key, ExceptionSink* xsink);
432
434
438 DLLEXPORT void removeKey(const char* key, ExceptionSink* xsink);
439
441
443 DLLLOCAL static const char* getStaticTypeName() {
444 return "hash";
445 }
446
448 DLLLOCAL static qore_type_t getStaticTypeCode() {
449 return NT_HASH;
450 }
451
453 DLLLOCAL virtual AbstractQoreNode* parseInit(LocalVar* oflag, int pflag, int& lvids, const QoreTypeInfo*& typeInfo);
454
455 DLLLOCAL QoreHashNode(bool ne);
456 DLLLOCAL void clear(ExceptionSink* xsink);
457
459 DLLLOCAL void clearNeedsEval();
460
462 DLLLOCAL void setNeedsEval();
463
464 DLLLOCAL AbstractQoreNode* evalKeyValue(const QoreString* key, ExceptionSink* xsink) const;
465
466 // returns a new hash consisting of just the members of value_list
467 DLLLOCAL QoreHashNode* getSlice(const QoreListNode* value_list, ExceptionSink* xsink) const;
468
469 // "key" is always passed in the default character encoding
470 DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key) const;
471
472 // "key" is always passed in the default character encoding
473 DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key, bool& exists) const;
474
475 DLLLOCAL static void doDuplicateKeyWarning(const char* key);
476 };
477
478 #include <qore/ReferenceHolder.h>
479
481
484 typedef ReferenceHolder<QoreHashNode> QoreHashNodeHolder;
485
486 class qhi_priv;
487
489
498 class HashIterator {
499 friend class HashAssignmentHelper;
500
501 protected:
502 QoreHashNode* h;
503 qhi_priv* priv;
504
506 DLLLOCAL HashIterator(const HashIterator&);
507
509 DLLLOCAL HashIterator& operator=(const HashIterator&);
510
512 DLLLOCAL void* operator new(size_t);
513
514 public:
516 DLLEXPORT HashIterator(QoreHashNode* h);
517
519 DLLEXPORT HashIterator(QoreHashNode& h);
520
522 DLLEXPORT ~HashIterator();
523
525
528 DLLEXPORT bool next();
529
531
534 DLLEXPORT bool prev();
535
537 DLLEXPORT const char* getKey() const;
538
540 DLLEXPORT QoreString* getKeyString() const;
541
543 DLLEXPORT AbstractQoreNode* getValue() const;
544
546 DLLEXPORT AbstractQoreNode* takeValueAndDelete();
547
549
553 DLLEXPORT void deleteKey(ExceptionSink* xsink);
554
556
559 DLLEXPORT AbstractQoreNode** getValuePtr() const;
560
562 DLLEXPORT AbstractQoreNode* getReferencedValue() const;
563
565 DLLEXPORT bool first() const;
566
568 DLLEXPORT bool last() const;
569
571 DLLEXPORT bool empty() const;
572
574 DLLEXPORT bool valid() const;
575 };
576
578
587 class ReverseHashIterator : public HashIterator {
588 public:
590 DLLEXPORT ReverseHashIterator(QoreHashNode* h);
591
593 DLLEXPORT ReverseHashIterator(QoreHashNode& h);
594
596 DLLEXPORT ~ReverseHashIterator();
597
599
602 DLLEXPORT bool next();
603
605
608 DLLEXPORT bool prev();
609
611 DLLEXPORT bool first() const;
612
614 DLLEXPORT bool last() const;
615 };
616
618
627 class ConstHashIterator {
628 protected:
629 const QoreHashNode* h;
630 qhi_priv* priv;
631
633 DLLLOCAL ConstHashIterator& operator=(const HashIterator&);
634
635 public:
637 DLLEXPORT ConstHashIterator(const QoreHashNode* h);
638
640 DLLEXPORT ConstHashIterator(const QoreHashNode& h);
641
643 DLLLOCAL ConstHashIterator(const ConstHashIterator&);
644
646 DLLEXPORT ~ConstHashIterator();
647
649
652 DLLEXPORT bool next();
653
655
658 DLLEXPORT bool prev();
659
661 DLLEXPORT const char* getKey() const;
662
664 DLLEXPORT QoreString* getKeyString() const;
665
667 DLLEXPORT const AbstractQoreNode* getValue() const;
668
670 DLLEXPORT AbstractQoreNode* getReferencedValue() const;
671
673 DLLEXPORT bool first() const;
674
676 DLLEXPORT bool last() const;
677
679 DLLEXPORT bool empty() const;
680
682 DLLEXPORT bool valid() const;
683
685 DLLEXPORT void reset();
686 };
687
689
698 class ReverseConstHashIterator : public ConstHashIterator {
699 public:
701 DLLEXPORT ReverseConstHashIterator(const QoreHashNode* h);
702
704 DLLEXPORT ReverseConstHashIterator(const QoreHashNode& h);
705
707 DLLEXPORT ~ReverseConstHashIterator();
708
710
713 DLLEXPORT bool next();
714
716
719 DLLEXPORT bool prev();
720
722 DLLEXPORT bool first() const;
723
725 DLLEXPORT bool last() const;
726 };
727
729 class HashAssignmentHelper {
730 private:
732 DLLLOCAL HashAssignmentHelper(const HashAssignmentHelper&);
733
735 DLLLOCAL HashAssignmentHelper& operator=(const HashAssignmentHelper&);
736
738 DLLLOCAL void* operator new(size_t);
739
740 protected:
742 class hash_assignment_priv *priv;
743
744 public:
746
750 DLLLOCAL HashAssignmentHelper(QoreHashNode& n_h, const char* key, bool must_already_exist = false);
751
753
757 DLLLOCAL HashAssignmentHelper(QoreHashNode& n_h, const std::string& key, bool must_already_exist = false);
758
760
767 DLLLOCAL HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString& key, bool must_already_exist = false);
768
770
777 DLLLOCAL HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString* key, bool must_already_exist = false);
778
780
782 DLLLOCAL HashAssignmentHelper(HashIterator &hi);
783
785 DLLLOCAL ~HashAssignmentHelper();
786
788
790 DLLLOCAL operator bool() const;
791
793
797 DLLLOCAL void assign(AbstractQoreNode* v, ExceptionSink* xsink);
798
800
803 DLLLOCAL AbstractQoreNode* swap(AbstractQoreNode* v, ExceptionSink* xsink);
804
806
808 DLLLOCAL AbstractQoreNode* operator*() const;
809 };
810
811 #endif // _QORE_HASH_H
ConstHashIterator::empty
DLLEXPORT bool empty() const
returns true if the hash is empty
QoreHashNode::derefImpl
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the hash
HashIterator::~HashIterator
DLLEXPORT ~HashIterator()
Destroys the iterator.
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 ...
ConstHashIterator::prev
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
QoreHashNode::getKeys
DLLEXPORT QoreListNode * getKeys() const
returns a QoreListNode of QoreStringNodes representing all keys in the hash, caller owns the referenc...
QoreHashNode
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:41
HashAssignmentHelper
use this class to make assignments to hash keys from a pointer to the key value
Definition: QoreHashNode.h:729
HashIterator::getValue
DLLEXPORT AbstractQoreNode * getValue() const
returns the value of the current key
ReverseConstHashIterator::ReverseConstHashIterator
DLLEXPORT ReverseConstHashIterator(const QoreHashNode *h)
initializes the iterator with the passed hash
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...
HashAssignmentHelper::assign
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...
QoreHashNode::getKeyValuePtr
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 ...
HashIterator::takeValueAndDelete
DLLEXPORT AbstractQoreNode * takeValueAndDelete()
deletes the key from the hash and returns the value, caller owns the reference
QoreHashNode::setKeyValue
DLLEXPORT void setKeyValue(const QoreString *key, AbstractQoreNode *value, ExceptionSink *xsink)
sets the value of "key" to "value"
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:587
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 ...
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
QoreHashNode::merge
DLLEXPORT void merge(const QoreHashNode *h, ExceptionSink *xsink)
appends all key-value pairs of "h" to this hash
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:448
ConstHashIterator::valid
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
QoreHashNode::getKeyValueExistence
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...
ConstHashIterator::ConstHashIterator
DLLEXPORT ConstHashIterator(const QoreHashNode *h)
initializes the iterator with the passed hash
qore_size_t
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:62
QoreHashNode::getKeyAsBigInt
DLLEXPORT int64 getKeyAsBigInt(const char *key, bool &found) const
returns the value of the key as an int64
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...
ConstHashIterator::first
DLLEXPORT bool first() const
returns true if on the first key of the hash
ConstHashIterator::last
DLLEXPORT bool last() const
returns true if on the last key of the hash
ReverseHashIterator::first
DLLEXPORT bool first() const
returns true if on the last key of the hash
QoreHashNode::takeKeyValue
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...
ConstHashIterator::getValue
DLLEXPORT const AbstractQoreNode * getValue() const
returns the value of the current key
ConstHashIterator::~ConstHashIterator
DLLEXPORT ~ConstHashIterator()
Destroys the iterator.
QoreHashNode::priv
class qore_hash_private * priv
private implementation of the class
Definition: QoreHashNode.h:60
QoreHashNode::evalImpl
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
evaluates the object and returns a value (or 0)
ConstHashIterator::reset
DLLEXPORT void reset()
resets the iterator to its initial state
qore_type_t
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
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's string type supported by the QoreEncoding class.
Definition: QoreString.h:42
QoreHashNode::getLastKey
DLLEXPORT const char * getLastKey() const
returns the cstring value of the last key in the hash
QoreHashNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
QoreHashNode::hashRefSelf
DLLEXPORT QoreHashNode * hashRefSelf() const
returns "this" with an incremented reference count
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:44
QoreHashNode::bigIntEvalImpl
virtual DLLLOCAL int64 bigIntEvalImpl(ExceptionSink *xsink) const
always returns 0
HashIterator::empty
DLLEXPORT bool empty() const
returns true if the hash is empty
HashAssignmentHelper::swap
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...
QoreHashNode::getAsBoolImpl
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
HashIterator::getValuePtr
DLLEXPORT AbstractQoreNode ** getValuePtr() const
returns a pointer to a pointer to the current value so the value of the key may be manipulated extern...
HashAssignmentHelper::operator*
DLLLOCAL AbstractQoreNode * operator*() const
returns the current value of the hash key; the pointer returned is still owned by the hash ...
HashIterator::prev
DLLEXPORT bool prev()
moves to the previous element, returns false when there are no more elements to iterate ...
QoreHashNode::realCopy
virtual DLLEXPORT AbstractQoreNode * realCopy() const
performs a copy of the hash and returns the new hash
QoreHashNode::getFirstKey
DLLEXPORT const char * getFirstKey() const
returns the cstring value of the first key in the hash
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...
NT_HASH
const qore_type_t NT_HASH
type value for QoreHashNode
Definition: node_types.h:43
HashIterator::getReferencedValue
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the value of the current key with an incremented reference count
HashIterator::last
DLLEXPORT bool last() const
returns true if on the last key of the hash
ReverseConstHashIterator::last
DLLEXPORT bool last() const
returns true if on the first key of the hash
HashAssignmentHelper::~HashAssignmentHelper
DLLLOCAL ~HashAssignmentHelper()
destroys the object and does post processing on the new value
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::boolEvalImpl
virtual DLLLOCAL bool boolEvalImpl(ExceptionSink *xsink) const
always returns false
QoreHashNode::clearNeedsEval
DLLLOCAL void clearNeedsEval()
sets "needs_eval" to false and "value" to true
ReverseConstHashIterator::prev
DLLEXPORT bool prev()
moves to the previous element in reverse order, returns false when there are no more elements to iter...
QoreHashNode::getKeyValue
DLLEXPORT AbstractQoreNode * getKeyValue(const QoreString *key, ExceptionSink *xsink)
returns the value of the key if it exists
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
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...
ReverseHashIterator::last
DLLEXPORT bool last() const
returns true if on the first key of the hash
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) ...
ReverseConstHashIterator
reverse constant iterator class for QoreHashNode, to be only created on the stack ...
Definition: QoreHashNode.h:698
QoreHashNode::integerEvalImpl
virtual DLLLOCAL int integerEvalImpl(ExceptionSink *xsink) const
always returns 0
QoreHashNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreHashNode.h:443
QoreHashNode::empty
DLLEXPORT bool empty() const
returns true if the hash has no members, false if not
QoreHashNode::deleteKey
DLLEXPORT void deleteKey(const QoreString *key, ExceptionSink *xsink)
performs a delete operation on the value of the given key
HashIterator::valid
DLLEXPORT bool valid() const
returns true if the iterator is currently pointing at a valid element
QoreHashNode::size
DLLEXPORT qore_size_t size() const
returns the number of members in the hash, executes in constant time
QoreHashNode::floatEvalImpl
virtual DLLLOCAL double floatEvalImpl(ExceptionSink *xsink) const
always returns 0.0
ConstHashIterator::getKey
DLLEXPORT const char * getKey() const
returns the current key
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::getKeyAsBool
DLLEXPORT bool getKeyAsBool(const char *key, bool &found) const
returns the value of the key as a bool
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:152
ConstHashIterator
constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:627
common.h
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...
ReverseConstHashIterator::~ReverseConstHashIterator
DLLEXPORT ~ReverseConstHashIterator()
Destroys the iterator.
HashAssignmentHelper::priv
class hash_assignment_priv * priv
private implementation
Definition: QoreHashNode.h:742
ConstHashIterator::getKeyString
DLLEXPORT QoreString * getKeyString() const
returns a QoreString for the current key, the caller owns QoreString returned
QoreHashNode::swapKeyValue
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)...
QoreHashNode::getExistingValuePtr
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 ...
QoreHashNode::QoreHashNode
DLLEXPORT QoreHashNode()
creates an empty hash
QoreHashNode::copy
DLLEXPORT QoreHashNode * copy() const
performs a copy of the hash and returns the new hash
HashIterator::getKeyString
DLLEXPORT QoreString * getKeyString() const
returns a QoreString for the current key, the caller owns QoreString returned
ReverseHashIterator::ReverseHashIterator
DLLEXPORT ReverseHashIterator(QoreHashNode *h)
initializes the iterator with the passed hash
ReverseConstHashIterator::first
DLLEXPORT bool first() const
returns true if on the last key of the hash
HashIterator::first
DLLEXPORT bool first() const
returns true if on the first key of the hash
QoreHashNode::parseInit
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
initializes during parsing
ReverseHashIterator::~ReverseHashIterator
DLLEXPORT ~ReverseHashIterator()
Destroys the iterator.
HashIterator::getKey
DLLEXPORT const char * getKey() const
returns the current key
ConstHashIterator::next
DLLEXPORT bool next()
moves to the next element, returns false when there are no more elements to iterate ...
QoreHashNode::existsKey
DLLEXPORT bool existsKey(const char *key) const
returns true if the hash contains the given key
ReferenceHolder
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:43
ConstHashIterator::getReferencedValue
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the value of the current key with an incremented reference count
HashIterator
iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:498