[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-glib v3 1/5] gconfig: Add gvir_config_object_has_child



---
 libvirt-gconfig/libvirt-gconfig-object-private.h |  2 ++
 libvirt-gconfig/libvirt-gconfig-object.c         | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index e91c4ef..7a0d21f 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -117,6 +117,8 @@ GVirConfigObject *gvir_config_object_get_child(GVirConfigObject *object,
 GVirConfigObject *gvir_config_object_get_child_with_type(GVirConfigObject *object,
                                                          const gchar *child_name,
                                                          GType child_type);
+gboolean gvir_config_object_has_child(GVirConfigObject *object,
+                                      const gchar *child_name);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index bf328f3..6225de2 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -970,3 +970,16 @@ gvir_config_object_get_child(GVirConfigObject *object,
                                                   child_name,
                                                   GVIR_CONFIG_TYPE_OBJECT);
 }
+
+G_GNUC_INTERNAL gboolean
+gvir_config_object_has_child(GVirConfigObject *object, const gchar *child_name)
+{
+    xmlNodePtr node;
+
+    g_return_val_if_fail(GVIR_CONFIG_IS_OBJECT(object), FALSE);
+    g_return_val_if_fail(child_name != NULL, FALSE);
+
+    node = gvir_config_xml_get_element(object->priv->node, child_name, NULL);
+
+    return (node != NULL);
+}
-- 
2.5.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]