AtxIterator.h File Reference

Header file for the ATX_Iterator interface. More...

#include "AtxInterfaces.h"
#include "AtxTypes.h"

Go to the source code of this file.

Defines

#define ATX_ERROR_END_OF_ITERATION   (ATX_ERROR_BASE_ITERATOR - 0)
#define ATX_Iterator_GetNext(self, element)   ATX_INTERFACE(self)->GetNext(self, element)
 Convenience macro used to call the GetNext() method on objects that implement the ATX_Iterator interface.
#define ATX_Iterator_Reset(self)   ATX_INTERFACE(self)->Reset(self)
 Convenience macro used to call the Reset() method on objects that implement the ATX_Iterator interface.

Variables

ATX_Result(* GetNext )(ATX_Iterator *self, ATX_Any *element)
 Interface implemented by objects that represent a list of elements of arbitrary type.
ATX_Result(* Reset )(ATX_Iterator *self)
 Resets the iterator, making it go back to the first element in the list.


Detailed Description

Header file for the ATX_Iterator interface.


Variable Documentation

ATX_Result(* GetNext)(ATX_Iterator *self, ATX_Any *element)

Interface implemented by objects that represent a list of elements of arbitrary type.

An ATX_Iterator interface is used to enumerate elements in a list. Clients of that interface typically enumerate elements by calling the GetNext() method repeatedly until they have found the element they were looking for, or the end of the list has been reached. Returns the next element in the list, or an error code when the end of the list has been reached.

Parameters:
self Pointer to the object on which this method is called
element Pointer to a variable that where the next element will be returned if the end of the list has not yet been reached
Returns:
ATX_SUCCESS if an element has been returned, ATX_ERROR_END_OF_ITERATION if the end of the list has been reached, or a negative error code if an error occurs.

ATX_Result(* Reset)(ATX_Iterator *self)

Resets the iterator, making it go back to the first element in the list.

After a call to Reset(), a call to GetNext() will return the first element in the list.

Parameters:
self Pointer to the object on which this method is called