core: class: add functions to get a registered class, and get the name of a class
This commit is contained in:
15
core/class.c
15
core/class.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user