XMMS2
xmms_list.h
Go to the documentation of this file.
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 /*
21  * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22  * file for a list of people on the GLib Team. See the ChangeLog
23  * files for a list of changes. These files are distributed with
24  * GLib at ftp://ftp.gtk.org/pub/gtk/.
25  */
26 
27 #ifndef __X_LIST_H__
28 #define __X_LIST_H__
29 
30 #include "xmmsclientpriv/xmmsclient_util.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct _x_list_t x_list_t;
37 
38 struct _x_list_t
39 {
40  void * data;
43 };
44 
45 /* Doubly linked lists
46  */
47 x_list_t* x_list_alloc (void);
48 void x_list_free (x_list_t *list);
49 void x_list_free_1 (x_list_t *list);
51  void * data);
53  void * data);
55  void * data,
56  int position);
58  void * data,
59  XCompareFunc func);
61  x_list_t *sibling,
62  void * data);
64  x_list_t *list2);
66  const void * data);
68  const void * data);
70  x_list_t *llink);
72  x_list_t *link_);
76  unsigned int n);
78  unsigned int n);
80  const void * data);
82  const void * data,
83  XCompareFunc func);
84 int x_list_position (x_list_t *list,
85  x_list_t *llink);
86 int x_list_index (x_list_t *list,
87  const void * data);
90 unsigned int x_list_length (x_list_t *list);
91 void x_list_foreach (x_list_t *list,
92  XFunc func,
93  void * user_data);
94 void * x_list_nth_data (x_list_t *list,
95  unsigned int n);
96 
97 #define x_list_previous(list) ((list) ? (((x_list_t *)(list))->prev) : NULL)
98 #define x_list_next(list) ((list) ? (((x_list_t *)(list))->next) : NULL)
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* __X_LIST_H__ */
105