-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathObject.h
51 lines (42 loc) · 988 Bytes
/
Object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//HEADER GUARDS
#ifndef __OBJECT__
#define __OBJECT__ true
#include <stdlib.h>
#include <stdio.h>
#define __call(o, m) o->methods->m(o)
#define __call_args(o, m, ...) o->methods->m(o, __VA_ARGS__)
//Object
//--Structure
struct Object;
struct Properties;
struct Methods;
typedef struct Object Object;
typedef struct Properties Properties;
typedef struct Methods Methods;
struct Object {
Properties * prop;
Methods * methods;
};
struct Properties {
char * _;
};
struct Methods {
void (*delete) (Object * o);
//can be overridden
char* (*toString) (void * o);
};
//--Methods
//----Constructor/Desctructor
Object * new_Object();
void delete_Object(Object * o);
void init_Object(Object * o);
void uninit_Object(Object * o);
//----init properties
void init_Properties(Properties * p);
void uninit_Properties(Properties * p);
//----init methods
void init_Methods(Methods * m);
void uninit_Methods(Methods * m);
//----method declarations
char* toString_Object(void * o);
#endif