qom: Introduce object_class_is_abstract()
This lets a caller check if an ObjectClass as returned by, e.g., object_class_by_name() is instantiatable. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws>
This commit is contained in:
parent
d89e12188d
commit
1786237894
@ -690,6 +690,14 @@ ObjectClass *object_class_get_parent(ObjectClass *klass);
|
||||
*/
|
||||
const char *object_class_get_name(ObjectClass *klass);
|
||||
|
||||
/**
|
||||
* object_class_is_abstract:
|
||||
* @klass: The class to obtain the abstractness for.
|
||||
*
|
||||
* Returns: %true if @klass is abstract, %false otherwise.
|
||||
*/
|
||||
bool object_class_is_abstract(ObjectClass *klass);
|
||||
|
||||
/**
|
||||
* object_class_by_name:
|
||||
* @typename: The QOM typename to obtain the class for.
|
||||
|
@ -501,6 +501,11 @@ ObjectClass *object_get_class(Object *obj)
|
||||
return obj->class;
|
||||
}
|
||||
|
||||
bool object_class_is_abstract(ObjectClass *klass)
|
||||
{
|
||||
return klass->type->abstract;
|
||||
}
|
||||
|
||||
const char *object_class_get_name(ObjectClass *klass)
|
||||
{
|
||||
return klass->type->name;
|
||||
|
Loading…
Reference in New Issue
Block a user