コード例 #1
0
/**
 * g_interface_info_find_method:
 * @info: a #GIInterfaceInfo
 * @name: name of method to obtain
 *
 * Obtain a method of the interface type given a @name. %NULL will be
 * returned if there's no method available with that name.
 *
 * Returns: (transfer full): the #GIFunctionInfo or %NULL if none found.
 * Free the struct by calling g_base_info_unref() when done.
 */
GIFunctionInfo *
g_interface_info_find_method (GIInterfaceInfo *info,
                              const gchar     *name)
{
    gint offset;
    GIRealInfo *rinfo = (GIRealInfo *)info;
    Header *header = (Header *)rinfo->typelib->data;
    InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];

    offset = rinfo->offset + header->interface_blob_size
             + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
             + blob->n_properties * header->property_blob_size;

    return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
}
コード例 #2
0
/**
 * g_object_info_find_method:
 * @info: a #GIObjectInfo
 * @name: name of method to obtain
 *
 * Obtain a method of the object type given a @name. %NULL will be
 * returned if there's no method available with that name.
 *
 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
 * g_base_info_unref() when done.
 */
GIFunctionInfo *
g_object_info_find_method (GIObjectInfo *info,
			   const gchar  *name)
{
  gint offset;
  GIRealInfo *rinfo = (GIRealInfo *)info;
  Header *header;
  ObjectBlob *blob;

  g_return_val_if_fail (info != NULL, 0);
  g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);

  header = (Header *)rinfo->typelib->data;
  blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];

  offset = g_object_info_get_field_offset(info, blob->n_fields)
    + blob->n_properties * header->property_blob_size;

  return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
}