[libvirt-gconfig PATCHv2 03/32] Make some GVirConfigObject helpers private

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

 



At this point, I'm not sure how/if the library user should be able
to directly manipulate the XML data wrapped by a GVirConfigObject.
It's preferrable to hide this API from the user until we have a
clearer idea how to expose it.
---
 libvirt-gconfig/Makefile.am                      |    3 +-
 libvirt-gconfig/libvirt-gconfig-domain.c         |    1 +
 libvirt-gconfig/libvirt-gconfig-object-private.h |   41 ++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-object.c         |   28 +++++++++------
 libvirt-gconfig/libvirt-gconfig-object.h         |   11 ------
 libvirt-gconfig/libvirt-gconfig.sym              |    1 -
 6 files changed, 61 insertions(+), 24 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-object-private.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 0d15e78..52eff79 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -19,7 +19,8 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-storage-pool.h \
 			libvirt-gconfig-storage-vol.h
 noinst_HEADERS = \
-			libvirt-gconfig-helpers-private.h
+			libvirt-gconfig-helpers-private.h \
+			libvirt-gconfig-object-private.h
 GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-object.c \
 			libvirt-gconfig-capabilities.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 3290389..d971a95 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -27,6 +27,7 @@
 
 #include "libvirt-gconfig/libvirt-gconfig.h"
 #include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
+#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
 
 extern gboolean debugFlag;
 
diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
new file mode 100644
index 0000000..aec88bf
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -0,0 +1,41 @@
+/*
+ * libvirt-gconfig-config-object-private.h: base object for XML configuration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau@xxxxxxxxxx>
+ */
+#ifndef __LIBVIRT_GCONFIG_OBJECT_PRIVATE_H__
+#define __LIBVIRT_GCONFIG_OBJECT_PRIVATE_H__
+
+G_BEGIN_DECLS
+
+xmlNodePtr gvir_config_object_get_xml_node(GVirConfigObject *config);
+char *gvir_config_object_get_node_content(GVirConfigObject *object,
+                                          const char *node_name);
+guint64 gvir_config_object_get_node_content_uint64(GVirConfigObject *object,
+                                                   const char *node_name);
+void gvir_config_object_set_node_content(GVirConfigObject *object,
+                                         const char *node_name,
+                                         const char *value);
+void gvir_config_object_set_node_content_uint64(GVirConfigObject *object,
+                                                const char *node_name,
+                                                guint64 value);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_OBJECT_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index fbdbedd..276be8c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -29,6 +29,7 @@
 
 #include "libvirt-gconfig/libvirt-gconfig.h"
 #include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
+#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
 
 
 //extern gboolean debugFlag;
@@ -277,13 +278,15 @@ const gchar *gvir_config_object_get_schema(GVirConfigObject *config)
 /* FIXME: will we always have one xmlNode per GConfig object? */
 /* FIXME: need to return the right node from subclasses */
 /* NB: the xmlNodePtr must not be freed by the caller */
-xmlNodePtr gvir_config_object_get_xml_node(GVirConfigObject *config)
+G_GNUC_INTERNAL xmlNodePtr
+gvir_config_object_get_xml_node(GVirConfigObject *config)
 {
     return config->priv->node;
 }
 
-char *gvir_config_object_get_node_content(GVirConfigObject *object,
-                                          const char *node_name)
+G_GNUC_INTERNAL char *
+gvir_config_object_get_node_content(GVirConfigObject *object,
+                                    const char *node_name)
 {
     xmlNodePtr node;
 
@@ -298,9 +301,10 @@ char *gvir_config_object_get_node_content(GVirConfigObject *object,
  * won't behave as expected. Should we get rid of the duplicated node names
  * here?
  */
-void gvir_config_object_set_node_content(GVirConfigObject *object,
-                                         const char *node_name,
-                                         const char *value)
+G_GNUC_INTERNAL void
+gvir_config_object_set_node_content(GVirConfigObject *object,
+                                    const char *node_name,
+                                    const char *value)
 {
     xmlNodePtr parent_node;
     xmlNodePtr old_node;
@@ -324,8 +328,9 @@ void gvir_config_object_set_node_content(GVirConfigObject *object,
 }
 
 /* FIXME: how to notify of errors/node not found? */
-guint64 gvir_config_object_get_node_content_uint64(GVirConfigObject *object,
-                                                   const char *node_name)
+G_GNUC_INTERNAL guint64
+gvir_config_object_get_node_content_uint64(GVirConfigObject *object,
+                                           const char *node_name)
 {
     xmlNodePtr node;
     xmlChar *str;
@@ -346,9 +351,10 @@ guint64 gvir_config_object_get_node_content_uint64(GVirConfigObject *object,
 }
 
 
-void gvir_config_object_set_node_content_uint64(GVirConfigObject *object,
-                                                const char *node_name,
-                                                guint64 value)
+G_GNUC_INTERNAL void
+gvir_config_object_set_node_content_uint64(GVirConfigObject *object,
+                                           const char *node_name,
+                                           guint64 value)
 {
     char *str;
     str = g_strdup_printf("%"G_GUINT64_FORMAT, value);
diff --git a/libvirt-gconfig/libvirt-gconfig-object.h b/libvirt-gconfig/libvirt-gconfig-object.h
index bac3403..ef87668 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.h
+++ b/libvirt-gconfig/libvirt-gconfig-object.h
@@ -73,17 +73,6 @@ void gvir_config_object_validate(GVirConfigObject *config,
 gchar *gvir_config_object_to_xml(GVirConfigObject *config);
 
 const gchar *gvir_config_object_get_schema(GVirConfigObject *config);
-xmlNodePtr gvir_config_object_get_xml_node(GVirConfigObject *config);
-char *gvir_config_object_get_node_content(GVirConfigObject *object,
-                                          const char *node_name);
-guint64 gvir_config_object_get_node_content_uint64(GVirConfigObject *object,
-                                                   const char *node_name);
-void gvir_config_object_set_node_content(GVirConfigObject *object,
-                                         const char *node_name,
-                                         const char *value);
-void gvir_config_object_set_node_content_uint64(GVirConfigObject *object,
-                                                const char *node_name,
-                                                guint64 value);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index ed28449..4764fef 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -38,7 +38,6 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_object_error_quark;
 	gvir_config_object_new;
 	gvir_config_object_get_schema;
-	gvir_config_object_get_xml_node;
 	gvir_config_object_to_xml;
 	gvir_config_object_validate;
 
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]