Loading...
Searching...
No Matches
<nothing> Class Reference

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

`#include <Pseudo_QC_Nothing.dox.h>`

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

## Public Member Functions

SingleValueIterator | contextIterator ()
| Returns an empty SingleValueIterator object.
nothing | firstKey ()
| Returns NOTHING.
nothing | firstValue ()
| Returns NOTHING.
bool | hasKey (softstring key)
| Returns True if the key exists in the hash (may or may not be assigned a value), False if not.
bool | hasKeyValue (softstring key)
| Returns True if the key exists and is assigned to a value, False if not.
SingleValueIterator | keyIterator ()
| Returns an empty SingleValueIterator object.
list< string > | keys ()
| Returns an empty list.
nothing | lastKey ()
| Returns NOTHING.
nothing | lastValue ()
| Returns NOTHING.
int | lsize ()
| Returns 0.
SingleValueIterator | pairIterator ()
| Returns an empty SingleValueIterator object.
SingleValueIterator | rangeIterator ()
| Returns an empty SingleValueIterator object.
int | typeCode ()
| Returns Qore::NT_NOTHING.
list< auto > | values ()
| Returns an empty list.
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 | complexType ()
| returns True if the value has a complex type, False if not
bool | empty ()
| Returns True; this method will be reimplemented in container types where it may return False.
string | fullType (*bool with_namespaces)
| returns the full type name which differs from the simple type name in case of complex types and objects
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 | 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 | 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.
number | toNumber ()
| Returns the arbitrary-precision numeric 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 non-empty value.

## Detailed Description

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

## Member Function Documentation

## contextIterator()

SingleValueIterator <nothing>::contextIterator | ( |  | ) |

Returns an empty SingleValueIterator object.

Returns
  an empty SingleValueIterator object

Code Flags:
  CONSTANT

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

See also
  <hash>::contextIterator()

Since
  Qore 0.8.6.2

## firstKey()

nothing <nothing>::firstKey | ( |  | ) |

Returns NOTHING.

Returns
  NOTHING

Code Flags:
  CONSTANT

Example:
  *hash h = hash_or_nothing();
  *string n = h.firstKey();

See also
  <hash>::firstKey()

Since
  Qore 0.8.7

## firstValue()

nothing <nothing>::firstValue | ( |  | ) |

Returns NOTHING.

Returns
  NOTHING

Code Flags:
  CONSTANT

Example:
  *hash h = hash_or_nothing();
  auto n = h.firstValue();

See also
  <hash>::firstValue()

Since
  Qore 0.8.7

## hasKey()

bool <nothing>::hasKey | ( | softstring | key | ) |

Returns True if the key exists in the hash (may or may not be assigned a value), False if not.

Code Flags:
  CONSTANT

Parameters

  key | the key name to check

Returns
  True if the key exists in the hash (may or may not be assigned a value), False if not

Example:
  *hash h = hash_or_nothing();
  bool b = h.hasKey(key);

See also
  <hash>::hasKey(softstring)

Since
  Qore 0.8.7

## hasKeyValue()

bool <nothing>::hasKeyValue | ( | softstring | key | ) |

Returns True if the key exists and is assigned to a value, False if not.

Code Flags:
  CONSTANT

Parameters

  key | the key name to check

Returns
  True if the key exists and is assigned to a value, False if not

Example:
  *hash h = hash_or_nothing();
  bool b = h.hasKeyValue(key);

See also
  <hash>::hasKeyValue(softstring)

Since
  Qore 0.8.7

## keyIterator()

SingleValueIterator <nothing>::keyIterator | ( |  | ) |

Returns an empty SingleValueIterator object.

Returns
  an empty SingleValueIterator object

Code Flags:
  CONSTANT

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

See also
  <hash>::keyIterator()

Since
  Qore 0.8.6.2

## keys()

list< string > <nothing>::keys | ( |  | ) |

Returns an empty list.

Returns
  an empty list

Code Flags:
  CONSTANT

Example:
  *hash h = hash_or_nothing();
  list<string> l = h.keys();

See also
  <hash>::keys()

Since
  Qore 0.8.7

## lastKey()

nothing <nothing>::lastKey | ( |  | ) |

Returns NOTHING.

Returns
  NOTHING

Code Flags:
  CONSTANT

Example:
  *hash h = hash_or_nothing();
  *string n = h.firstKey();

See also
  <hash>::firstKey()

Since
  Qore 0.8.7

## lastValue()

nothing <nothing>::lastValue | ( |  | ) |

Returns NOTHING.

Returns
  NOTHING

Code Flags:
  CONSTANT

Example:
  *hash h = hash_or_nothing();
  auto n = h.firstValue();

See also
  <hash>::lastValue()

Since
  Qore 0.8.7

## lsize()

int <nothing>::lsize | ( |  | ) |

Returns 0.

Returns
  0

Code Flags:
  CONSTANT

Example:
  printf("iterating %d element%s\n", val.lsize(), val.lsize() == 1 ? "" : "s");
  foreach any element in (val) {
  do_something(element);
  }

## pairIterator()

SingleValueIterator <nothing>::pairIterator | ( |  | ) |

Returns an empty SingleValueIterator object.

Returns
  an empty SingleValueIterator object

Code Flags:
  CONSTANT

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

Since
  Qore 0.8.6.2

## rangeIterator()

SingleValueIterator <nothing>::rangeIterator | ( |  | ) |

Returns an empty SingleValueIterator object.

Returns
  an empty SingleValueIterator object

Code Flags:
  CONSTANT

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

See also
  <list>::rangeIterator()

Since
  Qore 0.8.8

## typeCode()

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

Returns Qore::NT_NOTHING.

Returns
  Qore::NT_NOTHING

Code Flags:
  CONSTANT

Example:
  switch (n.typeCode()) {
  case NT_NOTHING:
  printf("%y: no value\n", n);
  break;
  }

## values()

list< auto > <nothing>::values | ( |  | ) |

Returns an empty list.

Returns
  an empty list

Code Flags:
  CONSTANT

Example:
  *hash h = hash_or_nothing();
  list<auto> l = h.values();

See also
  <hash>::values()

Since
  Qore 0.8.7