Tools.h++ Class Reference

Table Of Contents
The item will be passed in as argument item. Client data may be passed through as
parameter d.
T*
at(size_t i) const;
Returns the item at index i. The index i must be between zero and the number of items in
the collection less one, or an exception of type TOOL_INDEX will be thrown.
void
clear();
Removes all items from the list.
void
clearAndDestroy();
Removes and calls delete for each item in the list. Note that this assumes that each item
was allocated off the heap.
RWBoolean
contains(RWBoolean (*testFun)(const T*, void*), void* d)
const;
Returns TRUE if the list contains an item for which the user-defined "tester" function
pointed to by testFun returns TRUE . The tester function must have the prototype:
RWBoolean yourTester(const T* item, void* d);
For each item in the list this function will be called with the item as the first argument.
Client data may be passed through as parameter d.
RWBoolean
containsReference(const T* a) const;
Returns TRUE if the list contains an item with the address a.
size_t
entries() const;
Returns the number of items currently in the list.
T*
find(RWBoolean (*testFun)(const T*, void*),void* d) const;
Returns the first item in the list for which the user-defined "tester" function pointed to by
testFun returns TRUE. If there is no such item, then returns nil. The tester function must
have the prototype:
RWBoolean yourTester(const T* item, void* d);
For each item in the list this function will be called with the item as the first argument.
Client data may be passed through as parameter d.
T*
first() const;