gqueue.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_QUEUE_H__
00029 #define __G_QUEUE_H__
00030 
00031 #include <_ansi.h>
00032 #include <glib/glist.h>
00033 
00034 G_BEGIN_DECLS
00035 
00036 typedef struct _GQueue          GQueue;
00037 
00038 struct _GQueue
00039 {
00040   GList *head;
00041   GList *tail;
00042   guint  length;
00043 };
00044 
00045 /* Queues
00046  */
00047 IMPORT_C GQueue*  g_queue_new            (void);
00048 IMPORT_C void     g_queue_free           (GQueue           *queue);
00049 IMPORT_C gboolean g_queue_is_empty       (GQueue           *queue);
00050 IMPORT_C guint    g_queue_get_length     (GQueue           *queue);
00051 IMPORT_C void     g_queue_reverse        (GQueue           *queue);
00052 IMPORT_C GQueue * g_queue_copy           (GQueue           *queue);
00053 IMPORT_C void     g_queue_foreach        (GQueue           *queue,
00054                                  GFunc             func,
00055                                  gpointer          user_data);
00056 IMPORT_C GList *  g_queue_find           (GQueue           *queue,
00057                                  gconstpointer     data);
00058 IMPORT_C GList *  g_queue_find_custom    (GQueue           *queue,
00059                                  gconstpointer     data,
00060                                  GCompareFunc      func);
00061 IMPORT_C void     g_queue_sort           (GQueue           *queue,
00062                                  GCompareDataFunc  compare_func,
00063                                  gpointer          user_data);
00064 
00065 IMPORT_C void     g_queue_push_head      (GQueue           *queue,
00066                                  gpointer          data);
00067 IMPORT_C void     g_queue_push_tail      (GQueue           *queue,
00068                                  gpointer          data);
00069 IMPORT_C void     g_queue_push_nth       (GQueue           *queue,
00070                                  gpointer          data,
00071                                  gint              n);
00072 IMPORT_C gpointer g_queue_pop_head       (GQueue           *queue);
00073 IMPORT_C gpointer g_queue_pop_tail       (GQueue           *queue);
00074 IMPORT_C gpointer g_queue_pop_nth        (GQueue           *queue,
00075                                  guint             n);
00076 IMPORT_C gpointer g_queue_peek_head      (GQueue           *queue);
00077 IMPORT_C gpointer g_queue_peek_tail      (GQueue           *queue);
00078 IMPORT_C gpointer g_queue_peek_nth       (GQueue           *queue,
00079                                  guint             n);
00080 IMPORT_C gint     g_queue_index          (GQueue           *queue,
00081                                  gconstpointer     data);
00082 IMPORT_C void     g_queue_remove         (GQueue           *queue,
00083                                  gconstpointer     data);
00084 IMPORT_C void     g_queue_remove_all     (GQueue           *queue,
00085                                  gconstpointer     data);
00086 IMPORT_C void     g_queue_insert_before  (GQueue           *queue,
00087                                  GList            *sibling,
00088                                  gpointer          data);
00089 IMPORT_C void     g_queue_insert_after   (GQueue           *queue,
00090                                  GList            *sibling,
00091                                  gpointer          data);
00092 IMPORT_C void     g_queue_insert_sorted  (GQueue           *queue,
00093                                  gpointer          data,
00094                                  GCompareDataFunc  func,
00095                                  gpointer          user_data);
00096 
00097 IMPORT_C void     g_queue_push_head_link (GQueue           *queue,
00098                                  GList            *link_);
00099 IMPORT_C void     g_queue_push_tail_link (GQueue           *queue,
00100                                  GList            *link_);
00101 IMPORT_C void     g_queue_push_nth_link  (GQueue           *queue,
00102                                  gint              n,
00103                                  GList            *link_);
00104 IMPORT_C GList*   g_queue_pop_head_link  (GQueue           *queue);
00105 IMPORT_C GList*   g_queue_pop_tail_link  (GQueue           *queue);
00106 IMPORT_C GList*   g_queue_pop_nth_link   (GQueue           *queue,
00107                                  guint             n);
00108 IMPORT_C GList*   g_queue_peek_head_link (GQueue           *queue);
00109 IMPORT_C GList*   g_queue_peek_tail_link (GQueue           *queue);
00110 IMPORT_C GList*   g_queue_peek_nth_link  (GQueue           *queue,
00111                                  guint             n);
00112 IMPORT_C gint     g_queue_link_index     (GQueue           *queue,
00113                                  GList            *link_);
00114 IMPORT_C void     g_queue_unlink         (GQueue           *queue,
00115                                  GList            *link_);
00116 IMPORT_C void     g_queue_delete_link    (GQueue           *queue,
00117                                  GList            *link_);
00118 
00119 G_END_DECLS
00120 
00121 #endif /* __G_QUEUE_H__ */

Copyright © Nokia Corporation 2001-2008
Back to top