GIRepository.BaseInfo¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
dummy1 |
r |
||
dummy2 |
r |
||
dummy3 |
r |
||
dummy4 |
r |
||
dummy5 |
r |
||
dummy6 |
r |
||
dummy7 |
r |
||
padding |
[ |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GIRepository.BaseInfo¶
GIRepository.BaseInfo
is the common base struct of all other Info structs accessible through theGIRepository.Repository
API.All info structures can be cast to a
GIRepository.BaseInfo
, for instance:GIFunctionInfo *function_info = ...; GIBaseInfo *info = (GIBaseInfo *) function_info;
Most
GIRepository.Repository
APIs returning aGIRepository.BaseInfo
is actually creating a new struct; in other words, g_base_info_unref() has to be called when done accessing the data.GIRepository.BaseInfo
structuress are normally accessed by calling eitherGIRepository.Repository.find_by_name
(),GIRepository.Repository.find_by_gtype
() orGIRepository.Repository.get_info
().GIBaseInfo *button_info = g_irepository_find_by_name (NULL, "Gtk", "Button"); // ... use button_info ... g_base_info_unref (button_info);
- Hierarchy
GIBaseInfo +---- GIArgInfo +---- GICallableInfo +---- GIConstantInfo +---- GIFieldInfo +---- GIPropertyInfo +---- GIRegisteredTypeInfo +---- GITypeInfo
- equal(info2)¶
- Parameters:
info2 (
GIRepository.BaseInfo
) – aGIRepository.BaseInfo
- Returns:
True
if and only if self equals info2.- Return type:
Compare two
GIRepository.BaseInfo
.Using pointer comparison is not practical since many functions return different instances of
GIRepository.BaseInfo
that refers to the same part of the TypeLib; use this function instead to doGIRepository.BaseInfo
comparisons.
- get_attribute(name)¶
- Parameters:
name (
str
) – a freeform string naming an attribute- Returns:
The value of the attribute, or
None
if no such attribute exists- Return type:
Retrieve an arbitrary attribute associated with this node.
- get_container()¶
- Returns:
the container
- Return type:
Obtain the container of the self. The container is the parent
GIRepository.BaseInfo
. For instance, the parent of a #GIFunctionInfo is an #GIObjectInfo or #GIInterfaceInfo.
- get_name()¶
-
Obtain the name of the self. What the name represents depends on the
GIRepository.InfoType
of the self. For instance for #GIFunctionInfo it is the name of the function.
- get_type()¶
- Returns:
the info type of self
- Return type:
Obtain the info type of the
GIRepository.BaseInfo
.
- get_typelib()¶
- Returns:
the typelib.
- Return type:
Obtain the typelib this self belongs to
- is_deprecated()¶
-
Obtain whether the self is represents a metadata which is deprecated or not.
- iterate_attributes(iterator)¶
- Parameters:
iterator (
GIRepository.AttributeIter
) – aGIRepository.AttributeIter
structure, must be initialized; see below- Returns:
True
if there are more attributes- iterator:
a
GIRepository.AttributeIter
structure, must be initialized; see below- name:
Returned name, must not be freed
- value:
Returned name, must not be freed
- Return type:
(
bool
, iterator:GIRepository.AttributeIter
, name:str
, value:str
)
Iterate over all attributes associated with this node. The iterator structure is typically stack allocated, and must have its first member initialized to
None
. 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.
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); } }