Parent Topic: PCLCONTA
PCLIter objects should be restarted with Start() before further access if an object is added to, or deleted from the container class being scanned.
The PCLIter is derived from PCLObject, and so can be stored in containers and so forth.
PCLIter( poContainer );
const PCLContainer * poContainer;
Pointer to the container for which an iterator is
to be created. It can be NULL if the selection of
container is to be deferred till the call to Start().
The Start() method is position the iterator at the first item in a
container. It will return the pointer to the first object. It is
also optionally possible to pass a container to retarget the
iterator on a new container.
PCLObject * Start( poNewContainer );
const PCLContainer *poNewContainer;
Optional new container which defaults to NULL to indicate
that the current container should containue to be used.
The Next() method is used to advance an iterator to the next item in
a container. Calling this method repeatedly will advance the
iterator through each of the elements in the container till all have
been visited, at which point NULL will be returned.
PCLObject * Next();The Current() method is used to fetch the PCLObject currently refered to by the iterator. This will be the same value as the most recent call to Start() or Next() returned. Invoking the Current() method does not affect the PCLIter object.
PCLObject * Current();
{
PCLIter oIter( poStack );
for( oIter.Start(); oIter.Current() != NULL; oIter.Next() )
{
oIter.Current()->Dump( stdout );
}
}