cemu
载入中...
搜索中...
未找到
obj.h 文件参考

C面向对象头文件 更多...

浏览源代码.

struct  __OBJ_entry
 
struct  __OBJ_pool
 
struct  __OBJ_base
 

函数

int __stdcall VirtualProtect (void *addr, size_t size, unsigned long newprot, unsigned long *oldprot)
 
static void * __OBJ_clofn (void *prototype, size_t *phsize, void *data)
 
static struct __OBJ_pool__OBJ_pool_create ()
 
static void __OBJ_pool_destroy (struct __OBJ_pool *p)
 
static struct __OBJ_entry__OBJ_pool_find (struct __OBJ_entry entries[], int space, void *ptr)
 
static void __OBJ_pool_resize (struct __OBJ_pool *p, int space)
 
static void * __OBJ_pool_add (struct __OBJ_pool *p, void *ptr)
 
static int __OBJ_pool_remove (struct __OBJ_pool *p, void *ptr)
 
static void * __OBJ_pool_alloc (struct __OBJ_pool *p, size_t size)
 
static void * __OBJ_pool_realloc (struct __OBJ_pool *p, void *ptr, size_t size)
 
static void __OBJ_pool_free (struct __OBJ_pool *p, void *ptr)
 
static void __OBJ_freebase (struct __OBJ_base *base)
 
static void * __OBJ_alloc (size_t size)
 
static void * __OBJ_realloc (void *ptr, size_t size)
 
static void __OBJ_free (void *ptr)
 
static void __OBJ_release ()
 

变量

static size_t __OBJ_alloc_s = 0
 
static size_t __OBJ_realloc_s = 0
 
static size_t __OBJ_free_s = 0
 
static size_t __OBJ_release_s = 0
 

详细描述

C面向对象头文件

作者
lancer (lance.nosp@m.rsta.nosp@m.dium@.nosp@m.163..nosp@m.com)
版本
0.1
日期
2024-01-08

For example,

#include "obj.h"
// Class declaration
classdef(Dog);
class(Dog,
public(
int (*get_no)();
void (*print_msg)();
),
private(
int no;
char *msg;
)
);
ctor(Dog)(int no); // Constructor
dtor(Dog); // Destructor (optional)
method(Dog, int, get_no)(); // Method
method(Dog, void, print_msg)(); // Method
ctor(Dog)(int no)
{
obj_setup(Dog);
obj_bind(Dog, get_no);
obj_bind(Dog, print_msg);
self->no = no;
self->msg = "Woff woff!\n";
obj_done(Dog);
}
method(Dog, int, get_no)()
{
obj_prepare(Dog);
return self->no;
}
method(Dog, void, print_msg)()
{
obj_prepare(Dog);
printf("%s", self->msg);
}
C面向对象头文件