various: add GLIB_AVAILABLE_IN_ALL everywhere else
[platform/upstream/glib.git] / glib / glist.h
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 __G_LIST_H__
28 #define __G_LIST_H__
29
30 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31 #error "Only <glib.h> can be included directly."
32 #endif
33
34 #include <glib/gmem.h>
35 #include <glib/gnode.h>
36
37 G_BEGIN_DECLS
38
39 typedef struct _GList GList;
40
41 struct _GList
42 {
43   gpointer data;
44   GList *next;
45   GList *prev;
46 };
47
48 /* Doubly linked lists
49  */
50 GLIB_AVAILABLE_IN_ALL
51 GList*   g_list_alloc                   (void) G_GNUC_WARN_UNUSED_RESULT;
52 GLIB_AVAILABLE_IN_ALL
53 void     g_list_free                    (GList            *list);
54 GLIB_AVAILABLE_IN_ALL
55 void     g_list_free_1                  (GList            *list);
56 #define  g_list_free1                   g_list_free_1
57 GLIB_AVAILABLE_IN_ALL
58 void     g_list_free_full               (GList            *list,
59                                          GDestroyNotify    free_func);
60 GLIB_AVAILABLE_IN_ALL
61 GList*   g_list_append                  (GList            *list,
62                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
63 GLIB_AVAILABLE_IN_ALL
64 GList*   g_list_prepend                 (GList            *list,
65                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
66 GLIB_AVAILABLE_IN_ALL
67 GList*   g_list_insert                  (GList            *list,
68                                          gpointer          data,
69                                          gint              position) G_GNUC_WARN_UNUSED_RESULT;
70 GLIB_AVAILABLE_IN_ALL
71 GList*   g_list_insert_sorted           (GList            *list,
72                                          gpointer          data,
73                                          GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
74 GLIB_AVAILABLE_IN_ALL
75 GList*   g_list_insert_sorted_with_data (GList            *list,
76                                          gpointer          data,
77                                          GCompareDataFunc  func,
78                                          gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
79 GLIB_AVAILABLE_IN_ALL
80 GList*   g_list_insert_before           (GList            *list,
81                                          GList            *sibling,
82                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
83 GLIB_AVAILABLE_IN_ALL
84 GList*   g_list_concat                  (GList            *list1,
85                                          GList            *list2) G_GNUC_WARN_UNUSED_RESULT;
86 GLIB_AVAILABLE_IN_ALL
87 GList*   g_list_remove                  (GList            *list,
88                                          gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
89 GLIB_AVAILABLE_IN_ALL
90 GList*   g_list_remove_all              (GList            *list,
91                                          gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
92 GLIB_AVAILABLE_IN_ALL
93 GList*   g_list_remove_link             (GList            *list,
94                                          GList            *llink) G_GNUC_WARN_UNUSED_RESULT;
95 GLIB_AVAILABLE_IN_ALL
96 GList*   g_list_delete_link             (GList            *list,
97                                          GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
98 GLIB_AVAILABLE_IN_ALL
99 GList*   g_list_reverse                 (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
100 GLIB_AVAILABLE_IN_ALL
101 GList*   g_list_copy                    (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
102
103 GLIB_AVAILABLE_IN_2_34
104 GList*   g_list_copy_deep               (GList            *list,
105                                          GCopyFunc         func,
106                                          gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
107
108 GLIB_AVAILABLE_IN_ALL
109 GList*   g_list_nth                     (GList            *list,
110                                          guint             n);
111 GLIB_AVAILABLE_IN_ALL
112 GList*   g_list_nth_prev                (GList            *list,
113                                          guint             n);
114 GLIB_AVAILABLE_IN_ALL
115 GList*   g_list_find                    (GList            *list,
116                                          gconstpointer     data);
117 GLIB_AVAILABLE_IN_ALL
118 GList*   g_list_find_custom             (GList            *list,
119                                          gconstpointer     data,
120                                          GCompareFunc      func);
121 GLIB_AVAILABLE_IN_ALL
122 gint     g_list_position                (GList            *list,
123                                          GList            *llink);
124 GLIB_AVAILABLE_IN_ALL
125 gint     g_list_index                   (GList            *list,
126                                          gconstpointer     data);
127 GLIB_AVAILABLE_IN_ALL
128 GList*   g_list_last                    (GList            *list);
129 GLIB_AVAILABLE_IN_ALL
130 GList*   g_list_first                   (GList            *list);
131 GLIB_AVAILABLE_IN_ALL
132 guint    g_list_length                  (GList            *list);
133 GLIB_AVAILABLE_IN_ALL
134 void     g_list_foreach                 (GList            *list,
135                                          GFunc             func,
136                                          gpointer          user_data);
137 GLIB_AVAILABLE_IN_ALL
138 GList*   g_list_sort                    (GList            *list,
139                                          GCompareFunc      compare_func) G_GNUC_WARN_UNUSED_RESULT;
140 GLIB_AVAILABLE_IN_ALL
141 GList*   g_list_sort_with_data          (GList            *list,
142                                          GCompareDataFunc  compare_func,
143                                          gpointer          user_data)  G_GNUC_WARN_UNUSED_RESULT;
144 GLIB_AVAILABLE_IN_ALL
145 gpointer g_list_nth_data                (GList            *list,
146                                          guint             n);
147
148
149 #define g_list_previous(list)           ((list) ? (((GList *)(list))->prev) : NULL)
150 #define g_list_next(list)               ((list) ? (((GList *)(list))->next) : NULL)
151
152 G_END_DECLS
153
154 #endif /* __G_LIST_H__ */