1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 1997, 1998, 1999, 2000 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 * gparamspecs.h: GLib default param specs
21 #ifndef __G_PARAMSPECS_H__
22 #define __G_PARAMSPECS_H__
25 #include <gobject/gvalue.h>
26 #include <gobject/genums.h>
27 #include <gobject/gobject.h>
32 #endif /* __cplusplus */
35 /* --- type macros --- */
36 #define G_IS_VALUE_CHAR(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_CHAR))
37 #define G_IS_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
38 #define G_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar))
39 #define G_IS_VALUE_UCHAR(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_UCHAR))
40 #define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
41 #define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
42 #define G_IS_VALUE_BOOL(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_BOOL))
43 #define G_IS_PARAM_SPEC_BOOL(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOL))
44 #define G_PARAM_SPEC_BOOL(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOL, GParamSpecBool))
45 #define G_IS_VALUE_INT(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_INT))
46 #define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
47 #define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
48 #define G_IS_VALUE_UINT(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_UINT))
49 #define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
50 #define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
51 #define G_IS_VALUE_LONG(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_LONG))
52 #define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
53 #define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
54 #define G_IS_VALUE_ULONG(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_ULONG))
55 #define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
56 #define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
57 #define G_IS_VALUE_ENUM(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_ENUM))
58 #define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
59 #define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
60 #define G_IS_VALUE_FLAGS(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_FLAGS))
61 #define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
62 #define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
63 #define G_IS_VALUE_FLOAT(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_FLOAT))
64 #define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
65 #define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
66 #define G_IS_VALUE_DOUBLE(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_DOUBLE))
67 #define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
68 #define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
69 #define G_IS_VALUE_STRING(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_STRING))
70 #define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
71 #define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
72 #define G_IS_VALUE_OBJECT(value) (G_TYPE_CHECK_CLASS_TYPE ((value), G_TYPE_PARAM_OBJECT))
73 #define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
74 #define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
77 /* --- typedefs & structures --- */
78 typedef struct _GParamSpecChar GParamSpecChar;
79 typedef struct _GParamSpecUChar GParamSpecUChar;
80 typedef struct _GParamSpecBool GParamSpecBool;
81 typedef struct _GParamSpecInt GParamSpecInt;
82 typedef struct _GParamSpecUInt GParamSpecUInt;
83 typedef struct _GParamSpecLong GParamSpecLong;
84 typedef struct _GParamSpecULong GParamSpecULong;
85 typedef struct _GParamSpecEnum GParamSpecEnum;
86 typedef struct _GParamSpecFlags GParamSpecFlags;
87 typedef struct _GParamSpecFloat GParamSpecFloat;
88 typedef struct _GParamSpecDouble GParamSpecDouble;
89 typedef struct _GParamSpecString GParamSpecString;
90 typedef struct _GParamSpecObject GParamSpecObject;
91 struct _GParamSpecChar
93 GParamSpec parent_instance;
99 struct _GParamSpecUChar
101 GParamSpec parent_instance;
105 guint8 default_value;
107 struct _GParamSpecBool
109 GParamSpec parent_instance;
111 gboolean default_value;
113 struct _GParamSpecInt
115 GParamSpec parent_instance;
121 struct _GParamSpecUInt
123 GParamSpec parent_instance;
129 struct _GParamSpecLong
131 GParamSpec parent_instance;
137 struct _GParamSpecULong
139 GParamSpec parent_instance;
143 gulong default_value;
145 struct _GParamSpecEnum
147 GParamSpec parent_instance;
149 GEnumClass *enum_class;
152 struct _GParamSpecFlags
154 GParamSpec parent_instance;
156 GFlagsClass *flags_class;
157 gulong default_value;
159 struct _GParamSpecFloat
161 GParamSpec parent_instance;
165 gfloat default_value;
168 struct _GParamSpecDouble
170 GParamSpec parent_instance;
174 gdouble default_value;
177 struct _GParamSpecString
179 GParamSpec parent_instance;
181 gchar *default_value;
185 guint null_fold_if_empty : 1;
186 guint ensure_non_null : 1;
188 struct _GParamSpecObject
190 GParamSpec parent_instance;
196 /* --- GValue prototypes --- */
197 void g_value_set_char (GValue *value,
199 gint8 g_value_get_char (GValue *value);
200 void g_value_set_uchar (GValue *value,
202 guint8 g_value_get_uchar (GValue *value);
203 void g_value_set_bool (GValue *value,
205 gboolean g_value_get_bool (GValue *value);
206 void g_value_set_int (GValue *value,
208 gint g_value_get_int (GValue *value);
209 void g_value_set_uint (GValue *value,
211 guint g_value_get_uint (GValue *value);
212 void g_value_set_long (GValue *value,
214 glong g_value_get_long (GValue *value);
215 void g_value_set_ulong (GValue *value,
217 gulong g_value_get_ulong (GValue *value);
218 void g_value_set_enum (GValue *value,
220 gint g_value_get_enum (GValue *value);
221 void g_value_set_flags (GValue *value,
223 guint g_value_get_flags (GValue *value);
224 void g_value_set_float (GValue *value,
226 gfloat g_value_get_float (GValue *value);
227 void g_value_set_double (GValue *value,
229 gdouble g_value_get_double (GValue *value);
230 void g_value_set_string (GValue *value,
231 const gchar *v_string);
232 gchar* g_value_get_string (GValue *value);
233 gchar* g_value_dup_string (GValue *value);
234 void g_value_set_object (GValue *value,
236 GObject* g_value_get_object (GValue *value);
237 GObject* g_value_dup_object (GValue *value);
240 /* --- GParamSpec prototypes --- */
241 GParamSpec* g_param_spec_char (const gchar *name,
248 GParamSpec* g_param_spec_uchar (const gchar *name,
253 guint8 default_value,
255 GParamSpec* g_param_spec_bool (const gchar *name,
258 gboolean default_value,
260 GParamSpec* g_param_spec_int (const gchar *name,
267 GParamSpec* g_param_spec_uint (const gchar *name,
274 GParamSpec* g_param_spec_long (const gchar *name,
281 GParamSpec* g_param_spec_ulong (const gchar *name,
286 gulong default_value,
288 GParamSpec* g_param_spec_enum (const gchar *name,
294 GParamSpec* g_param_spec_flags (const gchar *name,
300 GParamSpec* g_param_spec_float (const gchar *name,
305 gfloat default_value,
307 GParamSpec* g_param_spec_double (const gchar *name,
312 gdouble default_value,
314 GParamSpec* g_param_spec_string (const gchar *name,
317 const gchar *default_value,
319 GParamSpec* g_param_spec_string_c (const gchar *name,
322 const gchar *default_value,
324 GParamSpec* g_param_spec_object (const gchar *name,
333 #endif /* __cplusplus */
335 #endif /* __G_PARAMSPECS_H__ */