Add g_type_interface_prerequisites.

This commit is contained in:
Matthias Clasen 2002-10-15 21:16:20 +00:00
parent f861d72bb2
commit 1565a2027e
5 changed files with 58 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2002-10-15 Matthias Clasen <maclas@gmx.de>
* gobject/gobject-sections.txt: Add g_type_interface_prerequisites.
2002-10-14 Matthias Clasen <maclas@gmx.de>
* gobject/Makefile.am (dist-hook):

View File

@ -55,6 +55,7 @@ g_type_interface_peek
g_type_interface_peek_parent
g_type_children
g_type_interfaces
g_type_interface_prerequisites
g_type_set_qdata
g_type_get_qdata
g_type_query

View File

@ -1,3 +1,8 @@
2002-10-15 Matthias Clasen <maclas@gmx.de>
* gtype.c (g_type_interface_prerequisites): New function to obtain
the prerequisites of an interface type.
Sat Oct 12 22:02:32 2002 Tim Janik <timj@gtk.org>
* merged up from 2.0:

View File

@ -1220,6 +1220,52 @@ g_type_interface_add_prerequisite (GType interface_type,
}
}
/**
* g_type_interface_prerequisites:
* @interface_type: an interface type
* @n_prerequisites: location to return the number of prerequisites, or %NULL
*
* Returns the prerequisites of an interfaces type.
*
* Return value: a newly-allocated zero-terminated array of #GType containing
* the prerequisites of @interface_type
**/
GType* /* free result */
g_type_interface_prerequisites (GType interface_type,
guint *n_prerequisites)
{
TypeNode *iface;
g_return_val_if_fail (G_TYPE_IS_INTERFACE (interface_type), NULL);
iface = lookup_type_node_I (interface_type);
if (iface)
{
GType *prerequisites;
guint i;
G_READ_LOCK (&type_rw_lock);
prerequisites = g_new (GType, IFACE_NODE_N_PREREQUISITES (iface) + 1);
for (i = 0; i < IFACE_NODE_N_PREREQUISITES (iface); i++)
prerequisites[i] = IFACE_NODE_PREREQUISITES (iface)[i];
prerequisites[i] = 0;
if (n_prerequisites)
*n_prerequisites = IFACE_NODE_N_PREREQUISITES (iface);
G_READ_UNLOCK (&type_rw_lock);
return prerequisites;
}
else
{
if (n_prerequisites)
*n_prerequisites = 0;
return NULL;
}
}
static IFaceHolder*
type_iface_peek_holder_L (TypeNode *iface,
GType instance_type)

View File

@ -295,6 +295,8 @@ void g_type_add_interface_dynamic (GType instance_type,
GTypePlugin *plugin);
void g_type_interface_add_prerequisite (GType interface_type,
GType prerequisite_type);
GType *g_type_interface_prerequisites (GType interface_type,
guint *n_prerequisites);
/* --- protected (for fundamental type implementations) --- */