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)
32 #define G_VALUE_HOLDS_BOXED(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED))
35 /* --- typedefs --- */
38 * @boxed: The boxed structure to be copied.
40 * This function is provided by the user and should produce a copy of the passed
43 * Returns: The newly created copy of the boxed structure.
45 typedef gpointer (*GBoxedCopyFunc) (gpointer boxed);
49 * @boxed: The boxed structure to be freed.
51 * This function is provided by the user and should free the boxed
54 typedef void (*GBoxedFreeFunc) (gpointer boxed);
57 /* --- prototypes --- */
58 gpointer g_boxed_copy (GType boxed_type,
59 gconstpointer src_boxed);
60 void g_boxed_free (GType boxed_type,
62 void g_value_set_boxed (GValue *value,
63 gconstpointer v_boxed);
64 void g_value_set_static_boxed (GValue *value,
65 gconstpointer v_boxed);
66 gpointer g_value_get_boxed (const GValue *value);
67 gpointer g_value_dup_boxed (const GValue *value);
70 /* --- convenience --- */
71 GType g_boxed_type_register_static (const gchar *name,
72 GBoxedCopyFunc boxed_copy,
73 GBoxedFreeFunc boxed_free);
76 /* --- GLib boxed types --- */
80 * The #GType for #GClosure.
82 #define G_TYPE_CLOSURE (g_closure_get_type ())
86 * The type ID of the "GValue" type which is a boxed type,
87 * used to pass around pointers to GValues.
89 #define G_TYPE_VALUE (g_value_get_type ())
93 * The type ID of the "GValueArray" type which is a boxed type,
94 * used to pass around pointers to GValueArrays.
96 #define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
100 * The #GType for #GDate.
102 #define G_TYPE_DATE (g_date_get_type ())
106 * The #GType for a boxed type holding a %NULL-terminated array of strings.
108 * The code fragments in the following example show the use of a property of
109 * type #G_TYPE_STRV with g_object_class_install_property(), g_object_set()
110 * and g_object_get().
113 * g_object_class_install_property (object_class,
115 * g_param_spec_boxed ("authors",
117 * _("List of authors"),
119 * G_PARAM_READWRITE));
122 * gchar *authors[] = { "Owen", "Tim", NULL };
123 * g_object_set (obj, "authors", authors, NULL);
127 * g_object_get (obj, "authors", &writers, NULL);
128 * // do something with writers
129 * g_strfreev (writers);
134 #define G_TYPE_STRV (g_strv_get_type ())
138 * The #GType for #GString.
140 #define G_TYPE_GSTRING (g_gstring_get_type ())
144 * The #GType for a boxed type holding a #GHashTable reference.
148 #define G_TYPE_HASH_TABLE (g_hash_table_get_type ())
152 * The #GType for a boxed type holding a #GRegex reference.
156 #define G_TYPE_REGEX (g_regex_get_type ())
159 void g_value_take_boxed (GValue *value,
160 gconstpointer v_boxed);
161 #ifndef G_DISABLE_DEPRECATED
162 void g_value_set_boxed_take_ownership (GValue *value,
163 gconstpointer v_boxed);
165 GType g_closure_get_type (void) G_GNUC_CONST;
166 GType g_value_get_type (void) G_GNUC_CONST;
167 GType g_value_array_get_type (void) G_GNUC_CONST;
168 GType g_date_get_type (void) G_GNUC_CONST;
169 GType g_strv_get_type (void) G_GNUC_CONST;
170 GType g_gstring_get_type (void) G_GNUC_CONST;
171 GType g_hash_table_get_type (void) G_GNUC_CONST;
172 GType g_regex_get_type (void) G_GNUC_CONST;
177 * A C representable type name for #G_TYPE_STRV.
179 typedef gchar** GStrv;
183 #endif /* __G_BOXED_H__ */