core: class: add functions to get a registered class, and get the name of a class

This commit is contained in:
2025-10-28 15:11:54 +00:00
parent cd54a4f755
commit 5f2bbc7151
2 changed files with 17 additions and 0 deletions

View File

@@ -6,6 +6,21 @@
#include <stdlib.h>
#include <string.h>
void *b_class_get(b_type id)
{
struct b_type_registration *r = b_type_get_registration(id);
if (!r) {
return NULL;
}
return r->r_class;
}
const char *b_class_get_name(const struct _b_class *c)
{
return c->c_type->r_info->t_name;
}
void *b_class_get_interface(const struct _b_class *c, const union b_type *id)
{
const struct b_type_registration *type_reg = c->c_type;