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

Data.GI.Base.GHashTable

Description

Machinery for some basic support of GHashTable.

The GLib GHashTable implementation requires two things: we need to "pack" a datatype into a pointer (for datatypes that are represented by pointers this is the trivial operation, for integers it is not, and GLib has some helper macros).

We also need to be able to hash and check for equality different datatypes.

Synopsis

Documentation

type GHashFunc a = FunPtr (PtrWrapped a -> IO Word32) Source #

A pointer to a hashing function on the C side.

type GEqualFunc a = FunPtr (PtrWrapped a -> PtrWrapped a -> IO Int32) Source #

A pointer to an equality checking function on the C side.

gDirectHash :: GHashFunc (Ptr a) Source #

Compute the hash for a Ptr.

gDirectEqual :: GEqualFunc (Ptr a) Source #

Check whether two pointers are equal.

ptrPackPtr :: Ptr a -> PtrWrapped (Ptr a) Source #

Pack a Ptr into a PtrWrapped Ptr.

ptrUnpackPtr :: PtrWrapped (Ptr a) -> Ptr a Source #

Extract a Ptr from a PtrWrapped Ptr.

gStrHash :: GHashFunc CString Source #

Compute the hash for a CString.

gStrEqual :: GEqualFunc CString Source #

Check whether two CStrings are equal.

cstringPackPtr :: CString -> PtrWrapped CString Source #

Pack a CString into a Ptr than can go into a GHashTable.

cstringUnpackPtr :: PtrWrapped CString -> CString Source #

Extract a CString wrapped into a Ptr coming from a GHashTable.