object: add macro to test object type
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user