Tools.h++ Manual

104011 Tandem Computers Incorporated 23-7
23
Public member functions type
* append(
type
* a);
Adds an item to the end of the collection. Returns nil if the insertion was
unsuccessful.
void apply(void (*ap)(type*, void*), void* );
Visits all the items in the collection in order, from first to last, calling the user-
provided function pointed to by ap for each item. This function should have
prototype:
void
yourApplyFunction
(
type
* c, void*);
and can perform any operation on the object at address
c
. The last argument is
useful for passing data to the apply function.
type
*& at(size_t i);
const type* at(size_t i) const;
Returns a pointer to the
i
’th item in the collection. The first variant can be
used as an lvalue, 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 in the collection.
RWBoolean contains(
yourTester
t, const
void* d) const;
Returns
TRUE
if the collection contains an item for which the user-defined
function pointed to by
t
finds a match with
d
.
RWBoolean containsReference(const type*
e) const;
Returns
TRUE
if the collection contains an item with the addresse
e
.
size_t entries() const;
Returns the number of items in the collection.
type
* find(
yourTester
t, const void*
d) const;
Returns the first item in the collection for which the user-provided function
pointed to by
t
finds a match with
d
, or nil if no item is found.
type
* findReference(const
type
* e)
const;
Returns the first item in the collection with the address
e
, or nil if no item is
found.