Prevent unused variable warnings from G_DEFINE_DYNAMIC_TYPE
[glib.git] / gobject / gboxed.h
blobeb8bc9ecff36178eef21517347263faafed86677
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."
21 #endif
23 #ifndef __G_BOXED_H__
24 #define __G_BOXED_H__
26 #include <gobject/gtype.h>
28 G_BEGIN_DECLS
30 /* --- type macros --- */
31 #define G_TYPE_IS_BOXED(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED)
32 /**
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 --- */
44 /**
45 * GBoxedCopyFunc:
46 * @boxed: The boxed structure to be copied.
48 * This function is provided by the user and should produce a copy of the passed
49 * in boxed structure.
51 * Returns: The newly created copy of the boxed structure.
53 typedef gpointer (*GBoxedCopyFunc) (gpointer boxed);
55 /**
56 * GBoxedFreeFunc:
57 * @boxed: The boxed structure to be freed.
59 * This function is provided by the user and should free the boxed
60 * structure passed.
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,
69 gpointer boxed);
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 --- */
85 /**
86 * G_TYPE_CLOSURE:
88 * The #GType for #GClosure.
90 #define G_TYPE_CLOSURE (g_closure_get_type ())
91 /**
92 * G_TYPE_VALUE:
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 ())
98 /**
99 * G_TYPE_VALUE_ARRAY:
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 ())
106 * G_TYPE_DATE:
108 * The #GType for #GDate.
110 #define G_TYPE_DATE (g_date_get_type ())
112 * G_TYPE_STRV:
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().
120 * |[
121 * g_object_class_install_property (object_class,
122 * PROP_AUTHORS,
123 * g_param_spec_boxed ("authors",
124 * _("Authors"),
125 * _("List of authors"),
126 * G_TYPE_STRV,
127 * G_PARAM_READWRITE));
130 * gchar *authors[] = { "Owen", "Tim", NULL };
131 * g_object_set (obj, "authors", authors, NULL);
134 * gchar *writers[];
135 * g_object_get (obj, "authors", &writers, NULL);
136 * // do something with writers
137 * g_strfreev (writers);
138 * ]|
140 * Since: 2.4
142 #define G_TYPE_STRV (g_strv_get_type ())
144 * G_TYPE_GSTRING:
146 * The #GType for #GString.
148 #define G_TYPE_GSTRING (g_gstring_get_type ())
150 * G_TYPE_HASH_TABLE:
152 * The #GType for a boxed type holding a #GHashTable reference.
154 * Since: 2.10
156 #define G_TYPE_HASH_TABLE (g_hash_table_get_type ())
158 * G_TYPE_REGEX:
160 * The #GType for a boxed type holding a #GRegex reference.
162 * Since: 2.14
164 #define G_TYPE_REGEX (g_regex_get_type ())
166 * G_TYPE_ARRAY:
168 * The #GType for a boxed type holding a #GArray reference.
170 * Since: 2.22
172 #define G_TYPE_ARRAY (g_array_get_type ())
174 * G_TYPE_BYTE_ARRAY:
176 * The #GType for a boxed type holding a #GByteArray reference.
178 * Since: 2.22
180 #define G_TYPE_BYTE_ARRAY (g_byte_array_get_type ())
182 * G_TYPE_PTR_ARRAY:
184 * The #GType for a boxed type holding a #GPtrArray reference.
186 * Since: 2.22
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.
194 * Since: 2.24
196 #define G_TYPE_VARIANT_TYPE (g_variant_type_get_gtype ())
198 * G_TYPE_ERROR:
200 * The #GType for a boxed type holding a #GError.
202 * Since: 2.26
204 #define G_TYPE_ERROR (g_error_get_type ())
206 * G_TYPE_DATE_TIME:
208 * The #GType for a boxed type holding a #GDateTime.
210 * Since: 2.26
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);
219 #endif
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;
237 #endif
240 * GStrv:
242 * A C representable type name for #G_TYPE_STRV.
244 typedef gchar** GStrv;
246 G_END_DECLS
248 #endif /* __G_BOXED_H__ */