ValueOptionalRefHolder Class Reference

allows storing a value and setting a boolean flag that indicates if the value should be dereference in the destructor or not More...

`#include <QoreValue.h>`

Inheritance diagram for ValueOptionalRefHolder:
[legend]
Collaboration diagram for ValueOptionalRefHolder:
[legend]

## Public Member Functions

DLLLOCAL | ValueOptionalRefHolder (QoreValue n_v, bool nd, ExceptionSink *xs)
| creates the object with the given values
DLLLOCAL | ValueOptionalRefHolder (ExceptionSink *xs)
| creates an empty object
DLLLOCAL void | clearTemp ()
| sets needs_deref = false
DLLEXPORT void | ensureReferencedValue ()
DLLEXPORT QoreValue | getReferencedValue ()
| returns a referenced value; caller owns the reference; the current object is not disturbed
DLLLOCAL bool | isTemp () const
| returns true if the value is temporary (needs dereferencing)
DLLLOCAL | operator bool () const
| returns true if the value is not NOTHING
DLLLOCAL void | setValue (QoreValue nv)
| assigns a new non-temporary value
DLLLOCAL void | setValue (QoreValue nv, bool temp)
| assigns a new value
DLLLOCAL AbstractQoreNode * | takeNode (bool &nd)
| returns the stored AbstractQoreNode pointer and sets the dereference flag as an output variable
template<typename T >
DLLLOCAL T * | takeReferencedNode ()
| returns the stored node value and leaves the current object empty
DLLEXPORT QoreValue | takeReferencedValue ()
| returns a QoreValue after incrementing the reference count of any node value stored if necessary
DLLLOCAL QoreValue | takeValue (bool &nd)
| returns the stored value and sets the dereference flag as an output variable
DLLLOCAL void | takeValueFrom (ValueOptionalRefHolder &val)
| returns the stored value which must be dereferenced if it is a node object (i.e. type == QV_Node)
Public Member Functions inherited from ValueHolderBase
DLLLOCAL | ValueHolderBase (ExceptionSink *xs)
| creates an ampty object
DLLLOCAL | ValueHolderBase (QoreValue n_v, ExceptionSink *xs)
| creates the object with the given value
DLLLOCAL QoreValue & | operator* ()
| returns the value being managed
DLLLOCAL const QoreValue & | operator* () const
| returns the value being managed
DLLLOCAL QoreValue * | operator-> ()
| returns the value being managed
DLLLOCAL const QoreValue * | operator-> () const
| returns the value being managed

## Protected Attributes

bool | needs_deref
| flag indicating if the value should be dereferenced in the destructor or not
Protected Attributes inherited from ValueHolderBase
QoreValue | v
| the value held
ExceptionSink * | xsink
| for possible Qore-language exceptions

## Detailed Description

allows storing a value and setting a boolean flag that indicates if the value should be dereference in the destructor or not

## Member Function Documentation

## ensureReferencedValue()

DLLEXPORT void ValueOptionalRefHolder::ensureReferencedValue | ( |  | ) |

if needs_deref is false and an AbstractQoreNode* is contained, then the value is referenced and needs_deref is set to true

The documentation for this class was generated from the following file:

- include/qore/QoreValue.h