fixed dealing with collection/lcopy of NULL values.
[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_PARAM_SPEC_CHAR(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
37 #define G_PARAM_SPEC_CHAR(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar))
38 #define G_IS_PARAM_SPEC_UCHAR(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
39 #define G_PARAM_SPEC_UCHAR(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
40 #define G_IS_PARAM_SPEC_BOOLEAN(pspec)   (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
41 #define G_PARAM_SPEC_BOOLEAN(pspec)      (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
42 #define G_IS_PARAM_SPEC_INT(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
43 #define G_PARAM_SPEC_INT(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
44 #define G_IS_PARAM_SPEC_UINT(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
45 #define G_PARAM_SPEC_UINT(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
46 #define G_IS_PARAM_SPEC_LONG(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
47 #define G_PARAM_SPEC_LONG(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
48 #define G_IS_PARAM_SPEC_ULONG(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
49 #define G_PARAM_SPEC_ULONG(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
50 #define G_IS_PARAM_SPEC_ENUM(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
51 #define G_PARAM_SPEC_ENUM(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
52 #define G_IS_PARAM_SPEC_FLAGS(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
53 #define G_PARAM_SPEC_FLAGS(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
54 #define G_IS_PARAM_SPEC_FLOAT(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
55 #define G_PARAM_SPEC_FLOAT(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
56 #define G_IS_PARAM_SPEC_DOUBLE(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
57 #define G_PARAM_SPEC_DOUBLE(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
58 #define G_IS_PARAM_SPEC_STRING(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
59 #define G_PARAM_SPEC_STRING(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
60 #define G_IS_PARAM_SPEC_PARAM(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
61 #define G_PARAM_SPEC_PARAM(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
62 #define G_IS_PARAM_SPEC_POINTER(pspec)   (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
63 #define G_PARAM_SPEC_POINTER(pspec)      (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
64 #define G_IS_PARAM_SPEC_CCALLBACK(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CCALLBACK))
65 #define G_PARAM_SPEC_CCALLBACK(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CCALLBACK, GParamSpecCCallback))
66 #define G_IS_PARAM_SPEC_OBJECT(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
67 #define G_PARAM_SPEC_OBJECT(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
68
69
70 /* --- typedefs & structures --- */
71 typedef struct _GParamSpecChar      GParamSpecChar;
72 typedef struct _GParamSpecUChar     GParamSpecUChar;
73 typedef struct _GParamSpecBoolean   GParamSpecBoolean;
74 typedef struct _GParamSpecInt       GParamSpecInt;
75 typedef struct _GParamSpecUInt      GParamSpecUInt;
76 typedef struct _GParamSpecLong      GParamSpecLong;
77 typedef struct _GParamSpecULong     GParamSpecULong;
78 typedef struct _GParamSpecEnum      GParamSpecEnum;
79 typedef struct _GParamSpecFlags     GParamSpecFlags;
80 typedef struct _GParamSpecFloat     GParamSpecFloat;
81 typedef struct _GParamSpecDouble    GParamSpecDouble;
82 typedef struct _GParamSpecString    GParamSpecString;
83 typedef struct _GParamSpecParam     GParamSpecParam;
84 typedef struct _GParamSpecPointer   GParamSpecPointer;
85 typedef struct _GParamSpecCCallback GParamSpecCCallback;
86 typedef struct _GParamSpecObject    GParamSpecObject;
87 struct _GParamSpecChar
88 {
89   GParamSpec    parent_instance;
90   
91   gint8         minimum;
92   gint8         maximum;
93   gint8         default_value;
94 };
95 struct _GParamSpecUChar
96 {
97   GParamSpec    parent_instance;
98   
99   guint8        minimum;
100   guint8        maximum;
101   guint8        default_value;
102 };
103 struct _GParamSpecBoolean
104 {
105   GParamSpec    parent_instance;
106   
107   gboolean      default_value;
108 };
109 struct _GParamSpecInt
110 {
111   GParamSpec    parent_instance;
112   
113   gint          minimum;
114   gint          maximum;
115   gint          default_value;
116 };
117 struct _GParamSpecUInt
118 {
119   GParamSpec    parent_instance;
120   
121   guint         minimum;
122   guint         maximum;
123   guint         default_value;
124 };
125 struct _GParamSpecLong
126 {
127   GParamSpec    parent_instance;
128   
129   glong         minimum;
130   glong         maximum;
131   glong         default_value;
132 };
133 struct _GParamSpecULong
134 {
135   GParamSpec    parent_instance;
136   
137   gulong        minimum;
138   gulong        maximum;
139   gulong        default_value;
140 };
141 struct _GParamSpecEnum
142 {
143   GParamSpec    parent_instance;
144   
145   GEnumClass   *enum_class;
146   glong         default_value;
147 };
148 struct _GParamSpecFlags
149 {
150   GParamSpec    parent_instance;
151   
152   GFlagsClass  *flags_class;
153   gulong        default_value;
154 };
155 struct _GParamSpecFloat
156 {
157   GParamSpec    parent_instance;
158   
159   gfloat        minimum;
160   gfloat        maximum;
161   gfloat        default_value;
162   gfloat        epsilon;
163 };
164 struct _GParamSpecDouble
165 {
166   GParamSpec    parent_instance;
167   
168   gdouble       minimum;
169   gdouble       maximum;
170   gdouble       default_value;
171   gdouble       epsilon;
172 };
173 struct _GParamSpecString
174 {
175   GParamSpec    parent_instance;
176   
177   gchar        *default_value;
178   gchar        *cset_first;
179   gchar        *cset_nth;
180   gchar         substitutor;
181   guint         null_fold_if_empty : 1;
182   guint         ensure_non_null : 1;
183 };
184 struct _GParamSpecParam
185 {
186   GParamSpec    parent_instance;
187   
188   GType         param_type;
189 };
190 struct _GParamSpecPointer
191 {
192   GParamSpec    parent_instance;
193 };
194 struct _GParamSpecCCallback
195 {
196   GParamSpec    parent_instance;
197 };
198 struct _GParamSpecObject
199 {
200   GParamSpec    parent_instance;
201   
202   GType         object_type;
203 };
204
205
206 /* --- GParamSpec prototypes --- */
207 GParamSpec*     g_param_spec_char       (const gchar    *name,
208                                          const gchar    *nick,
209                                          const gchar    *blurb,
210                                          gint8           minimum,
211                                          gint8           maximum,
212                                          gint8           default_value,
213                                          GParamFlags     flags);
214 GParamSpec*     g_param_spec_uchar      (const gchar    *name,
215                                          const gchar    *nick,
216                                          const gchar    *blurb,
217                                          guint8          minimum,
218                                          guint8          maximum,
219                                          guint8          default_value,
220                                          GParamFlags     flags);
221 GParamSpec*     g_param_spec_boolean    (const gchar    *name,
222                                          const gchar    *nick,
223                                          const gchar    *blurb,
224                                          gboolean        default_value,
225                                          GParamFlags     flags);
226 GParamSpec*     g_param_spec_int        (const gchar    *name,
227                                          const gchar    *nick,
228                                          const gchar    *blurb,
229                                          gint            minimum,
230                                          gint            maximum,
231                                          gint            default_value,
232                                          GParamFlags     flags);
233 GParamSpec*     g_param_spec_uint       (const gchar    *name,
234                                          const gchar    *nick,
235                                          const gchar    *blurb,
236                                          guint           minimum,
237                                          guint           maximum,
238                                          guint           default_value,
239                                          GParamFlags     flags);
240 GParamSpec*     g_param_spec_long       (const gchar    *name,
241                                          const gchar    *nick,
242                                          const gchar    *blurb,
243                                          glong           minimum,
244                                          glong           maximum,
245                                          glong           default_value,
246                                          GParamFlags     flags);
247 GParamSpec*     g_param_spec_ulong      (const gchar    *name,
248                                          const gchar    *nick,
249                                          const gchar    *blurb,
250                                          gulong          minimum,
251                                          gulong          maximum,
252                                          gulong          default_value,
253                                          GParamFlags     flags);
254 GParamSpec*     g_param_spec_enum       (const gchar    *name,
255                                          const gchar    *nick,
256                                          const gchar    *blurb,
257                                          GType           enum_type,
258                                          gint            default_value,
259                                          GParamFlags     flags);
260 GParamSpec*     g_param_spec_flags      (const gchar    *name,
261                                          const gchar    *nick,
262                                          const gchar    *blurb,
263                                          GType           flags_type,
264                                          guint           default_value,
265                                          GParamFlags     flags);
266 GParamSpec*     g_param_spec_float      (const gchar    *name,
267                                          const gchar    *nick,
268                                          const gchar    *blurb,
269                                          gfloat          minimum,
270                                          gfloat          maximum,
271                                          gfloat          default_value,
272                                          GParamFlags     flags);
273 GParamSpec*     g_param_spec_double     (const gchar    *name,
274                                          const gchar    *nick,
275                                          const gchar    *blurb,
276                                          gdouble         minimum,
277                                          gdouble         maximum,
278                                          gdouble         default_value,
279                                          GParamFlags     flags);
280 GParamSpec*     g_param_spec_string     (const gchar    *name,
281                                          const gchar    *nick,
282                                          const gchar    *blurb,
283                                          const gchar    *default_value,
284                                          GParamFlags     flags);
285 GParamSpec*     g_param_spec_string_c   (const gchar    *name,
286                                          const gchar    *nick,
287                                          const gchar    *blurb,
288                                          const gchar    *default_value,
289                                          GParamFlags     flags);
290 GParamSpec*     g_param_spec_param      (const gchar    *name,
291                                          const gchar    *nick,
292                                          const gchar    *blurb,
293                                          GType           param_type,
294                                          GParamFlags     flags);
295 GParamSpec*     g_param_spec_pointer    (const gchar    *name,
296                                          const gchar    *nick,
297                                          const gchar    *blurb,
298                                          GParamFlags     flags);
299 GParamSpec*     g_param_spec_ccallback  (const gchar    *name,
300                                          const gchar    *nick,
301                                          const gchar    *blurb,
302                                          GParamFlags     flags);
303 GParamSpec*     g_param_spec_object     (const gchar    *name,
304                                          const gchar    *nick,
305                                          const gchar    *blurb,
306                                          GType           object_type,
307                                          GParamFlags     flags);
308
309
310 #ifdef __cplusplus
311 }
312 #endif /* __cplusplus */
313
314 #endif /* __G_PARAMSPECS_H__ */