gid.gid

Module for [gid] class

Types 4

Container ownership

NoneNo ownership transfer
ContainerOwns container
FullOwns container and the items in it
aliasgMalloc = g_malloc0

An alias for g_malloc0 for allocating memory for interfacing with glib.

aliasgFree = g_free

Free a pointer allocated with malloc() but only if it is not null.

classGidConstructException : Exception

Exception class used for ObjectWrap constructor errors

Constructors
this(string msg)

Functions 34

fnvoid ptrFreezeGC(const void * ptr)Prevent the garbage collector from freeing or moving a memory region. Necessary when passing data to C which might not have any remaining pointers to it in D heap memory. Params: ptr = Pointer to a...
fnvoid ptrThawGC(const void * ptr)Re-enable garbage collection and moving of a memory region which was frozen by ptrFreezeGC(). Params: ptr = Pointer to anywhere inside the region to re-enable garbage collection of
fnvoid ptrThawDestroyNotify(void * ptr)GDestroyNotify callback which can be used to re-enable garbage collection and moving for a memory region frozen by ptrFreezeGC(). Params: ptr = The data to re-enable garbage collection and moving of.
fnvoid * freezeDelegate(void * dlg)Duplicate a delegate in GC memory and freeze it so that it isn't garbage collected when still referenced from C code. Params: dlg = Pointer to the delegate to freeze Returns: The duplicated delegat...
fnvoid thawDelegate(void * dlg)Unfreeze a delegate which was frozen with `freezeDelegate`, allowing it to be garbage collected Params: dlg = The C heap memory allocated delegate
fnchar * toCString(string dstr, Flag!"Alloc" alloc)Convert a D string to a zero terminated C string, with allocation parameter. Params: dstr = String to convert alloc = Yes.Alloc if string is being transferred to C (use g_malloc), No.Alloc for D al...
fnstring fromCString(const(char) * cstr, Flag!"Free" free)Convert a C string to a D string, with parameter to consume (free) the C string with gfree(). Params: cstr = Zero terminated C string free = Yes.Free to free the C string with gfree, No.Free to jus...
fnchar * strdup(const(char) * s)Duplicate a zero terminate C string. Params: s = The zero terminated string to duplicate Returns: The duplicate string Throws: OutOfMemoryError
fnT * arrayDtoC(T, Flag!"Alloc" alloc = No.Alloc, Flag!"ZeroTerm" zeroTerm = No.ZeroTerm)(T[] array)Template to copy a D array for use by C. Params: T = The array type alloc = Yes.Alloc to use g_malloc() to allocate the array, No.Alloc to use D memory (defaults to No) zeroTerm = Yes.ZeroTerminate...
fnubyte[] gByteArrayToD(GidOwnership ownership = GidOwnership.None)(GByteArray * gByteArray)Convert a GLib GByteArray to a D array. Params: ownership = The ownership of the GArray, None (default): do nothing with it, Container: free container only, Full: unref gByteArray = The GArray inst...
fnubyte[] gBytesToD(GidOwnership ownership = GidOwnership.None)(GBytes * gBytes)Convert a GLib GBytes to a D array. Params: ownership = The ownership of the GBytes, None (default): do nothing with it, Container/Full: unref gBytes = The GBytes instance Returns: D array of the g...
fnT[] gArrayGToD(T, GidOwnership ownership = GidOwnership.None)(GArray * gArray) if (containerTypeIsSupported!T)Convert a GLib GArray to a D array. Params: T = The type of elements in the array ownership = The ownership of the GArray, None (default): do nothing with it, Container: free container only, Full: ...
fnT[] gPtrArrayToD(T, GidOwnership ownership = GidOwnership.None)(GPtrArray * ptrArray) if (containerTypeIsSupported!T)Convert a GLib GPtrArray to a D array. Params: T = The type of elements in the pointer array ownership = The ownership of the GPtrArray, None (default): do nothing with it, Container: free containe...
fnT[] gListToD(T, GidOwnership ownership = GidOwnership.None)(GList * list) if (containerTypeIsSupported!T)Convert a GLib GList to a D array. Params: T = The type of elements in the list ownership = The ownership of the GList, None (default): do nothing with it, Container: free list only, Full: free lis...
fnT[] gSListToD(T, GidOwnership ownership = GidOwnership.None)(GSList * list) if (containerTypeIsSupported!T)Convert a GLib GSList to a D array. Params: T = The type of elements in the list ownership = The ownership of the GSList, None (default): do nothing with it, Container: free list only, Full: free l...
fnV[K] gHashTableToD(K, V, GidOwnership ownership = GidOwnership.None)(GHashTable * hash) if ((is(K == string) || is(K == const(void) *)) && (is(V : gobject.object.ObjectWrap) || is(V == interface) || is(V == string) || is(V == void *)))Template to convert a GHashTable to a D associative array. `K`: The key D type `V`: The value D type `owned`: Set to true if caller takes ownership of hash (frees it), false to leave it alone (defa...
fnGByteArray * gByteArrayFromD(ubyte[] a)Template to convert a D ubyte array to a GByteArray for passing to C functions Params: a = The D array Returns: New GArray which should be freed with containerFree!() template (if ownership not tak...
fnGBytes * gBytesFromD(ubyte[] a)Template to convert a D ubyte array to a GBytes for passing to C functions Params: a = The D array Returns: New GBytes which should be freed with containerFree!() template (if ownership not taken b...
fnGArray * gArrayGFromD(T, bool zeroTerminated = false)(T[] a) if (containerTypeIsSupported!T)Template to convert a D array to a GArray for passing to C functions Params: T = Type of the array values zeroTerminated = Set to true to enable zero termination in GArray (defaults to false) a = T...
fnGPtrArray * gPtrArrayFromD(T, bool zeroTerminated = false)(T[] a) if (containerTypeIsSupported!T)Template to convert a D array to a GPtrArray for passing to C functions Params: T = Type of the array values zeroTerminated = Set to true to enable zero termination in GPtrArray (defaults to false)...
fnGList * gListFromD(T)(T[] a) if (containerTypeIsSupported!T && !isTypeSimple!T)Template to convert a D array to a GList for passing to C functions Params: T = Type of the array values a = The D array Returns: New GList which should be freed with containerFree!() template (if ...
fnGSList * gSListFromD(T)(T[] a) if (containerTypeIsSupported!T)Template to convert a D array to a GSList for passing to C functions Params: T = Type of the array values zeroTerminated = Set to true to enable zero termination in GArray (defaults to false) a = T...
fnGHashTable * gHashTableFromD(K, V)(V[K] map) if ((is(K == string) || is(K == const(void) *)) && (is(V : gobject.object.ObjectWrap) || is(V == interface) || is(V == string) || is(V == void *)))Convert a D map to a GHashTable. Params: K = The key type V = The value type map = The D map Returns: A newly allocated GHashTable.
fnbool containerTypeIsSupported(T)()Check if a type is supported for the purpose of transforming between C and D containers Params: T = The type to check Returns: true if the type can be used for container C to/from D transformation
fnuint containerTypeSize(T)() if (containerTypeIsSupported!T)Get the size required for the type of an element for a container. Params: T = The type Returns: The element size in bytes
fnvoid containerFree(CT, T, GidOwnership ownership = GidOwnership.None)(CT container)Free a GLib container type. Params: CT = The C struct type pointer of the container type T = The type of the item stored in the container ownership = The ownership of the container from the perspec...
fnbool isTypeCopyableStruct(T)()Check if a type is a Boxed or Reffed type Params: T = Type to check Returns: true if type is a boxed or reffed type
fnbool isTypeSimple(T)()Check if a type is considered a simple container type (can be copied directly) Params: T = The D type to check Returns: bool if type is considered simple
fnT cToD(T)(void * data) if (containerTypeIsSupported!T)Template to copy a D value from a C value. Params: T = The D value type data = Pointer to the C value Returns: D value which is a copy of the C value
fnvoid dToC(T)(T val, void * data) if (containerTypeIsSupported!T)Template to copy a C value from a D value. Params: T = The D value type val = The D value to copy data = Pointer to the location to store the C value
fnvoid cValueFree(T)(void * data) if (containerTypeIsSupported!T)Free a C value. The value type is defined by the equivalent D template type T. Does nothing if the type does not need to be freed. Params: T = The D type counterpart data = Pointer to the C value
fnbool isBoxed(T)()Check if a type is a boxed struct or class. Params: T = The type to check Returns: true if T is a boxed type (just checks if it has a boxCopy member)
fnvoid * boxedCopy(T)(void * cBoxed)Copy a C boxed value using gboxedcopy. Params: T = The D boxed type cBoxed = The C boxed pointer Returns: A copy of the boxed type
fnvoid boxedFree(T)(void * cBoxed)Free a C boxed value using gboxedfree. Params: T = The D boxed type cBoxed = The C boxed pointer