applied patch from owen to implement GParamSpecUnichar.
[platform/upstream/glib.git] / gobject / gparamspecs.h
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 1997-1999, 2000-2001 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/gboxed.h>
28 #include        <gobject/gobject.h>
29
30 G_BEGIN_DECLS
31
32 /* --- type macros --- */
33 #define G_IS_PARAM_SPEC_CHAR(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
34 #define G_PARAM_SPEC_CHAR(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar))
35 #define G_IS_PARAM_SPEC_UCHAR(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
36 #define G_PARAM_SPEC_UCHAR(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
37 #define G_IS_PARAM_SPEC_BOOLEAN(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
38 #define G_PARAM_SPEC_BOOLEAN(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
39 #define G_IS_PARAM_SPEC_INT(pspec)         (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
40 #define G_PARAM_SPEC_INT(pspec)            (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
41 #define G_IS_PARAM_SPEC_UINT(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
42 #define G_PARAM_SPEC_UINT(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
43 #define G_IS_PARAM_SPEC_LONG(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
44 #define G_PARAM_SPEC_LONG(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
45 #define G_IS_PARAM_SPEC_ULONG(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
46 #define G_PARAM_SPEC_UNICHAR(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
47 #define G_IS_PARAM_SPEC_UNICHAR(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
48 #define G_PARAM_SPEC_ULONG(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
49 #define G_IS_PARAM_SPEC_ENUM(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
50 #define G_PARAM_SPEC_ENUM(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
51 #define G_IS_PARAM_SPEC_FLAGS(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
52 #define G_PARAM_SPEC_FLAGS(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
53 #define G_IS_PARAM_SPEC_FLOAT(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
54 #define G_PARAM_SPEC_FLOAT(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
55 #define G_IS_PARAM_SPEC_DOUBLE(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
56 #define G_PARAM_SPEC_DOUBLE(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
57 #define G_IS_PARAM_SPEC_STRING(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
58 #define G_PARAM_SPEC_STRING(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
59 #define G_IS_PARAM_SPEC_PARAM(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
60 #define G_PARAM_SPEC_PARAM(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
61 #define G_IS_PARAM_SPEC_BOXED(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
62 #define G_PARAM_SPEC_BOXED(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
63 #define G_IS_PARAM_SPEC_POINTER(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
64 #define G_PARAM_SPEC_POINTER(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
65 #define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
66 #define G_PARAM_SPEC_VALUE_ARRAY(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
67 #define G_IS_PARAM_SPEC_CLOSURE(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CLOSURE))
68 #define G_PARAM_SPEC_CLOSURE(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CLOSURE, GParamSpecClosure))
69 #define G_IS_PARAM_SPEC_OBJECT(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
70 #define G_PARAM_SPEC_OBJECT(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
71
72
73 /* --- typedefs & structures --- */
74 typedef struct _GParamSpecChar       GParamSpecChar;
75 typedef struct _GParamSpecUChar      GParamSpecUChar;
76 typedef struct _GParamSpecBoolean    GParamSpecBoolean;
77 typedef struct _GParamSpecInt        GParamSpecInt;
78 typedef struct _GParamSpecUInt       GParamSpecUInt;
79 typedef struct _GParamSpecLong       GParamSpecLong;
80 typedef struct _GParamSpecULong      GParamSpecULong;
81 typedef struct _GParamSpecUnichar    GParamSpecUnichar;
82 typedef struct _GParamSpecEnum       GParamSpecEnum;
83 typedef struct _GParamSpecFlags      GParamSpecFlags;
84 typedef struct _GParamSpecFloat      GParamSpecFloat;
85 typedef struct _GParamSpecDouble     GParamSpecDouble;
86 typedef struct _GParamSpecString     GParamSpecString;
87 typedef struct _GParamSpecParam      GParamSpecParam;
88 typedef struct _GParamSpecBoxed      GParamSpecBoxed;
89 typedef struct _GParamSpecPointer    GParamSpecPointer;
90 typedef struct _GParamSpecValueArray GParamSpecValueArray;
91 typedef struct _GParamSpecClosure    GParamSpecClosure;
92 typedef struct _GParamSpecObject     GParamSpecObject;
93 struct _GParamSpecChar
94 {
95   GParamSpec    parent_instance;
96   
97   gint8         minimum;
98   gint8         maximum;
99   gint8         default_value;
100 };
101 struct _GParamSpecUChar
102 {
103   GParamSpec    parent_instance;
104   
105   guint8        minimum;
106   guint8        maximum;
107   guint8        default_value;
108 };
109 struct _GParamSpecBoolean
110 {
111   GParamSpec    parent_instance;
112   
113   gboolean      default_value;
114 };
115 struct _GParamSpecInt
116 {
117   GParamSpec    parent_instance;
118   
119   gint          minimum;
120   gint          maximum;
121   gint          default_value;
122 };
123 struct _GParamSpecUInt
124 {
125   GParamSpec    parent_instance;
126   
127   guint         minimum;
128   guint         maximum;
129   guint         default_value;
130 };
131 struct _GParamSpecLong
132 {
133   GParamSpec    parent_instance;
134   
135   glong         minimum;
136   glong         maximum;
137   glong         default_value;
138 };
139 struct _GParamSpecULong
140 {
141   GParamSpec    parent_instance;
142   
143   gulong        minimum;
144   gulong        maximum;
145   gulong        default_value;
146 };
147 struct _GParamSpecUnichar
148 {
149   GParamSpec    parent_instance;
150   
151   gunichar      default_value;
152 };
153 struct _GParamSpecEnum
154 {
155   GParamSpec    parent_instance;
156   
157   GEnumClass   *enum_class;
158   glong         default_value;
159 };
160 struct _GParamSpecFlags
161 {
162   GParamSpec    parent_instance;
163   
164   GFlagsClass  *flags_class;
165   gulong        default_value;
166 };
167 struct _GParamSpecFloat
168 {
169   GParamSpec    parent_instance;
170   
171   gfloat        minimum;
172   gfloat        maximum;
173   gfloat        default_value;
174   gfloat        epsilon;
175 };
176 struct _GParamSpecDouble
177 {
178   GParamSpec    parent_instance;
179   
180   gdouble       minimum;
181   gdouble       maximum;
182   gdouble       default_value;
183   gdouble       epsilon;
184 };
185 struct _GParamSpecString
186 {
187   GParamSpec    parent_instance;
188   
189   gchar        *default_value;
190   gchar        *cset_first;
191   gchar        *cset_nth;
192   gchar         substitutor;
193   guint         null_fold_if_empty : 1;
194   guint         ensure_non_null : 1;
195 };
196 struct _GParamSpecParam
197 {
198   GParamSpec    parent_instance;
199 };
200 struct _GParamSpecBoxed
201 {
202   GParamSpec    parent_instance;
203 };
204 struct _GParamSpecPointer
205 {
206   GParamSpec    parent_instance;
207 };
208 struct _GParamSpecValueArray
209 {
210   GParamSpec    parent_instance;
211   GParamSpec   *element_spec;
212   guint         fixed_n_elements;
213 };
214 struct _GParamSpecClosure
215 {
216   GParamSpec    parent_instance;
217 };
218 struct _GParamSpecObject
219 {
220   GParamSpec    parent_instance;
221 };
222
223
224 /* --- GParamSpec prototypes --- */
225 GParamSpec*     g_param_spec_char        (const gchar    *name,
226                                           const gchar    *nick,
227                                           const gchar    *blurb,
228                                           gint8           minimum,
229                                           gint8           maximum,
230                                           gint8           default_value,
231                                           GParamFlags     flags);
232 GParamSpec*     g_param_spec_uchar       (const gchar    *name,
233                                           const gchar    *nick,
234                                           const gchar    *blurb,
235                                           guint8          minimum,
236                                           guint8          maximum,
237                                           guint8          default_value,
238                                           GParamFlags     flags);
239 GParamSpec*     g_param_spec_boolean     (const gchar    *name,
240                                           const gchar    *nick,
241                                           const gchar    *blurb,
242                                           gboolean        default_value,
243                                           GParamFlags     flags);
244 GParamSpec*     g_param_spec_int         (const gchar    *name,
245                                           const gchar    *nick,
246                                           const gchar    *blurb,
247                                           gint            minimum,
248                                           gint            maximum,
249                                           gint            default_value,
250                                           GParamFlags     flags);
251 GParamSpec*     g_param_spec_uint        (const gchar    *name,
252                                           const gchar    *nick,
253                                           const gchar    *blurb,
254                                           guint           minimum,
255                                           guint           maximum,
256                                           guint           default_value,
257                                           GParamFlags     flags);
258 GParamSpec*     g_param_spec_long        (const gchar    *name,
259                                           const gchar    *nick,
260                                           const gchar    *blurb,
261                                           glong           minimum,
262                                           glong           maximum,
263                                           glong           default_value,
264                                           GParamFlags     flags);
265 GParamSpec*     g_param_spec_ulong       (const gchar    *name,
266                                           const gchar    *nick,
267                                           const gchar    *blurb,
268                                           gulong          minimum,
269                                           gulong          maximum,
270                                           gulong          default_value,
271                                           GParamFlags     flags);
272 GParamSpec*    g_param_spec_unichar      (const gchar    *name,
273                                           const gchar    *nick,
274                                           const gchar    *blurb,
275                                           gunichar        default_value,
276                                           GParamFlags     flags);
277 GParamSpec*     g_param_spec_enum        (const gchar    *name,
278                                           const gchar    *nick,
279                                           const gchar    *blurb,
280                                           GType           enum_type,
281                                           gint            default_value,
282                                           GParamFlags     flags);
283 GParamSpec*     g_param_spec_flags       (const gchar    *name,
284                                           const gchar    *nick,
285                                           const gchar    *blurb,
286                                           GType           flags_type,
287                                           guint           default_value,
288                                           GParamFlags     flags);
289 GParamSpec*     g_param_spec_float       (const gchar    *name,
290                                           const gchar    *nick,
291                                           const gchar    *blurb,
292                                           gfloat          minimum,
293                                           gfloat          maximum,
294                                           gfloat          default_value,
295                                           GParamFlags     flags);
296 GParamSpec*     g_param_spec_double      (const gchar    *name,
297                                           const gchar    *nick,
298                                           const gchar    *blurb,
299                                           gdouble         minimum,
300                                           gdouble         maximum,
301                                           gdouble         default_value,
302                                           GParamFlags     flags);
303 GParamSpec*     g_param_spec_string      (const gchar    *name,
304                                           const gchar    *nick,
305                                           const gchar    *blurb,
306                                           const gchar    *default_value,
307                                           GParamFlags     flags);
308 GParamSpec*     g_param_spec_stringc     (const gchar    *name,
309                                           const gchar    *nick,
310                                           const gchar    *blurb,
311                                           const gchar    *default_value,
312                                           GParamFlags     flags);
313 GParamSpec*     g_param_spec_param       (const gchar    *name,
314                                           const gchar    *nick,
315                                           const gchar    *blurb,
316                                           GType           param_type,
317                                           GParamFlags     flags);
318 GParamSpec*     g_param_spec_boxed       (const gchar    *name,
319                                           const gchar    *nick,
320                                           const gchar    *blurb,
321                                           GType           boxed_type,
322                                           GParamFlags     flags);
323 GParamSpec*     g_param_spec_pointer     (const gchar    *name,
324                                           const gchar    *nick,
325                                           const gchar    *blurb,
326                                           GParamFlags     flags);
327 GParamSpec*     g_param_spec_value_array (const gchar    *name,
328                                           const gchar    *nick,
329                                           const gchar    *blurb,
330                                           GParamSpec     *element_spec,
331                                           GParamFlags     flags);
332 GParamSpec*     g_param_spec_closure     (const gchar    *name,
333                                           const gchar    *nick,
334                                           const gchar    *blurb,
335                                           GParamFlags     flags);
336 GParamSpec*     g_param_spec_object      (const gchar    *name,
337                                           const gchar    *nick,
338                                           const gchar    *blurb,
339                                           GType           object_type,
340                                           GParamFlags     flags);
341
342
343 G_END_DECLS
344
345 #endif /* __G_PARAMSPECS_H__ */