|
Rudiments
|
Public Member Functions | |
| dictionary () | |
| virtual | ~dictionary () |
| void | setValue (keytype key, valuetype value) |
| bool | getValue (keytype key, valuetype *value) |
| bool | remove (keytype key) |
| linkedlist< dictionarynode < keytype, valuetype > * > * | getList () |
| void | clear () |
| void | print () |
The dictionary class allows you to store arbitrary numbers of key/value pairs.
Each dictionary is composed of a list of dictionarynodes. Each dictionarynode contains the key and value.
Internally, the dictionary class uses a linkedlist to store the values though this is potentially inefficient and may change in a future version.
| dictionary< keytype, valuetype >::dictionary | ( | ) |
Creates an empty instance of the dictionary class.
|
virtual |
Deletes this instance of the dictionary class and all of its dictionarynodes. Note however, that neither the key nor value stored in each dictionarynode are deleted by this call.
| void dictionary< keytype, valuetype >::clear | ( | ) |
Deletes all dictionarynodes currently in the dictionary.
| linkedlist< dictionarynode<keytype,valuetype> *>* dictionary< keytype, valuetype >::getList | ( | ) |
Returns the list used internally.
| bool dictionary< keytype, valuetype >::getValue | ( | keytype | key, |
| valuetype * | value | ||
| ) |
Sets "value" to the value associated with "key". Returns true on success or false if "key" wasn't found.
| void dictionary< keytype, valuetype >::print | ( | ) |
Prints out a representation of the dictionary.
| bool dictionary< keytype, valuetype >::remove | ( | keytype | key | ) |
Removes the dictionarynode with "key". Returns true on success or false if "key" wasn't found.
| void dictionary< keytype, valuetype >::setValue | ( | keytype | key, |
| valuetype | value | ||
| ) |
Sets the value associated with "key" to "value". If "key" already exists, the value currently accociated with it is replaced with "value".
1.8.6