Re: gtype introspection



Matthias Clasen <maclas gmx de> writes:

> I'm currently looking into making gtk-doc emit more information about
> the type hierarchy and found that some things are simply not available
> at all. E.g. there seems to be no way to find the prerequisites of an
> interface. Ok to add the following ?

Looks fine to me. I wouldn't necessarily name it or design
it this way on its own, but it does look like you've done it
in the way that is most consistent with what is already there.
(g_type_children(), g_type_interface_peek_parent()).

Regards,
                                        Owen

> 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;
>     }
> }



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