glist.h

Go to the documentation of this file.
00001 /* GLIB - Library of useful routines for C programming
00002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00003  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 /*
00022  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00023  * file for a list of people on the GLib Team.  See the ChangeLog
00024  * files for a list of changes.  These files are distributed with
00025  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
00026  */
00027 
00028 #ifndef __G_LIST_H__
00029 #define __G_LIST_H__
00030 
00031 #include <_ansi.h>
00032 #include <glib/gmem.h>
00033 
00034 G_BEGIN_DECLS
00035 
00036 typedef struct _GList GList;
00037 
00038 struct _GList
00039 {
00040   gpointer data;
00041   GList *next;
00042   GList *prev;
00043 };
00044 
00045 /* Doubly linked lists
00046  */
00047 IMPORT_C GList*   g_list_alloc          (void);
00048 IMPORT_C void     g_list_free           (GList            *list);
00049 IMPORT_C void     g_list_free_1         (GList            *list);
00050 #define  g_list_free1                   g_list_free_1
00051 IMPORT_C GList*   g_list_append         (GList            *list,
00052                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00053 IMPORT_C GList*   g_list_prepend        (GList            *list,
00054                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00055 IMPORT_C GList*   g_list_insert                  (GList            *list,
00056                                          gpointer          data,
00057                                          gint              position) G_GNUC_WARN_UNUSED_RESULT;
00058 IMPORT_C GList*   g_list_insert_sorted           (GList            *list,
00059                                          gpointer          data,
00060                                          GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
00061 IMPORT_C GList*   g_list_insert_sorted_with_data (GList            *list,
00062                                          gpointer          data,
00063                                          GCompareDataFunc  func,
00064                                          gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
00065 IMPORT_C GList*   g_list_insert_before  (GList            *list,
00066                                          GList            *sibling,
00067                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00068 IMPORT_C GList*   g_list_concat         (GList            *list1,
00069                                          GList            *list2) G_GNUC_WARN_UNUSED_RESULT;
00070 IMPORT_C GList*   g_list_remove         (GList            *list,
00071                                          gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
00072 IMPORT_C GList*   g_list_remove_all     (GList            *list,
00073                                          gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
00074 IMPORT_C GList*   g_list_remove_link    (GList            *list,
00075                                          GList            *llink) G_GNUC_WARN_UNUSED_RESULT;
00076 IMPORT_C GList*   g_list_delete_link    (GList            *list,
00077                                          GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
00078 IMPORT_C GList*   g_list_reverse        (GList            *list);
00079 IMPORT_C GList*   g_list_copy           (GList            *list);
00080 IMPORT_C GList*   g_list_nth            (GList            *list,
00081                                          guint             n);
00082 IMPORT_C GList*   g_list_nth_prev       (GList            *list,
00083                                          guint             n);
00084 IMPORT_C GList*   g_list_find           (GList            *list,
00085                                          gconstpointer     data);
00086 IMPORT_C GList*   g_list_find_custom    (GList            *list,
00087                                          gconstpointer     data,
00088                                          GCompareFunc      func);
00089 IMPORT_C gint     g_list_position       (GList            *list,
00090                                          GList            *llink);
00091 IMPORT_C gint     g_list_index          (GList            *list,
00092                                          gconstpointer     data);
00093 IMPORT_C GList*   g_list_last           (GList            *list);
00094 IMPORT_C GList*   g_list_first          (GList            *list);
00095 IMPORT_C guint    g_list_length         (GList            *list);
00096 IMPORT_C void     g_list_foreach        (GList            *list,
00097                                          GFunc             func,
00098                                          gpointer          user_data);
00099 IMPORT_C GList*   g_list_sort           (GList            *list,
00100                                          GCompareFunc      compare_func) G_GNUC_WARN_UNUSED_RESULT;
00101 IMPORT_C GList*   g_list_sort_with_data (GList            *list,
00102                                          GCompareDataFunc  compare_func,
00103                                          gpointer          user_data)  G_GNUC_WARN_UNUSED_RESULT;
00104 IMPORT_C gpointer g_list_nth_data       (GList            *list,
00105                                          guint             n);
00106 
00107 
00108 #define g_list_previous(list)           ((list) ? (((GList *)(list))->prev) : NULL)
00109 #define g_list_next(list)               ((list) ? (((GList *)(list))->next) : NULL)
00110 
00111 #ifndef G_DISABLE_DEPRECATED
00112 IMPORT_C void     g_list_push_allocator          (gpointer          allocator);
00113 IMPORT_C void     g_list_pop_allocator           (void);
00114 #endif
00115 G_END_DECLS
00116 
00117 #endif /* __G_LIST_H__ */
00118 

Copyright © Nokia Corporation 2001-2008
Back to top