object: add macro to test object type

This commit is contained in:
2025-07-17 17:55:34 +01:00
parent 4690738af1
commit 92ccc5626d

View File

@@ -3,13 +3,15 @@
#include <blue/object/type.h> #include <blue/object/type.h>
#define B_OBJECT(p) ((b_object *)(p)) #define B_OBJECT(p) ((b_object *)(p))
#define B_TYPEOF(object) ((struct b_object *)(object)->ob_type) #define B_TYPEOF(object) ((struct b_object *)(object)->ob_type)
#define B_TYPEID(object) (b_typeid(B_OBJECT(object))) #define B_TYPEID(object) (b_typeid(B_OBJECT(object)))
#define B_RV(p) (b_make_rvalue(B_OBJECT(p))) #define B_RV(p) (b_make_rvalue(B_OBJECT(p)))
#define B_RVT(t, p) ((t *)(b_make_rvalue(B_OBJECT(p)))) #define B_RVT(t, p) ((t *)(b_make_rvalue(B_OBJECT(p))))
#define B_OBJECT_IS(object, type) (B_TYPEID(object) == B_OBJECT_TYPE_##type)
struct b_string; struct b_string;
struct b_stream; struct b_stream;