summaryrefslogtreecommitdiff
path: root/src/glibext/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext/helpers.h')
-rw-r--r--src/glibext/helpers.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/glibext/helpers.h b/src/glibext/helpers.h
index 71a7269..04e51ad 100644
--- a/src/glibext/helpers.h
+++ b/src/glibext/helpers.h
@@ -90,6 +90,36 @@
/**
+ * Bis repetita pour les interfaces...
+ */
+
+#define DECLARE_INTERFACE(TN, t_n, MOD, NAME) \
+ \
+ GType t_n##_get_type(void) G_GNUC_CONST; \
+ \
+ /* Coquille vide */ \
+ typedef struct _##TN TN; \
+ /* Interface */ \
+ typedef struct _##TN##Interface TN##Interface; \
+ \
+ G_GNUC_UNUSED static inline TN *MOD##_##NAME(gconstpointer obj) \
+ { \
+ return G_TYPE_CHECK_INSTANCE_CAST(obj, MOD##_TYPE_##NAME, TN); \
+ } \
+ \
+ G_GNUC_UNUSED static inline gboolean MOD##_IS_##NAME(gconstpointer obj) \
+ { \
+ return G_TYPE_CHECK_INSTANCE_TYPE(obj, MOD##_TYPE_##NAME); \
+ } \
+ \
+ G_GNUC_UNUSED static inline TN##Interface *MOD##_##NAME##_GET_IFACE(gconstpointer obj) \
+ { \
+ return G_TYPE_INSTANCE_GET_INTERFACE(obj, MOD##_TYPE_##NAME, TN##Interface); \
+ }
+
+
+
+/**
* Les principales fonctions incrémentant ou réduisant le nombre de références
* attachées à un objet acceptent de simples pointeurs génériques (cf. définitions
* du fichier <glib-2.80>/gobject/gobject.h :
@@ -143,7 +173,7 @@
assert(__inst != NULL); \
g_object_ref(ip); \
} \
- while (0);
+ while (0)
# define unref_object(ip) \
do \
@@ -153,7 +183,7 @@
assert(__inst != NULL); \
g_object_unref(ip); \
} \
- while (0);
+ while (0)
#else