epoc32/include/stdapis/glib-2.0/glib/ghash.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 ghash.h
     1 /* GLIB - Library of useful routines for C programming
       
     2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
       
     3  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this library; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 /*
       
    22  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
       
    23  * file for a list of people on the GLib Team.  See the ChangeLog
       
    24  * files for a list of changes.  These files are distributed with
       
    25  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
       
    26  */
       
    27 
       
    28 #ifndef __G_HASH_H__
       
    29 #define __G_HASH_H__
       
    30 
       
    31 #include <_ansi.h>
       
    32 #include <glib/gtypes.h>
       
    33 
       
    34 G_BEGIN_DECLS
       
    35 
       
    36 typedef struct _GHashTable  GHashTable;
       
    37 
       
    38 typedef gboolean  (*GHRFunc)  (gpointer  key,
       
    39                                gpointer  value,
       
    40                                gpointer  user_data);
       
    41 
       
    42 /* Hash tables
       
    43  */
       
    44 IMPORT_C GHashTable* g_hash_table_new		   (GHashFunc	    hash_func,
       
    45 					    GEqualFunc	    key_equal_func);
       
    46 IMPORT_C GHashTable* g_hash_table_new_full      	   (GHashFunc	    hash_func,
       
    47 					    GEqualFunc	    key_equal_func,
       
    48 					    GDestroyNotify  key_destroy_func,
       
    49 					    GDestroyNotify  value_destroy_func);
       
    50 IMPORT_C void	    g_hash_table_destroy	   (GHashTable	   *hash_table);
       
    51 IMPORT_C void	    g_hash_table_insert		   (GHashTable	   *hash_table,
       
    52 					    gpointer	    key,
       
    53 					    gpointer	    value);
       
    54 IMPORT_C void        g_hash_table_replace           (GHashTable     *hash_table,
       
    55 					    gpointer	    key,
       
    56 					    gpointer	    value);
       
    57 IMPORT_C gboolean    g_hash_table_remove		   (GHashTable	   *hash_table,
       
    58 					    gconstpointer   key);
       
    59 IMPORT_C gboolean    g_hash_table_steal             (GHashTable     *hash_table,
       
    60 					    gconstpointer   key);
       
    61 IMPORT_C gpointer    g_hash_table_lookup		   (GHashTable	   *hash_table,
       
    62 					    gconstpointer   key);
       
    63 IMPORT_C gboolean    g_hash_table_lookup_extended   (GHashTable	   *hash_table,
       
    64 					    gconstpointer   lookup_key,
       
    65 					    gpointer	   *orig_key,
       
    66 					    gpointer	   *value);
       
    67 IMPORT_C void	    g_hash_table_foreach	   (GHashTable	   *hash_table,
       
    68 					    GHFunc	    func,
       
    69 					    gpointer	    user_data);
       
    70 IMPORT_C gpointer    g_hash_table_find	   (GHashTable	   *hash_table,
       
    71 					    GHRFunc	    predicate,
       
    72 					    gpointer	    user_data);
       
    73 IMPORT_C guint	    g_hash_table_foreach_remove	   (GHashTable	   *hash_table,
       
    74 					    GHRFunc	    func,
       
    75 					    gpointer	    user_data);
       
    76 IMPORT_C guint	    g_hash_table_foreach_steal	   (GHashTable	   *hash_table,
       
    77 					    GHRFunc	    func,
       
    78 					    gpointer	    user_data);
       
    79 IMPORT_C guint	    g_hash_table_size		   (GHashTable	   *hash_table);
       
    80 
       
    81 /* keeping hash tables alive */
       
    82 IMPORT_C GHashTable* g_hash_table_ref   		   (GHashTable 	   *hash_table);
       
    83 IMPORT_C void        g_hash_table_unref             (GHashTable     *hash_table);
       
    84 
       
    85 #ifndef G_DISABLE_DEPRECATED
       
    86 
       
    87 /* The following two functions are deprecated and will be removed in
       
    88  * the next major release. They do no good. */
       
    89 #define g_hash_table_freeze(hash_table) ((void)0)
       
    90 #define g_hash_table_thaw(hash_table) ((void)0)
       
    91 
       
    92 #endif /* G_DISABLE_DEPRECATED */
       
    93 
       
    94 /* Hash Functions
       
    95  */
       
    96 IMPORT_C gboolean g_str_equal (gconstpointer  v1,
       
    97                       gconstpointer  v2);
       
    98 IMPORT_C guint    g_str_hash  (gconstpointer  v);
       
    99 
       
   100 IMPORT_C gboolean g_int_equal (gconstpointer  v1,
       
   101                       gconstpointer  v2);
       
   102 IMPORT_C guint    g_int_hash  (gconstpointer  v);
       
   103 
       
   104 /* This "hash" function will just return the key's address as an
       
   105  * unsigned integer. Useful for hashing on plain addresses or
       
   106  * simple integer values.
       
   107  * Passing NULL into g_hash_table_new() as GHashFunc has the
       
   108  * same effect as passing g_direct_hash().
       
   109  */
       
   110 IMPORT_C guint    g_direct_hash  (gconstpointer  v) G_GNUC_CONST;
       
   111 IMPORT_C gboolean g_direct_equal (gconstpointer  v1,
       
   112                          gconstpointer  v2) G_GNUC_CONST;
       
   113 
       
   114 G_END_DECLS
       
   115 
       
   116 #endif /* __G_HASH_H__ */
       
   117