Qore Programming Language Reference Manual
0.8.11.1
|
Methods in this pseudo-class are available to be executed on any value type (even NOTHING); this is the root class for all pseudo-classes. More...
Public Member Functions | |
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 | sizep () |
Returns True if the type can return a non-zero size (True for containers including binary objects and strings, False for everything else) 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 that would be converted to True according to the rules described in %perl-bool-eval. More... | |
Methods in this pseudo-class are available to be executed on any value type (even NOTHING); this is the root class for all pseudo-classes.
bool <value>::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)
bool <value>::empty | ( | ) |
Returns True; this method will be reimplemented in container types where it may return False.
This pseudo-method will return False in all non-container types; use <value>::val() to check if a generic expression that might not be a container type has a value instead.
bool <value>::intp | ( | ) |
Returns False; this method is reimplemented in other types and will return True if the given expression can be converted to an integer.
AbstractIterator <value>::iterator | ( | ) |
Returns an iterator object for the value; the default iterator object returned is SingleValueIterator.
int <value>::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.
int <value>::size | ( | ) |
Returns zero; this method will be reimplemented in container types where it may return a non-zero value.
This pseudo-method will return 0 in all non-container types; use <value>::val() to check if a generic expression that might not be a container type has a value instead.
bool <value>::sizep | ( | ) |
Returns True if the type can return a non-zero size (True for containers including binary objects and strings, False for everything else)
bool <value>::strp | ( | ) |
Returns False; this method is reimplemented in other types and will return True if the given expression can be converted to a string.
bool <value>::toBool | ( | ) |
Returns the boolean representation of the value; the default is False.
float <value>::toFloat | ( | ) |
Returns the floating-point representation of the value; the default is 0.0.
int <value>::toInt | ( | ) |
Returns the integer representation of the value; the default is 0.
Use <value>::intp() to determine if the current value can be converted to an integer
number <value>::toNumber | ( | ) |
Returns the arbitrary-precision numeric representation of the value; the default is 0.
string <value>::toString | ( | ) |
Returns the string representation of the value; the default is an empty string.
Use <value>::strp() to determine if the current value can be converted to a string
string <value>::type | ( | ) |
Returns the string type for the value.
int <value>::typeCode | ( | ) |
Returns the type code for the value.
This method is recommended over <value>::type() or the type(any) or typename(any) functions for comparing data types as it is much faster and more efficient than the other alternatives (which work with string values instead of integer codes).
bool <value>::val | ( | ) |
Returns False; this method is reimplemented in other types and will return True if the given expression has a value that would be converted to True according to the rules described in %perl-bool-eval.
This pseudo-method can be used to mimic perl's boolean evaluation when %strict-bool-eval is enabled; the return value of this method is the same as that of any value when evaluated in a boolean context when %perl-bool-eval is enabled (the default).
Prior to version 0.8.6, Qore implemented strict mathematical boolean evaluation by default (where any value must evaluate to a non-zero integer or floating-point value to be True), so this pseudo-method was implemented to provide the same functionality in qore. Note that as of qore 0.8.6, %perl-bool-eval is the default.