haskell-gi-base-0.22.2: Foundation for libraries generated by haskell-gi

Safe HaskellNone
LanguageHaskell98

Data.GI.Base.BasicTypes

Contents

Description

Basic types used in the bindings.

Synopsis

Memory management

data ManagedPtr a Source #

Thin wrapper over ForeignPtr, supporting the extra notion of disowning, that is, not running the finalizers associated with the foreign ptr.

Constructors

ManagedPtr 

Fields

type ManagedPtrNewtype a = Coercible a (ManagedPtr ()) Source #

A constraint ensuring that the given type is coercible to a ManagedPtr. It will hold for newtypes of the form

newtype Foo = Foo (ManagedPtr Foo)

which is the typical shape of wrapped GObjects.

class ManagedPtrNewtype a => BoxedObject a where Source #

Wrapped boxed structures, identified by their GType.

Methods

boxedType :: a -> IO GType Source #

Instances
BoxedObject GValue Source # 
Instance details

Defined in Data.GI.Base.GValue

BoxedObject GError Source # 
Instance details

Defined in Data.GI.Base.GError

BoxedObject (GClosure a) Source # 
Instance details

Defined in Data.GI.Base.GClosure

class BoxedEnum a where Source #

Enums with an associated GType.

Methods

boxedEnumType :: a -> IO GType Source #

class BoxedFlags a where Source #

Flags with an associated GType.

class ManagedPtrNewtype a => WrappedPtr a where Source #

Pointers to structs/unions without an associated GType.

Methods

wrappedPtrCalloc :: IO (Ptr a) Source #

Allocate a zero-initialized block of memory for the given type.

wrappedPtrCopy :: a -> IO a Source #

Make a copy of the given WrappedPtr.

wrappedPtrFree :: Maybe (GDestroyNotify a) Source #

A pointer to a function for freeing the given pointer, or Nothing is the memory associated to the pointer does not need to be freed.

data UnexpectedNullPointerReturn Source #

A common omission in the introspection data is missing (nullable) annotations for return types, when they clearly are nullable. (A common idiom is "Returns: valid value, or %NULL if something went wrong.")

Haskell wrappers will raise this exception if the return value is an unexpected nullPtr.

Basic GLib / GObject types

class (ManagedPtrNewtype a, HasParentTypes a) => GObject a where Source #

A wrapped GObject.

Methods

gobjectType :: IO GType Source #

The GType for this object.

newtype GType Source #

A newtype for use on the haskell side.

Constructors

GType 
Instances
IsGValue GType Source # 
Instance details

Defined in Data.GI.Base.GValue

type CGType = Word64 Source #

A type identifier in the GLib type system. This is the low-level type associated with the representation in memory, when using this on the Haskell side use GType below.

gtypeName :: GType -> IO String Source #

Get the name assigned to the given GType.

newtype GParamSpec Source #

A GParamSpec. See Data.GI.Base.GParamSpec for further methods.

noGParamSpec :: Maybe GParamSpec Source #

A convenient synonym for Nothing :: Maybe GParamSpec.

data GArray a Source #

A GArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.

Constructors

GArray (Ptr (GArray a)) 

data GPtrArray a Source #

A GPtrArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.

Constructors

GPtrArray (Ptr (GPtrArray a)) 

data GByteArray Source #

A GByteArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is packed to a ByteString on the Haskell side.

Constructors

GByteArray (Ptr GByteArray) 

data GHashTable a b Source #

A GHashTable. It is mapped to a Map on the Haskell side.

Constructors

GHashTable (Ptr (GHashTable a b)) 

data GList a Source #

A GList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.

Constructors

GList (Ptr (GList a)) 

g_list_free :: Ptr (GList a) -> IO () Source #

Free the given GList.

data GSList a Source #

A GSList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.

Constructors

GSList (Ptr (GSList a)) 

g_slist_free :: Ptr (GSList a) -> IO () Source #

Free the given GSList.

class Enum a => IsGFlag a Source #

An enum usable as a flag for a function.

newtype PtrWrapped a Source #

Some APIs, such as GHashTable, pass around scalar types wrapped into a pointer. We encode such a type as follows.

Constructors

PtrWrapped 

Fields

type GDestroyNotify a = FunPtr (Ptr a -> IO ()) Source #

Destroy the memory associated with a given pointer.