1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module glib.glist; 7 8 import glib.gtypes; 9 import glib.gmem; 10 import glib.gnode; 11 12 13 14 struct GList 15 { 16 gpointer data; 17 GList *next; 18 GList *prev; 19 } 20 21 22 extern (C) { 23 24 GList* g_list_alloc (); 25 26 void g_list_free (GList *list); 27 28 void g_list_free_1 (GList *list); 29 alias g_list_free1 = g_list_free_1; 30 31 void g_list_free_full (GList *list, 32 GDestroyNotify free_func); 33 34 GList* g_list_append (GList *list, 35 gpointer data); 36 37 GList* g_list_prepend (GList *list, 38 gpointer data); 39 40 GList* g_list_insert (GList *list, 41 gpointer data, 42 gint position); 43 44 GList* g_list_insert_sorted (GList *list, 45 gpointer data, 46 GCompareFunc func); 47 48 GList* g_list_insert_sorted_with_data (GList *list, 49 gpointer data, 50 GCompareDataFunc func, 51 gpointer user_data); 52 53 GList* g_list_insert_before (GList *list, 54 GList *sibling, 55 gpointer data); 56 57 GList* g_list_concat (GList *list1, 58 GList *list2); 59 60 GList* g_list_remove (GList *list, 61 gconstpointer data); 62 63 GList* g_list_remove_all (GList *list, 64 gconstpointer data); 65 66 GList* g_list_remove_link (GList *list, 67 GList *llink); 68 69 GList* g_list_delete_link (GList *list, 70 GList *link_); 71 72 GList* g_list_reverse (GList *list); 73 74 GList* g_list_copy (GList *list); 75 76 77 GList* g_list_copy_deep (GList *list, 78 GCopyFunc func, 79 gpointer user_data); 80 81 82 GList* g_list_nth (GList *list, 83 guint n); 84 85 GList* g_list_nth_prev (GList *list, 86 guint n); 87 88 GList* g_list_find (GList *list, 89 gconstpointer data); 90 91 GList* g_list_find_custom (GList *list, 92 gconstpointer data, 93 GCompareFunc func); 94 95 gint g_list_position (GList *list, 96 GList *llink); 97 98 gint g_list_index (GList *list, 99 gconstpointer data); 100 101 GList* g_list_last (GList *list); 102 103 GList* g_list_first (GList *list); 104 105 guint g_list_length (GList *list); 106 107 void g_list_foreach (GList *list, 108 GFunc func, 109 gpointer user_data); 110 111 GList* g_list_sort (GList *list, 112 GCompareFunc compare_func); 113 114 GList* g_list_sort_with_data (GList *list, 115 GCompareDataFunc compare_func, 116 gpointer user_data); 117 118 gpointer g_list_nth_data (GList *list, 119 guint n); 120 121 } 122 123 auto g_list_previous(L)(L list) { return list ? list.prev : null; } 124 auto g_list_next(L)(L list) { return list ? list.next : null; } 125