Top |
GIBaseInfo * | g_info_new () |
GIBaseInfo * | g_base_info_ref () |
void | g_base_info_unref () |
gboolean | g_base_info_equal () |
GIInfoType | g_base_info_get_type () |
GITypelib * | g_base_info_get_typelib () |
const gchar * | g_base_info_get_namespace () |
const gchar * | g_base_info_get_name () |
const gchar * | g_base_info_get_attribute () |
gboolean | g_base_info_iterate_attributes () |
GIBaseInfo * | g_base_info_get_container () |
gboolean | g_base_info_is_deprecated () |
const gchar * | g_info_type_to_string () |
GIBaseInfo is the common base struct of all other Info structs accessible through the GIRepository API.
All info structures can be cast to a GIBaseInfo, for instance:
1 2 |
GIFunctionInfo *function_info = ...; GIBaseInfo *info = (GIBaseInfo *) function_info; |
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.
GIBaseInfo structuress are normally accessed by calling either
g_irepository_find_by_name()
, g_irepository_find_by_gtype()
or
g_irepository_get_info()
.
1 2 3 4 5 6 |
GIBaseInfo *button_info = g_irepository_find_by_name (NULL, "Gtk", "Button"); // ... use button_info ... g_base_info_unref (button_info); |
GIBaseInfo * g_info_new (GIInfoType type
,GIBaseInfo *container
,GITypelib *typelib
,guint32 offset
);
TODO
GIBaseInfo *
g_base_info_ref (GIBaseInfo *info
);
Increases the reference count of info
.
[skip]
void
g_base_info_unref (GIBaseInfo *info
);
Decreases the reference count of info
. When its reference count
drops to 0, the info is freed.
[skip]
gboolean g_base_info_equal (GIBaseInfo *info1
,GIBaseInfo *info2
);
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.
GIInfoType
g_base_info_get_type (GIBaseInfo *info
);
Obtain the info type of the GIBaseInfo.
GITypelib *
g_base_info_get_typelib (GIBaseInfo *info
);
Obtain the typelib this info
belongs to
const gchar *
g_base_info_get_namespace (GIBaseInfo *info
);
Obtain the namespace of info
.
const gchar *
g_base_info_get_name (GIBaseInfo *info
);
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.
const gchar * g_base_info_get_attribute (GIBaseInfo *info
,const gchar *name
);
Retrieve an arbitrary attribute associated with this node.
gboolean g_base_info_iterate_attributes (GIBaseInfo *info
,GIAttributeIter *iterator
,char **name
,char **value
);
Iterate over all attributes associated with this node. The iterator
structure is typically stack allocated, and must have its first
member initialized to NULL
. Attributes are arbitrary namespaced key–value
pairs which can be attached to almost any item. They are intended for use
by software higher in the toolchain than bindings, and are distinct from
normal GIR annotations.
Both the name
and value
should be treated as constants
and must not be freed.
1 2 3 4 5 6 7 8 9 10 11 |
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); } } |
info |
||
iterator |
a GIAttributeIter structure, must be initialized; see below. |
[inout] |
name |
Returned name, must not be freed. |
[out][transfer none] |
value |
Returned name, must not be freed. |
[out][transfer none] |
GIBaseInfo *
g_base_info_get_container (GIBaseInfo *info
);
Obtain the container of the info
. The container is the parent
GIBaseInfo. For instance, the parent of a GIFunctionInfo is an
GIObjectInfo or GIInterfaceInfo.
gboolean
g_base_info_is_deprecated (GIBaseInfo *info
);
Obtain whether the info
is represents a metadata which is
deprecated or not.
const gchar *
g_info_type_to_string (GIInfoType type
);
Obtain a string representation of type
The type of a GIBaseInfo struct.
invalid type |
||
function, see GIFunctionInfo |
||
callback, see GIFunctionInfo |
||
struct, see GIStructInfo |
||
boxed, see GIStructInfo or GIUnionInfo |
||
enum, see GIEnumInfo |
||
flags, see GIEnumInfo |
||
object, see GIObjectInfo |
||
interface, see GIInterfaceInfo |
||
contant, see GIConstantInfo |
||
deleted, used to be GI_INFO_TYPE_ERROR_DOMAIN. |
||
union, see GIUnionInfo |
||
enum value, see GIValueInfo |
||
signal, see GISignalInfo |
||
virtual function, see GIVFuncInfo |
||
GObject property, see GIPropertyInfo |
||
struct or union field, see GIFieldInfo |
||
argument of a function or callback, see GIArgInfo |
||
type information, see GITypeInfo |
||
unresolved type, a type which is not present in the typelib, or any of its dependencies. |
typedef struct { } GIAttributeIter;
An opaque structure used to iterate over attributes in a GIBaseInfo struct.