OODuck  0.5
C Oriented Object framework with duck-typing support
Iterator Class Reference

Object used to iterate over Iterable. More...

Inheritance diagram for Iterator:
Object

Public Member Functions

void * __constructor__ (void *self, const void *iterable)
 Build new iterator from iterable. More...
 
void * next (void *self)
 Get next item in Iterable object. More...
 
void * get (const void *self)
 Get current item. More...
 
- Public Member Functions inherited from Object
void * ref (void *self)
 Increment object's reference counter. More...
 
void unref (void *self)
 Decrement object's reference counter, if equals 0, delete the object. More...
 
bool equal (const void *self, const void *other)
 Check objects equality. More...
 

Detailed Description

Object used to iterate over Iterable.

Member Function Documentation

void * __constructor__ ( void *  self,
const void *  iterable 
)

Build new iterator from iterable.

Parameters
selfIterator instance.
iterableIterable object.
Returns
Initialized instance.
void * get ( const void *  self)

Get current item.

Parameters
selfIterator object./
Returns
Current item or NULL if Iterator::next() hasn't been called (or no more items).
void * next ( void *  self)

Get next item in Iterable object.

Parameters
selfIterator object.
Returns
Next item or NULL if no more items.

Calls Iterable::next().