32 #ifndef _QORE_QORELISTNODEEVALOPTIONALREFHOLDER_H 34 #define _QORE_QORELISTNODEEVALOPTIONALREFHOLDER_H 43 DLLLOCAL
void discardIntern() {
44 if (needs_deref && val) {
51 val = exp->
evalList(needs_deref, xsink);
62 DLLLOCAL
void editIntern() {
67 else if (!needs_deref || !val->
is_unique()) {
78 DLLLOCAL
void *
operator new(size_t);
117 needs_deref = n_needs_deref;
146 DLLLOCAL
QoreValue& getEntryReference(
size_t index);
148 DLLLOCAL
size_t size()
const {
149 return val ? val->
size() : 0;
154 return !val || needs_deref || val->
is_unique();
172 DLLLOCAL
operator bool()
const {
return val != 0; }
DLLLOCAL const QoreListNode * operator->() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNodeEvalOptionalRefHolder.h:162
DLLLOCAL ~QoreListNodeEvalOptionalRefHolder()
clears the object (dereferences the old object if necessary)
Definition: QoreListNodeEvalOptionalRefHolder.h:91
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLLOCAL void discard()
clears the object (dereferences the old object if necessary)
Definition: QoreListNodeEvalOptionalRefHolder.h:96
DLLEXPORT size_t size() const
returns the number of elements in the list
DLLLOCAL void assignEval(const QoreListNode *exp)
assigns a new value by executing the given list and dereference flag to this object, dereferences the old object if necessary
Definition: QoreListNodeEvalOptionalRefHolder.h:103
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
DLLLOCAL const QoreListNode * operator*() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNodeEvalOptionalRefHolder.h:167
DLLEXPORT QoreListNode * evalList(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false, otherwise does nothing
DLLEXPORT void ref() const
increments the reference count
DLLEXPORT bool is_unique() const
returns true if the reference count is 1
DLLLOCAL void assign(bool n_needs_deref, QoreListNode *n_val)
assigns a new value and dereference flag to this object, dereferences the old object if necessary ...
Definition: QoreListNodeEvalOptionalRefHolder.h:115
DLLLOCAL void edit()
will create a unique list so the list can be edited
Definition: QoreListNodeEvalOptionalRefHolder.h:142
DLLLOCAL bool canEdit() const
returns true if the value being managed can be edited/updated
Definition: QoreListNodeEvalOptionalRefHolder.h:153
For use on the stack only: manages result of the optional evaluation of a QoreListNode.
Definition: QoreListNodeEvalOptionalRefHolder.h:37
DLLLOCAL QoreListNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: QoreListNodeEvalOptionalRefHolder.h:131
DLLLOCAL bool needsDeref() const
returns true if the object contains a temporary (evaluated) value that needs a dereference ...
Definition: QoreListNodeEvalOptionalRefHolder.h:122
DLLEXPORT QoreListNode * copy() const
performs a deep copy of the list and returns the new list