mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
[girepository] Split out GIBaseInfo
Split out GIBaseInfo to a separate source file. Move out definitions to gibaseinfo.h/gitypelib.h/gitypes.h and girepository-private.h Install gibaseinfo.h/gitypelib.h and gitypes.h as well, but require users to include girepository.h
This commit is contained in:
parent
7a383b6126
commit
67126e38d4
@ -1,5 +1,10 @@
|
|||||||
girepodir = $(includedir)/gobject-introspection-1.0/
|
girepodir = $(includedir)/gobject-introspection-1.0/
|
||||||
girepo_HEADERS = girepository.h girffi.h
|
girepo_HEADERS = \
|
||||||
|
gibaseinfo.h \
|
||||||
|
girepository.h \
|
||||||
|
girffi.h \
|
||||||
|
gitypelib.h \
|
||||||
|
gitypes.h
|
||||||
|
|
||||||
lib_LTLIBRARIES = libgirepository-1.0.la
|
lib_LTLIBRARIES = libgirepository-1.0.la
|
||||||
noinst_LTLIBRARIES = libgirepository-parser.la
|
noinst_LTLIBRARIES = libgirepository-parser.la
|
||||||
@ -7,10 +12,12 @@ noinst_LTLIBRARIES = libgirepository-parser.la
|
|||||||
libgirepository_1_0_la_SOURCES = \
|
libgirepository_1_0_la_SOURCES = \
|
||||||
gdump.c \
|
gdump.c \
|
||||||
gfield.c \
|
gfield.c \
|
||||||
|
gibaseinfo.c \
|
||||||
ginfo.c \
|
ginfo.c \
|
||||||
ginfo.h \
|
ginfo.h \
|
||||||
ginvoke.c \
|
ginvoke.c \
|
||||||
girepository.c \
|
girepository.c \
|
||||||
|
girepository-private.h \
|
||||||
girffi.c \
|
girffi.c \
|
||||||
girffi.h \
|
girffi.h \
|
||||||
girffi-private.h \
|
girffi-private.h \
|
||||||
|
591
gibaseinfo.c
Normal file
591
gibaseinfo.c
Normal file
@ -0,0 +1,591 @@
|
|||||||
|
/* GObject introspection: Repository implementation
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "gtypelib.h"
|
||||||
|
#include "ginfo.h"
|
||||||
|
#include "girepository-private.h"
|
||||||
|
|
||||||
|
#define INVALID_REFCOUNT 0x7FFFFFFF
|
||||||
|
|
||||||
|
/* info creation */
|
||||||
|
GIBaseInfo *
|
||||||
|
g_info_new_full (GIInfoType type,
|
||||||
|
GIRepository *repository,
|
||||||
|
GIBaseInfo *container,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint32 offset)
|
||||||
|
{
|
||||||
|
GIRealInfo *info;
|
||||||
|
|
||||||
|
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
|
||||||
|
|
||||||
|
info = g_slice_new (GIRealInfo);
|
||||||
|
|
||||||
|
_g_info_init (info, type, repository, container, typelib, offset);
|
||||||
|
info->ref_count = 1;
|
||||||
|
|
||||||
|
if (container && ((GIRealInfo *) container)->ref_count != INVALID_REFCOUNT)
|
||||||
|
g_base_info_ref (info->container);
|
||||||
|
|
||||||
|
g_object_ref (info->repository);
|
||||||
|
|
||||||
|
return (GIBaseInfo*)info;
|
||||||
|
}
|
||||||
|
|
||||||
|
GIBaseInfo *
|
||||||
|
g_info_new (GIInfoType type,
|
||||||
|
GIBaseInfo *container,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint32 offset)
|
||||||
|
{
|
||||||
|
return g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_g_info_init (GIRealInfo *info,
|
||||||
|
GIInfoType type,
|
||||||
|
GIRepository *repository,
|
||||||
|
GIBaseInfo *container,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint32 offset)
|
||||||
|
{
|
||||||
|
memset (info, 0, sizeof (GIRealInfo));
|
||||||
|
|
||||||
|
/* Invalid refcount used to flag stack-allocated infos */
|
||||||
|
info->ref_count = INVALID_REFCOUNT;
|
||||||
|
info->type = type;
|
||||||
|
|
||||||
|
info->typelib = typelib;
|
||||||
|
info->offset = offset;
|
||||||
|
|
||||||
|
if (container)
|
||||||
|
info->container = container;
|
||||||
|
|
||||||
|
g_assert (G_IS_IREPOSITORY (repository));
|
||||||
|
info->repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
GIBaseInfo *
|
||||||
|
_g_info_from_entry (GIRepository *repository,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint16 index)
|
||||||
|
{
|
||||||
|
GIBaseInfo *result;
|
||||||
|
DirEntry *entry = g_typelib_get_dir_entry (typelib, index);
|
||||||
|
|
||||||
|
if (entry->local)
|
||||||
|
result = g_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const gchar *namespace = g_typelib_get_string (typelib, entry->offset);
|
||||||
|
const gchar *name = g_typelib_get_string (typelib, entry->name);
|
||||||
|
|
||||||
|
result = g_irepository_find_by_name (repository, namespace, name);
|
||||||
|
if (result == NULL)
|
||||||
|
{
|
||||||
|
GIUnresolvedInfo *unresolved;
|
||||||
|
|
||||||
|
unresolved = g_slice_new0 (GIUnresolvedInfo);
|
||||||
|
|
||||||
|
unresolved->type = GI_INFO_TYPE_UNRESOLVED;
|
||||||
|
unresolved->ref_count = 1;
|
||||||
|
unresolved->repository = g_object_ref (repository);
|
||||||
|
unresolved->container = NULL;
|
||||||
|
unresolved->name = name;
|
||||||
|
unresolved->namespace = namespace;
|
||||||
|
|
||||||
|
return (GIBaseInfo *)unresolved;
|
||||||
|
}
|
||||||
|
return (GIBaseInfo *)result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GIBaseInfo *)result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GIBaseInfo functions */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:gibaseinfo
|
||||||
|
* @Short_description: Base struct for all GTypelib structs
|
||||||
|
* @Title: GIBaseInfo
|
||||||
|
*
|
||||||
|
* GIBaseInfo is the common base struct of all other *Info structs
|
||||||
|
* accessible through the #GIRepository API.
|
||||||
|
* All other structs can be casted to a #GIBaseInfo, for instance:
|
||||||
|
* <example>
|
||||||
|
* <title>Casting a #GIFunctionInfo to #GIBaseInfo</title>
|
||||||
|
* <programlisting>
|
||||||
|
* GIFunctionInfo *function_info = ...;
|
||||||
|
* GIBaseInfo *info = (GIBaseInfo*)function_info;
|
||||||
|
* </programlisting>
|
||||||
|
* </example>
|
||||||
|
* Most #GIRepository APIs returning a #GIBaseInfo is actually creating a new struct, in other
|
||||||
|
* words, g_base_info_unref() has to be called when done accessing the data.
|
||||||
|
* GIBaseInfos are normally accessed by calling either
|
||||||
|
* g_irepository_find_by_name(), g_irepository_find_by_gtype() or g_irepository_get_info().
|
||||||
|
*
|
||||||
|
* <example>
|
||||||
|
* <title>Getting the Button of the Gtk typelib</title>
|
||||||
|
* <programlisting>
|
||||||
|
* GIBaseInfo *button_info = g_irepository_find_by_name(NULL, "Gtk", "Button");
|
||||||
|
* ... use button_info ...
|
||||||
|
* g_base_info_unref(button_info);
|
||||||
|
* </programlisting>
|
||||||
|
* </example>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_ref:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Increases the reference count of @info.
|
||||||
|
*
|
||||||
|
* Returns: the same @info.
|
||||||
|
*/
|
||||||
|
GIBaseInfo *
|
||||||
|
g_base_info_ref (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
|
|
||||||
|
g_assert (rinfo->ref_count != INVALID_REFCOUNT);
|
||||||
|
((GIRealInfo*)info)->ref_count++;
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_unref:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Decreases the reference count of @info. When its reference count
|
||||||
|
* drops to 0, the info is freed.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
g_base_info_unref (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
|
|
||||||
|
g_assert (rinfo->ref_count > 0 && rinfo->ref_count != INVALID_REFCOUNT);
|
||||||
|
rinfo->ref_count--;
|
||||||
|
|
||||||
|
if (!rinfo->ref_count)
|
||||||
|
{
|
||||||
|
if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT)
|
||||||
|
g_base_info_unref (rinfo->container);
|
||||||
|
|
||||||
|
if (rinfo->repository)
|
||||||
|
g_object_unref (rinfo->repository);
|
||||||
|
|
||||||
|
g_slice_free (GIRealInfo, rinfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_get_type:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Obtain the info type of the GIBaseInfo.
|
||||||
|
*
|
||||||
|
* Returns: the info type of @info
|
||||||
|
*/
|
||||||
|
GIInfoType
|
||||||
|
g_base_info_get_type (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
|
||||||
|
return ((GIRealInfo*)info)->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_get_name:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Obtain the name of the @info. What the name represents depends on
|
||||||
|
* the #GIInfoType of the @info. For instance for #GIFunctionInfo it is
|
||||||
|
* the name of the function.
|
||||||
|
*
|
||||||
|
* Returns: the name of @info or %NULL if it lacks a name.
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
g_base_info_get_name (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
|
g_assert (rinfo->ref_count > 0);
|
||||||
|
switch (rinfo->type)
|
||||||
|
{
|
||||||
|
case GI_INFO_TYPE_FUNCTION:
|
||||||
|
case GI_INFO_TYPE_CALLBACK:
|
||||||
|
case GI_INFO_TYPE_STRUCT:
|
||||||
|
case GI_INFO_TYPE_BOXED:
|
||||||
|
case GI_INFO_TYPE_ENUM:
|
||||||
|
case GI_INFO_TYPE_FLAGS:
|
||||||
|
case GI_INFO_TYPE_OBJECT:
|
||||||
|
case GI_INFO_TYPE_INTERFACE:
|
||||||
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
|
case GI_INFO_TYPE_ERROR_DOMAIN:
|
||||||
|
case GI_INFO_TYPE_UNION:
|
||||||
|
{
|
||||||
|
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_VALUE:
|
||||||
|
{
|
||||||
|
ValueBlob *blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_SIGNAL:
|
||||||
|
{
|
||||||
|
SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_PROPERTY:
|
||||||
|
{
|
||||||
|
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_VFUNC:
|
||||||
|
{
|
||||||
|
VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_FIELD:
|
||||||
|
{
|
||||||
|
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_ARG:
|
||||||
|
{
|
||||||
|
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GI_INFO_TYPE_UNRESOLVED:
|
||||||
|
{
|
||||||
|
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
|
||||||
|
|
||||||
|
return unresolved->name;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GI_INFO_TYPE_TYPE:
|
||||||
|
default: ;
|
||||||
|
g_assert_not_reached ();
|
||||||
|
/* unnamed */
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_get_namespace:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Obtain the namespace of @info.
|
||||||
|
*
|
||||||
|
* Returns: the namespace
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
g_base_info_get_namespace (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo*) info;
|
||||||
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
|
||||||
|
g_assert (rinfo->ref_count > 0);
|
||||||
|
|
||||||
|
if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
|
||||||
|
{
|
||||||
|
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
|
||||||
|
|
||||||
|
return unresolved->namespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_typelib_get_string (rinfo->typelib, header->namespace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_is_deprecated:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Obtain whether the @info is represents a metadata which is
|
||||||
|
* deprecated or not.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if deprecated
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
g_base_info_is_deprecated (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo*) info;
|
||||||
|
switch (rinfo->type)
|
||||||
|
{
|
||||||
|
case GI_INFO_TYPE_FUNCTION:
|
||||||
|
case GI_INFO_TYPE_CALLBACK:
|
||||||
|
case GI_INFO_TYPE_STRUCT:
|
||||||
|
case GI_INFO_TYPE_BOXED:
|
||||||
|
case GI_INFO_TYPE_ENUM:
|
||||||
|
case GI_INFO_TYPE_FLAGS:
|
||||||
|
case GI_INFO_TYPE_OBJECT:
|
||||||
|
case GI_INFO_TYPE_INTERFACE:
|
||||||
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
|
case GI_INFO_TYPE_ERROR_DOMAIN:
|
||||||
|
{
|
||||||
|
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return blob->deprecated;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_VALUE:
|
||||||
|
{
|
||||||
|
ValueBlob *blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return blob->deprecated;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_SIGNAL:
|
||||||
|
{
|
||||||
|
SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return blob->deprecated;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_PROPERTY:
|
||||||
|
{
|
||||||
|
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
return blob->deprecated;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GI_INFO_TYPE_VFUNC:
|
||||||
|
case GI_INFO_TYPE_FIELD:
|
||||||
|
case GI_INFO_TYPE_ARG:
|
||||||
|
case GI_INFO_TYPE_TYPE:
|
||||||
|
default: ;
|
||||||
|
/* no deprecation flag for these */
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_get_attribute:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
* @name: a freeform string naming an attribute
|
||||||
|
*
|
||||||
|
* Retrieve an arbitrary attribute associated with this node.
|
||||||
|
*
|
||||||
|
* Returns: The value of the attribute, or %NULL if no such attribute exists
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
g_base_info_get_attribute (GIBaseInfo *info,
|
||||||
|
const gchar *name)
|
||||||
|
{
|
||||||
|
GIAttributeIter iter = { 0, };
|
||||||
|
gchar *curname, *curvalue;
|
||||||
|
while (g_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
|
||||||
|
{
|
||||||
|
if (strcmp (name, curname) == 0)
|
||||||
|
return (const gchar*) curvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cmp_attribute (const void *av,
|
||||||
|
const void *bv)
|
||||||
|
{
|
||||||
|
const AttributeBlob *a = av;
|
||||||
|
const AttributeBlob *b = bv;
|
||||||
|
|
||||||
|
if (a->offset < b->offset)
|
||||||
|
return -1;
|
||||||
|
else if (a->offset == b->offset)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AttributeBlob *
|
||||||
|
find_first_attribute (GIRealInfo *rinfo)
|
||||||
|
{
|
||||||
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
AttributeBlob blob, *first, *res, *previous;
|
||||||
|
|
||||||
|
blob.offset = rinfo->offset;
|
||||||
|
|
||||||
|
first = (AttributeBlob *) &rinfo->typelib->data[header->attributes];
|
||||||
|
|
||||||
|
res = bsearch (&blob, first, header->n_attributes,
|
||||||
|
header->attribute_blob_size, cmp_attribute);
|
||||||
|
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
previous = res - 1;
|
||||||
|
while (previous >= first && previous->offset == rinfo->offset)
|
||||||
|
{
|
||||||
|
res = previous;
|
||||||
|
previous = res - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_iterate_attributes:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
* @iterator: a #GIAttributeIter structure, must be initialized; see below
|
||||||
|
* @name: (out) (transfer none): Returned name, must not be freed
|
||||||
|
* @value: (out) (transfer none): Returned name, must not be freed
|
||||||
|
*
|
||||||
|
* Iterate over all attributes associated with this node. The iterator
|
||||||
|
* structure is typically stack allocated, and must have its first
|
||||||
|
* member initialized to %NULL.
|
||||||
|
*
|
||||||
|
* Both the @name and @value should be treated as constants
|
||||||
|
* and must not be freed.
|
||||||
|
*
|
||||||
|
* <example>
|
||||||
|
* <title>Iterating over attributes</title>
|
||||||
|
* <programlisting>
|
||||||
|
* void
|
||||||
|
* print_attributes (GIBaseInfo *info)
|
||||||
|
* {
|
||||||
|
* GIAttributeIter iter = { 0, };
|
||||||
|
* char *name;
|
||||||
|
* char *value;
|
||||||
|
* while (g_base_info_iterate_attributes (info, &iter, &name, &value))
|
||||||
|
* {
|
||||||
|
* g_print ("attribute name: %s value: %s", name, value);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* </programlisting>
|
||||||
|
* </example>
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if there are more attributes
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
g_base_info_iterate_attributes (GIBaseInfo *info,
|
||||||
|
GIAttributeIter *iterator,
|
||||||
|
gchar **name,
|
||||||
|
gchar **value)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
AttributeBlob *next, *after;
|
||||||
|
|
||||||
|
after = (AttributeBlob *) &rinfo->typelib->data[header->attributes +
|
||||||
|
header->n_attributes * header->attribute_blob_size];
|
||||||
|
|
||||||
|
if (iterator->data != NULL)
|
||||||
|
next = (AttributeBlob *) iterator->data;
|
||||||
|
else
|
||||||
|
next = find_first_attribute (rinfo);
|
||||||
|
|
||||||
|
if (next == NULL || next->offset != rinfo->offset || next >= after)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
*name = (gchar*) g_typelib_get_string (rinfo->typelib, next->name);
|
||||||
|
*value = (gchar*) g_typelib_get_string (rinfo->typelib, next->value);
|
||||||
|
iterator->data = next + 1;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_get_container:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Obtain the container of the @info. The container is the parent
|
||||||
|
* GIBaseInfo. For instance, the parent of a #GIFunctionInfo is an
|
||||||
|
* #GIObjectInfo or #GIInterfaceInfo.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the container
|
||||||
|
*/
|
||||||
|
GIBaseInfo *
|
||||||
|
g_base_info_get_container (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
return ((GIRealInfo*)info)->container;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_get_typelib:
|
||||||
|
* @info: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Obtain the typelib this @info belongs to
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the typelib.
|
||||||
|
*/
|
||||||
|
GTypelib *
|
||||||
|
g_base_info_get_typelib (GIBaseInfo *info)
|
||||||
|
{
|
||||||
|
return ((GIRealInfo*)info)->typelib;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_base_info_equal:
|
||||||
|
* @info1: a #GIBaseInfo
|
||||||
|
* @info2: a #GIBaseInfo
|
||||||
|
*
|
||||||
|
* Compare two #GIBaseInfo.
|
||||||
|
*
|
||||||
|
* Using pointer comparison is not practical since many functions return
|
||||||
|
* different instances of #GIBaseInfo that refers to the same part of the
|
||||||
|
* TypeLib; use this function instead to do #GIBaseInfo comparisons.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if and only if @info1 equals @info2.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
g_base_info_equal (GIBaseInfo *info1, GIBaseInfo *info2)
|
||||||
|
{
|
||||||
|
/* Compare the TypeLib pointers, which are mmapped. */
|
||||||
|
GIRealInfo *rinfo1 = (GIRealInfo*)info1;
|
||||||
|
GIRealInfo *rinfo2 = (GIRealInfo*)info2;
|
||||||
|
return rinfo1->typelib->data + rinfo1->offset == rinfo2->typelib->data + rinfo2->offset;
|
||||||
|
}
|
||||||
|
|
88
gibaseinfo.h
Normal file
88
gibaseinfo.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/* GObject introspection: GIBaseInfo
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIBASEINFO_H__
|
||||||
|
#define __GIBASEINFO_H__
|
||||||
|
|
||||||
|
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
|
||||||
|
#error "Only <girepository/girepository.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <girepository/gitypelib.h>
|
||||||
|
#include <girepository/gitypes.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
struct _GIBaseInfoStub {
|
||||||
|
/* <private> */
|
||||||
|
gint32 dummy1;
|
||||||
|
gint32 dummy2;
|
||||||
|
gpointer dummy3;
|
||||||
|
gpointer dummy4;
|
||||||
|
gpointer dummy5;
|
||||||
|
guint32 dummy6;
|
||||||
|
guint32 dummy7;
|
||||||
|
gpointer padding[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* GIBaseInfo */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIAttributeIter:
|
||||||
|
*
|
||||||
|
* An opaque structure used to iterate over attributes
|
||||||
|
* in a #GIBaseInfo struct.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
/* <private> */
|
||||||
|
gpointer data;
|
||||||
|
gpointer data2;
|
||||||
|
gpointer data3;
|
||||||
|
gpointer data4;
|
||||||
|
} GIAttributeIter;
|
||||||
|
|
||||||
|
GIBaseInfo * g_base_info_ref (GIBaseInfo *info);
|
||||||
|
void g_base_info_unref (GIBaseInfo *info);
|
||||||
|
GIInfoType g_base_info_get_type (GIBaseInfo *info);
|
||||||
|
const gchar * g_base_info_get_name (GIBaseInfo *info);
|
||||||
|
const gchar * g_base_info_get_namespace (GIBaseInfo *info);
|
||||||
|
gboolean g_base_info_is_deprecated (GIBaseInfo *info);
|
||||||
|
const gchar * g_base_info_get_attribute (GIBaseInfo *info,
|
||||||
|
const gchar *name);
|
||||||
|
gboolean g_base_info_iterate_attributes (GIBaseInfo *info,
|
||||||
|
GIAttributeIter *iterator,
|
||||||
|
char **name,
|
||||||
|
char **value);
|
||||||
|
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
|
||||||
|
GTypelib * g_base_info_get_typelib (GIBaseInfo *info);
|
||||||
|
gboolean g_base_info_equal (GIBaseInfo *info1,
|
||||||
|
GIBaseInfo *info2);
|
||||||
|
GIBaseInfo * g_info_new (GIInfoType type,
|
||||||
|
GIBaseInfo *container,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint32 offset);
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GIBASEINFO_H__ */
|
||||||
|
|
622
ginfo.c
622
ginfo.c
@ -27,607 +27,7 @@
|
|||||||
|
|
||||||
#include "gtypelib.h"
|
#include "gtypelib.h"
|
||||||
#include "ginfo.h"
|
#include "ginfo.h"
|
||||||
|
#include "girepository-private.h"
|
||||||
typedef struct _GIRealInfo GIRealInfo;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We just use one structure for all of the info object
|
|
||||||
* types; in general, we should be reading data directly
|
|
||||||
* from the typelib, and not having computed data in
|
|
||||||
* per-type structures.
|
|
||||||
*/
|
|
||||||
struct _GIRealInfo
|
|
||||||
{
|
|
||||||
/* Keep this part in sync with GIUnresolvedInfo below */
|
|
||||||
gint32 type;
|
|
||||||
gint32 ref_count;
|
|
||||||
GIRepository *repository;
|
|
||||||
GIBaseInfo *container;
|
|
||||||
|
|
||||||
/* Resolved specific */
|
|
||||||
|
|
||||||
GTypelib *typelib;
|
|
||||||
guint32 offset;
|
|
||||||
|
|
||||||
guint32 type_is_embedded : 1; /* Used by GITypeInfo */
|
|
||||||
guint32 reserved : 31;
|
|
||||||
|
|
||||||
gpointer reserved2[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GIUnresolvedInfo
|
|
||||||
{
|
|
||||||
/* Keep this part in sync with GIBaseInfo above */
|
|
||||||
gint32 type;
|
|
||||||
gint32 ref_count;
|
|
||||||
GIRepository *repository;
|
|
||||||
GIBaseInfo *container;
|
|
||||||
|
|
||||||
/* Unresolved specific */
|
|
||||||
|
|
||||||
const gchar *name;
|
|
||||||
const gchar *namespace;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define INVALID_REFCOUNT 0x7FFFFFFF
|
|
||||||
|
|
||||||
static void
|
|
||||||
g_info_init (GIRealInfo *info,
|
|
||||||
GIInfoType type,
|
|
||||||
GIRepository *repository,
|
|
||||||
GIBaseInfo *container,
|
|
||||||
GTypelib *typelib,
|
|
||||||
guint32 offset)
|
|
||||||
{
|
|
||||||
memset (info, 0, sizeof (GIRealInfo));
|
|
||||||
|
|
||||||
/* Invalid refcount used to flag stack-allocated infos */
|
|
||||||
info->ref_count = INVALID_REFCOUNT;
|
|
||||||
info->type = type;
|
|
||||||
|
|
||||||
info->typelib = typelib;
|
|
||||||
info->offset = offset;
|
|
||||||
|
|
||||||
if (container)
|
|
||||||
info->container = container;
|
|
||||||
|
|
||||||
g_assert (G_IS_IREPOSITORY (repository));
|
|
||||||
info->repository = repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* info creation */
|
|
||||||
GIBaseInfo *
|
|
||||||
g_info_new_full (GIInfoType type,
|
|
||||||
GIRepository *repository,
|
|
||||||
GIBaseInfo *container,
|
|
||||||
GTypelib *typelib,
|
|
||||||
guint32 offset)
|
|
||||||
{
|
|
||||||
GIRealInfo *info;
|
|
||||||
|
|
||||||
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
|
|
||||||
|
|
||||||
info = g_slice_new (GIRealInfo);
|
|
||||||
|
|
||||||
g_info_init (info, type, repository, container, typelib, offset);
|
|
||||||
info->ref_count = 1;
|
|
||||||
|
|
||||||
if (container && ((GIRealInfo *) container)->ref_count != INVALID_REFCOUNT)
|
|
||||||
g_base_info_ref (info->container);
|
|
||||||
|
|
||||||
g_object_ref (info->repository);
|
|
||||||
|
|
||||||
return (GIBaseInfo*)info;
|
|
||||||
}
|
|
||||||
|
|
||||||
GIBaseInfo *
|
|
||||||
g_info_new (GIInfoType type,
|
|
||||||
GIBaseInfo *container,
|
|
||||||
GTypelib *typelib,
|
|
||||||
guint32 offset)
|
|
||||||
{
|
|
||||||
return g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GIBaseInfo *
|
|
||||||
g_info_from_entry (GIRepository *repository,
|
|
||||||
GTypelib *typelib,
|
|
||||||
guint16 index)
|
|
||||||
{
|
|
||||||
GIBaseInfo *result;
|
|
||||||
DirEntry *entry = g_typelib_get_dir_entry (typelib, index);
|
|
||||||
|
|
||||||
if (entry->local)
|
|
||||||
result = g_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const gchar *namespace = g_typelib_get_string (typelib, entry->offset);
|
|
||||||
const gchar *name = g_typelib_get_string (typelib, entry->name);
|
|
||||||
|
|
||||||
result = g_irepository_find_by_name (repository, namespace, name);
|
|
||||||
if (result == NULL)
|
|
||||||
{
|
|
||||||
GIUnresolvedInfo *unresolved;
|
|
||||||
|
|
||||||
unresolved = g_slice_new0 (GIUnresolvedInfo);
|
|
||||||
|
|
||||||
unresolved->type = GI_INFO_TYPE_UNRESOLVED;
|
|
||||||
unresolved->ref_count = 1;
|
|
||||||
unresolved->repository = g_object_ref (repository);
|
|
||||||
unresolved->container = NULL;
|
|
||||||
unresolved->name = name;
|
|
||||||
unresolved->namespace = namespace;
|
|
||||||
|
|
||||||
return (GIBaseInfo *)unresolved;
|
|
||||||
}
|
|
||||||
return (GIBaseInfo *)result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (GIBaseInfo *)result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GIBaseInfo functions */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:gibaseinfo
|
|
||||||
* @Short_description: Base struct for all GTypelib structs
|
|
||||||
* @Title: GIBaseInfo
|
|
||||||
*
|
|
||||||
* GIBaseInfo is the common base struct of all other *Info structs
|
|
||||||
* accessible through the #GIRepository API.
|
|
||||||
* All other structs can be casted to a #GIBaseInfo, for instance:
|
|
||||||
* <example>
|
|
||||||
* <title>Casting a #GIFunctionInfo to #GIBaseInfo</title>
|
|
||||||
* <programlisting>
|
|
||||||
* GIFunctionInfo *function_info = ...;
|
|
||||||
* GIBaseInfo *info = (GIBaseInfo*)function_info;
|
|
||||||
* </programlisting>
|
|
||||||
* </example>
|
|
||||||
* Most #GIRepository APIs returning a #GIBaseInfo is actually creating a new struct, in other
|
|
||||||
* words, g_base_info_unref() has to be called when done accessing the data.
|
|
||||||
* GIBaseInfos are normally accessed by calling either
|
|
||||||
* g_irepository_find_by_name(), g_irepository_find_by_gtype() or g_irepository_get_info().
|
|
||||||
*
|
|
||||||
* <example>
|
|
||||||
* <title>Getting the Button of the Gtk typelib</title>
|
|
||||||
* <programlisting>
|
|
||||||
* GIBaseInfo *button_info = g_irepository_find_by_name(NULL, "Gtk", "Button");
|
|
||||||
* ... use button_info ...
|
|
||||||
* g_base_info_unref(button_info);
|
|
||||||
* </programlisting>
|
|
||||||
* </example>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_ref:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Increases the reference count of @info.
|
|
||||||
*
|
|
||||||
* Returns: the same @info.
|
|
||||||
*/
|
|
||||||
GIBaseInfo *
|
|
||||||
g_base_info_ref (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
|
||||||
|
|
||||||
g_assert (rinfo->ref_count != INVALID_REFCOUNT);
|
|
||||||
((GIRealInfo*)info)->ref_count++;
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_unref:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Decreases the reference count of @info. When its reference count
|
|
||||||
* drops to 0, the info is freed.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
g_base_info_unref (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
|
||||||
|
|
||||||
g_assert (rinfo->ref_count > 0 && rinfo->ref_count != INVALID_REFCOUNT);
|
|
||||||
rinfo->ref_count--;
|
|
||||||
|
|
||||||
if (!rinfo->ref_count)
|
|
||||||
{
|
|
||||||
if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT)
|
|
||||||
g_base_info_unref (rinfo->container);
|
|
||||||
|
|
||||||
if (rinfo->repository)
|
|
||||||
g_object_unref (rinfo->repository);
|
|
||||||
|
|
||||||
g_slice_free (GIRealInfo, rinfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_get_type:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Obtain the info type of the GIBaseInfo.
|
|
||||||
*
|
|
||||||
* Returns: the info type of @info
|
|
||||||
*/
|
|
||||||
GIInfoType
|
|
||||||
g_base_info_get_type (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
|
|
||||||
return ((GIRealInfo*)info)->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_get_name:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Obtain the name of the @info. What the name represents depends on
|
|
||||||
* the #GIInfoType of the @info. For instance for #GIFunctionInfo it is
|
|
||||||
* the name of the function.
|
|
||||||
*
|
|
||||||
* Returns: the name of @info or %NULL if it lacks a name.
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
g_base_info_get_name (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
|
||||||
g_assert (rinfo->ref_count > 0);
|
|
||||||
switch (rinfo->type)
|
|
||||||
{
|
|
||||||
case GI_INFO_TYPE_FUNCTION:
|
|
||||||
case GI_INFO_TYPE_CALLBACK:
|
|
||||||
case GI_INFO_TYPE_STRUCT:
|
|
||||||
case GI_INFO_TYPE_BOXED:
|
|
||||||
case GI_INFO_TYPE_ENUM:
|
|
||||||
case GI_INFO_TYPE_FLAGS:
|
|
||||||
case GI_INFO_TYPE_OBJECT:
|
|
||||||
case GI_INFO_TYPE_INTERFACE:
|
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
|
||||||
case GI_INFO_TYPE_UNION:
|
|
||||||
{
|
|
||||||
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_VALUE:
|
|
||||||
{
|
|
||||||
ValueBlob *blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_SIGNAL:
|
|
||||||
{
|
|
||||||
SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_PROPERTY:
|
|
||||||
{
|
|
||||||
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_VFUNC:
|
|
||||||
{
|
|
||||||
VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_FIELD:
|
|
||||||
{
|
|
||||||
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_ARG:
|
|
||||||
{
|
|
||||||
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GI_INFO_TYPE_UNRESOLVED:
|
|
||||||
{
|
|
||||||
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
|
|
||||||
|
|
||||||
return unresolved->name;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GI_INFO_TYPE_TYPE:
|
|
||||||
default: ;
|
|
||||||
g_assert_not_reached ();
|
|
||||||
/* unnamed */
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_get_namespace:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Obtain the namespace of @info.
|
|
||||||
*
|
|
||||||
* Returns: the namespace
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
g_base_info_get_namespace (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo*) info;
|
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
|
||||||
|
|
||||||
g_assert (rinfo->ref_count > 0);
|
|
||||||
|
|
||||||
if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
|
|
||||||
{
|
|
||||||
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
|
|
||||||
|
|
||||||
return unresolved->namespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, header->namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_is_deprecated:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Obtain whether the @info is represents a metadata which is
|
|
||||||
* deprecated or not.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if deprecated
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
g_base_info_is_deprecated (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo*) info;
|
|
||||||
switch (rinfo->type)
|
|
||||||
{
|
|
||||||
case GI_INFO_TYPE_FUNCTION:
|
|
||||||
case GI_INFO_TYPE_CALLBACK:
|
|
||||||
case GI_INFO_TYPE_STRUCT:
|
|
||||||
case GI_INFO_TYPE_BOXED:
|
|
||||||
case GI_INFO_TYPE_ENUM:
|
|
||||||
case GI_INFO_TYPE_FLAGS:
|
|
||||||
case GI_INFO_TYPE_OBJECT:
|
|
||||||
case GI_INFO_TYPE_INTERFACE:
|
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
|
||||||
{
|
|
||||||
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return blob->deprecated;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_VALUE:
|
|
||||||
{
|
|
||||||
ValueBlob *blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return blob->deprecated;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_SIGNAL:
|
|
||||||
{
|
|
||||||
SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return blob->deprecated;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_PROPERTY:
|
|
||||||
{
|
|
||||||
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return blob->deprecated;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GI_INFO_TYPE_VFUNC:
|
|
||||||
case GI_INFO_TYPE_FIELD:
|
|
||||||
case GI_INFO_TYPE_ARG:
|
|
||||||
case GI_INFO_TYPE_TYPE:
|
|
||||||
default: ;
|
|
||||||
/* no deprecation flag for these */
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_get_attribute:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
* @name: a freeform string naming an attribute
|
|
||||||
*
|
|
||||||
* Retrieve an arbitrary attribute associated with this node.
|
|
||||||
*
|
|
||||||
* Returns: The value of the attribute, or %NULL if no such attribute exists
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
g_base_info_get_attribute (GIBaseInfo *info,
|
|
||||||
const gchar *name)
|
|
||||||
{
|
|
||||||
GIAttributeIter iter = { 0, };
|
|
||||||
gchar *curname, *curvalue;
|
|
||||||
while (g_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
|
|
||||||
{
|
|
||||||
if (strcmp (name, curname) == 0)
|
|
||||||
return (const gchar*) curvalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
cmp_attribute (const void *av,
|
|
||||||
const void *bv)
|
|
||||||
{
|
|
||||||
const AttributeBlob *a = av;
|
|
||||||
const AttributeBlob *b = bv;
|
|
||||||
|
|
||||||
if (a->offset < b->offset)
|
|
||||||
return -1;
|
|
||||||
else if (a->offset == b->offset)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static AttributeBlob *
|
|
||||||
find_first_attribute (GIRealInfo *rinfo)
|
|
||||||
{
|
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
|
||||||
AttributeBlob blob, *first, *res, *previous;
|
|
||||||
|
|
||||||
blob.offset = rinfo->offset;
|
|
||||||
|
|
||||||
first = (AttributeBlob *) &rinfo->typelib->data[header->attributes];
|
|
||||||
|
|
||||||
res = bsearch (&blob, first, header->n_attributes,
|
|
||||||
header->attribute_blob_size, cmp_attribute);
|
|
||||||
|
|
||||||
if (res == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
previous = res - 1;
|
|
||||||
while (previous >= first && previous->offset == rinfo->offset)
|
|
||||||
{
|
|
||||||
res = previous;
|
|
||||||
previous = res - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_iterate_attributes:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
* @iterator: a #GIAttributeIter structure, must be initialized; see below
|
|
||||||
* @name: (out) (transfer none): Returned name, must not be freed
|
|
||||||
* @value: (out) (transfer none): Returned name, must not be freed
|
|
||||||
*
|
|
||||||
* Iterate over all attributes associated with this node. The iterator
|
|
||||||
* structure is typically stack allocated, and must have its first
|
|
||||||
* member initialized to %NULL.
|
|
||||||
*
|
|
||||||
* Both the @name and @value should be treated as constants
|
|
||||||
* and must not be freed.
|
|
||||||
*
|
|
||||||
* <example>
|
|
||||||
* <title>Iterating over attributes</title>
|
|
||||||
* <programlisting>
|
|
||||||
* void
|
|
||||||
* print_attributes (GIBaseInfo *info)
|
|
||||||
* {
|
|
||||||
* GIAttributeIter iter = { 0, };
|
|
||||||
* char *name;
|
|
||||||
* char *value;
|
|
||||||
* while (g_base_info_iterate_attributes (info, &iter, &name, &value))
|
|
||||||
* {
|
|
||||||
* g_print ("attribute name: %s value: %s", name, value);
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </programlisting>
|
|
||||||
* </example>
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if there are more attributes
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
g_base_info_iterate_attributes (GIBaseInfo *info,
|
|
||||||
GIAttributeIter *iterator,
|
|
||||||
gchar **name,
|
|
||||||
gchar **value)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
|
||||||
AttributeBlob *next, *after;
|
|
||||||
|
|
||||||
after = (AttributeBlob *) &rinfo->typelib->data[header->attributes +
|
|
||||||
header->n_attributes * header->attribute_blob_size];
|
|
||||||
|
|
||||||
if (iterator->data != NULL)
|
|
||||||
next = (AttributeBlob *) iterator->data;
|
|
||||||
else
|
|
||||||
next = find_first_attribute (rinfo);
|
|
||||||
|
|
||||||
if (next == NULL || next->offset != rinfo->offset || next >= after)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
*name = (gchar*) g_typelib_get_string (rinfo->typelib, next->name);
|
|
||||||
*value = (gchar*) g_typelib_get_string (rinfo->typelib, next->value);
|
|
||||||
iterator->data = next + 1;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_get_container:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Obtain the container of the @info. The container is the parent
|
|
||||||
* GIBaseInfo. For instance, the parent of a #GIFunctionInfo is an
|
|
||||||
* #GIObjectInfo or #GIInterfaceInfo.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the container
|
|
||||||
*/
|
|
||||||
GIBaseInfo *
|
|
||||||
g_base_info_get_container (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
return ((GIRealInfo*)info)->container;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_get_typelib:
|
|
||||||
* @info: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Obtain the typelib this @info belongs to
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the typelib.
|
|
||||||
*/
|
|
||||||
GTypelib *
|
|
||||||
g_base_info_get_typelib (GIBaseInfo *info)
|
|
||||||
{
|
|
||||||
return ((GIRealInfo*)info)->typelib;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_base_info_equal:
|
|
||||||
* @info1: a #GIBaseInfo
|
|
||||||
* @info2: a #GIBaseInfo
|
|
||||||
*
|
|
||||||
* Compare two #GIBaseInfo.
|
|
||||||
*
|
|
||||||
* Using pointer comparison is not practical since many functions return
|
|
||||||
* different instances of #GIBaseInfo that refers to the same part of the
|
|
||||||
* TypeLib; use this function instead to do #GIBaseInfo comparisons.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if and only if @info1 equals @info2.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
g_base_info_equal (GIBaseInfo *info1, GIBaseInfo *info2)
|
|
||||||
{
|
|
||||||
/* Compare the TypeLib pointers, which are mmapped. */
|
|
||||||
GIRealInfo *rinfo1 = (GIRealInfo*)info1;
|
|
||||||
GIRealInfo *rinfo2 = (GIRealInfo*)info2;
|
|
||||||
return rinfo1->typelib->data + rinfo1->offset == rinfo2->typelib->data + rinfo2->offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GIFunctionInfo functions */
|
/* GIFunctionInfo functions */
|
||||||
|
|
||||||
@ -832,7 +232,7 @@ g_type_info_init (GIBaseInfo *info,
|
|||||||
GIRealInfo *rinfo = (GIRealInfo*)container;
|
GIRealInfo *rinfo = (GIRealInfo*)container;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
|
|
||||||
g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
|
_g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
|
||||||
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
|
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,7 +415,7 @@ g_callable_info_load_arg (GICallableInfo *info,
|
|||||||
offset = signature_offset (info);
|
offset = signature_offset (info);
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
|
|
||||||
g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
|
_g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
|
||||||
offset + header->signature_blob_size + n * header->arg_blob_size);
|
offset + header->signature_blob_size + n * header->arg_blob_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1466,7 +866,7 @@ g_type_info_get_interface (GITypeInfo *info)
|
|||||||
InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->tag == GI_TYPE_TAG_INTERFACE)
|
if (blob->tag == GI_TYPE_TAG_INTERFACE)
|
||||||
return g_info_from_entry (rinfo->repository, rinfo->typelib, blob->interface);
|
return _g_info_from_entry (rinfo->repository, rinfo->typelib, blob->interface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1663,7 +1063,7 @@ g_type_info_get_error_domain (GITypeInfo *info,
|
|||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->tag == GI_TYPE_TAG_ERROR)
|
if (blob->tag == GI_TYPE_TAG_ERROR)
|
||||||
return (GIErrorDomainInfo *) g_info_from_entry (rinfo->repository,
|
return (GIErrorDomainInfo *) _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib,
|
rinfo->typelib,
|
||||||
blob->domains[n]);
|
blob->domains[n]);
|
||||||
}
|
}
|
||||||
@ -1729,7 +1129,7 @@ g_error_domain_info_get_codes (GIErrorDomainInfo *info)
|
|||||||
|
|
||||||
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return (GIInterfaceInfo *) g_info_from_entry (rinfo->repository,
|
return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->error_codes);
|
rinfo->typelib, blob->error_codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2125,7 +1525,7 @@ g_object_info_get_parent (GIObjectInfo *info)
|
|||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->parent)
|
if (blob->parent)
|
||||||
return (GIObjectInfo *) g_info_from_entry (rinfo->repository,
|
return (GIObjectInfo *) _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->parent);
|
rinfo->typelib, blob->parent);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2173,7 +1573,7 @@ g_object_info_get_interface (GIObjectInfo *info,
|
|||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return (GIInterfaceInfo *) g_info_from_entry (rinfo->repository,
|
return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->interfaces[n]);
|
rinfo->typelib, blob->interfaces[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2441,7 +1841,7 @@ g_object_info_get_class_struct (GIObjectInfo *info)
|
|||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->gtype_struct)
|
if (blob->gtype_struct)
|
||||||
return (GIStructInfo *) g_info_from_entry (rinfo->repository,
|
return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->gtype_struct);
|
rinfo->typelib, blob->gtype_struct);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2464,7 +1864,7 @@ g_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
|||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
return g_info_from_entry (rinfo->repository,
|
return _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->prerequisites[n]);
|
rinfo->typelib, blob->prerequisites[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2670,7 +2070,7 @@ g_interface_info_get_iface_struct (GIInterfaceInfo *info)
|
|||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->gtype_struct)
|
if (blob->gtype_struct)
|
||||||
return (GIStructInfo *) g_info_from_entry (rinfo->repository,
|
return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
|
||||||
rinfo->typelib, blob->gtype_struct);
|
rinfo->typelib, blob->gtype_struct);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
84
girepository-private.h
Normal file
84
girepository-private.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/* -*- Mode: C; c-file-style: "gnu"; -*- */
|
||||||
|
/* GObject introspection: Private headers
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Johan Dahlin
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIREPOSITORY_PRIVATE_H__
|
||||||
|
#define __GIREPOSITORY_PRIVATE_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <girepository/gibaseinfo.h>
|
||||||
|
#include <girepository/girepository.h>
|
||||||
|
#include <girepository/gitypelib.h>
|
||||||
|
|
||||||
|
typedef struct _GIRealInfo GIRealInfo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We just use one structure for all of the info object
|
||||||
|
* types; in general, we should be reading data directly
|
||||||
|
* from the typelib, and not having computed data in
|
||||||
|
* per-type structures.
|
||||||
|
*/
|
||||||
|
struct _GIRealInfo
|
||||||
|
{
|
||||||
|
/* Keep this part in sync with GIUnresolvedInfo below */
|
||||||
|
gint32 type;
|
||||||
|
gint32 ref_count;
|
||||||
|
GIRepository *repository;
|
||||||
|
GIBaseInfo *container;
|
||||||
|
|
||||||
|
/* Resolved specific */
|
||||||
|
|
||||||
|
GTypelib *typelib;
|
||||||
|
guint32 offset;
|
||||||
|
|
||||||
|
guint32 type_is_embedded : 1; /* Used by GITypeInfo */
|
||||||
|
guint32 reserved : 31;
|
||||||
|
|
||||||
|
gpointer reserved2[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GIUnresolvedInfo
|
||||||
|
{
|
||||||
|
/* Keep this part in sync with GIBaseInfo above */
|
||||||
|
gint32 type;
|
||||||
|
gint32 ref_count;
|
||||||
|
GIRepository *repository;
|
||||||
|
GIBaseInfo *container;
|
||||||
|
|
||||||
|
/* Unresolved specific */
|
||||||
|
|
||||||
|
const gchar *name;
|
||||||
|
const gchar *namespace;
|
||||||
|
};
|
||||||
|
|
||||||
|
void _g_info_init (GIRealInfo *info,
|
||||||
|
GIInfoType type,
|
||||||
|
GIRepository *repository,
|
||||||
|
GIBaseInfo *container,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint32 offset);
|
||||||
|
|
||||||
|
GIBaseInfo * _g_info_from_entry (GIRepository *repository,
|
||||||
|
GTypelib *typelib,
|
||||||
|
guint16 index);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GIREPOSITORY_PRIVATE_H__ */
|
259
girepository.h
259
girepository.h
@ -22,8 +22,12 @@
|
|||||||
#ifndef __G_IREPOSITORY_H__
|
#ifndef __G_IREPOSITORY_H__
|
||||||
#define __G_IREPOSITORY_H__
|
#define __G_IREPOSITORY_H__
|
||||||
|
|
||||||
|
#define __GIREPOSITORY_H_INSIDE__
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
#include <girepository/gibaseinfo.h>
|
||||||
|
#include <girepository/gitypelib.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -38,156 +42,6 @@ typedef struct _GIRepository GIRepository;
|
|||||||
typedef struct _GIRepositoryClass GIRepositoryClass;
|
typedef struct _GIRepositoryClass GIRepositoryClass;
|
||||||
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
|
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
|
||||||
|
|
||||||
typedef struct _GIBaseInfoStub GIBaseInfo;
|
|
||||||
|
|
||||||
struct _GIBaseInfoStub {
|
|
||||||
/* <private> */
|
|
||||||
gint32 dummy1;
|
|
||||||
gint32 dummy2;
|
|
||||||
gpointer dummy3;
|
|
||||||
gpointer dummy4;
|
|
||||||
gpointer dummy5;
|
|
||||||
guint32 dummy6;
|
|
||||||
guint32 dummy7;
|
|
||||||
gpointer padding[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GICallableInfo:
|
|
||||||
*
|
|
||||||
* Represents a callable, either #GIFunctionInfo, #GICallbackInfo or
|
|
||||||
* #GIVFuncInfo.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GICallableInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIFunctionInfo:
|
|
||||||
*
|
|
||||||
* Represents a function, eg arguments and return value.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIFunctionInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GICallbackInfo:
|
|
||||||
*
|
|
||||||
* Represents a callback, eg arguments and return value.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GICallbackInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIRegisteredTypeInfo:
|
|
||||||
*
|
|
||||||
* Represent a registered type.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIRegisteredTypeInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIStructInfo:
|
|
||||||
*
|
|
||||||
* Represents a struct.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIStructInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIUnionInfo:
|
|
||||||
*
|
|
||||||
* Represents a union.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIUnionInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIEnumInfo:
|
|
||||||
*
|
|
||||||
* Represents an enum or a flag.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIEnumInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIObjectInfo:
|
|
||||||
*
|
|
||||||
* Represents an object.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIObjectInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIInterfaceInfo:
|
|
||||||
*
|
|
||||||
* Represents an interface.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIInterfaceInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIConstantInfo:
|
|
||||||
*
|
|
||||||
* Represents a constant.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIConstantInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIValueInfo:
|
|
||||||
*
|
|
||||||
* Represents a enum value of a #GIEnumInfo.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIValueInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GISignalInfo:
|
|
||||||
*
|
|
||||||
* Represents a signal.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GISignalInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIVFuncInfo
|
|
||||||
*
|
|
||||||
* Represents a virtual function.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIVFuncInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIPropertyInfo:
|
|
||||||
*
|
|
||||||
* Represents a property of a #GIObjectInfo or a #GIInterfaceInfo.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIPropertyInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIFieldInfo:
|
|
||||||
*
|
|
||||||
* Represents a field of a #GIStructInfo or a #GIUnionInfo.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIFieldInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIArgInfo:
|
|
||||||
*
|
|
||||||
* Represents an argument.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIArgInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GITypeInfo:
|
|
||||||
*
|
|
||||||
* Represents type information, direction, transfer etc.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GITypeInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIErrorDomainInfo:
|
|
||||||
*
|
|
||||||
* Represents a #GError error domain.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIErrorDomainInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIUnresolvedInfo:
|
|
||||||
*
|
|
||||||
* Represents a unresolved type in a typelib.
|
|
||||||
*/
|
|
||||||
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
|
||||||
|
|
||||||
typedef struct _GTypelib GTypelib;
|
|
||||||
|
|
||||||
struct _GIRepository
|
struct _GIRepository
|
||||||
{
|
{
|
||||||
GObject parent;
|
GObject parent;
|
||||||
@ -257,20 +111,6 @@ GOptionGroup * g_irepository_get_option_group (void);
|
|||||||
|
|
||||||
gboolean g_irepository_dump (const char *arg, GError **error);
|
gboolean g_irepository_dump (const char *arg, GError **error);
|
||||||
|
|
||||||
/* Typelib */
|
|
||||||
|
|
||||||
GTypelib * g_typelib_new_from_memory (guchar *memory,
|
|
||||||
gsize len);
|
|
||||||
GTypelib * g_typelib_new_from_const_memory (const guchar *memory,
|
|
||||||
gsize len);
|
|
||||||
GTypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile);
|
|
||||||
void g_typelib_free (GTypelib *typelib);
|
|
||||||
|
|
||||||
gboolean g_typelib_symbol (GTypelib *typelib,
|
|
||||||
const gchar *symbol_name,
|
|
||||||
gpointer *symbol);
|
|
||||||
const gchar * g_typelib_get_namespace (GTypelib *typelib);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GIRepositoryError:
|
* GIRepositoryError:
|
||||||
* @G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND: the typelib could not be found.
|
* @G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND: the typelib could not be found.
|
||||||
@ -303,96 +143,6 @@ void gi_cclosure_marshal_generic (GClosure *closure,
|
|||||||
gpointer invocation_hint,
|
gpointer invocation_hint,
|
||||||
gpointer marshal_data);
|
gpointer marshal_data);
|
||||||
|
|
||||||
/* Types of objects registered in the repository */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIInfoType:
|
|
||||||
* @GI_INFO_TYPE_INVALID: invalid type
|
|
||||||
* @GI_INFO_TYPE_FUNCTION: function, see #GIFunctionInfo
|
|
||||||
* @GI_INFO_TYPE_CALLBACK: callback, see #GIFunctionInfo
|
|
||||||
* @GI_INFO_TYPE_STRUCT: struct, see #GIStructInfo
|
|
||||||
* @GI_INFO_TYPE_BOXED: boxed, see #GIStructInfo or #GIUnionInfo
|
|
||||||
* @GI_INFO_TYPE_ENUM: enum, see #GIEnumInfo
|
|
||||||
* @GI_INFO_TYPE_FLAGS: flags, see #GIEnumInfo
|
|
||||||
* @GI_INFO_TYPE_OBJECT: object, see #GIObjectInfo
|
|
||||||
* @GI_INFO_TYPE_INTERFACE: interface, see #GIInterfaceInfo
|
|
||||||
* @GI_INFO_TYPE_CONSTANT: contant, see #GIConstantInfo
|
|
||||||
* @GI_INFO_TYPE_ERROR_DOMAIN: error domain for a #GError, see #GIErrorDomainInfo
|
|
||||||
* @GI_INFO_TYPE_UNION: union, see #GIUnionInfo
|
|
||||||
* @GI_INFO_TYPE_VALUE: enum value, see #GIValueInfo
|
|
||||||
* @GI_INFO_TYPE_SIGNAL: signal, see #GISignalInfo
|
|
||||||
* @GI_INFO_TYPE_VFUNC: virtual function, see #GIVFuncInfo
|
|
||||||
* @GI_INFO_TYPE_PROPERTY: GObject property, see #GIPropertyInfo
|
|
||||||
* @GI_INFO_TYPE_FIELD: struct or union field, see #GIFieldInfo
|
|
||||||
* @GI_INFO_TYPE_ARG: argument of a function or callback, see #GIArgInfo
|
|
||||||
* @GI_INFO_TYPE_TYPE: type information, see #GITypeInfo
|
|
||||||
* @GI_INFO_TYPE_UNRESOLVED: unresolved type, a type which is not present in
|
|
||||||
* the typelib, or any of its dependencies.
|
|
||||||
*
|
|
||||||
* The type of a GIBaseInfo struct.
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GI_INFO_TYPE_INVALID,
|
|
||||||
GI_INFO_TYPE_FUNCTION,
|
|
||||||
GI_INFO_TYPE_CALLBACK,
|
|
||||||
GI_INFO_TYPE_STRUCT,
|
|
||||||
GI_INFO_TYPE_BOXED,
|
|
||||||
GI_INFO_TYPE_ENUM, /* 5 */
|
|
||||||
GI_INFO_TYPE_FLAGS,
|
|
||||||
GI_INFO_TYPE_OBJECT,
|
|
||||||
GI_INFO_TYPE_INTERFACE,
|
|
||||||
GI_INFO_TYPE_CONSTANT,
|
|
||||||
GI_INFO_TYPE_ERROR_DOMAIN, /* 10 */
|
|
||||||
GI_INFO_TYPE_UNION,
|
|
||||||
GI_INFO_TYPE_VALUE,
|
|
||||||
GI_INFO_TYPE_SIGNAL,
|
|
||||||
GI_INFO_TYPE_VFUNC,
|
|
||||||
GI_INFO_TYPE_PROPERTY, /* 15 */
|
|
||||||
GI_INFO_TYPE_FIELD,
|
|
||||||
GI_INFO_TYPE_ARG,
|
|
||||||
GI_INFO_TYPE_TYPE,
|
|
||||||
GI_INFO_TYPE_UNRESOLVED
|
|
||||||
} GIInfoType;
|
|
||||||
|
|
||||||
|
|
||||||
/* GIBaseInfo */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GIAttributeIter:
|
|
||||||
*
|
|
||||||
* An opaque structure used to iterate over attributes
|
|
||||||
* in a #GIBaseInfo struct.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/* <private> */
|
|
||||||
gpointer data;
|
|
||||||
gpointer data2;
|
|
||||||
gpointer data3;
|
|
||||||
gpointer data4;
|
|
||||||
} GIAttributeIter;
|
|
||||||
|
|
||||||
GIBaseInfo * g_base_info_ref (GIBaseInfo *info);
|
|
||||||
void g_base_info_unref (GIBaseInfo *info);
|
|
||||||
GIInfoType g_base_info_get_type (GIBaseInfo *info);
|
|
||||||
const gchar * g_base_info_get_name (GIBaseInfo *info);
|
|
||||||
const gchar * g_base_info_get_namespace (GIBaseInfo *info);
|
|
||||||
gboolean g_base_info_is_deprecated (GIBaseInfo *info);
|
|
||||||
const gchar * g_base_info_get_attribute (GIBaseInfo *info,
|
|
||||||
const gchar *name);
|
|
||||||
gboolean g_base_info_iterate_attributes (GIBaseInfo *info,
|
|
||||||
GIAttributeIter *iterator,
|
|
||||||
char **name,
|
|
||||||
char **value);
|
|
||||||
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
|
|
||||||
GTypelib * g_base_info_get_typelib (GIBaseInfo *info);
|
|
||||||
gboolean g_base_info_equal (GIBaseInfo *info1,
|
|
||||||
GIBaseInfo *info2);
|
|
||||||
GIBaseInfo * g_info_new (GIInfoType type,
|
|
||||||
GIBaseInfo *container,
|
|
||||||
GTypelib *typelib,
|
|
||||||
guint32 offset);
|
|
||||||
|
|
||||||
/* GIFunctionInfo */
|
/* GIFunctionInfo */
|
||||||
|
|
||||||
#define GI_IS_FUNCTION_INFO(info) \
|
#define GI_IS_FUNCTION_INFO(info) \
|
||||||
@ -919,5 +669,6 @@ gint g_constant_info_get_value (GIConstantInfo
|
|||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
||||||
#endif /* __G_IREPOSITORY_H__ */
|
#endif /* __G_IREPOSITORY_H__ */
|
||||||
|
|
||||||
|
53
gitypelib.h
Normal file
53
gitypelib.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* GObject introspection: Public typelib API
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
..skipping...
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GITYPELIB_H__
|
||||||
|
#define __GITYPELIB_H__
|
||||||
|
|
||||||
|
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
|
||||||
|
#error "Only <girepository/girepository.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _GTypelib GTypelib;
|
||||||
|
|
||||||
|
GTypelib * g_typelib_new_from_memory (guchar *memory,
|
||||||
|
gsize len);
|
||||||
|
GTypelib * g_typelib_new_from_const_memory (const guchar *memory,
|
||||||
|
gsize len);
|
||||||
|
GTypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile);
|
||||||
|
void g_typelib_free (GTypelib *typelib);
|
||||||
|
|
||||||
|
gboolean g_typelib_symbol (GTypelib *typelib,
|
||||||
|
const gchar *symbol_name,
|
||||||
|
gpointer *symbol);
|
||||||
|
const gchar * g_typelib_get_namespace (GTypelib *typelib);
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GITYPELIB_H__ */
|
||||||
|
|
225
gitypes.h
Normal file
225
gitypes.h
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
/* GObject introspection: types
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GITYPES_H__
|
||||||
|
#define __GITYPES_H__
|
||||||
|
|
||||||
|
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
|
||||||
|
#error "Only <girepository/girepository.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <girepository/gibaseinfo.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _GIBaseInfoStub GIBaseInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GICallableInfo:
|
||||||
|
*
|
||||||
|
* Represents a callable, either #GIFunctionInfo, #GICallbackInfo or
|
||||||
|
* #GIVFuncInfo.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GICallableInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIFunctionInfo:
|
||||||
|
*
|
||||||
|
* Represents a function, eg arguments and return value.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIFunctionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GICallbackInfo:
|
||||||
|
*
|
||||||
|
* Represents a callback, eg arguments and return value.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GICallbackInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIRegisteredTypeInfo:
|
||||||
|
*
|
||||||
|
* Represent a registered type.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIRegisteredTypeInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIStructInfo:
|
||||||
|
*
|
||||||
|
* Represents a struct.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIStructInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIUnionInfo:
|
||||||
|
*
|
||||||
|
* Represents a union.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIUnionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIEnumInfo:
|
||||||
|
*
|
||||||
|
* Represents an enum or a flag.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIEnumInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIObjectInfo:
|
||||||
|
*
|
||||||
|
* Represents an object.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIObjectInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIInterfaceInfo:
|
||||||
|
*
|
||||||
|
* Represents an interface.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIInterfaceInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIConstantInfo:
|
||||||
|
*
|
||||||
|
* Represents a constant.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIConstantInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIValueInfo:
|
||||||
|
*
|
||||||
|
* Represents a enum value of a #GIEnumInfo.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIValueInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GISignalInfo:
|
||||||
|
*
|
||||||
|
* Represents a signal.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GISignalInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIVFuncInfo
|
||||||
|
*
|
||||||
|
* Represents a virtual function.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIVFuncInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIPropertyInfo:
|
||||||
|
*
|
||||||
|
* Represents a property of a #GIObjectInfo or a #GIInterfaceInfo.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIPropertyInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIFieldInfo:
|
||||||
|
*
|
||||||
|
* Represents a field of a #GIStructInfo or a #GIUnionInfo.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIFieldInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIArgInfo:
|
||||||
|
*
|
||||||
|
* Represents an argument.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIArgInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GITypeInfo:
|
||||||
|
*
|
||||||
|
* Represents type information, direction, transfer etc.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GITypeInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIErrorDomainInfo:
|
||||||
|
*
|
||||||
|
* Represents a #GError error domain.
|
||||||
|
*/
|
||||||
|
typedef GIBaseInfo GIErrorDomainInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIUnresolvedInfo:
|
||||||
|
*
|
||||||
|
* Represents a unresolved type in a typelib.
|
||||||
|
*/
|
||||||
|
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
||||||
|
|
||||||
|
/* Types of objects registered in the repository */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GIInfoType:
|
||||||
|
* @GI_INFO_TYPE_INVALID: invalid type
|
||||||
|
* @GI_INFO_TYPE_FUNCTION: function, see #GIFunctionInfo
|
||||||
|
* @GI_INFO_TYPE_CALLBACK: callback, see #GIFunctionInfo
|
||||||
|
* @GI_INFO_TYPE_STRUCT: struct, see #GIStructInfo
|
||||||
|
* @GI_INFO_TYPE_BOXED: boxed, see #GIStructInfo or #GIUnionInfo
|
||||||
|
* @GI_INFO_TYPE_ENUM: enum, see #GIEnumInfo
|
||||||
|
* @GI_INFO_TYPE_FLAGS: flags, see #GIEnumInfo
|
||||||
|
* @GI_INFO_TYPE_OBJECT: object, see #GIObjectInfo
|
||||||
|
* @GI_INFO_TYPE_INTERFACE: interface, see #GIInterfaceInfo
|
||||||
|
* @GI_INFO_TYPE_CONSTANT: contant, see #GIConstantInfo
|
||||||
|
* @GI_INFO_TYPE_ERROR_DOMAIN: error domain for a #GError, see #GIErrorDomainInfo
|
||||||
|
* @GI_INFO_TYPE_UNION: union, see #GIUnionInfo
|
||||||
|
* @GI_INFO_TYPE_VALUE: enum value, see #GIValueInfo
|
||||||
|
* @GI_INFO_TYPE_SIGNAL: signal, see #GISignalInfo
|
||||||
|
* @GI_INFO_TYPE_VFUNC: virtual function, see #GIVFuncInfo
|
||||||
|
* @GI_INFO_TYPE_PROPERTY: GObject property, see #GIPropertyInfo
|
||||||
|
* @GI_INFO_TYPE_FIELD: struct or union field, see #GIFieldInfo
|
||||||
|
* @GI_INFO_TYPE_ARG: argument of a function or callback, see #GIArgInfo
|
||||||
|
* @GI_INFO_TYPE_TYPE: type information, see #GITypeInfo
|
||||||
|
* @GI_INFO_TYPE_UNRESOLVED: unresolved type, a type which is not present in
|
||||||
|
* the typelib, or any of its dependencies.
|
||||||
|
*
|
||||||
|
* The type of a GIBaseInfo struct.
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GI_INFO_TYPE_INVALID,
|
||||||
|
GI_INFO_TYPE_FUNCTION,
|
||||||
|
GI_INFO_TYPE_CALLBACK,
|
||||||
|
GI_INFO_TYPE_STRUCT,
|
||||||
|
GI_INFO_TYPE_BOXED,
|
||||||
|
GI_INFO_TYPE_ENUM, /* 5 */
|
||||||
|
GI_INFO_TYPE_FLAGS,
|
||||||
|
GI_INFO_TYPE_OBJECT,
|
||||||
|
GI_INFO_TYPE_INTERFACE,
|
||||||
|
GI_INFO_TYPE_CONSTANT,
|
||||||
|
GI_INFO_TYPE_ERROR_DOMAIN, /* 10 */
|
||||||
|
GI_INFO_TYPE_UNION,
|
||||||
|
GI_INFO_TYPE_VALUE,
|
||||||
|
GI_INFO_TYPE_SIGNAL,
|
||||||
|
GI_INFO_TYPE_VFUNC,
|
||||||
|
GI_INFO_TYPE_PROPERTY, /* 15 */
|
||||||
|
GI_INFO_TYPE_FIELD,
|
||||||
|
GI_INFO_TYPE_ARG,
|
||||||
|
GI_INFO_TYPE_TYPE,
|
||||||
|
GI_INFO_TYPE_UNRESOLVED
|
||||||
|
} GIInfoType;
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GITYPES_H__ */
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user