* [Qemu-devel] [PATCH] qom: Introduce object_class_is_abstract()
@ 2012-01-28 17:51 Andreas Färber
2012-01-28 18:24 ` Andreas Färber
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Färber @ 2012-01-28 17:51 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Färber
Since struct TypeImpl is not public, this is useful for enumerating
available types.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
include/qemu/object.h | 8 ++++++++
qom/object.c | 5 +++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/include/qemu/object.h b/include/qemu/object.h
index ba37850..8ec45f2 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -428,6 +428,14 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *klass,
*/
const char *object_class_get_name(ObjectClass *klass);
+/**
+ * object_class_is_abstract:
+ * @klass: The class to obtain the abstractness for.
+ *
+ * Returns: Whether @klass is an abstract class or not.
+ */
+bool object_class_is_abstract(ObjectClass *klass);
+
ObjectClass *object_class_by_name(const char *typename);
void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
diff --git a/qom/object.c b/qom/object.c
index 57cc592..1821959 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -451,6 +451,11 @@ const char *object_class_get_name(ObjectClass *klass)
return klass->type->name;
}
+bool object_class_is_abstract(ObjectClass *klass)
+{
+ return klass->type->abstract;
+}
+
ObjectClass *object_class_by_name(const char *typename)
{
TypeImpl *type = type_get_by_name(typename);
--
1.7.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-28 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-28 17:51 [Qemu-devel] [PATCH] qom: Introduce object_class_is_abstract() Andreas Färber
2012-01-28 18:24 ` Andreas Färber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).