Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GIBaseInfo is the common base struct of all other Info structs
accessible through the Repository
API.
All info structures can be cast to a BaseInfo
, for instance:
C code
GIFunctionInfo *function_info = ...; GIBaseInfo *info = (GIBaseInfo *) function_info;
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.
BaseInfo
structuress are normally accessed by calling either
repositoryFindByName
, repositoryFindByGtype
or
repositoryGetInfo
.
C code
GIBaseInfo *button_info = g_irepository_find_by_name (NULL, "Gtk", "Button"); // ... use button_info ... g_base_info_unref (button_info);
Hierarchy
plain code
GIBaseInfo +---- GIArgInfo +---- GICallableInfo +---- GIConstantInfo +---- GIFieldInfo +---- GIPropertyInfo +---- GIRegisteredTypeInfo +---- GITypeInfo
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 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 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
:: (HasCallStack, MonadIO m) | |
=> BaseInfo |
|
-> Text |
|
-> m Text | Returns: The value of the attribute, or |
Retrieve an arbitrary attribute associated with this node.
getContainer
:: (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
:: (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
:: (HasCallStack, MonadIO m) | |
=> BaseInfo |
|
-> m Text | Returns: the namespace |
Obtain the namespace of info
.
getType
:: (HasCallStack, MonadIO m) | |
=> BaseInfo |
|
-> m InfoType | Returns: the info type of |
Obtain the info type of the GIBaseInfo.
getTypelib
:: (HasCallStack, MonadIO m) | |
=> BaseInfo |
|
-> m Typelib | Returns: the typelib. |
Obtain the typelib this info
belongs to
isDeprecated
Obtain whether the info
is represents a metadata which is
deprecated or not.
iterateAttributes
baseInfoIterateAttributes Source #
:: (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.
C code
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); } }