1 | /* GObject - GLib Type, Object, Parameter and Signal Library |
2 | * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2.1 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General |
15 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
16 | * |
17 | * gvaluetypes.h: GLib default values |
18 | */ |
19 | #ifndef __G_VALUETYPES_H__ |
20 | #define __G_VALUETYPES_H__ |
21 | |
22 | #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) |
23 | #error "Only <glib-object.h> can be included directly." |
24 | #endif |
25 | |
26 | #include <gobject/gvalue.h> |
27 | |
28 | G_BEGIN_DECLS |
29 | |
30 | /* --- type macros --- */ |
31 | /** |
32 | * G_VALUE_HOLDS_CHAR: |
33 | * @value: a valid #GValue structure |
34 | * |
35 | * Checks whether the given #GValue can hold values of type %G_TYPE_CHAR. |
36 | * |
37 | * Returns: %TRUE on success. |
38 | */ |
39 | #define G_VALUE_HOLDS_CHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR)) |
40 | /** |
41 | * G_VALUE_HOLDS_UCHAR: |
42 | * @value: a valid #GValue structure |
43 | * |
44 | * Checks whether the given #GValue can hold values of type %G_TYPE_UCHAR. |
45 | * |
46 | * Returns: %TRUE on success. |
47 | */ |
48 | #define G_VALUE_HOLDS_UCHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR)) |
49 | /** |
50 | * G_VALUE_HOLDS_BOOLEAN: |
51 | * @value: a valid #GValue structure |
52 | * |
53 | * Checks whether the given #GValue can hold values of type %G_TYPE_BOOLEAN. |
54 | * |
55 | * Returns: %TRUE on success. |
56 | */ |
57 | #define G_VALUE_HOLDS_BOOLEAN(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN)) |
58 | /** |
59 | * G_VALUE_HOLDS_INT: |
60 | * @value: a valid #GValue structure |
61 | * |
62 | * Checks whether the given #GValue can hold values of type %G_TYPE_INT. |
63 | * |
64 | * Returns: %TRUE on success. |
65 | */ |
66 | #define G_VALUE_HOLDS_INT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) |
67 | /** |
68 | * G_VALUE_HOLDS_UINT: |
69 | * @value: a valid #GValue structure |
70 | * |
71 | * Checks whether the given #GValue can hold values of type %G_TYPE_UINT. |
72 | * |
73 | * Returns: %TRUE on success. |
74 | */ |
75 | #define G_VALUE_HOLDS_UINT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT)) |
76 | /** |
77 | * G_VALUE_HOLDS_LONG: |
78 | * @value: a valid #GValue structure |
79 | * |
80 | * Checks whether the given #GValue can hold values of type %G_TYPE_LONG. |
81 | * |
82 | * Returns: %TRUE on success. |
83 | */ |
84 | #define G_VALUE_HOLDS_LONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG)) |
85 | /** |
86 | * G_VALUE_HOLDS_ULONG: |
87 | * @value: a valid #GValue structure |
88 | * |
89 | * Checks whether the given #GValue can hold values of type %G_TYPE_ULONG. |
90 | * |
91 | * Returns: %TRUE on success. |
92 | */ |
93 | #define G_VALUE_HOLDS_ULONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG)) |
94 | /** |
95 | * G_VALUE_HOLDS_INT64: |
96 | * @value: a valid #GValue structure |
97 | * |
98 | * Checks whether the given #GValue can hold values of type %G_TYPE_INT64. |
99 | * |
100 | * Returns: %TRUE on success. |
101 | */ |
102 | #define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64)) |
103 | /** |
104 | * G_VALUE_HOLDS_UINT64: |
105 | * @value: a valid #GValue structure |
106 | * |
107 | * Checks whether the given #GValue can hold values of type %G_TYPE_UINT64. |
108 | * |
109 | * Returns: %TRUE on success. |
110 | */ |
111 | #define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64)) |
112 | /** |
113 | * G_VALUE_HOLDS_FLOAT: |
114 | * @value: a valid #GValue structure |
115 | * |
116 | * Checks whether the given #GValue can hold values of type %G_TYPE_FLOAT. |
117 | * |
118 | * Returns: %TRUE on success. |
119 | */ |
120 | #define G_VALUE_HOLDS_FLOAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT)) |
121 | /** |
122 | * G_VALUE_HOLDS_DOUBLE: |
123 | * @value: a valid #GValue structure |
124 | * |
125 | * Checks whether the given #GValue can hold values of type %G_TYPE_DOUBLE. |
126 | * |
127 | * Returns: %TRUE on success. |
128 | */ |
129 | #define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE)) |
130 | /** |
131 | * G_VALUE_HOLDS_STRING: |
132 | * @value: a valid #GValue structure |
133 | * |
134 | * Checks whether the given #GValue can hold values of type %G_TYPE_STRING. |
135 | * |
136 | * Returns: %TRUE on success. |
137 | */ |
138 | #define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING)) |
139 | /** |
140 | * G_VALUE_HOLDS_POINTER: |
141 | * @value: a valid #GValue structure |
142 | * |
143 | * Checks whether the given #GValue can hold values of type %G_TYPE_POINTER. |
144 | * |
145 | * Returns: %TRUE on success. |
146 | */ |
147 | #define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER)) |
148 | /** |
149 | * G_TYPE_GTYPE: |
150 | * |
151 | * The type for #GType. |
152 | */ |
153 | #define G_TYPE_GTYPE (g_gtype_get_type()) |
154 | /** |
155 | * G_VALUE_HOLDS_GTYPE: |
156 | * @value: a valid #GValue structure |
157 | * |
158 | * Checks whether the given #GValue can hold values of type %G_TYPE_GTYPE. |
159 | * |
160 | * Since: 2.12 |
161 | * Returns: %TRUE on success. |
162 | */ |
163 | #define G_VALUE_HOLDS_GTYPE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_GTYPE)) |
164 | /** |
165 | * G_VALUE_HOLDS_VARIANT: |
166 | * @value: a valid #GValue structure |
167 | * |
168 | * Checks whether the given #GValue can hold values of type %G_TYPE_VARIANT. |
169 | * |
170 | * Returns: %TRUE on success. |
171 | * |
172 | * Since: 2.26 |
173 | */ |
174 | #define G_VALUE_HOLDS_VARIANT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_VARIANT)) |
175 | |
176 | |
177 | /* --- prototypes --- */ |
178 | GLIB_DEPRECATED_IN_2_32_FOR(g_value_set_schar) |
179 | void g_value_set_char (GValue *value, |
180 | gchar v_char); |
181 | GLIB_DEPRECATED_IN_2_32_FOR(g_value_get_schar) |
182 | gchar g_value_get_char (const GValue *value); |
183 | GLIB_AVAILABLE_IN_ALL |
184 | void g_value_set_schar (GValue *value, |
185 | gint8 v_char); |
186 | GLIB_AVAILABLE_IN_ALL |
187 | gint8 g_value_get_schar (const GValue *value); |
188 | GLIB_AVAILABLE_IN_ALL |
189 | void g_value_set_uchar (GValue *value, |
190 | guchar v_uchar); |
191 | GLIB_AVAILABLE_IN_ALL |
192 | guchar g_value_get_uchar (const GValue *value); |
193 | GLIB_AVAILABLE_IN_ALL |
194 | void g_value_set_boolean (GValue *value, |
195 | gboolean v_boolean); |
196 | GLIB_AVAILABLE_IN_ALL |
197 | gboolean g_value_get_boolean (const GValue *value); |
198 | GLIB_AVAILABLE_IN_ALL |
199 | void g_value_set_int (GValue *value, |
200 | gint v_int); |
201 | GLIB_AVAILABLE_IN_ALL |
202 | gint g_value_get_int (const GValue *value); |
203 | GLIB_AVAILABLE_IN_ALL |
204 | void g_value_set_uint (GValue *value, |
205 | guint v_uint); |
206 | GLIB_AVAILABLE_IN_ALL |
207 | guint g_value_get_uint (const GValue *value); |
208 | GLIB_AVAILABLE_IN_ALL |
209 | void g_value_set_long (GValue *value, |
210 | glong v_long); |
211 | GLIB_AVAILABLE_IN_ALL |
212 | glong g_value_get_long (const GValue *value); |
213 | GLIB_AVAILABLE_IN_ALL |
214 | void g_value_set_ulong (GValue *value, |
215 | gulong v_ulong); |
216 | GLIB_AVAILABLE_IN_ALL |
217 | gulong g_value_get_ulong (const GValue *value); |
218 | GLIB_AVAILABLE_IN_ALL |
219 | void g_value_set_int64 (GValue *value, |
220 | gint64 v_int64); |
221 | GLIB_AVAILABLE_IN_ALL |
222 | gint64 g_value_get_int64 (const GValue *value); |
223 | GLIB_AVAILABLE_IN_ALL |
224 | void g_value_set_uint64 (GValue *value, |
225 | guint64 v_uint64); |
226 | GLIB_AVAILABLE_IN_ALL |
227 | guint64 g_value_get_uint64 (const GValue *value); |
228 | GLIB_AVAILABLE_IN_ALL |
229 | void g_value_set_float (GValue *value, |
230 | gfloat v_float); |
231 | GLIB_AVAILABLE_IN_ALL |
232 | gfloat g_value_get_float (const GValue *value); |
233 | GLIB_AVAILABLE_IN_ALL |
234 | void g_value_set_double (GValue *value, |
235 | gdouble v_double); |
236 | GLIB_AVAILABLE_IN_ALL |
237 | gdouble g_value_get_double (const GValue *value); |
238 | GLIB_AVAILABLE_IN_ALL |
239 | void g_value_set_string (GValue *value, |
240 | const gchar *v_string); |
241 | GLIB_AVAILABLE_IN_ALL |
242 | void g_value_set_static_string (GValue *value, |
243 | const gchar *v_string); |
244 | GLIB_AVAILABLE_IN_ALL |
245 | const gchar * g_value_get_string (const GValue *value); |
246 | GLIB_AVAILABLE_IN_ALL |
247 | gchar* g_value_dup_string (const GValue *value); |
248 | GLIB_AVAILABLE_IN_ALL |
249 | void g_value_set_pointer (GValue *value, |
250 | gpointer v_pointer); |
251 | GLIB_AVAILABLE_IN_ALL |
252 | gpointer g_value_get_pointer (const GValue *value); |
253 | GLIB_AVAILABLE_IN_ALL |
254 | GType g_gtype_get_type (void); |
255 | GLIB_AVAILABLE_IN_ALL |
256 | void g_value_set_gtype (GValue *value, |
257 | GType v_gtype); |
258 | GLIB_AVAILABLE_IN_ALL |
259 | GType g_value_get_gtype (const GValue *value); |
260 | GLIB_AVAILABLE_IN_ALL |
261 | void g_value_set_variant (GValue *value, |
262 | GVariant *variant); |
263 | GLIB_AVAILABLE_IN_ALL |
264 | void g_value_take_variant (GValue *value, |
265 | GVariant *variant); |
266 | GLIB_AVAILABLE_IN_ALL |
267 | GVariant* g_value_get_variant (const GValue *value); |
268 | GLIB_AVAILABLE_IN_ALL |
269 | GVariant* g_value_dup_variant (const GValue *value); |
270 | |
271 | |
272 | /* Convenience for registering new pointer types */ |
273 | GLIB_AVAILABLE_IN_ALL |
274 | GType g_pointer_type_register_static (const gchar *name); |
275 | |
276 | /* debugging aid, describe value contents as string */ |
277 | GLIB_AVAILABLE_IN_ALL |
278 | gchar* g_strdup_value_contents (const GValue *value); |
279 | |
280 | |
281 | GLIB_AVAILABLE_IN_ALL |
282 | void g_value_take_string (GValue *value, |
283 | gchar *v_string); |
284 | GLIB_DEPRECATED_FOR(g_value_take_string) |
285 | void g_value_set_string_take_ownership (GValue *value, |
286 | gchar *v_string); |
287 | |
288 | |
289 | /* humpf, need a C representable type name for G_TYPE_STRING */ |
290 | /** |
291 | * gchararray: |
292 | * |
293 | * A C representable type name for #G_TYPE_STRING. |
294 | */ |
295 | typedef gchar* gchararray; |
296 | |
297 | |
298 | G_END_DECLS |
299 | |
300 | #endif /* __G_VALUETYPES_H__ */ |
301 | |