| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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
- newtype BaseInfo = BaseInfo (ManagedPtr BaseInfo)
- newZeroBaseInfo :: MonadIO m => m BaseInfo
- baseInfoEqual :: (HasCallStack, MonadIO m) => BaseInfo -> BaseInfo -> m Bool
- baseInfoGetAttribute :: (HasCallStack, MonadIO m) => BaseInfo -> Text -> m Text
- baseInfoGetContainer :: (HasCallStack, MonadIO m) => BaseInfo -> m BaseInfo
- baseInfoGetName :: (HasCallStack, MonadIO m) => BaseInfo -> m Text
- baseInfoGetNamespace :: (HasCallStack, MonadIO m) => BaseInfo -> m Text
- baseInfoGetType :: (HasCallStack, MonadIO m) => BaseInfo -> m InfoType
- baseInfoGetTypelib :: (HasCallStack, MonadIO m) => BaseInfo -> m Typelib
- baseInfoIsDeprecated :: (HasCallStack, MonadIO m) => BaseInfo -> m Bool
- baseInfoIterateAttributes :: (HasCallStack, MonadIO m) => BaseInfo -> AttributeIter -> m (Bool, Text, Text)
Exported types
Memory-managed wrapper type.
Instances
| Eq BaseInfo Source # | |
| GBoxed BaseInfo Source # | |
Defined in GI.GIRepository.Structs.BaseInfo | |
| ManagedPtrNewtype BaseInfo Source # | |
Defined in GI.GIRepository.Structs.BaseInfo Methods toManagedPtr :: BaseInfo -> ManagedPtr BaseInfo | |
| TypedObject BaseInfo Source # | |
Defined in GI.GIRepository.Structs.BaseInfo | |
| HasParentTypes BaseInfo Source # | |
Defined in GI.GIRepository.Structs.BaseInfo | |
| tag ~ 'AttrSet => Constructible BaseInfo tag Source # | |
| IsGValue (Maybe BaseInfo) Source # | Convert |
Defined in GI.GIRepository.Structs.BaseInfo Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe BaseInfo -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe BaseInfo) | |
| type ParentTypes BaseInfo Source # | |
Defined in GI.GIRepository.Structs.BaseInfo | |
Methods
Click to display all available methods, including inherited ones
Methods
equal, isDeprecated, iterateAttributes.
Getters
getAttribute, getContainer, getName, getNamespace, getType, getTypelib.
Setters
None.
equal
getAttribute
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> Text |
|
| -> m Text | Returns: The value of the attribute, or |
Retrieve an arbitrary attribute associated with this node.
getContainer
Arguments
| :: (HasCallStack, MonadIO m) | |
| => 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> m Text | Returns: the name of |
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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> m Text | Returns: the namespace |
Obtain the namespace of info.
getType
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> m InfoType | Returns: the info type of |
Obtain the info type of the GIBaseInfo.
getTypelib
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> m Typelib | Returns: the typelib. |
Obtain the typelib this info belongs to
isDeprecated
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> m Bool | Returns: |
Obtain whether the info is represents a metadata which is
deprecated or not.
iterateAttributes
baseInfoIterateAttributes Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BaseInfo |
|
| -> AttributeIter |
|
| -> m (Bool, Text, Text) | Returns: |
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>