Files
fx/object/include/blue/object/object.h

42 lines
1.4 KiB
C
Raw Normal View History

2025-08-16 16:03:55 +01:00
#ifndef BLUE_OBJECT_OBJECT_H_
#define BLUE_OBJECT_OBJECT_H_
#include <blue/core/misc.h>
#include <blue/core/stringstream.h>
#include <blue/object/type.h>
#define B_OBJECT_MAGIC 0xDECAFC0C0ABEEF13ULL
#define B_OBJECT(p) ((b_object *)(p))
#define B_TYPE_OBJECT (b_object_get_type())
struct b_stream;
typedef struct _b_object b_object;
typedef struct _b_object_class {
void (*to_string)(b_object *, struct b_stream *);
} b_object_class;
#define b_object_get_private(object, private_struct, type_id) \
((private_struct *)z__b_object_get_private(B_OBJECT(object), type_id));
#define b_object_get_protected(object, protected_struct, type_id) \
((protected_struct *)z__b_object_get_protected(B_OBJECT(object), type_id));
#define b_object_get_interface(object, interface_struct, interface_id) \
((interface_struct *)z__b_object_get_interface( \
B_OBJECT(object), interface_id));
BLUE_API b_type b_object_get_type(void);
BLUE_API void *z__b_object_get_private(b_object *object, b_type type);
BLUE_API void *z__b_object_get_protected(b_object *object, b_type type);
BLUE_API void *z__b_object_get_interface(b_object *object, b_type type);
b_object *b_retain(b_object *p);
BLUE_API void b_release(b_object *p);
BLUE_API b_object *b_object_create(b_type type);
BLUE_API void b_object_to_string(b_object *p, struct b_stream *out);
#endif