Rudiments
|
#include <dictionary.h>
Inherits dictionarycollection< keytype, valuetype >.
The dictionary class allows you to store arbitrary numbers of key-value pairs.
|
inline |
Creates an empty instance of the dictionary class.
dictionary< keytype, valuetype >::dictionary | ( | bool | trackinsertionorder | ) |
Creates an empty instance of the dictionary class.
If "trackinsertionorder" is true then the order of key insertion is tracked and getKeys() and getList() below return a list of key-value pairs in the order that they were inserted.
If "trackinsertionorder" is false then the order of key insertion is not tracked and getList() and getList() below return alist of key-value pairs in ascending order.
|
inline |
Creates an instance of the dictionary class that is a copy of "a".
|
inline |
Creates an instance of the dictionary class that is a copy of "a".
|
inline |
Deletes this instance of the dictionary class.
The key stored in each pair is only deleted if setManageKeys(true) or setManageArrayKeys(true) has been called.
The value stored in each pair is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
|
inlinevirtual |
Deletes all key-value pairs currently in the dictionary.
The key stored in each pair is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
The key stored in each pair is only deleted if setManageKeys(true) or setManageArrayKeys(true) has been called.
The value stored in each pair is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
Always returns true.
Implements collection.
|
inlinevirtual |
Returns the number of key-value pairs in the dictionary.
Implements collection.
|
inlinevirtual |
Returns the key associated with "key" or NULL if "key" wasn't found. Note that there is no way to distinguish between failure to find "key" and a valid key of NULL associated with "key".
Implements dictionarycollection< keytype, valuetype >.
Sets "k" to the key associated with "key". Returns true on success or false if "key" wasn't found.
Implements dictionarycollection< keytype, valuetype >.
|
inlinevirtual |
Returns a list of the keys in the dictionary.
Implements dictionarycollection< keytype, valuetype >.
|
inlinevirtual |
Returns "true" if insertion order tracking is enabled and false otherwise.
If getTrackInsertionOrder() is true then the order of key insertion is tracked and getKeys() returns a list of keys in the order that they were inserted.
If getTrackInsertionOrder() is false then the order of key insertion is not tracked and getKeys() returns a list of keys in ascending order.
Implements dictionarycollection< keytype, valuetype >.
|
inlinevirtual |
Returns the value associated with "key" or NULL if "key" wasn't found. Note that there is no way to distinguish between failure to find "key" and a valid value of NULL associated with "key".
Implements dictionarycollection< keytype, valuetype >.
Sets "value" to the value associated with "key". Returns true on success or false if "key" wasn't found.
Implements dictionarycollection< keytype, valuetype >.
|
inline |
Makes this instance of the dictionary class identical to "a".
|
inline |
Makes this instance of the dictionary class identical to "a".
|
inlinevirtual |
Removes the key-value pair associated with "key". Returns true on success or false if "key" wasn't found.
The key stored in the pair is only deleted if setManageKeys(true) or setManageArrayKeys(true) has been called.
The value stored in the pair is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
Implements dictionarycollection< keytype, valuetype >.
|
inline |
Sets whether tracking of the order of key insertion is enabled or not.
If "trackinsertionorder" is true then the order of key insertion is tracked and getKeys() returns a list of keys in the order that they were inserted.
If "trackinsertionorder" is false then the order of key insertion is not tracked and getKeys() returns a list of keys in ascending order.
Defaults to "true".
Note, this can only be changed when there are no key-value pairs in the dictionary. Eg. before the first call to setValue() or after a call to clear().
Returns true if the call succeeded and false if it failed (eg. because the dictionary contained key-value pairs).
Sets the value associated with "key" to "value". If "key" already exists, the value currently accociated with it is replaced with "value".
Implements dictionarycollection< keytype, valuetype >.
|
inline |
Sets the value associated with each key in "dict" to the corresponding value from "dict". If "key" already exists, the value currently accociated with it is replaced with "value".
|
inlinevirtual |
Sets the value associated with each key in the "keys" array to the corresponding value in the "values" array. Assumes that keys is NULL terminated. If "key" already exists, the value currently accociated with it is replaced with "value".
Implements dictionarycollection< keytype, valuetype >.
|
inlinevirtual |
Sets the value associated with each of "count" keys in the "keys" array to the corresponding value in the "values" array. If "key" already exists, the value currently accociated with it is replaced with "value".
Implements dictionarycollection< keytype, valuetype >.
|
inlinevirtual |
Sets the value associated with each key in the "keys" array to the corresponding value in the "values" array. Assumes that keys is NULL terminated. If "key" already exists, the value currently accociated with it is replaced with "value".
Implements dictionarycollection< keytype, valuetype >.
|
inlinevirtual |
Sets the value associated with each of "count" keys in the "keys" array to the corresponding value in the "values" array. If "key" already exists, the value currently accociated with it is replaced with "value".
Implements dictionarycollection< keytype, valuetype >.