Qore SqlUtil Module Reference: SqlUtil::AbstractHashContainer Class Reference

Qore SqlUtil Module Reference 1.2

- 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
SqlUtil::AbstractHashContainer Class Referenceabstract

abstract container class that throws an exception if an unknown key is accessed More...

Inheritance diagram for SqlUtil::AbstractHashContainer:
[legend]

## Public Member Functions
| clear ()
| purges the contained data More...
| constructor (*hash nh)
| creates the object with the hash argument passed
| copy (AbstractHashContainer old)
| creates a "deep copy" of the object
bool | empty ()
| returns True if the container is empty, False if not
*string | firstKey ()
| Returns the first key name in the contained hash or NOTHING if the contained hash has no keys. More...
abstract string | getElementName ()
| must return the name of the contained element
*hash | getHash ()
| returns the hash contained by this object
bool | hasKey (string k)
| Returns True if the key exists in the contained hash (may or may not be assigned a value), False if not. More...
bool | hasKeyValue (string k)
| Returns True if the key exists in the contained hash and is assigned a value, False if not. More...
Qore::AbstractIterator | iterator ()
| Returns a HashIterator object for the contained hash. More...
Qore::AbstractIterator | keyIterator ()
| Returns a HashKeyIterator object for the contained hash. More...
list | keys ()
| Returns a list of key names of the contained hash. More...
*string | lastKey ()
| Returns the last key name in the contained hash or NOTHING if the contained hash has no keys. More...
bool | matchKeys (hash h1)
| returns True if the hash argument has the same keys (in any order), False if not More...
bool | matchKeys (list l)
| returns True if the list argument has the same list of key strings as the keys in the object (in any order), False if not More...
bool | matchKeys (AbstractHashContainer c)
| returns True if the container argument has the same keys (in any order), False if not More...
any | memberGate (string k)
| returns the value of the given key in the contained hash if it exists, otherwise throws a `KEY-ERROR` exception More...
Qore::AbstractIterator | pairIterator ()
| Returns a HashPairIterator object for the contained hash. More...
bool | partialMatchKeys (hash h1)
| returns True if the hash argument has at least the same keys (in any order, can have more keys), False if not More...
bool | partialMatchKeys (list l)
| returns True if the list argument has at least the same keys (in any order, can have more keys), False if not More...
bool | partialMatchKeys (AbstractHashContainer c)
| returns True if the container argument has at least the same keys (in any order, can have more keys), False if not More...
| renameKey (string old_name, string new_name)
| renames the given key; maintains the key order
int | size ()
| Returns the number of keys in the contained hash. More...
abstract any | take (string k)
| removes the given key from the contained hash and returns the value
bool | val ()
| Returns False if the contained hash has no keys, True if it does. More...
list | values ()
| Returns a list of values of the contained hash. More...

## Detailed Description

abstract container class that throws an exception if an unknown key is accessed

## Member Function Documentation

SqlUtil::AbstractHashContainer::clear | ( |  | ) |

purges the contained data

Example:
  $c.clear();

*string SqlUtil::AbstractHashContainer::firstKey | ( |  | ) |

Returns the first key name in the contained hash or NOTHING if the contained hash has no keys.

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

Returns
  the first key name in the contained hash or NOTHING if the contained hash has no keys

See Also
  lastKey()

bool SqlUtil::AbstractHashContainer::hasKey | ( | string | k | ) |

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

Example:
  my bool $b = $h.hasKey($key);

Parameters

  k | the key name to check

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

bool SqlUtil::AbstractHashContainer::hasKeyValue | ( | string | k | ) |

Returns True if the key exists in the contained hash and is assigned a value, False if not.

Example:
  my bool $b = $h.hasKeyValue($key);

Parameters

  k | the key name to check

Returns
  True if the key exists in the contained hash and is assigned a value, False if not

Qore::AbstractIterator SqlUtil::AbstractHashContainer::iterator | ( |  | ) |

Returns a HashIterator object for the contained hash.

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

Returns
  a HashIterator object for the contained hash

Qore::AbstractIterator SqlUtil::AbstractHashContainer::keyIterator | ( |  | ) |

Returns a HashKeyIterator object for the contained hash.

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

Returns
  a HashKeyIterator object for the contained hash

list SqlUtil::AbstractHashContainer::keys | ( |  | ) |

Returns a list of key names of the contained hash.

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

Returns
  a list of key names of the contained hash

*string SqlUtil::AbstractHashContainer::lastKey | ( |  | ) |

Returns the last key name in the contained hash or NOTHING if the contained hash has no keys.

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

Returns
  the last key name in the contained hash or NOTHING if the contained hash has no keys

See Also
  firstKey()

bool SqlUtil::AbstractHashContainer::matchKeys | ( | hash | h1 | ) |

returns True if the hash argument has the same keys (in any order), False if not

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

Parameters

  h1 | the hash to compare

Returns
  True if the hash argument has the same keys (in any order), False if not

bool SqlUtil::AbstractHashContainer::matchKeys | ( | list | l | ) |

returns True if the list argument has the same list of key strings as the keys in the object (in any order), False if not

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

Parameters

  l | the hash to compare

Returns
  True if the list argument has the same list of key strings as the keys in the object (in any order), False if not

bool SqlUtil::AbstractHashContainer::matchKeys | ( | AbstractHashContainer | c | ) |

returns True if the container argument has the same keys (in any order), False if not

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

Parameters

  c | the container to compare

Returns
  True if the container argument has the same keys (in any order), False if not

any SqlUtil::AbstractHashContainer::memberGate | ( | string | k | ) |

returns the value of the given key in the contained hash if it exists, otherwise throws a `KEY-ERROR` exception

Example:
  my any $v = $c.name;

Parameters

  k | the name of the key to access

Returns
  the value of the given key in the contained hash if it exists

Exceptions

  KEY-ERROR | the given key does not exist in the contained hash

Note
  this method is called automatically when an unknown or inaccessible member name is accessed from outside the class

See Also
  memberGate_methods

Qore::AbstractIterator SqlUtil::AbstractHashContainer::pairIterator | ( |  | ) |

Returns a HashPairIterator object for the contained hash.

Example:
  map printf("+ %s: %y\n", $1.key, $1.value), $h.pairIterator();

Returns
  a HashPairIterator object for the contained hash

bool SqlUtil::AbstractHashContainer::partialMatchKeys | ( | hash | h1 | ) |

returns True if the hash argument has at least the same keys (in any order, can have more keys), False if not

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

Parameters

  h1 | the hash to compare

Returns
  True if the hash argument has at least the same keys (in any order, can have more keys), False if not

bool SqlUtil::AbstractHashContainer::partialMatchKeys | ( | list | l | ) |

returns True if the list argument has at least the same keys (in any order, can have more keys), False if not

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

Parameters

  l | the list of strings to compare

Returns
  True if the list argument has at least the same keys (in any order, can have more keys), False if not

bool SqlUtil::AbstractHashContainer::partialMatchKeys | ( | AbstractHashContainer | c | ) |

returns True if the container argument has at least the same keys (in any order, can have more keys), False if not

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

Parameters

  c | the container to compare

Returns
  True if the container argument has at least the same keys (in any order, can have more keys), False if not

int SqlUtil::AbstractHashContainer::size | ( |  | ) |

Returns the number of keys in the contained hash.

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

Returns
  the number of keys in the contained hash

bool SqlUtil::AbstractHashContainer::val | ( |  | ) |

Returns False if the contained hash has no keys, True if it does.

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

The opposite of empty()

Returns
  False if the contained hash has no keys, True if it does

list SqlUtil::AbstractHashContainer::values | ( |  | ) |

Returns a list of values of the contained hash.

Example:
  my list $l = $h.values();

Returns
  a list of values of the contained hash