Qore Programming Language  0.8.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | List of all members
QoreNodeEvalOptionalRefHolder Class Reference

this class manages reference counts for the optional evaluation of AbstractQoreNode objects More...

#include <QoreNodeEvalOptionalRefHolder.h>

Public Member Functions

DLLLOCAL QoreNodeEvalOptionalRefHolder (ExceptionSink *n_xsink)
 constructor used to create a holder object
 
DLLLOCAL QoreNodeEvalOptionalRefHolder (const AbstractQoreNode *exp, ExceptionSink *n_xsink)
 constructor with a value that will call the class' eval(needs_deref) method
 
DLLLOCAL ~QoreNodeEvalOptionalRefHolder ()
 discards any temporary value evaluated by the constructor or assigned by "assign()"
 
DLLLOCAL void assign (bool n_needs_deref, AbstractQoreNode *n_val)
 assigns a new value to this holder object
 
DLLLOCAL void discard ()
 discards any temporary value evaluated by the constructor or assigned by "assign()"
 
DLLLOCAL AbstractQoreNodegetReferencedValue ()
 returns a referenced value - the caller will own the reference
 
DLLLOCAL bool isTemp () const
 returns true if the value is temporary (needs dereferencing)
 
DLLLOCAL operator bool () const
 returns true if a value is being held
 
DLLLOCAL const AbstractQoreNodeoperator* () const
 returns the object being managed
 
DLLLOCAL const AbstractQoreNodeoperator-> () const
 returns the object being managed
 

Detailed Description

this class manages reference counts for the optional evaluation of AbstractQoreNode objects

This class can only be used on the stack (cannot be allocated dynamically). This class is designed to avoid atomic reference count increments and decrements whenever possible and to avoid an "eval()" call for types that do not require it (such as value types). It is used extensively internally but normally should not need to be used outside of the qore library itself.

QoreNodeEvalOptionalRefHolder evaluated_node(node, xsink);
return evaluated_node ? evaluated_node->getAsBool() : false;

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