Qore Programming Language Reference Manual 0.8.8

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
<callref> Class Reference

Methods in this pseudo-class can be executed on call references. More...

Inheritance diagram for Qore::<callref>:
[legend]

## Public Member Functions
bool | callp ()
| Returns True because this is a callable type. More...
any | exec (...)
| Evaluates the code with the arguments given and returns the result. More...
int | typeCode ()
| Returns Qore::NT_CALLREF. More...
bool | val ()
| Returns True. More...
Public Member Functions inherited from <value>
bool | callp ()
| Returns False; this method is reimplemented in other types and will return True if the given expression is a callable value (ie closures or call references) More...
bool | empty ()
| Returns True; this method will be reimplemented in container types where it may return False. More...
bool | intp ()
| Returns False; this method is reimplemented in other types and will return True if the given expression can be converted to an integer. More...
AbstractIterator | iterator ()
| Returns an iterator object for the value; the default iterator object returned is SingleValueIterator. More...
int | lsize ()
| Returns 1; the return value of this method should give the list size of the value, which is normally 1 for non-lists (except for NOTHING where the size will be 0) and the number of the elements in the list for lists; this method will be reimplemented in other types where it may return other values. More...
int | size ()
| Returns zero; this method will be reimplemented in container types where it may return a non-zero value. More...
bool | strp ()
| Returns False; this method is reimplemented in other types and will return True if the given expression can be converted to a string. More...
bool | toBool ()
| Returns the boolean representation of the value; the default is False. More...
float | toFloat ()
| Returns the floating-point representation of the value; the default is 0.0. More...
int | toInt ()
| Returns the integer representation of the value; the default is 0. More...
number | toNumber ()
| Returns the arbitrary-precision numeric representation of the value; the default is 0. More...
string | toString ()
| Returns the string representation of the value; the default is an empty string. More...
string | type ()
| Returns the string type for the value. More...
int | typeCode ()
| Returns the type code for the value. More...
bool | val ()
| Returns False; this method is reimplemented in other types and will return True if the given expression has a value. More...

## Detailed Description

Methods in this pseudo-class can be executed on call references.

## Member Function Documentation

bool <callref>::callp | ( |  | ) |

Returns True because this is a callable type.

Code Flags:
  CONSTANT

Example:
  if ($n.callp())
  printf("the result of calling the value: %y\n", $n());

Returns
  True because this is a callable type

any <callref>::exec | ( |  | ... | ) |

Evaluates the code with the arguments given and returns the result.

Parameters

  ... | the arguments to the code to be called

Returns
  the return value of the code called

int <callref>::typeCode | ( |  | ) |

Returns Qore::NT_CALLREF.

Code Flags:
  CONSTANT

Example:
  switch ($c.typeCode()) {
  case NT_CALLREF:
  printf("%y: is a call reference\n", $c);
  break;
  }

Returns
  Qore::NT_CALLREF

bool <callref>::val | ( |  | ) |

Returns True.

Code Flags:
  CONSTANT

Example:
  my bool $b = $c.val();

Returns
  True

See Also
  - %perl-bool-eval
  - %strict-bool-eval