#include <yateclass.h>
Public Member Functions | |
ListIterator (ObjList &list) | |
ListIterator (HashList &list) | |
~ListIterator () | |
unsigned int | length () const |
GenObject * | get (unsigned int index) const |
GenObject * | get () |
bool | eof () const |
void | reset () |
An ObjList or HashList iterator that can be used even when list elements are changed while iterating. Note that it will not detect that an item was removed and another with the same address was inserted back in list.
ListIterator | ( | ObjList & | list | ) |
Constructor used to iterate trough an ObjList. The image of the list is frozen at the time the constructor executes
list | List to get the objects from |
ListIterator | ( | HashList & | list | ) |
Constructor used to iterate trough a HashList. The image of the list is frozen at the time the constructor executes
list | List to get the objects from |
~ListIterator | ( | ) |
Destructor - frees the allocated memory
bool eof | ( | ) | const [inline] |
Check if the current pointer is past the end of the list
GenObject* get | ( | ) |
Get the current element and advance the current index. Items that were removed from list or are not alive are skipped over. An example of typical usage:
ListIterator iter(list); while (GenObject* obj = iter.get()) { do_something_with(obj); }
GenObject* get | ( | unsigned int | index | ) | const |
Get an arbitrary element in the iterator's list image. Items that were removed from list or are not alive are not returned.
index | Position to get the item from |
unsigned int length | ( | ) | const [inline] |
Get the number of elements in the list
void reset | ( | ) | [inline] |
Reset the iterator index to the first position in the list