1becdefe85e56aea902fe1eedd95dbd65c1cd5a2
[platform/upstream/glib.git] / gobject / gparamspecs.h
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
3  *
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.
8  *
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.
13  *
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.
18  *
19  * gparamspecs.h: GLib default param specs
20  */
21 #ifndef __G_PARAMSPECS_H__
22 #define __G_PARAMSPECS_H__
23
24
25 #include        <gobject/gvalue.h>
26 #include        <gobject/genums.h>
27 #include        <gobject/gobject.h>
28
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34
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))
75
76
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
92 {
93   GParamSpec    parent_instance;
94   
95   gint8         minimum;
96   gint8         maximum;
97   gint8         default_value;
98 };
99 struct _GParamSpecUChar
100 {
101   GParamSpec    parent_instance;
102   
103   guint8        minimum;
104   guint8        maximum;
105   guint8        default_value;
106 };
107 struct _GParamSpecBool
108 {
109   GParamSpec    parent_instance;
110   
111   gboolean      default_value;
112 };
113 struct _GParamSpecInt
114 {
115   GParamSpec    parent_instance;
116   
117   gint          minimum;
118   gint          maximum;
119   gint          default_value;
120 };
121 struct _GParamSpecUInt
122 {
123   GParamSpec    parent_instance;
124   
125   guint         minimum;
126   guint         maximum;
127   guint         default_value;
128 };
129 struct _GParamSpecLong
130 {
131   GParamSpec    parent_instance;
132   
133   glong         minimum;
134   glong         maximum;
135   glong         default_value;
136 };
137 struct _GParamSpecULong
138 {
139   GParamSpec    parent_instance;
140   
141   gulong        minimum;
142   gulong        maximum;
143   gulong        default_value;
144 };
145 struct _GParamSpecEnum
146 {
147   GParamSpec    parent_instance;
148   
149   GEnumClass   *enum_class;
150   glong         default_value;
151 };
152 struct _GParamSpecFlags
153 {
154   GParamSpec    parent_instance;
155   
156   GFlagsClass  *flags_class;
157   gulong        default_value;
158 };
159 struct _GParamSpecFloat
160 {
161   GParamSpec    parent_instance;
162   
163   gfloat        minimum;
164   gfloat        maximum;
165   gfloat        default_value;
166   gfloat        epsilon;
167 };
168 struct _GParamSpecDouble
169 {
170   GParamSpec    parent_instance;
171   
172   gdouble       minimum;
173   gdouble       maximum;
174   gdouble       default_value;
175   gdouble       epsilon;
176 };
177 struct _GParamSpecString
178 {
179   GParamSpec    parent_instance;
180   
181   gchar        *default_value;
182   gchar        *cset_first;
183   gchar        *cset_nth;
184   gchar         substitutor;
185   guint         null_fold_if_empty : 1;
186   guint         ensure_non_null : 1;
187 };
188 struct _GParamSpecObject
189 {
190   GParamSpec    parent_instance;
191   
192   GType         object_type;
193 };
194
195
196 /* --- GValue prototypes --- */
197 void            g_value_set_char        (GValue         *value,
198                                          gint8           v_char);
199 gint8           g_value_get_char        (GValue         *value);
200 void            g_value_set_uchar       (GValue         *value,
201                                          guint8          v_uchar);
202 guint8          g_value_get_uchar       (GValue         *value);
203 void            g_value_set_bool        (GValue         *value,
204                                          gboolean        v_bool);
205 gboolean        g_value_get_bool        (GValue         *value);
206 void            g_value_set_int         (GValue         *value,
207                                          gint            v_int);
208 gint            g_value_get_int         (GValue         *value);
209 void            g_value_set_uint        (GValue         *value,
210                                          guint           v_uint);
211 guint           g_value_get_uint        (GValue         *value);
212 void            g_value_set_long        (GValue         *value,
213                                          glong           v_long);
214 glong           g_value_get_long        (GValue         *value);
215 void            g_value_set_ulong       (GValue         *value,
216                                          gulong          v_ulong);
217 gulong          g_value_get_ulong       (GValue         *value);
218 void            g_value_set_enum        (GValue         *value,
219                                          gint            v_enum);
220 gint            g_value_get_enum        (GValue         *value);
221 void            g_value_set_flags       (GValue         *value,
222                                          guint           v_flags);
223 guint           g_value_get_flags       (GValue         *value);
224 void            g_value_set_float       (GValue         *value,
225                                          gfloat          v_float);
226 gfloat          g_value_get_float       (GValue         *value);
227 void            g_value_set_double      (GValue         *value,
228                                          gdouble         v_double);
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,
235                                          GObject        *v_object);
236 GObject*        g_value_get_object      (GValue         *value);
237 GObject*        g_value_dup_object      (GValue         *value);
238
239
240 /* --- GParamSpec prototypes --- */
241 GParamSpec*     g_param_spec_char       (const gchar    *name,
242                                          const gchar    *nick,
243                                          const gchar    *blurb,
244                                          gint8           minimum,
245                                          gint8           maximum,
246                                          gint8           default_value,
247                                          GParamFlags     flags);
248 GParamSpec*     g_param_spec_uchar      (const gchar    *name,
249                                          const gchar    *nick,
250                                          const gchar    *blurb,
251                                          guint8          minimum,
252                                          guint8          maximum,
253                                          guint8          default_value,
254                                          GParamFlags     flags);
255 GParamSpec*     g_param_spec_bool       (const gchar    *name,
256                                          const gchar    *nick,
257                                          const gchar    *blurb,
258                                          gboolean        default_value,
259                                          GParamFlags     flags);
260 GParamSpec*     g_param_spec_int        (const gchar    *name,
261                                          const gchar    *nick,
262                                          const gchar    *blurb,
263                                          gint            minimum,
264                                          gint            maximum,
265                                          gint            default_value,
266                                          GParamFlags     flags);
267 GParamSpec*     g_param_spec_uint       (const gchar    *name,
268                                          const gchar    *nick,
269                                          const gchar    *blurb,
270                                          guint           minimum,
271                                          guint           maximum,
272                                          guint           default_value,
273                                          GParamFlags     flags);
274 GParamSpec*     g_param_spec_long       (const gchar    *name,
275                                          const gchar    *nick,
276                                          const gchar    *blurb,
277                                          glong           minimum,
278                                          glong           maximum,
279                                          glong           default_value,
280                                          GParamFlags     flags);
281 GParamSpec*     g_param_spec_ulong      (const gchar    *name,
282                                          const gchar    *nick,
283                                          const gchar    *blurb,
284                                          gulong          minimum,
285                                          gulong          maximum,
286                                          gulong          default_value,
287                                          GParamFlags     flags);
288 GParamSpec*     g_param_spec_enum       (const gchar    *name,
289                                          const gchar    *nick,
290                                          const gchar    *blurb,
291                                          GType           enum_type,
292                                          gint            default_value,
293                                          GParamFlags     flags);
294 GParamSpec*     g_param_spec_flags      (const gchar    *name,
295                                          const gchar    *nick,
296                                          const gchar    *blurb,
297                                          GType           flags_type,
298                                          guint           default_value,
299                                          GParamFlags     flags);
300 GParamSpec*     g_param_spec_float      (const gchar    *name,
301                                          const gchar    *nick,
302                                          const gchar    *blurb,
303                                          gfloat          minimum,
304                                          gfloat          maximum,
305                                          gfloat          default_value,
306                                          GParamFlags     flags);
307 GParamSpec*     g_param_spec_double     (const gchar    *name,
308                                          const gchar    *nick,
309                                          const gchar    *blurb,
310                                          gdouble         minimum,
311                                          gdouble         maximum,
312                                          gdouble         default_value,
313                                          GParamFlags     flags);
314 GParamSpec*     g_param_spec_string     (const gchar    *name,
315                                          const gchar    *nick,
316                                          const gchar    *blurb,
317                                          const gchar    *default_value,
318                                          GParamFlags     flags);
319 GParamSpec*     g_param_spec_string_c   (const gchar    *name,
320                                          const gchar    *nick,
321                                          const gchar    *blurb,
322                                          const gchar    *default_value,
323                                          GParamFlags     flags);
324 GParamSpec*     g_param_spec_object     (const gchar    *name,
325                                          const gchar    *nick,
326                                          const gchar    *blurb,
327                                          GType           object_type,
328                                          GParamFlags     flags);
329
330
331 #ifdef __cplusplus
332 }
333 #endif /* __cplusplus */
334
335 #endif /* __G_PARAMSPECS_H__ */