|
Rudiments
|
Public Member Functions | |
| dictionary () | |
| virtual | ~dictionary () |
| void | setData (keytype key, datatype data) |
| bool | getData (keytype key, datatype *data) |
| bool | removeData (keytype key) |
| dictionarylisttype * | 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 dictionarynode's. 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, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::dictionary | ( | ) |
Creates an empty instance of the dictionary class.
| virtual dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::~dictionary | ( | ) | [virtual] |
Deletes this instance of the dictionary class and all of its dictionarynodes. Note however, that neither the key nor data stored in each dictionarynode are deleted by this call.
| void dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::clear | ( | ) |
Deletes all dictionarynodes currently in the dictionary.
| bool dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::getData | ( | keytype | key, |
| datatype * | data | ||
| ) |
Sets "data" to the data associated with "key". Returns true on success or false if "key" wasn't found.
| dictionarylisttype* dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::getList | ( | ) |
Returns the list used internally.
| void dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::print | ( | ) |
Prints out a representation of the dictionary.
| bool dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::removeData | ( | keytype | key | ) |
Removes the dictionarynode with "key". Returns true on success or false if "key" wasn't found.
| void dictionary< keytype, datatype, dictionarynodetype, dictionarylistnodetype, dictionarylisttype >::setData | ( | keytype | key, |
| datatype | data | ||
| ) |
Sets the data associated with "key" to "data". If "key" already exists, the data currently accociated with it is replaced with "data".
1.7.4