[libgovirt] Add OvirtResource::to_xml() vfunc
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] Add OvirtResource::to_xml() vfunc
- Date: Tue, 8 Oct 2013 17:05:16 +0000 (UTC)
commit a4f3d45b70145c65e4016dc82a3cc641c3c0f8a6
Author: Christophe Fergeau <cfergeau redhat com>
Date: Thu Aug 29 20:52:30 2013 +0200
Add OvirtResource::to_xml() vfunc
This is used to serialize an OvirtResource to XML, which is needed
when one wants to add/update a resource.
govirt/ovirt-resource-private.h | 1 +
govirt/ovirt-resource.c | 14 ++++++++++++++
govirt/ovirt-resource.h | 3 ++-
3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/govirt/ovirt-resource-private.h b/govirt/ovirt-resource-private.h
index baa1a8c..28bd251 100644
--- a/govirt/ovirt-resource-private.h
+++ b/govirt/ovirt-resource-private.h
@@ -28,6 +28,7 @@ G_BEGIN_DECLS
const char *ovirt_resource_get_action(OvirtResource *resource,
const char *action);
+char *ovirt_resource_to_xml(OvirtResource *resource);
G_END_DECLS
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index 1b2e057..c127a7c 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -456,3 +456,17 @@ static gboolean ovirt_resource_init_from_xml(OvirtResource *resource,
return klass->init_from_xml(resource, node, error);
}
+
+
+char *ovirt_resource_to_xml(OvirtResource *resource)
+{
+ OvirtResourceClass *klass;
+
+ g_return_val_if_fail(OVIRT_IS_RESOURCE(resource), NULL);
+
+ klass = OVIRT_RESOURCE_GET_CLASS(resource);
+ if (klass->to_xml == NULL)
+ return NULL;
+
+ return klass->to_xml(resource);
+}
diff --git a/govirt/ovirt-resource.h b/govirt/ovirt-resource.h
index 8288bd3..d48d8a9 100644
--- a/govirt/ovirt-resource.h
+++ b/govirt/ovirt-resource.h
@@ -56,8 +56,9 @@ struct _OvirtResourceClass
gboolean (*init_from_xml)(OvirtResource *resource,
RestXmlNode *node,
GError **error);
+ char *(*to_xml)(OvirtResource *resource);
- gpointer padding[20];
+ gpointer padding[19];
};
GType ovirt_resource_get_type(void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]