gtype introspection



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 ?

Matthias


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]