Qore Programming Language 1.19.5
|
Base value class; parent of QoreValue; designed to be passed by value. More...
#include <QoreValue.h>
Public Member Methods | |
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 (const QoreSimpleValue &val) |
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 | |
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 | isEqualHard (const QoreValue v) const |
returns trus if the argument value is equal to the current value without any type conversions | |
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 | |
DLLEXPORT void | set (const QoreSimpleValue &val) |
assigns a new 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 | |
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... | |
Public Attributes | |
valtype_t | type |
indicates the value that the union is holding | |
qore_value_u | v |
the actual value is stored here | |
Private Member Methods | |
DLLEXPORT AbstractQoreNode * | takeNodeIntern () |
returns the internal AbstractQoreNode pointer, does not check that type == QV_Node, leaves the object empty | |
Base value class; parent of QoreValue; designed to be passed by value.
|
inline |
returns the value as the given type
References type.
Referenced by AbstractQoreThreadResource::cleanup(), get_hard_value_or_nothing_param(), ValueHolder::releaseAs(), and test_reference_param().
|
inline |
returns the value as the given type
References type.
DLLEXPORT bool QoreSimpleValue::isConstant | ( | ) | const |
returns true if the value is a constant value (does not require evaluation)
returns true if the type is a constant int, bool, float, number, string, list, hash, date, binary, object, nothing, or null value
DLLEXPORT bool QoreSimpleValue::isScalar | ( | ) | const |
returns true if the value is a scalar (int, bool, float, number, string)
|
inline |
returns a pointer to an object of the given class; takes the pointer from the object; the caller owns the reference returned
will assert() in debug mode if the object does not contain a value of the requested type or if type != QV_Node
References qore_value_u::n, QV_Node, type, and v.
Referenced by ValueOptionalRefHolder::takeReferencedNode().
DLLEXPORT AbstractQoreNode * QoreSimpleValue::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)
Referenced by ValueOptionalRefHolder::takeNode().