gslist.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_SLIST_H__
00029 #define __G_SLIST_H__
00030 
00031 #include <_ansi.h>
00032 #include <glib/gmem.h>
00033 
00034 G_BEGIN_DECLS
00035 
00036 typedef struct _GSList GSList;
00037 
00038 struct _GSList
00039 {
00040   gpointer data;
00041   GSList *next;
00042 };
00043 
00044 /* Singly linked lists
00045  */
00046 IMPORT_C GSList*  g_slist_alloc                   (void) G_GNUC_WARN_UNUSED_RESULT;
00047 IMPORT_C void     g_slist_free           (GSList           *list);
00048 IMPORT_C void     g_slist_free_1         (GSList           *list);
00049 #define  g_slist_free1                   g_slist_free_1
00050 IMPORT_C GSList*  g_slist_append         (GSList           *list,
00051                                           gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00052 IMPORT_C GSList*  g_slist_prepend        (GSList           *list,
00053                                           gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00054 IMPORT_C GSList*  g_slist_insert                  (GSList           *list,
00055                                           gpointer          data,
00056                                           gint              position) G_GNUC_WARN_UNUSED_RESULT;
00057 IMPORT_C GSList*  g_slist_insert_sorted           (GSList           *list,
00058                                           gpointer          data,
00059                                           GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
00060 IMPORT_C GSList*  g_slist_insert_sorted_with_data (GSList           *list,
00061                                           gpointer          data,
00062                                           GCompareDataFunc  func,
00063                                           gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
00064 IMPORT_C GSList*  g_slist_insert_before           (GSList           *slist,
00065                                           GSList           *sibling,
00066                                           gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00067 IMPORT_C GSList*  g_slist_concat         (GSList           *list1,
00068                                           GSList           *list2) G_GNUC_WARN_UNUSED_RESULT;
00069 IMPORT_C GSList*  g_slist_remove         (GSList           *list,
00070                                           gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
00071 IMPORT_C GSList*  g_slist_remove_all     (GSList           *list,
00072                                           gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
00073 IMPORT_C GSList*  g_slist_remove_link    (GSList           *list,
00074                                           GSList           *link_) G_GNUC_WARN_UNUSED_RESULT;
00075 IMPORT_C GSList*  g_slist_delete_link    (GSList           *list,
00076                                           GSList           *link_) G_GNUC_WARN_UNUSED_RESULT;
00077 IMPORT_C GSList*  g_slist_reverse                 (GSList           *list) G_GNUC_WARN_UNUSED_RESULT;
00078 IMPORT_C GSList*  g_slist_copy                    (GSList           *list) G_GNUC_WARN_UNUSED_RESULT;
00079 IMPORT_C GSList*  g_slist_nth            (GSList           *list,
00080                                           guint             n);
00081 IMPORT_C GSList*  g_slist_find           (GSList           *list,
00082                                           gconstpointer     data);
00083 IMPORT_C GSList*  g_slist_find_custom    (GSList           *list,
00084                                           gconstpointer     data,
00085                                           GCompareFunc      func);
00086 IMPORT_C gint     g_slist_position       (GSList           *list,
00087                                           GSList           *llink);
00088 IMPORT_C gint     g_slist_index          (GSList           *list,
00089                                           gconstpointer     data);
00090 IMPORT_C GSList*  g_slist_last           (GSList           *list);
00091 IMPORT_C guint    g_slist_length         (GSList           *list);
00092 IMPORT_C void     g_slist_foreach        (GSList           *list,
00093                                           GFunc             func,
00094                                           gpointer          user_data);
00095 IMPORT_C GSList*  g_slist_sort           (GSList           *list,
00096                                           GCompareFunc      compare_func) G_GNUC_WARN_UNUSED_RESULT;
00097 IMPORT_C GSList*  g_slist_sort_with_data (GSList           *list,
00098                                           GCompareDataFunc  compare_func,
00099                                           gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
00100 IMPORT_C gpointer g_slist_nth_data       (GSList           *list,
00101                                           guint             n);
00102 
00103 #define  g_slist_next(slist)             ((slist) ? (((GSList *)(slist))->next) : NULL)
00104 
00105 #ifndef G_DISABLE_DEPRECATED
00106 IMPORT_C void     g_slist_push_allocator          (gpointer        dummy);
00107 IMPORT_C void     g_slist_pop_allocator           (void);
00108 #endif
00109 G_END_DECLS
00110 
00111 #endif /* __G_SLIST_H__ */
00112 

Copyright © Nokia Corporation 2001-2008
Back to top