Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/gtk-doc/html/glib/ drwxr-xr-x |
Viewing file: Select action/file-type:
Synopsis#include <glib.h> GHashTable; 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); guint (*GHashFunc) (gconstpointer key); gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b); void g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value); void g_hash_table_replace (GHashTable *hash_table, gpointer key, gpointer value); guint g_hash_table_size (GHashTable *hash_table); 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); gpointer g_hash_table_find (GHashTable *hash_table, GHRFunc predicate, gpointer user_data); void (*GHFunc) (gpointer key, gpointer value, gpointer user_data); gboolean g_hash_table_remove (GHashTable *hash_table, gconstpointer key); gboolean g_hash_table_steal (GHashTable *hash_table, gconstpointer key); 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); gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data); #define g_hash_table_freeze (hash_table) #define g_hash_table_thaw (hash_table) void g_hash_table_destroy (GHashTable *hash_table); gboolean g_direct_equal (gconstpointer v, gconstpointer v2); guint g_direct_hash (gconstpointer v); gboolean g_int_equal (gconstpointer v, gconstpointer v2); guint g_int_hash (gconstpointer v); gboolean g_str_equal (gconstpointer v, gconstpointer v2); guint g_str_hash (gconstpointer v); DescriptionA GHashTable provides associations between keys and values which is optimized so that given a key, the associated value can be found very quickly.
Note that neither keys nor values are copied when inserted into the
GHashTable, so they must exist for the lifetime of the GHashTable.
This means that the use of static strings is OK, but temporary
strings (i.e. those created in buffers and those returned by GTK+ widgets)
should be copied with If keys or values are dynamically allocated, you must be careful to ensure that they are freed when they are removed from the GHashTable, and also when they are overwritten by new insertions into the GHashTable. It is also not advisable to mix static strings and dynamically-allocated strings in a GHashTable, because it then becomes difficult to determine whether the string should be freed.
To create a GHashTable, use
To insert a key and value into a GHashTable, use
To lookup a value corresponding to a given key, use
To remove a key and value, use
To call a function for each key and value pair use
To destroy a GHashTable use DetailsGHashTabletypedef struct _GHashTable GHashTable; The GHashTable struct is an opaque data structure to represent a Hash Table. It should only be accessed via the following functions. g_hash_table_new ()GHashTable* g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func); Creates a new GHashTable.
g_hash_table_new_full ()GHashTable* g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
Creates a new GHashTable like
GHashFunc ()guint (*GHashFunc) (gconstpointer key);
Specifies the type of the hash function which is passed to
The function is passed a key and should return a guint hash value.
The functions FIXME: Need more here. The hash values should be evenly distributed over a fairly large range? The modulus is taken with the hash table size (a prime number) to find the 'bucket' to place each key into. The function should also be very fast, since it is called for each key lookup.
GEqualFunc ()gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b);
Specifies the type of a function used to test two values for
equality. The function should return
g_hash_table_insert ()void g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value); Inserts a new key and value into a GHashTable.
If the key already exists in the GHashTable its current value is replaced
with the new value. If you supplied a
g_hash_table_replace ()void g_hash_table_replace (GHashTable *hash_table, gpointer key, gpointer value);
Inserts a new key and value into a GHashTable similar to
g_hash_table_size ()guint g_hash_table_size (GHashTable *hash_table); Returns the number of elements contained in the GHashTable.
g_hash_table_lookup ()gpointer g_hash_table_lookup (GHashTable *hash_table, gconstpointer key);
Looks up a key in a GHashTable. Note that this function cannot
distinguish between a key that is not present and one which is present
and has the value
g_hash_table_lookup_extended ()gboolean g_hash_table_lookup_extended (GHashTable *hash_table, gconstpointer lookup_key, gpointer *orig_key, gpointer *value);
Looks up a key in the GHashTable, returning the original key and the
associated value and a gboolean which is
g_hash_table_foreach ()void g_hash_table_foreach (GHashTable *hash_table, GHFunc func, gpointer user_data);
Calls the given function for each of the key/value pairs in the
GHashTable. The function is passed the key and value of each
pair, and the given
g_hash_table_find ()gpointer g_hash_table_find (GHashTable *hash_table, GHRFunc predicate, gpointer user_data);
Calls the given function for key/value pairs in the GHashTable until
Since 2.4 GHFunc ()void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
Specifies the type of the function passed to
g_hash_table_remove ()gboolean g_hash_table_remove (GHashTable *hash_table, gconstpointer key); Removes a key and its associated value from a GHashTable.
If the GHashTable was created using
g_hash_table_steal ()gboolean g_hash_table_steal (GHashTable *hash_table, gconstpointer key); Removes a key and its associated value from a GHashTable without calling the key and value destroy functions.
g_hash_table_foreach_remove ()guint g_hash_table_foreach_remove (GHashTable *hash_table, GHRFunc func, gpointer user_data);
Calls the given function for each key/value pair in the GHashTable.
If the function returns
g_hash_table_foreach_steal ()guint g_hash_table_foreach_steal (GHashTable *hash_table, GHRFunc func, gpointer user_data);
Calls the given function for each key/value pair in the GHashTable.
If the function returns
GHRFunc ()gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data);
Specifies the type of the function passed to
g_hash_table_freeze()#define g_hash_table_freeze(hash_table) Warning
This function is deprecated and will be removed in the next major release of GLib. It does nothing.
g_hash_table_thaw()#define g_hash_table_thaw(hash_table) Warning
This function is deprecated and will be removed in the next major release of GLib. It does nothing.
g_hash_table_destroy ()void g_hash_table_destroy (GHashTable *hash_table);
Destroys the GHashTable. If keys and/or values are dynamically
allocated, you should either free them first or create the GHashTable
using
g_direct_equal ()gboolean g_direct_equal (gconstpointer v, gconstpointer v2);
Compares two gpointer arguments and returns
g_direct_hash ()guint g_direct_hash (gconstpointer v);
Converts a gpointer to a hash value.
It can be passed to
g_int_equal ()gboolean g_int_equal (gconstpointer v, gconstpointer v2);
Compares the two gint values being pointed to and returns g_int_hash ()guint g_int_hash (gconstpointer v);
Converts a pointer to a gint to a hash value.
It can be passed to
g_str_equal ()gboolean g_str_equal (gconstpointer v, gconstpointer v2);
Compares two strings and returns
g_str_hash ()guint g_str_hash (gconstpointer v);
Converts a string to a hash value.
It can be passed to
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0037 ]-- |