32 #ifndef _QORE_PARAMS_H 34 #define _QORE_PARAMS_H 36 #include <qore/AbstractQoreNode.h> 47 return n ? (unsigned)n->
size() : 0;
55 return n ? (unsigned)n->
size() : 0;
66 if (!n)
return nullptr;
98 #define HARD_QORE_VALUE_OR_NOTHING_PARAM(name, Type, list, i) Type* name = get_hard_value_or_nothing_param<Type>(list, i) 101 #define HARD_QORE_VALUE_PARAM(name, Type, list, i) Type* name = get_hard_value_param(list, i).get<Type>() 104 #define HARD_QORE_VALUE_INT(list, i) get_hard_value_param(list, i).getAsBigInt() 107 #define HARD_QORE_VALUE_FLOAT(list, i) get_hard_value_param(list, i).getAsFloat() 110 #define HARD_QORE_VALUE_NUMBER(list, i) get_hard_value_param(list, i).get<const QoreNumberNode>() 113 #define HARD_QORE_VALUE_BOOL(list, i) get_hard_value_param(list, i).getAsBool() 116 #define HARD_QORE_VALUE_STRING(list, i) get_hard_value_param(list, i).get<const QoreStringNode>() 119 #define HARD_QORE_VALUE_DATE(list, i) get_hard_value_param(list, i).get<const DateTimeNode>() 122 #define HARD_QORE_VALUE_BINARY(list, i) get_hard_value_param(list, i).get<const BinaryNode>() 125 #define HARD_QORE_VALUE_LIST(list, i) get_hard_value_param(list, i).get<const QoreListNode>() 128 #define HARD_QORE_VALUE_HASH(list, i) get_hard_value_param(list, i).get<const QoreHashNode>() 131 #define HARD_QORE_VALUE_REF(list, i) get_hard_value_param(list, i).get<const ReferenceNode>() 134 #define HARD_QORE_VALUE_OBJECT(list, i) const_cast<QoreObject*>(get_hard_value_param(list, i).get<const QoreObject>()) 137 #define HARD_QORE_VALUE_OBJ_DATA(vname, Type, list, i, cid, dname, cname, xsink) HARD_QORE_VALUE_PARAM(obj_##vname, const QoreObject, list, i); Type* vname = reinterpret_cast<Type*>(obj_##vname->getReferencedPrivateData(cid, xsink)); if (!vname && !*xsink) xsink->raiseException("OBJECT-ALREADY-DELETED", "cannot complete call setup to %s() because parameter %d (<class %s>) has already been deleted", cname, i + 1, dname) 140 #define TAKE_HARD_QORE_VALUE_OBJ_DATA(vname, Type, list, i, cid, dname, cname, xsink) HARD_QORE_VALUE_PARAM(obj_##vname, const QoreObject, list, i); Type* vname = reinterpret_cast<Type*>(const_cast<QoreObject*>(obj_##vname)->getAndClearPrivateData(cid, xsink)); if (!vname && !*xsink) xsink->raiseException("OBJECT-ALREADY-DELETED", "cannot complete call setup to %s() because parameter %d (<class %s>) has already been deleted", cname, i + 1, dname); else if (vname) const_cast<QoreObject*>(obj_##vname)->doDelete(xsink) 143 #define HARD_QORE_VALUE_OBJ_OR_NOTHING_DATA(vname, Type, list, i, cid, xsink) HARD_QORE_VALUE_OR_NOTHING_PARAM(obj_##vname, const QoreObject, list, i); Type* vname = obj_##vname ? reinterpret_cast<Type*>(obj_##vname->getReferencedPrivateData(cid, xsink)) : 0; defines string encoding functions in Qore
Definition: QoreEncoding.h:83
DLLEXPORT const QoreEncoding * QCS_DEFAULT
the default encoding for the Qore library
static T * get_hard_value_or_nothing_param(const QoreListNode *n, qore_size_t i)
returns the given type for hard typed parameters
Definition: params.h:86
DLLEXPORT QoreValue retrieveEntry(size_t index)
returns the element at "index" (first element is index 0)
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:73
static const ReferenceNode * test_reference_param(const QoreListNode *n, qore_size_t i)
returns a ReferenceNode pointer for the argument position given or 0 if there is no argument there or...
Definition: params.h:65
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
static unsigned num_args(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:46
static QoreValue get_param_value(const QoreListNode *n, qore_size_t i)
returns the argument in the position given or 0 if there is none
Definition: params.h:78
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT QoreEncodingManager QEM
the QoreEncodingManager object
DLLEXPORT size_t size() const
returns the number of elements in the list
parse type: reference to a lvalue expression
Definition: ReferenceNode.h:45
const qore_type_t NT_REFERENCE
type value for ReferenceNode
Definition: node_types.h:64
static DLLEXPORT const QoreEncoding * findCreate(const char *name)
finds an encoding if it exists (also looks up against alias names) and creates a new one if it doesn'...
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
static unsigned num_params(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:54
#define HARD_QORE_VALUE_PARAM(name, Type, list, i)
returns a hard typed parameter
Definition: params.h:101
static const QoreEncoding * get_value_encoding_param(const QoreListNode *n, qore_size_t i, const QoreEncoding *def=QCS_DEFAULT)
returns the QoreEncoding corresponding to the string passed or a default encoding
Definition: params.h:146
#define HARD_QORE_VALUE_STRING(list, i)
returns a const QoreStringNode* from a hard typed string param
Definition: params.h:116
static QoreValue get_hard_value_param(const QoreListNode *n, qore_size_t i)
returns the given type for hard typed parameters
Definition: params.h:92