class.h 734 Bytes
#ifndef __INTERFACE_CLASS_H__
#define __INTERFACE_CLASS_H__

#include <stdarg.h>

#include "class.h"
#include "interface.h"

typedef void (* fptr_ctor)(void *, va_list *);
typedef void (* fptr_dtor)(void *);
typedef void (* fptr_clone)(void *, const void * const);

extern const struct interface i_Class;

struct i_Class {
	const struct interface * const _;
	fptr_ctor                      ctor;
	fptr_dtor                      dtor;
	fptr_clone                     clone;
};

extern inline void * classNew(class_ptr, ...);
extern inline void   classDelete(void **);

#define new(class,...)	classNew(_##class, __VA_ARGS__)
#define delete(object)	classDelete((void **)(object))

#endif // __INTERFACE_CLASS_H__

// vim: set ts=4 sw=4: