Companion

object Companion

Functions

Link copied to clipboard
fun alloc(): List

Allocates space for one #GList element. It is called by g_list_append(), g_list_prepend(), g_list_insert() and g_list_insert_sorted() and so is rarely used on its own.

Link copied to clipboard
fun append(list: List, data: <Error class: unknown class>? = null): List

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

Link copied to clipboard
fun concat(list1: List, list2: List): List

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

Link copied to clipboard
fun copy(list: List): List

Copies a #GList.

Link copied to clipboard
fun copyDeep(list: List, func: CopyFunc): List

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

Link copied to clipboard
fun deleteLink(list: List, link: List): List

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

Link copied to clipboard
fun find(list: List, data: <Error class: unknown class>? = null): List

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

Link copied to clipboard
fun first(list: List): List

Gets the first element in a #GList.

Link copied to clipboard
fun foreach(list: List, func: Func)

Calls a function for each element of a #GList.

Link copied to clipboard
fun free(list: List)

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

Link copied to clipboard
fun free1(list: List)

Frees one #GList element, but does not update links from the next and previous elements in the list, so you should not call this function on an element that is currently part of a list.

Link copied to clipboard
fun index(list: List, data: <Error class: unknown class>? = null): <Error class: unknown class>

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

Link copied to clipboard
fun insert(list: List, data: <Error class: unknown class>? = null, position: <Error class: unknown class>): List

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

Link copied to clipboard
fun insertBefore(list: List, sibling: List, data: <Error class: unknown class>? = null): List

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

Link copied to clipboard
fun insertBeforeLink(list: List, sibling: List? = null, link: List): List

Inserts @link_ into the list before the given position.

Link copied to clipboard
fun insertSortedWithData(list: List, data: <Error class: unknown class>? = null, func: CompareDataFunc): List

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

Link copied to clipboard
fun last(list: List): List

Gets the last element in a #GList.

Link copied to clipboard
fun length(list: List): <Error class: unknown class>

Gets the number of elements in a #GList.

Link copied to clipboard
fun nth(list: List, n: <Error class: unknown class>): List

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

Link copied to clipboard
fun nthData(list: List, n: <Error class: unknown class>): <Error class: unknown class>?

Gets the data of the element at the given position.

Link copied to clipboard
fun nthPrev(list: List, n: <Error class: unknown class>): List

Gets the element @n places before @list.

Link copied to clipboard
Link copied to clipboard
fun position(list: List, llink: List): <Error class: unknown class>

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

Link copied to clipboard
fun prepend(list: List, data: <Error class: unknown class>? = null): List

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

Link copied to clipboard
fun remove(list: List, data: <Error class: unknown class>? = null): List

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

Link copied to clipboard
fun removeAll(list: List, data: <Error class: unknown class>? = null): List

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

Link copied to clipboard
fun removeLink(list: List, llink: List): List

Removes an element from a #GList, without freeing the element. The removed element's prev and next links are set to null, so that it becomes a self-contained list with one element.

Link copied to clipboard
fun reverse(list: List): List

Reverses a #GList. It simply switches the next and prev pointers of each element.

Link copied to clipboard
fun sortWithData(list: List, compareFunc: CompareDataFunc): List

Like g_list_sort(), but the comparison function accepts a user data argument.