Tools.h++ Class Reference

Table Of Contents
first() const;
Returns (but does not remove) the first item in the list, or nil if the list is empty.
T*
get();
Returns and removes the first item in the list, or nil if the list is empty.
size_t
index(RWBoolean (*testFun)(const T*, void*),void* d) const;
Returns the index of 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 RW_NPOS.
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.
void
insert(T* a);
Appends the item pointed to by a to the end of the list. This item cannot be inserted into
more than one list, nor can it be inserted into the same list more than once.
void
insertAt(size_t i, T* a);
Insert the item pointed to by a at the index position i. This position must be between zero
and the number of items in the list, or an exception of type TOOL_INDEX will be
thrown. The item cannot be inserted into more than one list, nor can it be inserted into the
same list more than once.
RWBoolean
isEmpty() const;
Returns TRUE if there are no items in the list, FALSE otherwise.
T*
last() const;
Returns (but does not remove) the last item in the list, or nil if the list is empty.
size_t
occurrencesOf(RWBoolean (*testFun)(const T*, void*),void* d)
const;
Traverses the list and returns the number of times for which the user-defined "tester"
function pointed to by testFun returned TRUE . The tester function must have the
prototype:
RWBoolean yourTester(const T* item, void* d);