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);
61 DLLLOCAL
void editIntern() {
66 else if (!needs_deref || !val->
is_unique()) {
77 DLLLOCAL
void *
operator new(size_t);
116 needs_deref = n_needs_deref;
145 DLLLOCAL
QoreValue& getEntryReference(
size_t index);
147 DLLLOCAL
size_t size()
const {
148 return val ? val->
size() : 0;
153 return !val || needs_deref || val->
is_unique();
171 DLLLOCAL
operator bool()
const {
return val != 0; }
DLLEXPORT void ref() const
increments the reference count
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false,...
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
For use on the stack only: manages result of the optional evaluation of a QoreListNode.
Definition: QoreListNodeEvalOptionalRefHolder.h:37
DLLLOCAL void assignEval(const QoreListNode *exp)
assigns a new value by executing the given list and dereference flag to this object,...
Definition: QoreListNodeEvalOptionalRefHolder.h:102
DLLLOCAL const QoreListNode * operator*() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNodeEvalOptionalRefHolder.h:166
DLLLOCAL const QoreListNode * operator->() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNodeEvalOptionalRefHolder.h:161
DLLLOCAL ~QoreListNodeEvalOptionalRefHolder()
clears the object (dereferences the old object if necessary)
Definition: QoreListNodeEvalOptionalRefHolder.h:90
DLLLOCAL bool canEdit() const
returns true if the value being managed can be edited/updated
Definition: QoreListNodeEvalOptionalRefHolder.h:152
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:114
DLLLOCAL QoreListNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: QoreListNodeEvalOptionalRefHolder.h:130
DLLLOCAL bool needsDeref() const
returns true if the object contains a temporary (evaluated) value that needs a dereference
Definition: QoreListNodeEvalOptionalRefHolder.h:121
DLLLOCAL void edit()
will create a unique list so the list can be edited
Definition: QoreListNodeEvalOptionalRefHolder.h:141
DLLLOCAL void discard()
clears the object (dereferences the old object if necessary)
Definition: QoreListNodeEvalOptionalRefHolder.h:95
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT size_t size() const
returns the number of elements in the list
DLLEXPORT QoreListNode * evalList(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
DLLEXPORT QoreListNode * copy() const
performs a deep copy of the list and returns the new list
DLLEXPORT bool is_unique() const
returns true if the reference count is 1
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275