haskell-gi-base-0.24.5: Foundation for libraries generated by haskell-gi
Safe HaskellNone
LanguageHaskell2010

Data.GI.Base.BasicTypes

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

Instances

Instances details
Eq (ManagedPtr a) Source #

Two ManagedPtrs are equal if they wrap the same underlying C Ptr.

Instance details

Defined in Data.GI.Base.BasicTypes

Methods

(==) :: ManagedPtr a -> ManagedPtr a -> Bool #

(/=) :: ManagedPtr a -> ManagedPtr a -> Bool #

class Coercible a (ManagedPtr ()) => ManagedPtrNewtype a where Source #

A constraint ensuring that the given type is a newtype over a ManagedPtr.

Methods

toManagedPtr :: a -> ManagedPtr a Source #

Instances

Instances details
Coercible a (ManagedPtr ()) => ManagedPtrNewtype a Source #

A default instance for IsManagedPtr for newtypes over ManagedPtr.

Instance details

Defined in Data.GI.Base.BasicTypes

Methods

toManagedPtr :: a -> ManagedPtr a Source #

class ManagedPtrNewtype a => BoxedPtr a where Source #

Pointers to chunks of memory which we know how to copy and release.

Methods

boxedPtrCopy :: a -> IO a Source #

Make a copy of the given BoxedPtr.

boxedPtrFree :: a -> IO () Source #

A pointer to a function for freeing the given pointer.

class BoxedPtr a => CallocPtr a where Source #

A ptr to a memory block which we know how to allocate and fill with zero.

Methods

boxedPtrCalloc :: IO (Ptr a) Source #

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

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.

Constructors

UnexpectedNullPointerReturn 

Fields

Basic GLib / GObject types

class HasParentTypes a => TypedObject a where Source #

A wrapped object that has an associated GLib type. This does not necessarily descend from GObject, that constraint is implemented by GObject below.

Methods

glibType :: IO GType Source #

The GType for this object.

Instances

Instances details
TypedObject GValue Source #

Find the associated GType for GValue.

Instance details

Defined in Data.GI.Base.GValue

TypedObject GError Source # 
Instance details

Defined in Data.GI.Base.GError

TypedObject (GClosure a) Source #

Find the associated GType for the given closure.

Instance details

Defined in Data.GI.Base.GClosure

class (ManagedPtrNewtype a, TypedObject a) => GObject a Source #

A wrapped GObject, or any other type that descends from it.

newtype GType Source #

A newtype for use on the Haskell side.

Constructors

GType 

Instances

Instances details
Eq GType Source # 
Instance details

Defined in Data.GI.Base.BasicTypes

Methods

(==) :: GType -> GType -> Bool #

(/=) :: GType -> GType -> Bool #

Show GType Source # 
Instance details

Defined in Data.GI.Base.BasicTypes

Methods

showsPrec :: Int -> GType -> ShowS #

show :: GType -> String #

showList :: [GType] -> ShowS #

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 GVariant Source #

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

Constructors

GVariant (ManagedPtr GVariant) 

class (ManagedPtrNewtype a, TypedObject a) => GBoxed a Source #

Chunks of memory whose allocation/deallocation info has been registered with the GLib type system.

Instances

Instances details
GBoxed GValue Source #

GValues are registered as boxed in the GLib type system.

Instance details

Defined in Data.GI.Base.GValue

GBoxed GError Source #

GErrors are registered as boxed in the GLib type system.

Instance details

Defined in Data.GI.Base.GError

GBoxed (GClosure a) Source #

GClosures are registered as boxed in the GLib type system.

Instance details

Defined in Data.GI.Base.GClosure

class TypedObject a => BoxedEnum a Source #

Enums with an associated GType.

class TypedObject a => BoxedFlags a Source #

Flags with an associated 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.

Instances

Instances details
IsGFlag GParamFlag Source # 
Instance details

Defined in Data.GI.Base.GParamSpec

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.