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

List implementation. More...

Inheritance diagram for List:
Iterable Object

Public Member Functions

size_t length (const void *self)
 Get list length. More...
 
void * get (const void *self, int idx)
 Get list item. More...
 
void append (void *self, const void *obj)
 Append object to list. More...
 
void preprend (void *self, const void *obj)
 Prepend object to list. More...
 
void insert (void *self, int i, const void *obj)
 Insert object into list. More...
 
void * pop (const void *self, int i)
 Remove object from list and return it. More...
 
- Public Member Functions inherited from Iterable
bool contains (const void *self, const void *object)
 Check if object is in the collection. More...
 
void clear (void *self)
 Remove all items from iterable. More...
 
void * next (const void *self, const void *iterator)
 
- 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

List implementation.

Member Function Documentation

void append ( void *  self,
const void *  obj 
)

Append object to list.

Parameters
selfList object.
objObject to append.
void * get ( const void *  self,
int  idx 
)

Get list item.

Parameters
selfList object.
idxItem index.
Returns
Item object.
void insert ( void *  self,
int  i,
const void *  obj 
)

Insert object into list.

Parameters
selfList object.
iPosition at which the object must be inserted.
objObject to insert.
size_t length ( const void *  self)

Get list length.

Parameters
selfList object.
Returns
List size.
void * pop ( const void *  self,
int  i 
)

Remove object from list and return it.

Parameters
selfList object.
iPosition of the object to pop (or -1 for the last one)
Returns
Item object.
void preprend ( void *  self,
const void *  obj 
)

Prepend object to list.

Parameters
selfList object.
objObject to preprend.