XMMS2
|
00001 /* GLIB - Library of useful routines for C programming 00002 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /* 00021 * Modified by the GLib Team and others 1997-2000. See the AUTHORS 00022 * file for a list of people on the GLib Team. See the ChangeLog 00023 * files for a list of changes. These files are distributed with 00024 * GLib at ftp://ftp.gtk.org/pub/gtk/. 00025 */ 00026 00027 #ifndef __X_LIST_H__ 00028 #define __X_LIST_H__ 00029 00030 #include "xmmsclientpriv/xmmsclient_util.h" 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 typedef struct _x_list_t x_list_t; 00037 00038 struct _x_list_t 00039 { 00040 void * data; 00041 x_list_t *next; 00042 x_list_t *prev; 00043 }; 00044 00045 /* Doubly linked lists 00046 */ 00047 x_list_t* x_list_alloc (void); 00048 void x_list_free (x_list_t *list); 00049 void x_list_free_1 (x_list_t *list); 00050 x_list_t* x_list_append (x_list_t *list, 00051 void * data); 00052 x_list_t* x_list_prepend (x_list_t *list, 00053 void * data); 00054 x_list_t* x_list_insert (x_list_t *list, 00055 void * data, 00056 int position); 00057 x_list_t* x_list_insert_sorted (x_list_t *list, 00058 void * data, 00059 XCompareFunc func); 00060 x_list_t* x_list_insert_before (x_list_t *list, 00061 x_list_t *sibling, 00062 void * data); 00063 x_list_t* x_list_concat (x_list_t *list1, 00064 x_list_t *list2); 00065 x_list_t* x_list_remove (x_list_t *list, 00066 const void * data); 00067 x_list_t* x_list_remove_all (x_list_t *list, 00068 const void * data); 00069 x_list_t* x_list_remove_link (x_list_t *list, 00070 x_list_t *llink); 00071 x_list_t* x_list_delete_link (x_list_t *list, 00072 x_list_t *link_); 00073 x_list_t* x_list_reverse (x_list_t *list); 00074 x_list_t* x_list_copy (x_list_t *list); 00075 x_list_t* x_list_nth (x_list_t *list, 00076 unsigned int n); 00077 x_list_t* x_list_nth_prev (x_list_t *list, 00078 unsigned int n); 00079 x_list_t* x_list_find (x_list_t *list, 00080 const void * data); 00081 x_list_t* x_list_find_custom (x_list_t *list, 00082 const void * data, 00083 XCompareFunc func); 00084 int x_list_position (x_list_t *list, 00085 x_list_t *llink); 00086 int x_list_index (x_list_t *list, 00087 const void * data); 00088 x_list_t* x_list_last (x_list_t *list); 00089 x_list_t* x_list_first (x_list_t *list); 00090 unsigned int x_list_length (x_list_t *list); 00091 void x_list_foreach (x_list_t *list, 00092 XFunc func, 00093 void * user_data); 00094 void * x_list_nth_data (x_list_t *list, 00095 unsigned int n); 00096 00097 #define x_list_previous(list) ((list) ? (((x_list_t *)(list))->prev) : NULL) 00098 #define x_list_next(list) ((list) ? (((x_list_t *)(list))->next) : NULL) 00099 00100 #ifdef __cplusplus 00101 } 00102 #endif 00103 00104 #endif /* __X_LIST_H__ */ 00105