core: object: make interface query functions const; remove type parameters

This commit is contained in:
2025-10-19 10:21:43 +01:00
parent e1e4544b67
commit 379bd048b2
5 changed files with 16 additions and 19 deletions

View File

@@ -8,10 +8,6 @@
typedef struct _b_class b_class;
#define b_class_get_interface(class, interface_struct, interface_id) \
((interface_struct *)z__b_class_get_interface( \
B_CLASS(class), interface_id));
BLUE_API void *z__b_class_get_interface(b_class *c, b_type id);
BLUE_API void *b_class_get_interface(const b_class *c, b_type id);
#endif

View File

@@ -19,10 +19,10 @@
{
#define B_TYPE_CLASS_DEFINITION_END(type_name) }
#define B_TYPE_CLASS_INTERFACE_BEGIN(interface_name, interface_id) \
interface_name##_class *__B_IFACE_I1(iface, __LINE__) \
= b_class_get_interface(p, interface_name##_class, interface_id); \
if (__B_IFACE_I1(iface, __LINE__)) { \
#define B_TYPE_CLASS_INTERFACE_BEGIN(interface_name, interface_id) \
interface_name##_class *__B_IFACE_I1(iface, __LINE__) \
= b_class_get_interface(p, interface_id); \
if (__B_IFACE_I1(iface, __LINE__)) { \
interface_name##_class *iface = __B_IFACE_I1(iface, __LINE__);
#define B_TYPE_CLASS_INTERFACE_END(interface_name, interface_id) }
#define B_INTERFACE_ENTRY(slot) iface->slot

View File

@@ -15,19 +15,20 @@ struct b_stream;
typedef struct _b_object b_object;
typedef struct _b_object_class {
void (*to_string)(b_object *, struct b_stream *);
void (*to_string)(const b_object *, struct b_stream *);
} b_object_class;
BLUE_API b_type b_object_get_type(void);
BLUE_API void *b_object_get_private(b_object *object, b_type type);
BLUE_API void *b_object_get_protected(b_object *object, b_type type);
BLUE_API void *b_object_get_interface(b_object *object, b_type type);
BLUE_API void *b_object_get_private(const b_object *object, b_type type);
BLUE_API void *b_object_get_protected(const b_object *object, b_type type);
BLUE_API void *b_object_get_interface(const b_object *object, b_type type);
BLUE_API b_object *b_object_ref(b_object *p);
BLUE_API void b_object_unref(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);
BLUE_API void b_object_to_string(const b_object *p, struct b_stream *out);
BLUE_API bool b_object_is_type(const b_object *p, b_type type);
#endif