1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
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 of the License, or (at your option) any later version.
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.
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * gvaluetypes.h: GLib default values
21 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
22 #error "Only <glib-object.h> can be included directly."
25 #ifndef __G_VALUETYPES_H__
26 #define __G_VALUETYPES_H__
28 #include <gobject/gvalue.h>
32 /* --- type macros --- */
35 * @value: a valid #GValue structure
37 * Checks whether the given #GValue can hold values of type %G_TYPE_CHAR.
39 * Returns: %TRUE on success.
41 #define G_VALUE_HOLDS_CHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR))
43 * G_VALUE_HOLDS_UCHAR:
44 * @value: a valid #GValue structure
46 * Checks whether the given #GValue can hold values of type %G_TYPE_UCHAR.
48 * Returns: %TRUE on success.
50 #define G_VALUE_HOLDS_UCHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR))
52 * G_VALUE_HOLDS_BOOLEAN:
53 * @value: a valid #GValue structure
55 * Checks whether the given #GValue can hold values of type %G_TYPE_BOOLEAN.
57 * Returns: %TRUE on success.
59 #define G_VALUE_HOLDS_BOOLEAN(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN))
62 * @value: a valid #GValue structure
64 * Checks whether the given #GValue can hold values of type %G_TYPE_INT.
66 * Returns: %TRUE on success.
68 #define G_VALUE_HOLDS_INT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT))
71 * @value: a valid #GValue structure
73 * Checks whether the given #GValue can hold values of type %G_TYPE_UINT.
75 * Returns: %TRUE on success.
77 #define G_VALUE_HOLDS_UINT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT))
80 * @value: a valid #GValue structure
82 * Checks whether the given #GValue can hold values of type %G_TYPE_LONG.
84 * Returns: %TRUE on success.
86 #define G_VALUE_HOLDS_LONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG))
88 * G_VALUE_HOLDS_ULONG:
89 * @value: a valid #GValue structure
91 * Checks whether the given #GValue can hold values of type %G_TYPE_ULONG.
93 * Returns: %TRUE on success.
95 #define G_VALUE_HOLDS_ULONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG))
97 * G_VALUE_HOLDS_INT64:
98 * @value: a valid #GValue structure
100 * Checks whether the given #GValue can hold values of type %G_TYPE_INT64.
102 * Returns: %TRUE on success.
104 #define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64))
106 * G_VALUE_HOLDS_UINT64:
107 * @value: a valid #GValue structure
109 * Checks whether the given #GValue can hold values of type %G_TYPE_UINT64.
111 * Returns: %TRUE on success.
113 #define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64))
115 * G_VALUE_HOLDS_FLOAT:
116 * @value: a valid #GValue structure
118 * Checks whether the given #GValue can hold values of type %G_TYPE_FLOAT.
120 * Returns: %TRUE on success.
122 #define G_VALUE_HOLDS_FLOAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT))
124 * G_VALUE_HOLDS_DOUBLE:
125 * @value: a valid #GValue structure
127 * Checks whether the given #GValue can hold values of type %G_TYPE_DOUBLE.
129 * Returns: %TRUE on success.
131 #define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE))
133 * G_VALUE_HOLDS_STRING:
134 * @value: a valid #GValue structure
136 * Checks whether the given #GValue can hold values of type %G_TYPE_STRING.
138 * Returns: %TRUE on success.
140 #define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING))
142 * G_VALUE_HOLDS_POINTER:
143 * @value: a valid #GValue structure
145 * Checks whether the given #GValue can hold values of type %G_TYPE_POINTER.
147 * Returns: %TRUE on success.
149 #define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER))
153 * The type for #GType.
155 #define G_TYPE_GTYPE (g_gtype_get_type())
157 * G_VALUE_HOLDS_GTYPE:
158 * @value: a valid #GValue structure
160 * Checks whether the given #GValue can hold values of type %G_TYPE_GTYPE.
163 * Returns: %TRUE on success.
165 #define G_VALUE_HOLDS_GTYPE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_GTYPE))
167 * G_VALUE_HOLDS_VARIANT:
168 * @value: a valid #GValue structure
170 * Checks whether the given #GValue can hold values of type %G_TYPE_VARIANT.
172 * Returns: %TRUE on success.
176 #define G_VALUE_HOLDS_VARIANT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_VARIANT))
179 /* --- prototypes --- */
180 void g_value_set_char (GValue
*value
,
182 gchar
g_value_get_char (const GValue
*value
);
183 void g_value_set_uchar (GValue
*value
,
185 guchar
g_value_get_uchar (const GValue
*value
);
186 void g_value_set_boolean (GValue
*value
,
188 gboolean
g_value_get_boolean (const GValue
*value
);
189 void g_value_set_int (GValue
*value
,
191 gint
g_value_get_int (const GValue
*value
);
192 void g_value_set_uint (GValue
*value
,
194 guint
g_value_get_uint (const GValue
*value
);
195 void g_value_set_long (GValue
*value
,
197 glong
g_value_get_long (const GValue
*value
);
198 void g_value_set_ulong (GValue
*value
,
200 gulong
g_value_get_ulong (const GValue
*value
);
201 void g_value_set_int64 (GValue
*value
,
203 gint64
g_value_get_int64 (const GValue
*value
);
204 void g_value_set_uint64 (GValue
*value
,
206 guint64
g_value_get_uint64 (const GValue
*value
);
207 void g_value_set_float (GValue
*value
,
209 gfloat
g_value_get_float (const GValue
*value
);
210 void g_value_set_double (GValue
*value
,
212 gdouble
g_value_get_double (const GValue
*value
);
213 void g_value_set_string (GValue
*value
,
214 const gchar
*v_string
);
215 void g_value_set_static_string (GValue
*value
,
216 const gchar
*v_string
);
217 G_CONST_RETURN gchar
* g_value_get_string (const GValue
*value
);
218 gchar
* g_value_dup_string (const GValue
*value
);
219 void g_value_set_pointer (GValue
*value
,
221 gpointer
g_value_get_pointer (const GValue
*value
);
222 GType
g_gtype_get_type (void);
223 void g_value_set_gtype (GValue
*value
,
225 GType
g_value_get_gtype (const GValue
*value
);
226 void g_value_set_variant (GValue
*value
,
228 void g_value_take_variant (GValue
*value
,
230 GVariant
* g_value_get_variant (const GValue
*value
);
231 GVariant
* g_value_dup_variant (const GValue
*value
);
234 /* Convenience for registering new pointer types */
235 GType
g_pointer_type_register_static (const gchar
*name
);
237 /* debugging aid, describe value contents as string */
238 gchar
* g_strdup_value_contents (const GValue
*value
);
241 void g_value_take_string (GValue
*value
,
243 #ifndef G_DISABLE_DEPRECATED
244 void g_value_set_string_take_ownership (GValue
*value
,
249 /* humpf, need a C representable type name for G_TYPE_STRING */
253 * A C representable type name for #G_TYPE_STRING.
255 typedef gchar
* gchararray
;
260 #endif /* __G_VALUETYPES_H__ */