Main Page | Data Structures | File List | Data Fields | Globals

gcontainer.h

Go to the documentation of this file.
00001 /*
00002  * luau (Lib Update/Auto-Update): Simple Update Library
00003  * Copyright (C) 2003  David Eklund
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.1 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 Free Software       -
00017  * - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -
00018  */
00019 
00020 #ifndef GCONTAINER_H
00021 #define GCONTAINER_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #  include <config.h>
00025 #endif
00026 
00027 #include <glib.h>
00028 
00030 typedef enum { GCONT_PTR_ARRAY, GCONT_LIST, GCONT_SLIST } GContType;
00031 
00033 typedef struct {
00034         GContType type;
00035         int len;
00036         void *data;
00037 } GContainer;
00038 
00040 typedef struct {
00041         GContType type;
00042         int index;
00043         union {
00044                 GPtrArray *array;
00045                 GSList *slistPtr;
00046                 struct {
00047                         GList *curr;
00048                         GList *last;
00049                 } list;
00050         } data;
00051 } GIterator;
00052 
00053 GContainer* g_container_new(GContType type);
00054 GContainer* g_container_new_from_data(GContType type, void *data);
00055 
00056 void g_container_add(GContainer *container, const gpointer data);
00057 
00058 gboolean g_container_remove(GContainer *container, const gpointer data);
00059 gboolean g_container_remove_fast(GContainer *container, const gpointer data);
00060 gpointer g_container_remove_index(GContainer *container, guint index);
00061 gpointer g_container_remove_index_fast(GContainer *container, guint index);
00062 
00063 gpointer g_container_index(const GContainer *container, guint index);
00064 
00065 gboolean g_container_get_iter(GIterator *iter, const GContainer *container);
00066 gboolean g_container_get_iter_last(GIterator *iter, const GContainer *container);
00067 
00068 gpointer g_iterator_get(const GIterator *iter);
00069 gpointer g_iterator_next(GIterator *iter);
00070 gpointer g_iterator_prev(GIterator *iter);
00071 gboolean g_iterator_hasNext(const GIterator *iter);
00072 gboolean g_iterator_hasPrev(const GIterator *iter);
00073 
00075 void* g_container_free(GContainer *container, gboolean freeAssoc);
00076 
00078 void g_container_copy(GContainer *dest, GContainer *src);
00080 void g_container_convert(GContType type, GContainer *container);
00082 void g_container_destroy(GContainer *array);
00084 void g_container_destroy_type(GContType type, void *array);
00085 
00086 #endif /* GCONTAINER_H */

Generated on Mon Apr 12 22:17:10 2004 for luau by doxygen 1.3.2