summaryrefslogtreecommitdiff
path: root/gobject/gtype.h
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-17 15:11:00 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-17 15:11:00 +0100
commit41383b303c0bb54da68bbf5500b5e2d9e552ab69 (patch)
treef82c28a2ff4c3bd63b269f50504cea3b300469b2 /gobject/gtype.h
parent2295ba857f09fa58c6e61ec4147536021055bbf6 (diff)
downloadglib-41383b303c0bb54da68bbf5500b5e2d9e552ab69.tar.gz
Bug 612502 - Add support for class private data
This adds the two new functions g_type_add_class_private() and g_type_class_get_private() and a convenience macro for the getter G_TYPE_CLASS_GET_PRIVATE().
Diffstat (limited to 'gobject/gtype.h')
-rw-r--r--gobject/gtype.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/gobject/gtype.h b/gobject/gtype.h
index 3c7f6e5d9..33a4a8b22 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -606,6 +606,22 @@ struct _GTypeQuery
*/
#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))
+/**
+ * G_TYPE_CLASS_GET_PRIVATE:
+ * @klass: the class of a type deriving from @private_type.
+ * @g_type: the type identifying which private data to retrieve.
+ * @c_type: The C type for the private structure.
+ *
+ * Gets the private class structure for a particular type.
+ * The private structure must have been registered in the
+ * get_type() function with g_type_add_class_private().
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Since: 2.24
+ * Returns: a pointer to the private data structure.
+ */
+#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type)))
/**
* GTypeDebugFlags:
@@ -1218,6 +1234,11 @@ void g_type_class_add_private (gpointer g_class,
gpointer g_type_instance_get_private (GTypeInstance *instance,
GType private_type);
+void g_type_add_class_private (GType class_type,
+ gsize private_size);
+gpointer g_type_class_get_private (GTypeClass *klass,
+ GType private_type);
+
/* --- GType boilerplate --- */
/**