Tools.h++ Manual

22-54 104011 Tandem Computers Incorporated
22
void
yourFun
(T* a, void* d);
This function will be called for each item in the list, with a pointer to the item
as the first argument. Client data may be passed through as parameter
d
.
T*& at(size_t i);
T* at(size_t i) const;
Returns a pointer to the
i
'th value in the list. The first variant can be used as
an l-value, the second cannot. 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 collection.
void clearAndDestroy();
Removes all items from the collection and calls their destructors.
RWBoolean contains(T* a) const;
Returns
TRUE
if the list contains an object that is equal to the object pointed to
by
a
,
FALSE
otherwise. Equality is measured by the class-defined equality
operator for type
T
.
RWBoolean contains(RWBoolean
(*testFun)(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
. Returns
FALSE
otherwise. The
tester function must have the prototype:
RWBoolean
yourTester
(T*, void* d);
This function will be called for each item in the list, with a pointer to the item
as the first argument. Client data may be passed through as parameter
d
.
size_t entries() const;
Returns the number of items that are currently in the collection.
T* find(T* a) const;
Returns a pointer to the first object encountered which is equal to the object
pointed to by
a
, or nil if no such object can be found. Equality is measured by
the class-defined equality operator for type
T
.