ghash.[ch] added new functions g_hash_table_new_full,

2001-03-30  Sven Neumann  <sven@gimp.org>

        * ghash.[ch]
        * docs/reference/glib/tmpl/hash_tables.sgml: added new functions
        g_hash_table_new_full, g_hash_table_replace, g_hash_table_steal and
        g_hash_table_foreach_steal. Moved most docs out of the template
        file into the C file. Please proofread the new documentation.
This commit is contained in:
Sven Neumann
2001-03-30 18:14:41 +00:00
committed by Sven Neumann
parent 9228b3327f
commit a2b269bae3
13 changed files with 1000 additions and 347 deletions

View File

@@ -31,50 +31,62 @@
G_BEGIN_DECLS
typedef struct _GHashTable GHashTable;
typedef struct _GHashTable GHashTable;
typedef gboolean (*GHRFunc) (gpointer key,
gpointer value,
gpointer user_data);
typedef gboolean (*GHRFunc) (gpointer key,
gpointer value,
gpointer user_data);
/* Hash tables
*/
GHashTable* g_hash_table_new (GHashFunc hash_func,
GEqualFunc key_equal_func);
void g_hash_table_destroy (GHashTable *hash_table);
void g_hash_table_insert (GHashTable *hash_table,
gpointer key,
gpointer value);
gboolean g_hash_table_remove (GHashTable *hash_table,
gconstpointer key);
gpointer g_hash_table_lookup (GHashTable *hash_table,
gconstpointer key);
gboolean g_hash_table_lookup_extended(GHashTable *hash_table,
gconstpointer lookup_key,
gpointer *orig_key,
gpointer *value);
void g_hash_table_foreach (GHashTable *hash_table,
GHFunc func,
gpointer user_data);
guint g_hash_table_foreach_remove (GHashTable *hash_table,
GHRFunc func,
gpointer user_data);
guint g_hash_table_size (GHashTable *hash_table);
GHashTable* g_hash_table_new (GHashFunc hash_func,
GEqualFunc key_equal_func);
GHashTable* g_hash_table_new_full (GHashFunc hash_func,
GEqualFunc key_equal_func,
GDestroyNotify key_destroy_func,
GDestroyNotify value_destroy_func);
void g_hash_table_destroy (GHashTable *hash_table);
void g_hash_table_insert (GHashTable *hash_table,
gpointer key,
gpointer value);
void g_hash_table_replace (GHashTable *hash_table,
gpointer key,
gpointer value);
gboolean g_hash_table_remove (GHashTable *hash_table,
gconstpointer key);
gboolean g_hash_table_steal (GHashTable *hash_table,
gconstpointer key);
gpointer g_hash_table_lookup (GHashTable *hash_table,
gconstpointer key);
gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
gconstpointer lookup_key,
gpointer *orig_key,
gpointer *value);
void g_hash_table_foreach (GHashTable *hash_table,
GHFunc func,
gpointer user_data);
guint g_hash_table_foreach_remove (GHashTable *hash_table,
GHRFunc func,
gpointer user_data);
guint g_hash_table_foreach_steal (GHashTable *hash_table,
GHRFunc func,
gpointer user_data);
guint g_hash_table_size (GHashTable *hash_table);
/* The following two functions are deprecated and will be removed in
* the next major release. They do no good. */
void g_hash_table_freeze (GHashTable *hash_table);
void g_hash_table_thaw (GHashTable *hash_table);
void g_hash_table_freeze (GHashTable *hash_table);
void g_hash_table_thaw (GHashTable *hash_table);
/* Hash Functions
*/
gboolean g_str_equal (gconstpointer v,
gconstpointer v2);
guint g_str_hash (gconstpointer v);
gboolean g_str_equal (gconstpointer v,
gconstpointer v2);
guint g_str_hash (gconstpointer v);
gboolean g_int_equal (gconstpointer v,
gconstpointer v2) G_GNUC_CONST;
guint g_int_hash (gconstpointer v) G_GNUC_CONST;
gboolean g_int_equal (gconstpointer v,
gconstpointer v2) G_GNUC_CONST;
guint g_int_hash (gconstpointer v) G_GNUC_CONST;
/* This "hash" function will just return the key's adress as an
* unsigned integer. Useful for hashing on plain adresses or
@@ -82,9 +94,9 @@ guint g_int_hash (gconstpointer v) G_GNUC_CONST;
* passing NULL into g_hash_table_new() as GHashFunc has the
* same effect as passing g_direct_hash().
*/
guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
gboolean g_direct_equal (gconstpointer v,
gconstpointer v2) G_GNUC_CONST;
guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
gboolean g_direct_equal (gconstpointer v,
gconstpointer v2) G_GNUC_CONST;
G_END_DECLS