GIRepository.BaseInfo

Fields

Name

Type

Access

Description

dummy1

int

r

dummy2

int

r

dummy3

object

r

dummy4

object

r

dummy5

object

r

dummy6

int

r

dummy7

int

r

padding

[object]

r

Methods

equal (info2)

get_attribute (name)

get_container ()

get_name ()

get_namespace ()

get_type ()

get_typelib ()

is_deprecated ()

iterate_attributes (iterator)

Details

class GIRepository.BaseInfo

GIRepository.BaseInfo is the common base struct of all other Info structs accessible through the GIRepository.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 a GIRepository.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 either GIRepository.Repository.find_by_name(), GIRepository.Repository.find_by_gtype() or GIRepository.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) – a GIRepository.BaseInfo

Returns:

True if and only if self equals info2.

Return type:

bool

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 do GIRepository.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:

str

Retrieve an arbitrary attribute associated with this node.

get_container()
Returns:

the container

Return type:

GIRepository.BaseInfo

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()
Returns:

the name of self or None if it lacks a name.

Return type:

str

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_namespace()
Returns:

the namespace

Return type:

str

Obtain the namespace of self.

get_type()
Returns:

the info type of self

Return type:

GIRepository.InfoType

Obtain the info type of the GIRepository.BaseInfo.

get_typelib()
Returns:

the typelib.

Return type:

GIRepository.Typelib

Obtain the typelib this self belongs to

is_deprecated()
Returns:

True if deprecated

Return type:

bool

Obtain whether the self is represents a metadata which is deprecated or not.

iterate_attributes(iterator)
Parameters:

iterator (GIRepository.AttributeIter) – a GIRepository.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);
    }
}