Tools.h++ Manual
22-34 104011 Tandem Computers Incorporated
22
This function will be called for each key value pair in the dictionary, with a
pointer to the key as the first argument and a reference to a pointer to the value
as the second argument. The key should not be changed or touched. A new
value can be substituted, or the old value can be changed. Client data may be
passed through as parameter
d
.
void clear();
Removes all key value pairs from the collection.
void clearAndDestroy();
Removes all key value pairs from the collection and calls the destructor for
both the keys and the values.
RWBoolean contains(K* key) const;
Returns
TRUE
if the dictionary contains a key which is equal to the key pointed
to by
key
. Returns
FALSE
otherwise. Equality is measured by the class-
defined equality operator for type
K
.
size_t entries() const;
Returns the number of key-value pairs currently in the dictionary.
K* find(K* key) const;
Returns a pointer to the key which is equal to the key pointed to by
key
, or nil
if no such item could be found. Equality is measured by the class-defined
equality operator for type
K
.
V* findValue(K* key) const;
Returns a pointer to the value associated with the key pointed to by
key
, or nil
if no such item could be found. Equality is measured by the class-defined
equality operator for type
K
.
K* findKeyAndValue(K* key, V*&
retVal) const;
Returns a pointer to the key associated with the key pointed to by
key
, or nil if
no such item could be found. If a key is found, the pointer to its associated
value is put in
retVal
. Equality is measured by the class-defined equality
operator for type
K
.
void insertKeyAndValue(K* key, V*
value);
If the key pointed to by
key
is in the dictionary, then its associated value is
changed to
value
. Otherwise, a new key value pair is inserted into the
dictionary.