OODuck  0.5
C Oriented Object framework with duck-typing support
Static

Statically defined functions. More...

Functions

int vasprintf (char **ret, const char *fmt, va_list args)
 Allocate new formatted string. More...
 
int asprintf (char **ret, const char *fmt,...)
 Allocate new formatted string. More...
 
bool isA (const void *_self, const void *class)
 Check if object is an instance of class. More...
 
bool isOf (const void *_self, const void *class)
 Check if object is an instance of class or any derivated class. More...
 
void * cast (const void *class, const void *_self)
 Assert that object is of specified class. More...
 
const void * super (const void *_class)
 Return super class. More...
 
void * method (const void *_class, const char *name)
 Get class method. More...
 
const void * classOf (const void *_self)
 Get class of object. More...
 
size_t sizeOf (const void *_self)
 Get object's size. More...
 
void * new (const void *_class,...)
 Allocate new object. More...
 
void delete (void *_self)
 Free object. More...
 
void * ref (void *_self)
 Calls Object::__ref__().
 
void unref (void *_self)
 Calls Object::__unref__().
 
void ooduck_init (void)
 Initialize static types. More...
 

Detailed Description

Statically defined functions.

Function Documentation

int asprintf ( char **  ret,
const char *  fmt,
  ... 
)

Allocate new formatted string.

Parameters
retAddress to store newly allocated string.
fmtFormat string
...Argument list used to format the string.
Returns
Number of characters written in string.

Calls vasprintf().

void * cast ( const void *  class,
const void *  self 
)

Assert that object is of specified class.

Parameters
classClass object.
selfObject instance.
Returns
Casted object instance.
const void * classOf ( const void *  self)

Get class of object.

Parameters
selfObject instance.
Returns
Class object.
void delete ( void *  self)

Free object.

Parameters
selfObject instance.

Calls Class::__destructor__()

bool isA ( const void *  self,
const void *  class 
)

Check if object is an instance of class.

Parameters
selfObject instance.
classClass object.
Returns
TRUE if object is an instance of class, FALSE otherwise.
bool isOf ( const void *  self,
const void *  class 
)

Check if object is an instance of class or any derivated class.

Parameters
selfObject instance.
classClass object.
Returns
TRUE if object is an instance of class/derivated class, FALSE otherwise.
void * method ( const void *  class,
const char *  name 
)

Get class method.

Parameters
classClass object.
nameMethod name.
Returns
Function pointer to the correct method.
void * new ( const void *  class,
  ... 
)

Allocate new object.

Parameters
classObject's class.
...Class constructor parameters.
Returns
New object or NULL on error.

Calls meta Class::__alloc__() and if allocation was done, calls Class::__constructor__().

void ooduck_init ( void  )

Initialize static types.

Only Object, Class and VTableEntry are defined statically.

size_t sizeOf ( const void *  self)

Get object's size.

Parameters
selfObject instance.
Returns
Object size in bytes.
const void * super ( const void *  class)

Return super class.

Parameters
classClass object.
Returns
Parent class.
int vasprintf ( char **  ret,
const char *  fmt,
va_list  args 
)

Allocate new formatted string.

Parameters
retAddress to store newly allocated string.
fmtFormat string
argsArgument list used to format the string.
Returns
Number of characters written in string.