Tools.h++ Class Reference

Table Of Contents
Public Member Functions
void
applyToKeyAndValue( void (*applyFun)(K*,V*&,void*),void* d);
Applies the user-defined function pointed to by applyFun to every key-value pair in the
dictionary. This function must have prototype:
void yourFun(K* key, V*& value, void* d);
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 deletes both the keys and the values.
RWBoolean
contains(const 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(const 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(const 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(const 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);