[libvirt-glib PATCHv3 01/27] Add gobject boilerplate for GVirConfigDomain{Clock, Timer}

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

 



--
v3: rename from GVirConfig* to GVirConfigDomain*
---
 libvirt-gconfig/Makefile.am                    |    4 +
 libvirt-gconfig/libvirt-gconfig-domain-clock.c |   81 ++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-clock.h |   68 ++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-timer.c |   81 ++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-timer.h |   68 ++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h              |    2 +
 libvirt-gconfig/libvirt-gconfig.sym            |    8 +++
 7 files changed, 312 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-clock.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-clock.h
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-timer.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-timer.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 52eff79..daa99b8 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -9,7 +9,9 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-object.h \
 			libvirt-gconfig-capabilities.h \
 			libvirt-gconfig-domain.h \
+			libvirt-gconfig-domain-clock.h \
 			libvirt-gconfig-domain-snapshot.h \
+			libvirt-gconfig-domain-timer.h \
 			libvirt-gconfig-helpers.h \
 			libvirt-gconfig-interface.h \
 			libvirt-gconfig-network.h \
@@ -25,7 +27,9 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-object.c \
 			libvirt-gconfig-capabilities.c \
 			libvirt-gconfig-domain.c \
+			libvirt-gconfig-domain-clock.c \
 			libvirt-gconfig-domain-snapshot.c \
+			libvirt-gconfig-domain-timer.c \
 			libvirt-gconfig-helpers.c \
 			libvirt-gconfig-interface.c \
 			libvirt-gconfig-network.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-clock.c b/libvirt-gconfig/libvirt-gconfig-domain-clock.c
new file mode 100644
index 0000000..6642742
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-clock.c
@@ -0,0 +1,81 @@
+/*
+ * libvirt-gobject-config-domain-clock.c: libvirt glib integration
+ *
+ * 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>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <libxml/tree.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_DOMAIN_CLOCK_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_CLOCK, GVirConfigDomainClockPrivate))
+
+struct _GVirConfigDomainClockPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainClock, gvir_config_domain_clock, GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_domain_clock_class_init(GVirConfigDomainClockClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainClockPrivate));
+}
+
+
+static void gvir_config_domain_clock_init(GVirConfigDomainClock *klock)
+{
+    GVirConfigDomainClockPrivate *priv;
+
+    DEBUG("Init GVirConfigDomainClock=%p", klock);
+
+    priv = klock->priv = GVIR_CONFIG_DOMAIN_CLOCK_GET_PRIVATE(klock);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigDomainClock *gvir_config_domain_clock_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_CLOCK,
+                                    "clock", NULL);
+    return GVIR_CONFIG_DOMAIN_CLOCK(object);
+}
+
+GVirConfigDomainClock *gvir_config_domain_clock_new_from_xml(const gchar *xml,
+                                                GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_CLOCK,
+                                             "clock", NULL, xml, error);
+    return GVIR_CONFIG_DOMAIN_CLOCK(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-clock.h b/libvirt-gconfig/libvirt-gconfig-domain-clock.h
new file mode 100644
index 0000000..7b22ff8
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-clock.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-domain-clock.h: libvirt gobject integration
+ *
+ * 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>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_CLOCK_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_CLOCK_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_CLOCK            (gvir_config_domain_clock_get_type ())
+#define GVIR_CONFIG_DOMAIN_CLOCK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_CLOCK, GVirConfigDomainClock))
+#define GVIR_CONFIG_DOMAIN_CLOCK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_CLOCK, GVirConfigDomainClockClass))
+#define GVIR_IS_CONFIG_DOMAIN_CLOCK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_CLOCK))
+#define GVIR_IS_CONFIG_DOMAIN_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_CLOCK))
+#define GVIR_CONFIG_DOMAIN_CLOCK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_CLOCK, GVirConfigDomainClockClass))
+
+typedef struct _GVirConfigDomainClock GVirConfigDomainClock;
+typedef struct _GVirConfigDomainClockPrivate GVirConfigDomainClockPrivate;
+typedef struct _GVirConfigDomainClockClass GVirConfigDomainClockClass;
+
+struct _GVirConfigDomainClock
+{
+    GVirConfigObject parent;
+
+    GVirConfigDomainClockPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainClockClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_domain_clock_get_type(void);
+
+GVirConfigDomainClock *gvir_config_domain_clock_new(void);
+GVirConfigDomainClock *gvir_config_domain_clock_new_from_xml(const gchar *xml,
+                                                GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_CLOCK_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.c b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
new file mode 100644
index 0000000..179d8b2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
@@ -0,0 +1,81 @@
+/*
+ * libvirt-gobject-config-domain-timer.c: libvirt glib integration
+ *
+ * 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@xxxxxxxxx>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <libxml/tree.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_TIMER, GVirConfigDomainTimerPrivate))
+
+struct _GVirConfigDomainTimerPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainTimer, gvir_config_domain_timer, GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_domain_timer_class_init(GVirConfigDomainTimerClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainTimerPrivate));
+}
+
+
+static void gvir_config_domain_timer_init(GVirConfigDomainTimer *timer)
+{
+    GVirConfigDomainTimerPrivate *priv;
+
+    DEBUG("Init GVirConfigDomainTimer=%p", timer);
+
+    priv = timer->priv = GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(timer);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigDomainTimer *gvir_config_domain_timer_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_TIMER, "timer", NULL);
+    return GVIR_CONFIG_DOMAIN_TIMER(object);
+}
+
+
+GVirConfigDomainTimer *gvir_config_domain_timer_new_from_xml(const gchar *xml,
+                                                GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_TIMER,
+                                             "timer", NULL, xml, error);
+    return GVIR_CONFIG_DOMAIN_TIMER(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.h b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
new file mode 100644
index 0000000..147913f
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-domain-timer.c: libvirt gobject integration
+ *
+ * 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@xxxxxxxxx>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_TIMER_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_TIMER_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_TIMER            (gvir_config_domain_timer_get_type ())
+#define GVIR_CONFIG_DOMAIN_TIMER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_TIMER, GVirConfigDomainTimer))
+#define GVIR_CONFIG_DOMAIN_TIMER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_TIMER, GVirConfigDomainTimerClass))
+#define GVIR_IS_CONFIG_DOMAIN_TIMER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_TIMER))
+#define GVIR_IS_CONFIG_DOMAIN_TIMER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_TIMER))
+#define GVIR_CONFIG_DOMAIN_TIMER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_TIMER, GVirConfigDomainTimerClass))
+
+typedef struct _GVirConfigDomainTimer GVirConfigDomainTimer;
+typedef struct _GVirConfigDomainTimerPrivate GVirConfigDomainTimerPrivate;
+typedef struct _GVirConfigDomainTimerClass GVirConfigDomainTimerClass;
+
+struct _GVirConfigDomainTimer
+{
+    GVirConfigObject parent;
+
+    GVirConfigDomainTimerPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainTimerClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_domain_timer_get_type(void);
+
+GVirConfigDomainTimer *gvir_config_domain_timer_new(void);
+GVirConfigDomainTimer *gvir_config_domain_timer_new_from_xml(const gchar *xml,
+                                                      GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_TIMER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 4e23f0d..9656f32 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -29,7 +29,9 @@
 #include <libvirt-gconfig/libvirt-gconfig-object.h>
 #include <libvirt-gconfig/libvirt-gconfig-capabilities.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-clock.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-timer.h>
 #include <libvirt-gconfig/libvirt-gconfig-helpers.h>
 #include <libvirt-gconfig/libvirt-gconfig-interface.h>
 #include <libvirt-gconfig/libvirt-gconfig-network.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 4764fef..9d779b5 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -14,10 +14,18 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_domain_get_name;
 	gvir_config_domain_set_name;
 
+	gvir_config_domain_clock_get_type;
+	gvir_config_domain_clock_new;
+	gvir_config_domain_clock_new_from_xml;
+
 	gvir_config_domain_snapshot_get_type;
 	gvir_config_domain_snapshot_new;
 	gvir_config_domain_snapshot_new_from_xml;
 
+	gvir_config_domain_timer_get_type;
+	gvir_config_domain_timer_new;
+	gvir_config_domain_timer_new_from_xml;
+
 	gvir_config_interface_get_type;
 	gvir_config_interface_new;
 	gvir_config_interface_new_from_xml;
-- 
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]