CObject
|
#include <CCListIterator.h>
Public Member Functions | |
const struct CCListIterator_VTable * | CCListIterator_GetVTable () |
CError | CCListIterator (struct CCListIterator *self, struct CIList *list) |
CBool | CIIterator_HasNext (struct CIIterator *self) |
void | CIIterator_Next (struct CIIterator *self, void *element) |
CBool | CIIterator_HasPrevious (struct CIIterator *self) |
void | CIIterator_Previous (struct CIIterator *self, void *element) |
CBool | CIIterator_Set (struct CIIterator *self, void *element) |
CBool | CIIterator_Remove (struct CIIterator *self) |
size_t | CIIterator_Index (struct CIIterator *self) |
Data Fields | |
struct CObject | cobject |
struct CIIterator | ciiterator |
struct CIList * | list |
size_t | index |
size_t | next_index |
size_t | previous_index |
size_t | last_index_used |
CBool | is_next_valid |
CBool | is_previous_valid |
CBool | is_last_index_used_valid |
struct CInterface | interface |
This is an implementations of the CIIterator interface for the CIList interface. Any data structure which implements the CIList interface can be iterated through using this structure. For example, the code below uses this iterator to print out every element in an array list.
CError CCListIterator | ( | struct CCListIterator * | self, |
struct CIList * | list | ||
) |
Constructs an interator capable of iterating over a list.
self | The iterator. |
list | The list to iterate through. |
|
inherited |
Evaluates if there is a next element in the collection. If this returns a logical true, then CIIterator_Next() will get the next element in the collection.
self | The iterator. |
|
inherited |
Evaluates if there is a previous element in the collection. If this returns a logical true, then CIIterator_Previous() will get the previous element in the collection.
self | The iterator. |
|
inherited |
Gets the index of the element in the collection last returned by a call to CIIterator_Next() or CIIterator_Previous(). If no call to those methods has been made yet, this does nothing and returns zero. Note, zero can be a valid index, so a returned value of zero is not an error code.
self | The iterator. |
|
inherited |
Gets the next element in the collection. If CIIterator_HasNext() returns a logical true, then this function will get a valid element. If CIIterator_HasNext() returned a logical false, then this function does nothing. This does not happen because of the call to CIIterator_HasNext(), CIIterator_HasNext() will only tell the application how this method is going to behave.
self | The iterator |
element | The next element in the collection will be copied to the the memory pointed to by this. |
|
inherited |
Gets the previous element in the collection. If CIIterator_HasPrevious() returns a logical true, then this function will get a valid element. If CIIterator_HasPrevious() returned a logical false, then this function does nothing.
self | The iterator |
element | The previous element in the collection will be copied to the the memory pointed to by this. |
|
inherited |
Removes the element in the collection last returned by a call to CIIterator_Next() or CIIterator_Previous(). If no call to those methods has been made yet, then this does nothing and returns a logical false.
self | The iterator. |
|
inherited |
Sets the element in the collection last returned by a call to CIIterator_Next() or CIIterator_Previous(). If no call to those methods has been made yet, then this does nothing and returns a logical false.
self | The iterator. |
element | Memory pointed to will be copied into the collection |