Safe Haskell | None |
---|---|
Language | Haskell98 |
Basic types used in the bindings.
Synopsis
- data ManagedPtr a = ManagedPtr {}
- type ManagedPtrNewtype a = Coercible a (ManagedPtr ())
- class ManagedPtrNewtype a => BoxedObject a where
- class BoxedEnum a where
- boxedEnumType :: a -> IO GType
- class BoxedFlags a where
- boxedFlagsType :: Proxy a -> IO GType
- class ManagedPtrNewtype a => WrappedPtr a where
- wrappedPtrCalloc :: IO (Ptr a)
- wrappedPtrCopy :: a -> IO a
- wrappedPtrFree :: Maybe (GDestroyNotify a)
- data UnexpectedNullPointerReturn = UnexpectedNullPointerReturn {}
- class (ManagedPtrNewtype a, HasParentTypes a) => GObject a where
- gobjectType :: IO GType
- newtype GType = GType {}
- type CGType = Word64
- gtypeName :: GType -> IO String
- newtype GVariant = GVariant (ManagedPtr GVariant)
- newtype GParamSpec = GParamSpec (ManagedPtr GParamSpec)
- noGParamSpec :: Maybe GParamSpec
- data GArray a = GArray (Ptr (GArray a))
- data GPtrArray a = GPtrArray (Ptr (GPtrArray a))
- data GByteArray = GByteArray (Ptr GByteArray)
- data GHashTable a b = GHashTable (Ptr (GHashTable a b))
- data GList a = GList (Ptr (GList a))
- g_list_free :: Ptr (GList a) -> IO ()
- data GSList a = GSList (Ptr (GSList a))
- g_slist_free :: Ptr (GSList a) -> IO ()
- class Enum a => IsGFlag a
- newtype PtrWrapped a = PtrWrapped {}
- type GDestroyNotify a = FunPtr (Ptr a -> IO ())
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.
ManagedPtr | |
|
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 GObject
s.
class ManagedPtrNewtype a => BoxedObject a where Source #
Wrapped boxed structures, identified by their GType
.
Instances
BoxedObject GValue Source # | |
BoxedObject GError Source # | |
BoxedObject (GClosure a) Source # | |
class BoxedEnum a where Source #
Enums with an associated GType
.
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
.
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
.
Instances
Basic GLib / GObject types
class (ManagedPtrNewtype a, HasParentTypes a) => GObject a where Source #
A wrapped GObject
.
A newtype for use on the haskell side.
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.
A GVariant. See Data.GI.Base.GVariant for further methods.
Instances
IsGVariant GVariant Source # | |
Defined in Data.GI.Base.GVariant |
newtype GParamSpec Source #
A GParamSpec. See Data.GI.Base.GParamSpec for further methods.
noGParamSpec :: Maybe GParamSpec Source #
A convenient synonym for Nothing :: Maybe GParamSpec
.
A GArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.
A GPtrArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.
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.
data GHashTable a b Source #
A GHashTable. It is mapped to a Map
on the Haskell side.
GHashTable (Ptr (GHashTable a b)) |
A GList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.
A GSList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.
newtype PtrWrapped a Source #
Some APIs, such as GHashTable
, pass around scalar types
wrapped into a pointer. We encode such a type as follows.