All Classes Namespaces Functions Variables Groups Pages
<object> Class Reference

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

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

## Public Member Functions

string | className ()
| Returns the class name of the object.
bool | empty ()
| Returns True if the object has no public or private members, False if it does.
*string | firstKey ()
| Returns the first member name in the object or NOTHING if the object has no members; if called from outside the object, the first public member name is returned (if any)
bool | isSystem ()
| Returns True if the object is a system object (ie a constant object like stdin, etc), False if not.
AbstractIterator | iterator ()
| Returns an ObjectIterator object for the hash.
ObjectKeyIterator | keyIterator ()
| Returns a ObjectKeyIterator object for the hash.
list | keys ()
| Returns a list of member names of the object; if called from outside the object, only public members are returned.
*string | lastKey ()
| Returns the last member name in the object or NOTHING if the object has no members; if called from outside the object, the last public member name is returned (if any)
ObjectPairIterator | pairIterator ()
| Returns a ObjectPairIterator object for the hash.
int | size ()
| Returns the number of members in the object, public and private.
int | typeCode ()
| Returns Qore::NT_OBJECT.
bool | val ()
| Returns False if the object has no public or private members, True if it does.
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)
bool | empty ()
| Returns True; this method will be reimplemented in container types where it may return False.
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.
AbstractIterator | iterator ()
| Returns an iterator object for the value; the default iterator object returned is SingleValueIterator.
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.
int | size ()
| Returns zero; this method will be reimplemented in container types where it may return a non-zero value.
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.
bool | toBool ()
| Returns the boolean representation of the value; the default is False.
float | toFloat ()
| Returns the floating-point representation of the value; the default is 0.0.
int | toInt ()
| Returns the integer representation of the value; the default is 0.
string | toString ()
| Returns the string representation of the value; the default is an empty string.
string | type ()
| Returns the string type for the value.
int | typeCode ()
| Returns the type code for the value.
bool | val ()
| Returns False; this method is reimplemented in other types and will return True if the given expression has a value.

## Detailed Description

Methods in this pseudo-class can be executed on objects.

## Member Function Documentation

string <object>::className | ( |  | ) |

Returns the class name of the object.

Returns
  the class name of the object

Code Flags:
  CONSTANT

Example:
  my string $cn = $o.className();

bool <object>::empty | ( |  | ) |

Returns True if the object has no public or private members, False if it does.

The opposite of <object>::val()

Returns
  True if the object has no public or private members, False if it does

Code Flags:
  RET_VALUE_ONLY

Example:
  my bool $b = $o.empty();

*string <object>::firstKey | ( |  | ) |

Returns the first member name in the object or NOTHING if the object has no members; if called from outside the object, the first public member name is returned (if any)

Returns
  the first member name in the object or NOTHING if the object has no members; if called from outside the object, the first public member name is returned (if any)

Code Flags:
  RET_VALUE_ONLY

Example:
  my *string $n = $o.firstKey();

See Also
  <object>::lastKey()

bool <object>::isSystem | ( |  | ) |

Returns True if the object is a system object (ie a constant object like stdin, etc), False if not.

Returns
  True if the object is a system object (ie a constant object like stdin, etc), False if not

Code Flags:
  CONSTANT

Example:
  my bool $b = $i.isSystem();

AbstractIterator <object>::iterator | ( |  | ) |

Returns an ObjectIterator object for the hash.

Returns
  an ObjectIterator object for the hash

Code Flags:
  CONSTANT

Example:
  map printf("+ %y\n", $1), $obj.iterator();

Since
  Qore 0.8.6

ObjectKeyIterator <object>::keyIterator | ( |  | ) |

Returns a ObjectKeyIterator object for the hash.

Returns
  a ObjectKeyIterator object for the hash

Code Flags:
  CONSTANT

Example:
  map printf("+ %s\n", $1), $obj.keyIterator();

Since
  Qore 0.8.6.2

list <object>::keys | ( |  | ) |

Returns a list of member names of the object; if called from outside the object, only public members are returned.

Returns
  a list of member names of the object; if called from outside the object, only public members are returned

Code Flags:
  RET_VALUE_ONLY

Example:
  my list $l = $o.keys();

*string <object>::lastKey | ( |  | ) |

Returns the last member name in the object or NOTHING if the object has no members; if called from outside the object, the last public member name is returned (if any)

Returns
  the last member name in the object or NOTHING if the object has no members; if called from outside the object, the last public member name is returned (if any)

Code Flags:
  RET_VALUE_ONLY

Example:
  my *string $n = $o.lastKey();

See Also
  <object>::firstKey()

ObjectPairIterator <object>::pairIterator | ( |  | ) |

Returns a ObjectPairIterator object for the hash.

Returns
  a ObjectPairIterator object for the hash

Code Flags:
  CONSTANT

Example:
  map printf("+ %s\n", $1), $obj.pairIterator();

Since
  Qore 0.8.6.2

int <object>::size | ( |  | ) |

Returns the number of members in the object, public and private.

Returns
  the number of members in the object, public and private

Code Flags:
  RET_VALUE_ONLY

Example:
  my int $num = $o.size();

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

Returns Qore::NT_OBJECT.

Returns
  Qore::NT_OBJECT

Code Flags:
  CONSTANT

Example:
  switch ($o.typeCode()) {
  case Qore::NT_OBJECT:
  printf("%y: is an object\n", $o);
  break;
  }

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

Returns False if the object has no public or private members, True if it does.

The opposite of <object>::empty()

Returns
  False if the object has no public or private members, True if it does

Code Flags:
  RET_VALUE_ONLY

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

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