gi-girepository-1.0.22: GIRepository (gobject-introspection) bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GIRepository.Structs.BaseInfo

Description

GIBaseInfo is the common base struct of all other *Info structs accessible through the Repository API. All other structs can be casted to a BaseInfo, for instance: <example> <title>Casting a GIFunctionInfo to BaseInfo</title> <programlisting> GIFunctionInfo *function_info = ...; GIBaseInfo *info = (GIBaseInfo*)function_info; </programlisting> </example> Most Repository APIs returning a BaseInfo 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 repositoryFindByName, repositoryFindByGtype or repositoryGetInfo.

<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>

<refsect1 id="gi-gibaseinfo.struct-hierarchy" role="struct_hierarchy"> <title role="struct_hierarchy.title">Struct hierarchy</title> <synopsis> GIBaseInfo +----<link linkend="gi-GIArgInfo">GIArgInfo</link> +----<link linkend="gi-GICallableInfo">GICallableInfo</link> +----<link linkend="gi-GIConstantInfo">GIConstantInfo</link> +----<link linkend="gi-GIFieldInfo">GIFieldInfo</link> +----<link linkend="gi-GIPropertyInfo">GIPropertyInfo</link> +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link> +----<link linkend="gi-GITypeInfo">GITypeInfo</link> </synopsis> </refsect1>

Synopsis

Exported types

newtype BaseInfo Source #

Memory-managed wrapper type.

Constructors

BaseInfo (ManagedPtr BaseInfo) 

Instances

Instances details
Eq BaseInfo Source # 
Instance details

Defined in GI.GIRepository.Structs.BaseInfo

BoxedObject BaseInfo Source # 
Instance details

Defined in GI.GIRepository.Structs.BaseInfo

Methods

boxedType :: BaseInfo -> IO GType #

IsGValue BaseInfo Source #

Convert BaseInfo to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.GIRepository.Structs.BaseInfo

tag ~ 'AttrSet => Constructible BaseInfo tag Source # 
Instance details

Defined in GI.GIRepository.Structs.BaseInfo

Methods

new :: MonadIO m => (ManagedPtr BaseInfo -> BaseInfo) -> [AttrOp BaseInfo tag] -> m BaseInfo #

newZeroBaseInfo :: MonadIO m => m BaseInfo Source #

Construct a BaseInfo struct initialized to zero.

noBaseInfo :: Maybe BaseInfo Source #

A convenience alias for Nothing :: Maybe BaseInfo.

Methods

Overloaded methods

equal

baseInfoEqual Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info1: a BaseInfo

-> BaseInfo

info2: a BaseInfo

-> m Bool

Returns: True if and only if info1 equals info2.

Compare two BaseInfo.

Using pointer comparison is not practical since many functions return different instances of BaseInfo that refers to the same part of the TypeLib; use this function instead to do BaseInfo comparisons.

getAttribute

baseInfoGetAttribute Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> Text

name: a freeform string naming an attribute

-> m Text

Returns: The value of the attribute, or Nothing if no such attribute exists

Retrieve an arbitrary attribute associated with this node.

getContainer

baseInfoGetContainer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> m BaseInfo

Returns: the container

Obtain the container of the info. The container is the parent GIBaseInfo. For instance, the parent of a GIFunctionInfo is an GIObjectInfo or GIInterfaceInfo.

getName

baseInfoGetName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> m Text

Returns: the name of info or Nothing if it lacks a name.

Obtain the name of the info. What the name represents depends on the InfoType of the info. For instance for GIFunctionInfo it is the name of the function.

getNamespace

baseInfoGetNamespace Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> m Text

Returns: the namespace

Obtain the namespace of info.

getType

baseInfoGetType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> m InfoType

Returns: the info type of info

Obtain the info type of the GIBaseInfo.

getTypelib

baseInfoGetTypelib Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> m Typelib

Returns: the typelib.

Obtain the typelib this info belongs to

isDeprecated

baseInfoIsDeprecated Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> m Bool

Returns: True if deprecated

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

iterateAttributes

baseInfoIterateAttributes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BaseInfo

info: a BaseInfo

-> AttributeIter

iterator: a AttributeIter structure, must be initialized; see below

-> m (Bool, Text, Text)

Returns: True if there are more attributes

Iterate over all attributes associated with this node. The iterator structure is typically stack allocated, and must have its first member initialized to Nothing. 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.

<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>