ghash.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  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 /*
00021  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00022  * file for a list of people on the GLib Team.  See the ChangeLog
00023  * files for a list of changes.  These files are distributed with
00024  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
00025  */
00026 
00027 #ifndef __G_HASH_H__
00028 #define __G_HASH_H__
00029 
00030 #include <g_types.h>
00031 
00032 G_BEGIN_DECLS
00033 
00034 typedef struct _GHashTable      GHashTable;
00035 
00036 typedef gboolean        (*GHRFunc)              (gpointer       key,
00037                                                  gpointer       value,
00038                                                  gpointer       user_data);
00039 
00040 /* Hash tables
00041  */
00042 GHashTable* g_hash_table_new            (GHashFunc       hash_func,
00043                                          GEqualFunc      key_equal_func);
00044 void        g_hash_table_destroy        (GHashTable     *hash_table);
00045 void        g_hash_table_insert         (GHashTable     *hash_table,
00046                                          gpointer        key,
00047                                          gpointer        value);
00048 gboolean    g_hash_table_remove         (GHashTable     *hash_table,
00049                                          gconstpointer   key);
00050 gpointer    g_hash_table_lookup         (GHashTable     *hash_table,
00051                                          gconstpointer   key);
00052 gboolean    g_hash_table_lookup_extended(GHashTable     *hash_table,
00053                                          gconstpointer   lookup_key,
00054                                          gpointer       *orig_key,
00055                                          gpointer       *value);
00056 void        g_hash_table_foreach        (GHashTable     *hash_table,
00057                                          GHFunc          func,
00058                                          gpointer        user_data);
00059 guint       g_hash_table_foreach_remove (GHashTable     *hash_table,
00060                                          GHRFunc         func,
00061                                          gpointer        user_data);
00062 guint       g_hash_table_size           (GHashTable     *hash_table);
00063 
00064 /* The following two functions are deprecated and will be removed in
00065  * the next major release. They do no good. */
00066 void        g_hash_table_freeze         (GHashTable     *hash_table);
00067 void        g_hash_table_thaw           (GHashTable     *hash_table);
00068 
00069 /* Hash Functions
00070  */
00071 gboolean g_str_equal (gconstpointer   v,
00072                       gconstpointer   v2);
00073 guint    g_str_hash  (gconstpointer   v);
00074 
00075 gboolean g_int_equal (gconstpointer   v,
00076                       gconstpointer   v2) G_GNUC_CONST;
00077 guint    g_int_hash  (gconstpointer   v) G_GNUC_CONST;
00078 
00079 /* This "hash" function will just return the key's adress as an
00080  * unsigned integer. Useful for hashing on plain adresses or
00081  * simple integer values.
00082  * passing NULL into g_hash_table_new() as GHashFunc has the
00083  * same effect as passing g_direct_hash().
00084  */
00085 guint    g_direct_hash  (gconstpointer v) G_GNUC_CONST;
00086 gboolean g_direct_equal (gconstpointer v,
00087                          gconstpointer v2) G_GNUC_CONST;
00088 
00089 G_END_DECLS
00090 
00091 #endif /* __G_HASH_H__ */
00092 

Generated on Tue Jul 5 14:14:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1