Qore Programming Language 0.8.8

- Main Page
- Related Pages
- Modules
- Classes
- Files

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

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
HashAssignmentHelper Class Reference

use this class to make assignments to hash keys from a pointer to the key value More...

`#include <QoreHashNode.h>`

## Public Member Functions
DLLLOCAL | HashAssignmentHelper (QoreHashNode &n_h, const char *key, bool must_already_exist=false)
| constructor taking a const char* More...
DLLLOCAL | HashAssignmentHelper (QoreHashNode &n_h, const std::string &key, bool must_already_exist=false)
| constructor taking a const std::string& More...
DLLLOCAL | HashAssignmentHelper (ExceptionSink *xsink, QoreHashNode &n_h, const QoreString &key, bool must_already_exist=false)
| constructor taking a const QoreString& More...
DLLLOCAL | HashAssignmentHelper (ExceptionSink *xsink, QoreHashNode &n_h, const QoreString *key, bool must_already_exist=false)
| constructor taking a const QoreString& More...
DLLLOCAL | HashAssignmentHelper (HashIterator &hi)
| constructor taking a HashIterator& More...
DLLLOCAL | ~HashAssignmentHelper ()
| destroys the object and does post processing on the new value
DLLLOCAL void | assign (AbstractQoreNode *v, ExceptionSink *xsink)
| assigns a value to the hash key, dereferences any old value, assumes that the value is already referenced for the assignment More...
DLLLOCAL | operator bool () const
| returns true if the object is holding a valid pointer, false if not More...
DLLLOCAL AbstractQoreNode * | operator* () const
| returns the current value of the hash key; the pointer returned is still owned by the hash More...
DLLLOCAL AbstractQoreNode * | swap (AbstractQoreNode *v, ExceptionSink *xsink)
| swaps the current value with the new value of the hash key, assumes that the new value is already referenced for the assignment; returns the old value More...

## Protected Attributes
class hash_assignment_priv * | priv
| private implementation

## Detailed Description

use this class to make assignments to hash keys from a pointer to the key value

## Constructor & Destructor Documentation

DLLLOCAL HashAssignmentHelper::HashAssignmentHelper | ( | QoreHashNode & | n_h,
|  | const char * | key,
|  | bool | must_already_exist = `false`
| ) |  |

constructor taking a const char*

Parameters

  n_h | the hash to use
  key | the key to assign
  must_already_exist | if true, then this constructor will only succeed if the key already exists

DLLLOCAL HashAssignmentHelper::HashAssignmentHelper | ( | QoreHashNode & | n_h,
|  | const std::string & | key,
|  | bool | must_already_exist = `false`
| ) |  |

constructor taking a const std::string&

Parameters

  n_h | the hash to use
  key | the key to assign
  must_already_exist | if true, then this constructor will only succeed if the key already exists

DLLLOCAL HashAssignmentHelper::HashAssignmentHelper | ( | ExceptionSink * | xsink,
|  | QoreHashNode & | n_h,
|  | const QoreString & | key,
|  | bool | must_already_exist = `false`
| ) |  |

constructor taking a const QoreString&

this constructor may raise a Qore-language exception if the key argument cannot be successfully converted to the default encoding, in which case no further functions should be called on the object

Parameters

  xsink | the container object for Qore-language exceptions, in case one is thrown trying to covert the key encoding to the default encoding
  n_h | the hash to use
  key | the key to assign
  must_already_exist | if true, then this constructor will only succeed if the key already exists

DLLLOCAL HashAssignmentHelper::HashAssignmentHelper | ( | ExceptionSink * | xsink,
|  | QoreHashNode & | n_h,
|  | const QoreString * | key,
|  | bool | must_already_exist = `false`
| ) |  |

constructor taking a const QoreString&

this constructor may raise a Qore-language exception if the key argument cannot be successfully converted to the default encoding, in which case no further functions should be called on the object

Parameters

  xsink | the container object for Qore-language exceptions, in case one is thrown trying to covert the key encoding to the default encoding
  n_h | the hash to use
  key | the key to assign
  must_already_exist | if true, then this constructor will only succeed if the key already exists

DLLLOCAL HashAssignmentHelper::HashAssignmentHelper | ( | HashIterator & | hi | ) |

constructor taking a HashIterator&

Parameters

  hi | the HashIterator to use for the key and hash

## Member Function Documentation

DLLLOCAL void HashAssignmentHelper::assign | ( | AbstractQoreNode * | v,
|  | ExceptionSink * | xsink
| ) |  |

assigns a value to the hash key, dereferences any old value, assumes that the value is already referenced for the assignment

a Qore-language exception could be raised when the existing value is dereferenced (i.e. if it's an object that goes out of scope and the destructor raises an exception, for example)

DLLLOCAL HashAssignmentHelper::operator bool | ( |  | ) | const

returns true if the object is holding a valid pointer, false if not

in case this function returns false

DLLLOCAL AbstractQoreNode* HashAssignmentHelper::operator* | ( |  | ) | const

returns the current value of the hash key; the pointer returned is still owned by the hash

Returns
  the current value of the hash key

DLLLOCAL AbstractQoreNode* HashAssignmentHelper::swap | ( | AbstractQoreNode * | v,
|  | ExceptionSink * | xsink
| ) |  |

swaps the current value with the new value of the hash key, assumes that the new value is already referenced for the assignment; returns the old value

could throw a Qore-language exception if there is a type error; in this case 0 is returned and the value passed for the assignment is dereferenced

Returns
  the old value of the hash key including its reference count (the old value is not dereferenced); the caller owns the value returned

The documentation for this class was generated from the following file:

- include/qore/QoreHashNode.h (6086)