24 #ifndef _QORE_PARAMS_H
26 #define _QORE_PARAMS_H
28 #include <qore/AbstractQoreNode.h>
39 return n ? (unsigned)n->
size() : 0;
47 return n ? (unsigned)n->
size() : 0;
249 template <
typename T>
256 template <
typename T>
277 #define HARD_QORE_OR_NOTHING_PARAM(name, Type, list, i) Type *name = get_hard_or_nothing_param<Type>(list, i)
280 #define HARD_QORE_PARAM(name, Type, list, i) Type *name = get_hard_param<Type>(list, i)
283 #define HARD_QORE_INT(list, i) get_hard_param<const QoreBigIntNode>(list, i)->val
286 #define HARD_QORE_FLOAT(list, i) get_hard_param<const QoreFloatNode>(list, i)->f
289 #define HARD_QORE_NUMBER(list, i) get_hard_param<const QoreNumberNode>(list, i)
292 #define HARD_QORE_BOOL(list, i) get_hard_param<const QoreBoolNode>(list, i)->getValue()
295 #define HARD_QORE_STRING(list, i) get_hard_param<const QoreStringNode>(list, i)
298 #define HARD_QORE_DATE(list, i) get_hard_param<const DateTimeNode>(list, i)
301 #define HARD_QORE_BINARY(list, i) get_hard_param<const BinaryNode>(list, i)
304 #define HARD_QORE_LIST(list, i) get_hard_param<const QoreListNode>(list, i)
307 #define HARD_QORE_HASH(list, i) get_hard_param<const QoreHashNode>(list, i)
310 #define HARD_QORE_REF(list, i) get_hard_param<const ReferenceNode>(list, i)
313 #define HARD_QORE_OBJECT(list, i) const_cast<QoreObject *>(get_hard_param<const QoreObject>(list, i))
316 #define HARD_QORE_OBJ_DATA(vname, Type, list, i, cid, dname, cname, xsink) HARD_QORE_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)
319 #define HARD_QORE_OBJ_OR_NOTHING_DATA(vname, Type, list, i, cid, xsink) HARD_QORE_OR_NOTHING_PARAM(obj_##vname, const QoreObject, list, i); Type* vname = obj_##vname ? reinterpret_cast<Type*>(obj_##vname->getReferencedPrivateData(cid, xsink)) : 0;
const qore_type_t NT_BINARY
type value for BinaryNode
Definition: node_types.h:41
defines string encoding functions in Qore
Definition: QoreEncoding.h:72
#define HARD_QORE_PARAM(name, Type, list, i)
returns a hard typed parameter
Definition: params.h:280
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:41
DLLEXPORT bool getAsBool() const
returns the boolean value of the object
static const ResolvedCallReferenceNode * test_callref_param(const QoreListNode *n, qore_size_t i)
returns a ResolvedCallReferenceNode pointer for the argument position given or 0 if there is no argum...
Definition: params.h:200
DLLEXPORT const QoreEncoding * QCS_DEFAULT
the default encoding for the Qore library
static int get_int_param_with_default(const QoreListNode *n, qore_size_t i, int def)
returns an integer corresponding to the argument given or a default value if there is none ...
Definition: params.h:89
static const ResolvedCallReferenceNode * test_funcref_param(const QoreListNode *n, qore_size_t i)
returns a ResolvedCallReferenceNode pointer for the argument position given or 0 if there is no argum...
Definition: params.h:213
DLLEXPORT double getAsFloat() const
returns the float value of the object
static const QoreHashNode * test_hash_param(const QoreListNode *n, qore_size_t i)
returns a QoreHashNode pointer for the argument position given or 0 if there is no argument there or ...
Definition: params.h:174
const qore_type_t NT_LIST
type value for QoreListNode
Definition: node_types.h:42
DLLEXPORT qore_size_t size() const
returns the number of bytes in the object
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
static T * get_hard_or_nothing_param(const QoreListNode *n, qore_size_t i)
returns the given type for hard typed parameters
Definition: params.h:250
const qore_type_t NT_NOTHING
type value for QoreNothingNode
Definition: node_types.h:34
const qore_type_t NT_OBJECT
type value for QoreObject
Definition: node_types.h:44
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:62
static const DateTimeNode * test_date_param(const QoreListNode *n, qore_size_t i)
returns a DateTimeNode pointer for the argument position given or 0 if there is no argument there or ...
Definition: params.h:161
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:224
const qore_type_t NT_DATE
type value for DateTimeNode
Definition: node_types.h:38
static const QoreEncoding * get_hard_qore_encoding_param(const QoreListNode *n, qore_size_t i)
returns the QoreEncoding corresponding to the string passed or a default encoding ...
Definition: params.h:322
const qore_type_t NT_FUNCREF
type value for AbstractCallReferenceNode
Definition: node_types.h:63
static QoreObject * test_object_param(const QoreListNode *n, qore_size_t i)
returns a QoreObject pointer for the argument position given or 0 if there is no argument there or if...
Definition: params.h:148
static const BinaryNode * test_binary_param(const QoreListNode *n, qore_size_t i)
returns a const BinaryNode pointer for the argument position given or 0 if there is no argument there...
Definition: params.h:122
DLLEXPORT int getAsInt() const
returns the integer value of the object
DLLEXPORT AbstractQoreNode * retrieve_entry(qore_size_t index)
returns the element at "index" (first element is index 0)
DLLEXPORT int64 getAsBigInt() const
returns the 64-bit integer value of the object
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:40
static unsigned num_args(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:38
static bool is_nothing(const AbstractQoreNode *n)
to check if an AbstractQoreNode object is NOTHING
Definition: QoreLib.h:284
static T * get_hard_param(const QoreListNode *n, qore_size_t i)
returns the given type for hard typed parameters
Definition: params.h:257
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:44
DLLEXPORT QoreEncodingManager QEM
the QoreEncodingManager object
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only...
Definition: DateTimeNode.h:36
static bool get_bool_param(const QoreListNode *n, qore_size_t i)
returns a boolean value corresponding to the argument given or false if there is none ...
Definition: params.h:110
parse type: reference to a lvalue expression
Definition: ReferenceNode.h:37
const qore_type_t NT_RUNTIME_CLOSURE
type value for ResolvedCallReferenceNode (QoreClosureNode, QoreObjectClosureNode) ...
Definition: node_types.h:66
const qore_type_t NT_HASH
type value for QoreHashNode
Definition: node_types.h:43
static bool test_nothing_param(const QoreListNode *n, qore_size_t i)
returns true if the arugment position given is NOTHING
Definition: params.h:237
const qore_type_t NT_REFERENCE
type value for ReferenceNode
Definition: node_types.h:56
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'...
static const QoreListNode * test_list_param(const QoreListNode *n, qore_size_t i)
returns a QoreListNode pointer for the argument position given or 0 if there is no argument there or ...
Definition: params.h:187
const qore_type_t NT_STRING
type value for QoreStringNode
Definition: node_types.h:37
DLLEXPORT qore_size_t size() const
returns the number of elements in the list
static const QoreStringNode * test_string_param(const QoreListNode *n, qore_size_t i)
returns a const QoreStringNode pointer for the argument position given or 0 if there is no argument t...
Definition: params.h:135
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:56
static unsigned num_params(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:46
static int64 get_bigint_param(const QoreListNode *n, qore_size_t i)
returns a 64-bit integer corresponding to the argument given or 0 if there is none ...
Definition: params.h:82
DLLLOCAL qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:286
base class for resolved call references
Definition: CallReferenceNode.h:120
static int64 get_bigint_param_with_default(const QoreListNode *n, qore_size_t i, int64 def)
returns a 64-bit integer corresponding to the argument given or a default value if there is none ...
Definition: params.h:96
static const QoreEncoding * get_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:243
static double get_float_param(const QoreListNode *n, qore_size_t i)
returns a float corresponding to the argument given or 0 if there is none
Definition: params.h:103
DLLEXPORT const void * getPtr() const
returns the pointer to the data
static int get_int_param(const QoreListNode *n, qore_size_t i)
returns an integer corresponding to the argument given or 0 if there is none
Definition: params.h:75
static const AbstractQoreNode * get_param(const QoreListNode *n, qore_size_t i)
returns the argument in the position given or 0 if there is none
Definition: params.h:56
DLLEXPORT qore_size_t size() const
returns number of bytes in the string (not including the null pointer)
static qore_type_t get_param_type(const QoreListNode *n, qore_size_t i)
returns the argument type in the position given or 0 if there is none
Definition: params.h:68
holds arbitrary binary data
Definition: BinaryNode.h:33
DLLEXPORT const char * getBuffer() const
returns the string's buffer; this data should not be changed