1 gdataset.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_DATASET_H__ |
|
29 #define __G_DATASET_H__ |
|
30 |
|
31 #include <_ansi.h> |
|
32 #include <glib/gquark.h> |
|
33 |
|
34 G_BEGIN_DECLS |
|
35 |
|
36 typedef struct _GData GData; |
|
37 |
|
38 typedef void (*GDataForeachFunc) (GQuark key_id, |
|
39 gpointer data, |
|
40 gpointer user_data); |
|
41 |
|
42 /* Keyed Data List |
|
43 */ |
|
44 IMPORT_C void g_datalist_init (GData **datalist); |
|
45 IMPORT_C void g_datalist_clear (GData **datalist); |
|
46 IMPORT_C gpointer g_datalist_id_get_data (GData **datalist, |
|
47 GQuark key_id); |
|
48 IMPORT_C void g_datalist_id_set_data_full (GData **datalist, |
|
49 GQuark key_id, |
|
50 gpointer data, |
|
51 GDestroyNotify destroy_func); |
|
52 IMPORT_C gpointer g_datalist_id_remove_no_notify (GData **datalist, |
|
53 GQuark key_id); |
|
54 IMPORT_C void g_datalist_foreach (GData **datalist, |
|
55 GDataForeachFunc func, |
|
56 gpointer user_data); |
|
57 |
|
58 /** |
|
59 * G_DATALIST_FLAGS_MASK: |
|
60 * |
|
61 * A bitmask that restricts the possible flags passed to |
|
62 * g_datalist_set_flags(). Passing a flags value where |
|
63 * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error. |
|
64 */ |
|
65 #define G_DATALIST_FLAGS_MASK 0x3 |
|
66 |
|
67 IMPORT_C void g_datalist_set_flags (GData **datalist, |
|
68 guint flags); |
|
69 IMPORT_C void g_datalist_unset_flags (GData **datalist, |
|
70 guint flags); |
|
71 IMPORT_C guint g_datalist_get_flags (GData **datalist); |
|
72 |
|
73 #define g_datalist_id_set_data(dl, q, d) \ |
|
74 g_datalist_id_set_data_full ((dl), (q), (d), NULL) |
|
75 #define g_datalist_id_remove_data(dl, q) \ |
|
76 g_datalist_id_set_data ((dl), (q), NULL) |
|
77 #define g_datalist_get_data(dl, k) \ |
|
78 (g_datalist_id_get_data ((dl), g_quark_try_string (k))) |
|
79 #define g_datalist_set_data_full(dl, k, d, f) \ |
|
80 g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) |
|
81 #define g_datalist_remove_no_notify(dl, k) \ |
|
82 g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) |
|
83 #define g_datalist_set_data(dl, k, d) \ |
|
84 g_datalist_set_data_full ((dl), (k), (d), NULL) |
|
85 #define g_datalist_remove_data(dl, k) \ |
|
86 g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) |
|
87 |
|
88 |
|
89 /* Location Associated Keyed Data |
|
90 */ |
|
91 IMPORT_C void g_dataset_destroy (gconstpointer dataset_location); |
|
92 IMPORT_C gpointer g_dataset_id_get_data (gconstpointer dataset_location, |
|
93 GQuark key_id); |
|
94 IMPORT_C void g_dataset_id_set_data_full (gconstpointer dataset_location, |
|
95 GQuark key_id, |
|
96 gpointer data, |
|
97 GDestroyNotify destroy_func); |
|
98 IMPORT_C gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location, |
|
99 GQuark key_id); |
|
100 IMPORT_C void g_dataset_foreach (gconstpointer dataset_location, |
|
101 GDataForeachFunc func, |
|
102 gpointer user_data); |
|
103 #define g_dataset_id_set_data(l, k, d) \ |
|
104 g_dataset_id_set_data_full ((l), (k), (d), NULL) |
|
105 #define g_dataset_id_remove_data(l, k) \ |
|
106 g_dataset_id_set_data ((l), (k), NULL) |
|
107 #define g_dataset_get_data(l, k) \ |
|
108 (g_dataset_id_get_data ((l), g_quark_try_string (k))) |
|
109 #define g_dataset_set_data_full(l, k, d, f) \ |
|
110 g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) |
|
111 #define g_dataset_remove_no_notify(l, k) \ |
|
112 g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) |
|
113 #define g_dataset_set_data(l, k, d) \ |
|
114 g_dataset_set_data_full ((l), (k), (d), NULL) |
|
115 #define g_dataset_remove_data(l, k) \ |
|
116 g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) |
|
117 |
|
118 G_END_DECLS |
|
119 |
|
120 #endif /* __G_DATASET_H__ */ |
|
121 |
|
122 |
|
123 |
|
124 |