1.9.1 NamedObjList information functions
The size
and initialize
functions of SequentialList are re-exported. Note that initialize
removes only the links to the objects and does not delete the objects. Here is what's new:NamedObj* objWithName(const char* name);
Find the first NamedObj on the list whose name is equal to
const NamedObj* objWithName(const char* name) const; name,
and return a pointer to it. Return 0 if it is not found. There are two forms, one of which returns a const object.NamedObj* head();
Return a pointer to the first object on the list (0 if none). There are two forms, one of which returns a const object.
const NamedObj* head() const; 1.9.2 Other NamedObjList functions
void put(NamedObj& obj)
Add a pointer to obj
to the list, at the end. The object must live at least as long as the list.void initElements();
Apply the initialize
method to each NamedObj on the list.int remove(NamedObj* obj);
Remove obj
from the list, if present (this does not delete obj).
Return 1 if it was present, 0 if not.void deleteAll();
Delete all elements from the list, and reset it to be an empty list. WARNING: this assumes that the members of the list are on the heap (allocated by new,
so that deleting them is valid)!1.9.3 NamedObjList iterators
There are two different iterators associated with NamedObjList; class NamedObjListIter and class CNamedObjListIter. The latter returns const objects (which cannot then be modified). The former returns a non-const pointer, and can only be used if the NamedObjList itself is not const. Both obey the standard iterator interface and are privately derived from class ListIter.