gid.gid
Module for [gid] class
enum GidOwnership
class GidConstructException
fn arrayDtoC boxedCopy boxedFree containerFree containerTypeIsSupported containerTypeSize cToD cValueFree dToC freezeDelegate fromCString gArrayGFromD gArrayGToD gByteArrayFromD gByteArrayToD gBytesFromD gBytesToD gHashTableFromD gHashTableToD gListFromD gListToD gPtrArrayFromD gPtrArrayToD gSListFromD gSListToD isBoxed isTypeCopyableStruct isTypeSimple ptrFreezeGC ptrThawDestroyNotify ptrThawGC strdup thawDelegate toCString
Types 4
enumGidOwnership
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
fn
void 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...fn
void 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 offn
void 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.fn
void * 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...fn
void thawDelegate(void * dlg)Unfreeze a delegate which was frozen with `freezeDelegate`, allowing it to be garbage collected Params: dlg = The C heap memory allocated delegatefn
char * 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...fn
string 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...fn
char * strdup(const(char) * s)Duplicate a zero terminate C string. Params: s = The zero terminated string to duplicate Returns: The duplicate string Throws: OutOfMemoryErrorfn
T * 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...fn
ubyte[] 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...fn
ubyte[] 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...fn
T[] 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: ...fn
T[] 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...fn
T[] 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...fn
T[] 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...fn
V[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...fn
GByteArray * 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...fn
GBytes * 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...fn
GArray * 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...fn
GPtrArray * 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)...fn
GList * 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 ...fn
GSList * 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...fn
GHashTable * 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.fn
bool 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 transformationfn
uint 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 bytesfn
void 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...fn
bool 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 typefn
bool 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 simplefn
T 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 valuefn
void 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 valuefn
void 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 valuefn
bool 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)fn
void * 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 typefn
void boxedFree(T)(void * cBoxed)Free a C boxed value using gboxedfree. Params: T = The D boxed type cBoxed = The C boxed pointer