1 gtree.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_TREE_H__ |
|
29 #define __G_TREE_H__ |
|
30 |
|
31 #include <_ansi.h> |
|
32 #include <glib/gnode.h> |
|
33 |
|
34 G_BEGIN_DECLS |
|
35 |
|
36 typedef struct _GTree GTree; |
|
37 |
|
38 typedef gboolean (*GTraverseFunc) (gpointer key, |
|
39 gpointer value, |
|
40 gpointer data); |
|
41 |
|
42 /* Balanced binary trees |
|
43 */ |
|
44 IMPORT_C GTree* g_tree_new (GCompareFunc key_compare_func); |
|
45 IMPORT_C GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func, |
|
46 gpointer key_compare_data); |
|
47 IMPORT_C GTree* g_tree_new_full (GCompareDataFunc key_compare_func, |
|
48 gpointer key_compare_data, |
|
49 GDestroyNotify key_destroy_func, |
|
50 GDestroyNotify value_destroy_func); |
|
51 IMPORT_C void g_tree_destroy (GTree *tree); |
|
52 IMPORT_C void g_tree_insert (GTree *tree, |
|
53 gpointer key, |
|
54 gpointer value); |
|
55 IMPORT_C void g_tree_replace (GTree *tree, |
|
56 gpointer key, |
|
57 gpointer value); |
|
58 IMPORT_C gboolean g_tree_remove (GTree *tree, |
|
59 gconstpointer key); |
|
60 IMPORT_C gboolean g_tree_steal (GTree *tree, |
|
61 gconstpointer key); |
|
62 IMPORT_C gpointer g_tree_lookup (GTree *tree, |
|
63 gconstpointer key); |
|
64 IMPORT_C gboolean g_tree_lookup_extended (GTree *tree, |
|
65 gconstpointer lookup_key, |
|
66 gpointer *orig_key, |
|
67 gpointer *value); |
|
68 IMPORT_C void g_tree_foreach (GTree *tree, |
|
69 GTraverseFunc func, |
|
70 gpointer user_data); |
|
71 |
|
72 #ifndef G_DISABLE_DEPRECATED |
|
73 IMPORT_C void g_tree_traverse (GTree *tree, |
|
74 GTraverseFunc traverse_func, |
|
75 GTraverseType traverse_type, |
|
76 gpointer user_data); |
|
77 #endif /* G_DISABLE_DEPRECATED */ |
|
78 |
|
79 IMPORT_C gpointer g_tree_search (GTree *tree, |
|
80 GCompareFunc search_func, |
|
81 gconstpointer user_data); |
|
82 IMPORT_C gint g_tree_height (GTree *tree); |
|
83 IMPORT_C gint g_tree_nnodes (GTree *tree); |
|
84 |
|
85 |
|
86 |
|
87 G_END_DECLS |
|
88 |
|
89 #endif /* __G_TREE_H__ */ |
|
90 |