All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
params.h File Reference

### (6de6cc3b438610bf03b2bec44a3d7c61f90e3165)

`#include <qore/AbstractQoreNode.h>`
Include dependency graph for params.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | HARD_QORE_BINARY(list, i) get_hard_param<const BinaryNode>(list, i)
| returns a const BinaryNode* from a hard typed binary param
#define | HARD_QORE_BOOL(list, i) get_hard_param<const QoreBoolNode>(list, i)->getValue()
| returns a bool from a hard typed bool param
#define | HARD_QORE_DATE(list, i) get_hard_param<const DateTimeNode>(list, i)
| returns a const DateTimeNode* from a hard typed date param
#define | HARD_QORE_FLOAT(list, i) get_hard_param<const QoreFloatNode>(list, i)->f
| returns a double from a hard typed float param
#define | HARD_QORE_HASH(list, i) get_hard_param<const QoreHashNode>(list, i)
| returns a const QoreHashNode* from a hard typed hash param
#define | HARD_QORE_INT(list, i) get_hard_param<const QoreBigIntNode>(list, i)->val
| returns an int64 from a hard typed int param
#define | HARD_QORE_LIST(list, i) get_hard_param<const QoreListNode>(list, i)
| returns a const QoreListNode* from a hard typed list param
#define | HARD_QORE_NUMBER(list, i) get_hard_param<const QoreNumberNode>(list, i)
| returns a const QoreNumberNode* from a hard typed number or softnumber param
#define | HARD_QORE_OBJECT(list, i) const_cast<QoreObject*>(get_hard_param<const QoreObject>(list, i))
| returns a QoreObject* from a hard typed object param
#define | HARD_QORE_OR_NOTHING_PARAM(name, Type, list, i) Type* name = get_hard_or_nothing_param<Type>(list, i)
| returns a hard typed parameter
#define | HARD_QORE_PARAM(name, Type, list, i) Type* name = get_hard_param<Type>(list, i)
| returns a hard typed parameter
#define | HARD_QORE_REF(list, i) get_hard_param<const ReferenceNode>(list, i)
| returns a const QoreHashNode* from a hard typed hash param
#define | HARD_QORE_STRING(list, i) get_hard_param<const QoreStringNode>(list, i)
| returns a const QoreStringNode* from a hard typed string param
#define | HARD_QORE_VALUE_BINARY(list, i) get_hard_value_param(list, i).get<const BinaryNode>()
| returns a const BinaryNode* from a hard typed binary param
#define | HARD_QORE_VALUE_BOOL(list, i) get_hard_value_param(list, i).getAsBool()
| returns a bool from a hard typed bool param
#define | HARD_QORE_VALUE_DATE(list, i) get_hard_value_param(list, i).get<const DateTimeNode>()
| returns a const DateTimeNode* from a hard typed date param
#define | HARD_QORE_VALUE_FLOAT(list, i) get_hard_value_param(list, i).getAsFloat()
| returns a double from a hard typed float param
#define | HARD_QORE_VALUE_HASH(list, i) get_hard_value_param(list, i).get<const QoreHashNode>()
| returns a const QoreHashNode* from a hard typed hash param
#define | HARD_QORE_VALUE_INT(list, i) get_hard_value_param(list, i).getAsBigInt()
| returns an int64 from a hard typed int param
#define | HARD_QORE_VALUE_LIST(list, i) get_hard_value_param(list, i).get<const QoreListNode>()
| returns a const QoreListNode* from a hard typed list param
#define | HARD_QORE_VALUE_NUMBER(list, i) get_hard_value_param(list, i).get<const QoreNumberNode>()
| returns a const QoreNumberNode* from a hard typed number or softnumber param

#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)

| sets up an object pointer
#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;
| sets up an object pointer
#define | HARD_QORE_VALUE_OBJECT(list, i) const_cast<QoreObject*>(get_hard_value_param(list, i).get<const QoreObject>())
| returns a QoreObject* from a hard typed object param
#define | HARD_QORE_VALUE_OR_NOTHING_PARAM(name, Type, list, i) Type* name = get_hard_value_or_nothing_param<Type>(list, i)
| returns a hard typed parameter
#define | HARD_QORE_VALUE_PARAM(name, Type, list, i) Type* name = get_hard_value_param(list, i).get<Type>()
| returns a hard typed parameter
#define | HARD_QORE_VALUE_REF(list, i) get_hard_value_param(list, i).get<const ReferenceNode>()
| returns a const QoreHashNode* from a hard typed hash param
#define | HARD_QORE_VALUE_STRING(list, i) get_hard_value_param(list, i).get<const QoreStringNode>()
| returns a const QoreStringNode* from a hard typed string param

#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)

| destructively sets up an object pointer; caller owns the pointer

## Functions

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
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
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
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
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
template<typename T >
static T * | get_hard_or_nothing_param (const QoreListNode *n, qore_size_t i)
| returns the given type for hard typed parameters
template<typename T >
static T * | get_hard_param (const QoreListNode *n, qore_size_t i)
| returns the given type for hard typed parameters
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
template<typename T >
static T * | get_hard_value_or_nothing_param (const QoreValueList *n, qore_size_t i)
| returns the given type for hard typed parameters
static QoreValue | get_hard_value_param (const QoreValueList *n, qore_size_t i)
| returns the given type for hard typed parameters
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
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
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 More...
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 More...
static QoreValue | get_param_value (const QoreValueList *n, qore_size_t i)
| returns the argument in the position given or 0 if there is none More...
static const QoreEncoding * | get_value_encoding_param (const QoreValueList *n, qore_size_t i, const QoreEncoding *def=QCS_DEFAULT)
| returns the QoreEncoding corresponding to the string passed or a default encoding
static unsigned | num_args (const QoreListNode *n)
| returns the number of arguments passed to the function More...
static unsigned | num_args (const QoreValueList *n)
| returns the number of arguments passed to the function More...
static unsigned | num_params (const QoreListNode *n)
| returns the number of arguments passed to the function More...
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 or if the argument is not a BinaryNode More...
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 argument there or if the argument is not a ResolvedCallReferenceNode More...
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 if the argument is not a DateTimeNode More...
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 argument there or if the argument is not a ResolvedCallReferenceNode More...
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 if the argument is not a QoreHashNode More...
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 if the argument is not a QoreListNode More...
static bool | test_nothing_param (const QoreListNode *n, qore_size_t i)
| returns true if the arugment position given is NOTHING More...
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 the argument is not a QoreObject More...
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 if the argument is not a ReferenceNode More...
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 there or if the argument is not a QoreStringNode More...

## Detailed Description

Contains inline functions for accessing function and class method arguments.

## Function Documentation

static const AbstractQoreNode* get_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns the argument in the position given or 0 if there is none

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  the argument in the position given or 0 if there is none

References is_nothing(), and QoreListNode::retrieve_entry().

static qore_type_t get_param_type | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns the argument type in the position given or 0 if there is none

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  the argument type in the position given or 0 if there is none

References AbstractQoreNode::getType(), NT_NOTHING, and QoreListNode::retrieve_entry().

static QoreValue get_param_value | ( | const QoreValueList * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns the argument in the position given or 0 if there is none

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  the argument in the position given or 0 if there is none

References QoreValueList::retrieveEntry().

static unsigned num_args | ( | const QoreListNode * | n | ) |

inline static

returns the number of arguments passed to the function

Parameters

  n | a pointer to the argument list

Returns
  the number of arguments passed to the function

References QoreListNode::size().

static unsigned num_args | ( | const QoreValueList * | n | ) |

inline static

returns the number of arguments passed to the function

Parameters

  n | a pointer to the argument list

Returns
  the number of arguments passed to the function

References QoreValueList::size().

static unsigned num_params | ( | const QoreListNode * | n | ) |

inline static

returns the number of arguments passed to the function

Parameters

  n | a pointer to the argument list

Returns
  the number of arguments passed to the function

References QoreListNode::size().

static const BinaryNode* test_binary_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a const BinaryNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a BinaryNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a const BinaryNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a BinaryNode

References AbstractQoreNode::getType(), NT_BINARY, and QoreListNode::retrieve_entry().

static const ResolvedCallReferenceNode* test_callref_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a ResolvedCallReferenceNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a ResolvedCallReferenceNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a ResolvedCallReferenceNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a ResolvedCallReferenceNode

References AbstractQoreNode::getType(), NT_FUNCREF, NT_RUNTIME_CLOSURE, and QoreListNode::retrieve_entry().

Referenced by test_funcref_param().

static const DateTimeNode* test_date_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a DateTimeNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a DateTimeNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a DateTimeNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a DateTimeNode

References AbstractQoreNode::getType(), NT_DATE, and QoreListNode::retrieve_entry().

static const ResolvedCallReferenceNode* test_funcref_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a ResolvedCallReferenceNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a ResolvedCallReferenceNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a ResolvedCallReferenceNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a ResolvedCallReferenceNode

References test_callref_param().

static const QoreHashNode* test_hash_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a QoreHashNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreHashNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a QoreHashNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreHashNode

References AbstractQoreNode::getType(), NT_HASH, and QoreListNode::retrieve_entry().

static const QoreListNode* test_list_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a QoreListNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreListNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a QoreListNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreListNode

References AbstractQoreNode::getType(), NT_LIST, and QoreListNode::retrieve_entry().

static bool test_nothing_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns true if the arugment position given is NOTHING

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  true if the arugment position given is NOTHING

References is_nothing(), and QoreListNode::retrieve_entry().

static QoreObject* test_object_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a QoreObject pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreObject

QoreObjects are returned not as "const" because they are unique and can always be manipulated

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a QoreObject pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreObject

References AbstractQoreNode::getType(), NT_OBJECT, and QoreListNode::retrieve_entry().

static const ReferenceNode* test_reference_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a ReferenceNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a ReferenceNode

Note that this will also return a value for a closure; this is a synonym for test_funcref_param

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a ReferenceNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a ReferenceNode

References AbstractQoreNode::getType(), NT_REFERENCE, and QoreListNode::retrieve_entry().

static const QoreStringNode* test_string_param | ( | const QoreListNode * | n,
|  | qore_size_t | i
| ) |  |

inline static

returns a const QoreStringNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreStringNode

Parameters

  n | a pointer to the argument list
  i | the offset in the list to test (first element is offset 0)

Returns
  a const QoreStringNode pointer for the argument position given or 0 if there is no argument there or if the argument is not a QoreStringNode

References AbstractQoreNode::getType(), NT_STRING, and QoreListNode::retrieve_entry().

Referenced by get_encoding_param().