|  | Qore Programming Language 1.13.0
    | 
The main value class in Qore, designed to be passed by value. More...
#include <QoreValue.h>
| Public Member Methods | |
| DLLEXPORT | QoreValue () | 
| creates with no value (i.e. QoreNothingNode) | |
| DLLEXPORT | QoreValue (AbstractQoreNode *n) | 
| the QoreValue object takes the reference of the argument passed | |
| DLLEXPORT | QoreValue (bool b) | 
| creates as a bool | |
| DLLEXPORT | QoreValue (const AbstractQoreNode *n) | 
| creates as the given object; does not reference n for the assignment to this object  More... | |
| DLLEXPORT | QoreValue (const QoreSimpleValue &v) | 
| creates the value from the argument | |
| DLLEXPORT | QoreValue (const QoreValue &old) | 
| copies the value, in case type == QV_Node, no additional references are made in this function | |
| DLLEXPORT | QoreValue (double f) | 
| creates as a double | |
| DLLEXPORT | QoreValue (int i) | 
| creates as an int | |
| DLLEXPORT | QoreValue (int64 i) | 
| creates as an int | |
| DLLEXPORT | QoreValue (long i) | 
| creates as an int | |
| DLLEXPORT | QoreValue (unsigned int i) | 
| creates as an int | |
| DLLEXPORT | QoreValue (unsigned long i) | 
| creates as an int | |
| DLLEXPORT | QoreValue (unsigned long long i) | 
| creates as an int | |
| DLLEXPORT AbstractQoreNode * | assign (AbstractQoreNode *n) | 
| the QoreValue object takes the reference of the argument  More... | |
| DLLEXPORT AbstractQoreNode * | assign (bool n) | 
| sets the value of the object and returns any node value held previously  More... | |
| DLLEXPORT AbstractQoreNode * | assign (const QoreValue n) | 
| sets the value of the object and returns any node value held previously  More... | |
| DLLEXPORT AbstractQoreNode * | assign (double n) | 
| sets the value of the object and returns any node value held previously  More... | |
| DLLEXPORT AbstractQoreNode * | assign (int64 n) | 
| sets the value of the object and returns any node value held previously  More... | |
| DLLEXPORT AbstractQoreNode * | assignNothing () | 
| sets the value of the object to QoreNothingNode and returns any node value held previously  More... | |
| DLLEXPORT bool | derefCanThrowException () const | 
| returns true if a dereference could theoretically throw an exception (an object is reachable from this value) | |
| DLLEXPORT void | discard (ExceptionSink *xsink) | 
| dereferences any contained AbstractQoreNode pointer and sets to 0; does not modify other values | |
| DLLEXPORT QoreValue | eval (bool &needs_deref, ExceptionSink *xsink) const | 
| evaluates the node and returns the result | |
| DLLEXPORT QoreValue | eval (ExceptionSink *xsink) const | 
| evaluates the node and returns the result | |
| DLLEXPORT QoreString * | getAsString (bool &del, int foff, ExceptionSink *xsink) const | 
| returns the string value with optional formatting of the contained node | |
| DLLEXPORT int | getAsString (QoreString &str, int format_offset, ExceptionSink *xsink) const | 
| appends the string value of the contained node to the string argument with optional formatting | |
| DLLEXPORT const QoreTypeInfo * | getFullTypeInfo () const | 
| returns the exact type of the value; i.e. the class type for classes, hashdecl type for hashdecls  More... | |
| DLLEXPORT const char * | getFullTypeName () const | 
| returns a string type description of the full type of the value contained (ex: "nothing"for a null AbstractQoreNode pointer)  More... | |
| DLLEXPORT const char * | getFullTypeName (bool with_namespaces) const | 
| returns a string type description of the full type of the value contained (ex: "nothing"for a null AbstractQoreNode pointer)  More... | |
| DLLEXPORT const QoreTypeInfo * | getTypeInfo () const | 
| returns the type of the value  More... | |
| DLLEXPORT bool | hasNode () const | 
| returns true if the object contains a non-null AbstractQoreNode pointer (ie type == QV_Node && v.n is not 0) | |
| DLLEXPORT bool | isEqualHard (const QoreValue v) const | 
| returns trus if the argument value is equal to the current value without any type conversions | |
| DLLEXPORT bool | isEqualSoft (const QoreValue v, ExceptionSink *xsink) const | 
| returns trus if the argument value is equal to the current value with type conversions | |
| DLLEXPORT bool | isEqualValue (const QoreValue v) | 
| returns true of the argument is exactly the same value as the current value, meaning also that if both contain pointers, that the pointers contained are the same pointer | |
| DLLEXPORT bool | isReferenceCounted () const | 
| returns true if the value holds a referenced-counted node | |
| DLLEXPORT QoreValue & | operator= (const QoreSimpleValue &n) | 
| assigns a new value | |
| DLLEXPORT QoreValue & | operator= (const QoreValue &n) | 
| assigns a new value | |
| DLLEXPORT void | ref () const | 
| references the contained value if type == QV_Node | |
| DLLEXPORT QoreValue | refSelf () const | 
| references the contained value if type == QV_Node, returns itself | |
| DLLEXPORT void | sanitize () | 
| converts any node pointers to efficient representations if possible and dereferences the node value contained | |
| DLLEXPORT void | swap (QoreValue &val) | 
| exchanges the values | |
| DLLEXPORT AbstractQoreNode * | takeIfNode () | 
| returns a referenced value; leaving the "this" untouched; the caller owns the reference returned  More... | |
|  Public Member Methods inherited from QoreSimpleValue | |
| DLLLOCAL QoreSimpleValue & | assign (AbstractQoreNode *n) | 
| assigns a new value to the object and returns a reference to the object; any current value is overwritten | |
| DLLLOCAL QoreSimpleValue & | assign (bool b) | 
| assigns a new value to the object and returns a reference to the object; any current value is overwritten | |
| DLLLOCAL QoreSimpleValue & | assign (double f) | 
| assigns a new value to the object and returns a reference to the object; any current value is overwritten | |
| DLLLOCAL QoreSimpleValue & | assign (int64 i) | 
| assigns a new value to the object and returns a reference to the object; any current value is overwritten | |
| DLLLOCAL QoreSimpleValue & | assign (QoreSimpleValue &val) | 
| assigns a new value to the object and returns a reference to the object; any current value is overwritten | |
| DLLEXPORT void | clear () | 
| unconditionally set the QoreValue to QoreNothingNode (does not dereference any possible contained AbstractQoreNode ptr) | |
| DLLEXPORT void | discard (ExceptionSink *xsink) | 
| dereferences any contained AbstractQoreNode pointer and sets to 0; does not modify other values | |
| template<typename T > | |
| DLLLOCAL detail::QoreValueCastHelper< T >::Result | get () | 
| returns the value as the given type  More... | |
| template<typename T > | |
| DLLLOCAL detail::QoreValueCastHelper< constT >::Result | get () const | 
| returns the value as the given type  More... | |
| DLLEXPORT int64 | getAsBigInt () const | 
| returns the value as an int | |
| DLLEXPORT bool | getAsBool () const | 
| returns the value as a bool | |
| DLLEXPORT double | getAsFloat () const | 
| returns the value as a float | |
| DLLEXPORT AbstractQoreNode * | getInternalNode () | 
| returns any AbstractQoreNode value held; if type != QV_Node, returns nullptr | |
| DLLEXPORT const AbstractQoreNode * | getInternalNode () const | 
| returns any AbstractQoreNode value held; if type != QV_Node, returns nullptr | |
| DLLEXPORT qore_type_t | getType () const | 
| returns the type of value contained | |
| DLLEXPORT const char * | getTypeName () const | 
| returns a string type description of the value contained (ex: "nothing"for a null AbstractQoreNode pointer) | |
| DLLEXPORT bool | hasEffect () const | 
| return true if the value needs evaluation and has a side effect | |
| DLLEXPORT bool | isConstant () const | 
| returns true if the value is a constant value (does not require evaluation)  More... | |
| DLLEXPORT bool | isNothing () const | 
| returns true if the object contains NOTHING | |
| DLLEXPORT bool | isNull () const | 
| returns true if the object contains NULL | |
| DLLEXPORT bool | isNullOrNothing () const | 
| returns true if the object contains NOTHING or NULL | |
| DLLEXPORT bool | isScalar () const | 
| returns true if the value is a scalar (int, bool, float, number, string)  More... | |
| DLLEXPORT bool | isValue () const | 
| returns true if the object holds a value, false if it holds an expression | |
| DLLEXPORT bool | needsEval () const | 
| return true if the value needs evaluation | |
| DLLEXPORT | operator bool () const | 
| returns true if the value is not NOTHING | |
| DLLEXPORT void | set (AbstractQoreNode *n) | 
| assigns a new value to the object; any current value is overwritten | |
| DLLLOCAL void | set (bool b) | 
| assigns a boolean value to the object; any current value is overwritten | |
| DLLLOCAL void | set (double f) | 
| assigns a floating-point value to the object; any current value is overwritten | |
| DLLLOCAL void | set (int64 i) | 
| assigns an integer value to the object; any current value is overwritten | |
| DLLEXPORT void | set (QoreSimpleValue val) | 
| assigns a new value to the object; any current value is overwritten | |
| template<typename T > | |
| DLLLOCAL T * | take () | 
| returns a pointer to an object of the given class; takes the pointer from the object; the caller owns the reference returned  More... | |
| DLLEXPORT AbstractQoreNode * | takeNode () | 
| returns a referenced AbstractQoreNode pointer leaving "this" empty (value is taken from "this"); the caller owns the reference returned; do not call with a simple value (int, float or bool)  More... | |
| Friends | |
| template<typename > | |
| struct | detail::QoreValueCastHelper | 
| class | ValueHolder | 
| class | ValueOptionalRefHolder | 
| Additional Inherited Members | |
|  Public Attributes inherited from QoreSimpleValue | |
| valtype_t | type | 
| indicates the value that the union is holding | |
| qore_value_u | v | 
| the actual value is stored here | |
|  Private Member Methods inherited from QoreSimpleValue | |
| DLLEXPORT AbstractQoreNode * | takeNodeIntern () | 
| returns the internal AbstractQoreNode pointer, does not check that type == QV_Node, leaves the object empty | |
The main value class in Qore, designed to be passed by value.
| DLLEXPORT QoreValue::QoreValue | ( | const AbstractQoreNode * | n | ) | 
creates as the given object; does not reference n for the assignment to this object
sanitizes n (increases the reference of n if necessary), meaning that if possible, the value is converted to an immediate value in place (int, float, or bool)
if getType() == QV_Node after this assignment, then the node must be referenced for the assignment
| DLLEXPORT AbstractQoreNode * QoreValue::assign | ( | AbstractQoreNode * | n | ) | 
the QoreValue object takes the reference of the argument
| n | the new node value of the object, sets type to QV_Node | 
| DLLEXPORT AbstractQoreNode * QoreValue::assign | ( | bool | n | ) | 
sets the value of the object and returns any node value held previously
| n | the new value of the object; sets type to QV_Bool | 
| DLLEXPORT AbstractQoreNode * QoreValue::assign | ( | const QoreValue | n | ) | 
sets the value of the object and returns any node value held previously
| n | the new value of the object | 
| DLLEXPORT AbstractQoreNode * QoreValue::assign | ( | double | n | ) | 
sets the value of the object and returns any node value held previously
| n | the new value of the object; sets type to QV_Float | 
| DLLEXPORT AbstractQoreNode * QoreValue::assign | ( | int64 | n | ) | 
sets the value of the object and returns any node value held previously
| n | the new value of the object; sets type to QV_Int | 
| DLLEXPORT AbstractQoreNode * QoreValue::assignNothing | ( | ) | 
sets the value of the object to QoreNothingNode and returns any node value held previously
sets type to QV_Node
| DLLEXPORT const QoreTypeInfo * QoreValue::getFullTypeInfo | ( | ) | const | 
returns the exact type of the value; i.e. the class type for classes, hashdecl type for hashdecls
| DLLEXPORT const char * QoreValue::getFullTypeName | ( | ) | const | 
returns a string type description of the full type of the value contained (ex: "nothing" for a null AbstractQoreNode pointer) 
differs from the return value of getTypeName() for complex types (ex: "hash<string, int>") 
| DLLEXPORT const char * QoreValue::getFullTypeName | ( | bool | with_namespaces | ) | const | 
returns a string type description of the full type of the value contained (ex: "nothing" for a null AbstractQoreNode pointer) 
differs from the return value of getTypeName() for complex types (ex: "hash<string, int>")
| with_namespaces | if true then class and hashdecl names are given with full namespace paths | 
| DLLEXPORT const QoreTypeInfo * QoreValue::getTypeInfo | ( | ) | const | 
returns the type of the value
| DLLEXPORT AbstractQoreNode * QoreValue::takeIfNode | ( | ) | 
returns a referenced value; leaving the "this" untouched; the caller owns the reference returned
returns a referenced AbstractQoreNode pointer only if the contained value is an AbstractQoreNode pointer, in which case "this" is left empty (the value is taken from "this"); returns 0 if the object does not contain an AbstractQoreNode pointer (type != QV_Node)