QoreHashNode.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreHashNode.h
Qore Programming Language
Copyright (C) 2003 - 2016 David Nichols
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the Qore library is released under a choice of three open-source
licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
information.
*/
#ifndef _QORE_QOREHASHNODE_H
#define _QORE_QOREHASHNODE_H
#include <qore/AbstractQoreNode.h>
#include <qore/common.h>
class HashMember;
class LocalVar;
class QoreHashNode : public AbstractQoreNode {
friend class HashIterator;
friend class ReverseHashIterator;
friend class ConstHashIterator;
friend class ReverseConstHashIterator;
friend class HashAssignmentHelper;
friend class hash_assignment_priv;
friend class qore_object_private;
friend class qore_hash_private;
private:
DLLLOCAL QoreHashNode(const QoreHashNode&);
DLLLOCAL QoreHashNode& operator=(const QoreHashNode&);
protected:
class qore_hash_private *priv;
DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
DLLEXPORT virtual AbstractQoreNode* evalImpl(ExceptionSink* xsink) const;
DLLLOCAL virtual AbstractQoreNode* evalImpl(bool &needs_deref, ExceptionSink* xsink) const;
DLLLOCAL virtual int64 bigIntEvalImpl(ExceptionSink* xsink) const;
DLLLOCAL virtual int integerEvalImpl(ExceptionSink* xsink) const;
DLLLOCAL virtual bool boolEvalImpl(ExceptionSink* xsink) const;
DLLLOCAL virtual double floatEvalImpl(ExceptionSink* xsink) const;
DLLEXPORT virtual ~QoreHashNode();
public:
DLLEXPORT QoreHashNode();
DLLEXPORT virtual bool getAsBoolImpl() const;
DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
DLLEXPORT virtual QoreString* getAsString(bool &del, int foff, ExceptionSink* xsink) const;
DLLEXPORT virtual AbstractQoreNode* realCopy() const;
DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
DLLEXPORT virtual const char* getTypeName() const;
DLLEXPORT QoreHashNode* hashRefSelf() const;
DLLEXPORT const char* getFirstKey() const;
DLLEXPORT const char* getLastKey() const;
DLLEXPORT AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists);
DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const char* key, bool &exists) const;
DLLEXPORT AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink);
DLLEXPORT const AbstractQoreNode* getKeyValueExistence(const QoreString* key, bool &exists, ExceptionSink* xsink) const;
DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* getKeyValue(const QoreString& key, ExceptionSink* xsink);
DLLEXPORT const AbstractQoreNode* getKeyValue(const QoreString* key, ExceptionSink* xsink) const;
DLLEXPORT AbstractQoreNode* getKeyValue(const char* key);
DLLEXPORT const AbstractQoreNode* getKeyValue(const char* key) const;
DLLEXPORT int64 getKeyAsBigInt(const char* key, bool &found) const;
DLLEXPORT bool getKeyAsBool(const char* key, bool &found) const;
DLLEXPORT QoreHashNode* copy() const;
DLLEXPORT AbstractQoreNode** getKeyValuePtr(const QoreString* key, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode** getKeyValuePtr(const char* key);
DLLEXPORT AbstractQoreNode** getExistingValuePtr(const QoreString* key, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode** getExistingValuePtr(const char* key);
DLLEXPORT void merge(const QoreHashNode* h, ExceptionSink* xsink);
DLLEXPORT void setKeyValue(const QoreString* key, AbstractQoreNode* value, ExceptionSink* xsink);
DLLEXPORT void setKeyValue(const QoreString& key, AbstractQoreNode* value, ExceptionSink* xsink);
DLLEXPORT void setKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* swapKeyValue(const QoreString* key, AbstractQoreNode* value, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value);
DLLEXPORT AbstractQoreNode* swapKeyValue(const char* key, AbstractQoreNode* value, ExceptionSink* xsink);
DLLEXPORT void deleteKey(const QoreString* key, ExceptionSink* xsink);
DLLEXPORT void deleteKey(const char* key, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* takeKeyValue(const QoreString* key, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* takeKeyValue(const char* key);
DLLEXPORT QoreListNode* getKeys() const;
DLLEXPORT bool compareSoft(const QoreHashNode* h, ExceptionSink* xsink) const;
DLLEXPORT bool compareHard(const QoreHashNode* h, ExceptionSink* xsink) const;
DLLEXPORT qore_size_t size() const;
DLLEXPORT bool empty() const;
DLLEXPORT bool existsKey(const char* key) const;
DLLEXPORT bool existsKeyValue(const char* key) const;
DLLEXPORT void removeKey(const QoreString* key, ExceptionSink* xsink);
DLLEXPORT void removeKey(const char* key, ExceptionSink* xsink);
DLLLOCAL static const char* getStaticTypeName() {
return "hash";
}
DLLLOCAL static qore_type_t getStaticTypeCode() {
return NT_HASH;
}
static const qore_type_t TYPE = NT_HASH;
DLLLOCAL virtual AbstractQoreNode* parseInit(LocalVar* oflag, int pflag, int& lvids, const QoreTypeInfo*& typeInfo);
DLLLOCAL QoreHashNode(bool ne);
DLLLOCAL void clear(ExceptionSink* xsink, bool reverse = false);
DLLLOCAL void clearNeedsEval();
DLLLOCAL void setNeedsEval();
DLLLOCAL AbstractQoreNode* evalKeyValue(const QoreString* key, ExceptionSink* xsink) const;
// returns a new hash consisting of just the members of value_list
DLLLOCAL QoreHashNode* getSlice(const QoreListNode* value_list, ExceptionSink* xsink) const;
// "key" is always passed in the default character encoding
DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key) const;
// "key" is always passed in the default character encoding
DLLLOCAL AbstractQoreNode* getReferencedKeyValue(const char* key, bool& exists) const;
};
#include <qore/ReferenceHolder.h>
typedef ReferenceHolder<QoreHashNode> QoreHashNodeHolder;
class qhi_priv;
class HashIterator {
friend class HashAssignmentHelper;
protected:
QoreHashNode* h;
qhi_priv* priv;
DLLLOCAL HashIterator(const HashIterator&);
DLLLOCAL HashIterator& operator=(const HashIterator&);
DLLLOCAL void* operator new(size_t);
public:
DLLEXPORT HashIterator(QoreHashNode* h);
DLLEXPORT HashIterator(QoreHashNode& h);
DLLEXPORT ~HashIterator();
DLLEXPORT bool next();
DLLEXPORT bool prev();
DLLEXPORT const char* getKey() const;
DLLEXPORT QoreString* getKeyString() const;
DLLEXPORT AbstractQoreNode* getValue() const;
DLLEXPORT AbstractQoreNode* takeValueAndDelete();
DLLEXPORT void deleteKey(ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode** getValuePtr() const;
DLLEXPORT AbstractQoreNode* getReferencedValue() const;
DLLEXPORT bool first() const;
DLLEXPORT bool last() const;
DLLEXPORT bool empty() const;
DLLEXPORT bool valid() const;
};
class ReverseHashIterator : public HashIterator {
public:
DLLEXPORT ReverseHashIterator(QoreHashNode* h);
DLLEXPORT ReverseHashIterator(QoreHashNode& h);
DLLEXPORT ~ReverseHashIterator();
DLLEXPORT bool next();
DLLEXPORT bool prev();
DLLEXPORT bool first() const;
DLLEXPORT bool last() const;
};
class ConstHashIterator {
protected:
const QoreHashNode* h;
qhi_priv* priv;
DLLLOCAL ConstHashIterator& operator=(const HashIterator&);
public:
DLLEXPORT ConstHashIterator(const QoreHashNode* h);
DLLEXPORT ConstHashIterator(const QoreHashNode& h);
DLLLOCAL ConstHashIterator(const ConstHashIterator&);
DLLEXPORT ~ConstHashIterator();
DLLEXPORT bool next();
DLLEXPORT bool prev();
DLLEXPORT const char* getKey() const;
DLLEXPORT QoreString* getKeyString() const;
DLLEXPORT const AbstractQoreNode* getValue() const;
DLLEXPORT AbstractQoreNode* getReferencedValue() const;
DLLEXPORT bool first() const;
DLLEXPORT bool last() const;
DLLEXPORT bool empty() const;
DLLEXPORT bool valid() const;
DLLEXPORT void reset();
};
class ReverseConstHashIterator : public ConstHashIterator {
public:
DLLEXPORT ReverseConstHashIterator(const QoreHashNode* h);
DLLEXPORT ReverseConstHashIterator(const QoreHashNode& h);
DLLEXPORT ~ReverseConstHashIterator();
DLLEXPORT bool next();
DLLEXPORT bool prev();
DLLEXPORT bool first() const;
DLLEXPORT bool last() const;
};
class HashAssignmentHelper {
private:
DLLLOCAL HashAssignmentHelper(const HashAssignmentHelper&);
DLLLOCAL HashAssignmentHelper& operator=(const HashAssignmentHelper&);
DLLLOCAL void* operator new(size_t);
protected:
class hash_assignment_priv *priv;
public:
DLLEXPORT HashAssignmentHelper(QoreHashNode& n_h, const char* key, bool must_already_exist = false);
DLLEXPORT HashAssignmentHelper(QoreHashNode& n_h, const std::string& key, bool must_already_exist = false);
DLLEXPORT HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString& key, bool must_already_exist = false);
DLLEXPORT HashAssignmentHelper(ExceptionSink* xsink, QoreHashNode& n_h, const QoreString* key, bool must_already_exist = false);
DLLEXPORT HashAssignmentHelper(HashIterator &hi);
DLLEXPORT ~HashAssignmentHelper();
DLLEXPORT void reassign(const char* key, bool must_already_exist = false);
DLLEXPORT void reassign(const std::string& key, bool must_already_exist = false);
DLLEXPORT operator bool() const;
DLLEXPORT void assign(AbstractQoreNode* v, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* swap(AbstractQoreNode* v, ExceptionSink* xsink);
DLLEXPORT AbstractQoreNode* operator*() const;
};
#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:49
HashAssignmentHelper
use this class to make assignments to hash keys from a pointer to the key value
Definition: QoreHashNode.h:738
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...
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:596
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:55
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:457
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:71
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:68
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
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:82
HashAssignmentHelper::~HashAssignmentHelper
DLLEXPORT ~HashAssignmentHelper()
destroys the object and does post processing on the new value
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:52
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
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...
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
HashAssignmentHelper::operator*
DLLEXPORT AbstractQoreNode * operator*() const
returns the current value of the hash key; the pointer returned is still owned by the 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:51
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
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:43
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:707
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:452
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:228
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
HashAssignmentHelper::reassign
DLLEXPORT void reassign(const char *key, bool must_already_exist=false)
reassigns the object to the given key for a new assignment
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
qore_type_t
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:68
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:160
ConstHashIterator
constant iterator class for QoreHashNode, to be only created on the stack
Definition: QoreHashNode.h:636
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:751
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
HashAssignmentHelper::assign
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...
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
HashAssignmentHelper::swap
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...
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:51
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:507