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> GTree; GTree* g_tree_new (GCompareFunc key_compare_func); GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func, gpointer key_compare_data); GTree* g_tree_new_full (GCompareDataFunc key_compare_func, gpointer key_compare_data, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func); void g_tree_insert (GTree *tree, gpointer key, gpointer value); void g_tree_replace (GTree *tree, gpointer key, gpointer value); gint g_tree_nnodes (GTree *tree); gint g_tree_height (GTree *tree); gpointer g_tree_lookup (GTree *tree, gconstpointer key); gboolean g_tree_lookup_extended (GTree *tree, gconstpointer lookup_key, gpointer *orig_key, gpointer *value); void g_tree_foreach (GTree *tree, GTraverseFunc func, gpointer user_data); void g_tree_traverse (GTree *tree, GTraverseFunc traverse_func, GTraverseType traverse_type, gpointer user_data); gboolean (*GTraverseFunc) (gpointer key, gpointer value, gpointer data); enum GTraverseType; gpointer g_tree_search (GTree *tree, GCompareFunc search_func, gconstpointer user_data); void g_tree_remove (GTree *tree, gconstpointer key); void g_tree_steal (GTree *tree, gconstpointer key); void g_tree_destroy (GTree *tree); DescriptionThe GTree structure and its associated functions provide a sorted collection of key/value pairs optimized for searching and traversing in order.
To create a new GTree use
To insert a key/value pair into a GTree use
To lookup the value corresponding to a given key, use
To find out the number of nodes in a GTree, use
To traverse a GTree, calling a function for each node visited in the
traversal, use
To remove a key/value pair use
To destroy a GTree, use DetailsGTreetypedef struct _GTree GTree; The GTree struct is an opaque data structure representing a Balanced Binary Tree. It should be accessed only by using the following functions. g_tree_new ()GTree* g_tree_new (GCompareFunc key_compare_func); Creates a new GTree.
g_tree_new_with_data ()GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func, gpointer key_compare_data);
Creates a new GTree with a comparison function that accepts user data.
See
g_tree_new_full ()GTree* g_tree_new_full (GCompareDataFunc key_compare_func, gpointer key_compare_data, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
Creates a new GTree like
g_tree_insert ()void g_tree_insert (GTree *tree, gpointer key, gpointer value);
Inserts a key/value pair into a GTree. If the given key already exists
in the GTree its corresponding value is set to the new value. If you
supplied a value_destroy_func when creating the GTree, the old value is
freed using that function. If you supplied a The tree is automatically 'balanced' as new key/value pairs are added, so that the distance from the root to every leaf is as small as possible.
g_tree_replace ()void g_tree_replace (GTree *tree, gpointer key, gpointer value);
Inserts a new key and value into a GTree similar to The tree is automatically 'balanced' as new key/value pairs are added, so that the distance from the root to every leaf is as small as possible.
g_tree_height ()gint g_tree_height (GTree *tree); Gets the height of a GTree. If the GTree contains no nodes, the height is 0. If the GTree contains only one root node the height is 1. If the root node has children the height is 2, etc.
g_tree_lookup ()gpointer g_tree_lookup (GTree *tree, gconstpointer key); Gets the value corresponding to the given key. Since a GTree is automatically balanced as key/value pairs are added, key lookup is very fast.
g_tree_lookup_extended ()gboolean g_tree_lookup_extended (GTree *tree, gconstpointer lookup_key, gpointer *orig_key, gpointer *value);
Looks up a key in the GTree, returning the original key and the
associated value and a gboolean which is g_tree_foreach ()void g_tree_foreach (GTree *tree, GTraverseFunc func, gpointer user_data);
Calls the given function for each of the key/value pairs in the GTree.
The function is passed the key and value of each pair, and the given
The tree may not be modified while iterating over it (you can't add/remove items). To remove all items matching a predicate, you need to add each item to a list in your GTraverseFunc as you walk over the tree, then walk the list and remove each item.
g_tree_traverse ()void g_tree_traverse (GTree *tree, GTraverseFunc traverse_func, GTraverseType traverse_type, gpointer user_data); Warning
Calls the given function for each node in the GTree.
GTraverseFunc ()gboolean (*GTraverseFunc) (gpointer key, gpointer value, gpointer data);
Specifies the type of function passed to
enum GTraverseTypetypedef enum { G_IN_ORDER, G_PRE_ORDER, G_POST_ORDER, G_LEVEL_ORDER } GTraverseType;
Specifies the type of traveral performed by
g_tree_search ()gpointer g_tree_search (GTree *tree, GCompareFunc search_func, gconstpointer user_data);
Searches a GTree using
The
g_tree_remove ()void g_tree_remove (GTree *tree, gconstpointer key); Removes a key/value pair from a GTree.
If the GTree was created using
g_tree_steal ()void g_tree_steal (GTree *tree, gconstpointer key); Removes a key and its associated value from a GTree without calling the key and value destroy functions. If the key does not exist in the GTree, the function does nothing.
g_tree_destroy ()void g_tree_destroy (GTree *tree);
Destroys the GTree. If keys and/or values are dynamically allocated, you
should either free them first or create the GTree using
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0038 ]-- |