core: object: add functions to retrieve multiple parts of an object at once

This commit is contained in:
2025-10-24 12:28:50 +01:00
parent 21c4005819
commit 36b624849c
2 changed files with 40 additions and 11 deletions

View File

@@ -2,22 +2,21 @@
#define BLUE_CORE_OBJECT_H_
#include <blue/core/misc.h>
#include <blue/core/stringstream.h>
#include <blue/core/type.h>
#define B_OBJECT_MAGIC 0xDECAFC0C0ABEEF13ULL
#define B_OBJECT_MAGIC 0xDECAFC0C0ABEEF13ULL
#define B_OBJECT(p) ((b_object *)(p))
#define B_TYPE_OBJECT (b_object_get_type())
#define B_OBJECT(p) ((b_object *)(p))
#define B_TYPE_OBJECT (b_object_get_type())
#define B_RV(p) (b_object_make_rvalue(p))
#define B_TYPE_FWDREF(name) struct _b_object
struct b_stream;
#define B_RV(p) (b_object_make_rvalue(p))
typedef struct _b_object b_object;
typedef B_TYPE_FWDREF(b_object) b_object;
typedef struct _b_object_class {
void (*to_string)(const b_object *, struct b_stream *);
void (*to_string)(const b_object *, B_TYPE_FWDREF(b_stream) *);
} b_object_class;
BLUE_API b_type b_object_get_type(void);
@@ -25,13 +24,16 @@ BLUE_API b_type b_object_get_type(void);
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_status b_object_get_data(
const b_object *object, b_type type, void **priv, void **prot,
void **iface);
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_make_rvalue(b_object *p);
BLUE_API b_object *b_object_create(b_type type);
BLUE_API void b_object_to_string(const b_object *p, struct b_stream *out);
BLUE_API void b_object_to_string(const b_object *p, B_TYPE_FWDREF(b_stream) * out);
BLUE_API bool b_object_is_type(const b_object *p, b_type type);
#endif