1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 2000-2001 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 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
20 #error "Only <glib-object.h> can be included directly."
26 #include <gobject/gtype.h>
30 /* --- type macros --- */
31 #define G_TYPE_IS_BOXED(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED)
33 * G_VALUE_HOLDS_BOXED:
34 * @value: a valid #GValue structure
36 * Checks whether the given #GValue can hold values derived from type %G_TYPE_BOXED.
38 * Returns: %TRUE on success.
40 #define G_VALUE_HOLDS_BOXED(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED))
43 /* --- typedefs --- */
46 * @boxed: The boxed structure to be copied.
48 * This function is provided by the user and should produce a copy of the passed
51 * Returns: The newly created copy of the boxed structure.
53 typedef gpointer (*GBoxedCopyFunc) (gpointer boxed);
57 * @boxed: The boxed structure to be freed.
59 * This function is provided by the user and should free the boxed
62 typedef void (*GBoxedFreeFunc) (gpointer boxed);
65 /* --- prototypes --- */
66 gpointer g_boxed_copy (GType boxed_type,
67 gconstpointer src_boxed);
68 void g_boxed_free (GType boxed_type,
70 void g_value_set_boxed (GValue *value,
71 gconstpointer v_boxed);
72 void g_value_set_static_boxed (GValue *value,
73 gconstpointer v_boxed);
74 gpointer g_value_get_boxed (const GValue *value);
75 gpointer g_value_dup_boxed (const GValue *value);
78 /* --- convenience --- */
79 GType g_boxed_type_register_static (const gchar *name,
80 GBoxedCopyFunc boxed_copy,
81 GBoxedFreeFunc boxed_free);
84 /* --- GLib boxed types --- */
88 * The #GType for #GClosure.
90 #define G_TYPE_CLOSURE (g_closure_get_type ())
94 * The type ID of the "GValue" type which is a boxed type,
95 * used to pass around pointers to GValues.
97 #define G_TYPE_VALUE (g_value_get_type ())
101 * The type ID of the "GValueArray" type which is a boxed type,
102 * used to pass around pointers to GValueArrays.
104 #define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
108 * The #GType for #GDate.
110 #define G_TYPE_DATE (g_date_get_type ())
114 * The #GType for a boxed type holding a %NULL-terminated array of strings.
116 * The code fragments in the following example show the use of a property of
117 * type #G_TYPE_STRV with g_object_class_install_property(), g_object_set()
118 * and g_object_get().
121 * g_object_class_install_property (object_class,
123 * g_param_spec_boxed ("authors",
125 * _("List of authors"),
127 * G_PARAM_READWRITE));
130 * gchar *authors[] = { "Owen", "Tim", NULL };
131 * g_object_set (obj, "authors", authors, NULL);
135 * g_object_get (obj, "authors", &writers, NULL);
136 * // do something with writers
137 * g_strfreev (writers);
142 #define G_TYPE_STRV (g_strv_get_type ())
146 * The #GType for #GString.
148 #define G_TYPE_GSTRING (g_gstring_get_type ())
152 * The #GType for a boxed type holding a #GHashTable reference.
156 #define G_TYPE_HASH_TABLE (g_hash_table_get_type ())
160 * The #GType for a boxed type holding a #GRegex reference.
164 #define G_TYPE_REGEX (g_regex_get_type ())
168 * The #GType for a boxed type holding a #GArray reference.
172 #define G_TYPE_ARRAY (g_array_get_type ())
176 * The #GType for a boxed type holding a #GByteArray reference.
180 #define G_TYPE_BYTE_ARRAY (g_byte_array_get_type ())
184 * The #GType for a boxed type holding a #GPtrArray reference.
188 #define G_TYPE_PTR_ARRAY (g_ptr_array_get_type ())
190 * G_TYPE_VARIANT_TYPE:
192 * The #GType for a boxed type holding a #GVariantType.
196 #define G_TYPE_VARIANT_TYPE (g_variant_type_get_gtype ())
200 * The #GType for a boxed type holding a #GError.
204 #define G_TYPE_ERROR (g_error_get_type ())
208 * The #GType for a boxed type holding a #GDateTime.
212 #define G_TYPE_DATE_TIME (g_date_time_get_type ())
214 void g_value_take_boxed (GValue *value,
215 gconstpointer v_boxed);
216 #ifndef G_DISABLE_DEPRECATED
217 void g_value_set_boxed_take_ownership (GValue *value,
218 gconstpointer v_boxed);
220 GType g_closure_get_type (void) G_GNUC_CONST;
221 GType g_value_get_type (void) G_GNUC_CONST;
222 GType g_value_array_get_type (void) G_GNUC_CONST;
223 GType g_date_get_type (void) G_GNUC_CONST;
224 GType g_strv_get_type (void) G_GNUC_CONST;
225 GType g_gstring_get_type (void) G_GNUC_CONST;
226 GType g_hash_table_get_type (void) G_GNUC_CONST;
227 GType g_array_get_type (void) G_GNUC_CONST;
228 GType g_byte_array_get_type (void) G_GNUC_CONST;
229 GType g_ptr_array_get_type (void) G_GNUC_CONST;
230 GType g_variant_type_get_gtype(void) G_GNUC_CONST;
231 GType g_regex_get_type (void) G_GNUC_CONST;
232 GType g_error_get_type (void) G_GNUC_CONST;
233 GType g_date_time_get_type (void) G_GNUC_CONST;
235 #ifndef G_DISABLE_DEPRECATED
236 GType g_variant_get_gtype (void) G_GNUC_CONST;
242 * A C representable type name for #G_TYPE_STRV.
244 typedef gchar** GStrv;
248 #endif /* __G_BOXED_H__ */