ListSG

The #GSList struct is used for each element in the singly-linked list.

Constructors

this
this(GSList* gSList, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Aliases

foreac
alias foreac = foreach_
Undocumented in source.

Functions

append
ListSG append(void* data)

Adds a new element on to the end of the list.

concat
ListSG concat(ListSG list2)

Adds the second #GSList onto the end of the first #GSList. Note that the elements of the second #GSList are not copied. They are used directly.

copy
ListSG copy()

Copies a #GSList.

copyDeep
ListSG copyDeep(GCopyFunc func, void* userData)

Makes a full (deep) copy of a #GSList.

deleteLink
ListSG deleteLink(ListSG link)

Removes the node link_ from the list and frees it. Compare this to g_slist_remove_link() which removes the node without freeing it.

find
ListSG find(void* data)

Finds the element in a #GSList which contains the given data.

findCustom
ListSG findCustom(void* data, GCompareFunc func)

Finds an element in a #GSList, using a supplied function to find the desired element. It iterates over the list, calling the given function which should return 0 when the desired element is found. The function takes two #gconstpointer arguments, the #GSList element's data as the first argument and the given user data.

foreach_
void foreach_(GFunc func, void* userData)

Calls a function for each element of a #GSList.

free
void free()

Frees all of the memory used by a #GSList. The freed elements are returned to the slice allocator.

free1
void free1()

Frees one #GSList element. It is usually used after g_slist_remove_link().

freeFull
void freeFull(GDestroyNotify freeFunc)

Convenience method, which frees all the memory used by a #GSList, and calls the specified destroy function on every element's data.

getListSGStruct
GSList* getListSGStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

index
int index(void* data)

Gets the position of the element containing the given data (starting from 0).

insert
ListSG insert(void* data, int position)

Inserts a new element into the list at the given position.

insertBefore
ListSG insertBefore(ListSG sibling, void* data)

Inserts a node before @sibling containing @data.

insertSorted
ListSG insertSorted(void* data, GCompareFunc func)

Inserts a new element into the list, using the given comparison function to determine its position.

insertSortedWithData
ListSG insertSortedWithData(void* data, GCompareDataFunc func, void* userData)

Inserts a new element into the list, using the given comparison function to determine its position.

last
ListSG last()

Gets the last element in a #GSList.

length
uint length()

Gets the number of elements in a #GSList.

nth
ListSG nth(uint n)

Gets the element at the given position in a #GSList.

nthData
void* nthData(uint n)

Gets the data of the element at the given position.

position
int position(ListSG llink)

Gets the position of the given element in the #GSList (starting from 0).

prepend
ListSG prepend(void* data)

Adds a new element on to the start of the list.

remove
ListSG remove(void* data)

Removes an element from a #GSList. If two elements contain the same data, only the first is removed. If none of the elements contain the data, the #GSList is unchanged.

removeAll
ListSG removeAll(void* data)

Removes all list nodes with data equal to @data. Returns the new head of the list. Contrast with g_slist_remove() which removes only the first node matching the given data.

removeLink
ListSG removeLink(ListSG link)

Removes an element from a #GSList, without freeing the element. The removed element's next link is set to %NULL, so that it becomes a self-contained list with one element.

reverse
ListSG reverse()

Reverses a #GSList.

sort
ListSG sort(GCompareFunc compareFunc)

Sorts a #GSList using the given comparison function. The algorithm used is a stable sort.

sortWithData
ListSG sortWithData(GCompareDataFunc compareFunc, void* userData)

Like g_slist_sort(), but the sort function accepts a user data argument.

toArray
T[] toArray()

Turn the list into a D array of the desiered type. Type T wraps should match the type of the data.

Properties

data
void* data [@property getter]
next
ListSG next [@property getter]

get the next element

Static functions

alloc
ListSG alloc()

Allocates space for one #GSList element. It is called by the g_slist_append(), g_slist_prepend(), g_slist_insert() and g_slist_insert_sorted() functions and so is rarely used on its own.

clearSlist
void clearSlist(ListSG slistPtr, GDestroyNotify destroy)

Clears a pointer to a #GSList, freeing it and, optionally, freeing its elements using @destroy.

Variables

gSList
GSList* gSList;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta