class.h
804 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 *, 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 void * classNew(class_ptr, ...);
extern void classDelete(void **);
extern void * classClone(void *);
#define new(class,...) classNew(_##class, ##__VA_ARGS__)
#define delete(object) classDelete((void **)(object))
#define clone(object) classClone((void *)(object))
#endif // __INTERFACE_CLASS_H__
// vim: set ts=4 sw=4: