Improve the detection of invalid includes by moving the test outside the
[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 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
22 #error "Only <glib-object.h> can be included directly."
23 #endif
24
25 #ifndef __G_PARAMSPECS_H__
26 #define __G_PARAMSPECS_H__
27
28 #include        <gobject/gvalue.h>
29 #include        <gobject/genums.h>
30 #include        <gobject/gboxed.h>
31 #include        <gobject/gobject.h>
32
33 G_BEGIN_DECLS
34
35 /* --- type macros --- */
36 #define G_TYPE_PARAM_CHAR                  (g_param_spec_types[0])
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_TYPE_PARAM_UCHAR                 (g_param_spec_types[1])
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_TYPE_PARAM_BOOLEAN               (g_param_spec_types[2])
43 #define G_IS_PARAM_SPEC_BOOLEAN(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
44 #define G_PARAM_SPEC_BOOLEAN(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
45 #define G_TYPE_PARAM_INT                   (g_param_spec_types[3])
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_TYPE_PARAM_UINT                  (g_param_spec_types[4])
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_TYPE_PARAM_LONG                  (g_param_spec_types[5])
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_TYPE_PARAM_ULONG                 (g_param_spec_types[6])
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_TYPE_PARAM_INT64                 (g_param_spec_types[7])
58 #define G_IS_PARAM_SPEC_INT64(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64))
59 #define G_PARAM_SPEC_INT64(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64))
60 #define G_TYPE_PARAM_UINT64                (g_param_spec_types[8])
61 #define G_IS_PARAM_SPEC_UINT64(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64))
62 #define G_PARAM_SPEC_UINT64(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64))
63 #define G_TYPE_PARAM_UNICHAR               (g_param_spec_types[9])
64 #define G_PARAM_SPEC_UNICHAR(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
65 #define G_IS_PARAM_SPEC_UNICHAR(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
66 #define G_TYPE_PARAM_ENUM                  (g_param_spec_types[10])
67 #define G_IS_PARAM_SPEC_ENUM(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
68 #define G_PARAM_SPEC_ENUM(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
69 #define G_TYPE_PARAM_FLAGS                 (g_param_spec_types[11])
70 #define G_IS_PARAM_SPEC_FLAGS(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
71 #define G_PARAM_SPEC_FLAGS(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
72 #define G_TYPE_PARAM_FLOAT                 (g_param_spec_types[12])
73 #define G_IS_PARAM_SPEC_FLOAT(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
74 #define G_PARAM_SPEC_FLOAT(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
75 #define G_TYPE_PARAM_DOUBLE                (g_param_spec_types[13])
76 #define G_IS_PARAM_SPEC_DOUBLE(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
77 #define G_PARAM_SPEC_DOUBLE(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
78 #define G_TYPE_PARAM_STRING                (g_param_spec_types[14])
79 #define G_IS_PARAM_SPEC_STRING(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
80 #define G_PARAM_SPEC_STRING(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
81 #define G_TYPE_PARAM_PARAM                 (g_param_spec_types[15])
82 #define G_IS_PARAM_SPEC_PARAM(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
83 #define G_PARAM_SPEC_PARAM(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
84 #define G_TYPE_PARAM_BOXED                 (g_param_spec_types[16])
85 #define G_IS_PARAM_SPEC_BOXED(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
86 #define G_PARAM_SPEC_BOXED(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
87 #define G_TYPE_PARAM_POINTER               (g_param_spec_types[17])
88 #define G_IS_PARAM_SPEC_POINTER(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
89 #define G_PARAM_SPEC_POINTER(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
90 #define G_TYPE_PARAM_VALUE_ARRAY           (g_param_spec_types[18])
91 #define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
92 #define G_PARAM_SPEC_VALUE_ARRAY(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
93 #define G_TYPE_PARAM_OBJECT                (g_param_spec_types[19])
94 #define G_IS_PARAM_SPEC_OBJECT(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
95 #define G_PARAM_SPEC_OBJECT(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
96
97
98 /* --- typedefs & structures --- */
99 typedef struct _GParamSpecChar       GParamSpecChar;
100 typedef struct _GParamSpecUChar      GParamSpecUChar;
101 typedef struct _GParamSpecBoolean    GParamSpecBoolean;
102 typedef struct _GParamSpecInt        GParamSpecInt;
103 typedef struct _GParamSpecUInt       GParamSpecUInt;
104 typedef struct _GParamSpecLong       GParamSpecLong;
105 typedef struct _GParamSpecULong      GParamSpecULong;
106 typedef struct _GParamSpecInt64      GParamSpecInt64;
107 typedef struct _GParamSpecUInt64     GParamSpecUInt64;
108 typedef struct _GParamSpecUnichar    GParamSpecUnichar;
109 typedef struct _GParamSpecEnum       GParamSpecEnum;
110 typedef struct _GParamSpecFlags      GParamSpecFlags;
111 typedef struct _GParamSpecFloat      GParamSpecFloat;
112 typedef struct _GParamSpecDouble     GParamSpecDouble;
113 typedef struct _GParamSpecString     GParamSpecString;
114 typedef struct _GParamSpecParam      GParamSpecParam;
115 typedef struct _GParamSpecBoxed      GParamSpecBoxed;
116 typedef struct _GParamSpecPointer    GParamSpecPointer;
117 typedef struct _GParamSpecValueArray GParamSpecValueArray;
118 typedef struct _GParamSpecObject     GParamSpecObject;
119
120 struct _GParamSpecChar
121 {
122   GParamSpec    parent_instance;
123   
124   gint8         minimum;
125   gint8         maximum;
126   gint8         default_value;
127 };
128 struct _GParamSpecUChar
129 {
130   GParamSpec    parent_instance;
131   
132   guint8        minimum;
133   guint8        maximum;
134   guint8        default_value;
135 };
136 struct _GParamSpecBoolean
137 {
138   GParamSpec    parent_instance;
139   
140   gboolean      default_value;
141 };
142 struct _GParamSpecInt
143 {
144   GParamSpec    parent_instance;
145   
146   gint          minimum;
147   gint          maximum;
148   gint          default_value;
149 };
150 struct _GParamSpecUInt
151 {
152   GParamSpec    parent_instance;
153   
154   guint         minimum;
155   guint         maximum;
156   guint         default_value;
157 };
158 struct _GParamSpecLong
159 {
160   GParamSpec    parent_instance;
161   
162   glong         minimum;
163   glong         maximum;
164   glong         default_value;
165 };
166 struct _GParamSpecULong
167 {
168   GParamSpec    parent_instance;
169   
170   gulong        minimum;
171   gulong        maximum;
172   gulong        default_value;
173 };
174 struct _GParamSpecInt64
175 {
176   GParamSpec    parent_instance;
177   
178   gint64        minimum;
179   gint64        maximum;
180   gint64        default_value;
181 };
182 struct _GParamSpecUInt64
183 {
184   GParamSpec    parent_instance;
185   
186   guint64       minimum;
187   guint64       maximum;
188   guint64       default_value;
189 };
190 struct _GParamSpecUnichar
191 {
192   GParamSpec    parent_instance;
193   
194   gunichar      default_value;
195 };
196 struct _GParamSpecEnum
197 {
198   GParamSpec    parent_instance;
199   
200   GEnumClass   *enum_class;
201   gint          default_value;
202 };
203 struct _GParamSpecFlags
204 {
205   GParamSpec    parent_instance;
206   
207   GFlagsClass  *flags_class;
208   guint         default_value;
209 };
210 struct _GParamSpecFloat
211 {
212   GParamSpec    parent_instance;
213   
214   gfloat        minimum;
215   gfloat        maximum;
216   gfloat        default_value;
217   gfloat        epsilon;
218 };
219 struct _GParamSpecDouble
220 {
221   GParamSpec    parent_instance;
222   
223   gdouble       minimum;
224   gdouble       maximum;
225   gdouble       default_value;
226   gdouble       epsilon;
227 };
228 struct _GParamSpecString
229 {
230   GParamSpec    parent_instance;
231   
232   gchar        *default_value;
233   gchar        *cset_first;
234   gchar        *cset_nth;
235   gchar         substitutor;
236   guint         null_fold_if_empty : 1;
237   guint         ensure_non_null : 1;
238 };
239 struct _GParamSpecParam
240 {
241   GParamSpec    parent_instance;
242 };
243 struct _GParamSpecBoxed
244 {
245   GParamSpec    parent_instance;
246 };
247 struct _GParamSpecPointer
248 {
249   GParamSpec    parent_instance;
250 };
251 struct _GParamSpecValueArray
252 {
253   GParamSpec    parent_instance;
254   GParamSpec   *element_spec;
255   guint         fixed_n_elements;
256 };
257 struct _GParamSpecObject
258 {
259   GParamSpec    parent_instance;
260 };
261
262 /* --- GParamSpec prototypes --- */
263 GParamSpec*     g_param_spec_char        (const gchar    *name,
264                                           const gchar    *nick,
265                                           const gchar    *blurb,
266                                           gint8           minimum,
267                                           gint8           maximum,
268                                           gint8           default_value,
269                                           GParamFlags     flags);
270 GParamSpec*     g_param_spec_uchar       (const gchar    *name,
271                                           const gchar    *nick,
272                                           const gchar    *blurb,
273                                           guint8          minimum,
274                                           guint8          maximum,
275                                           guint8          default_value,
276                                           GParamFlags     flags);
277 GParamSpec*     g_param_spec_boolean     (const gchar    *name,
278                                           const gchar    *nick,
279                                           const gchar    *blurb,
280                                           gboolean        default_value,
281                                           GParamFlags     flags);
282 GParamSpec*     g_param_spec_int         (const gchar    *name,
283                                           const gchar    *nick,
284                                           const gchar    *blurb,
285                                           gint            minimum,
286                                           gint            maximum,
287                                           gint            default_value,
288                                           GParamFlags     flags);
289 GParamSpec*     g_param_spec_uint        (const gchar    *name,
290                                           const gchar    *nick,
291                                           const gchar    *blurb,
292                                           guint           minimum,
293                                           guint           maximum,
294                                           guint           default_value,
295                                           GParamFlags     flags);
296 GParamSpec*     g_param_spec_long        (const gchar    *name,
297                                           const gchar    *nick,
298                                           const gchar    *blurb,
299                                           glong           minimum,
300                                           glong           maximum,
301                                           glong           default_value,
302                                           GParamFlags     flags);
303 GParamSpec*     g_param_spec_ulong       (const gchar    *name,
304                                           const gchar    *nick,
305                                           const gchar    *blurb,
306                                           gulong          minimum,
307                                           gulong          maximum,
308                                           gulong          default_value,
309                                           GParamFlags     flags);
310 GParamSpec*     g_param_spec_int64       (const gchar    *name,
311                                           const gchar    *nick,
312                                           const gchar    *blurb,
313                                           gint64          minimum,
314                                           gint64          maximum,
315                                           gint64          default_value,
316                                           GParamFlags     flags);
317 GParamSpec*     g_param_spec_uint64      (const gchar    *name,
318                                           const gchar    *nick,
319                                           const gchar    *blurb,
320                                           guint64         minimum,
321                                           guint64         maximum,
322                                           guint64         default_value,
323                                           GParamFlags     flags);
324 GParamSpec*    g_param_spec_unichar      (const gchar    *name,
325                                           const gchar    *nick,
326                                           const gchar    *blurb,
327                                           gunichar        default_value,
328                                           GParamFlags     flags);
329 GParamSpec*     g_param_spec_enum        (const gchar    *name,
330                                           const gchar    *nick,
331                                           const gchar    *blurb,
332                                           GType           enum_type,
333                                           gint            default_value,
334                                           GParamFlags     flags);
335 GParamSpec*     g_param_spec_flags       (const gchar    *name,
336                                           const gchar    *nick,
337                                           const gchar    *blurb,
338                                           GType           flags_type,
339                                           guint           default_value,
340                                           GParamFlags     flags);
341 GParamSpec*     g_param_spec_float       (const gchar    *name,
342                                           const gchar    *nick,
343                                           const gchar    *blurb,
344                                           gfloat          minimum,
345                                           gfloat          maximum,
346                                           gfloat          default_value,
347                                           GParamFlags     flags);
348 GParamSpec*     g_param_spec_double      (const gchar    *name,
349                                           const gchar    *nick,
350                                           const gchar    *blurb,
351                                           gdouble         minimum,
352                                           gdouble         maximum,
353                                           gdouble         default_value,
354                                           GParamFlags     flags);
355 GParamSpec*     g_param_spec_string      (const gchar    *name,
356                                           const gchar    *nick,
357                                           const gchar    *blurb,
358                                           const gchar    *default_value,
359                                           GParamFlags     flags);
360 GParamSpec*     g_param_spec_param       (const gchar    *name,
361                                           const gchar    *nick,
362                                           const gchar    *blurb,
363                                           GType           param_type,
364                                           GParamFlags     flags);
365 GParamSpec*     g_param_spec_boxed       (const gchar    *name,
366                                           const gchar    *nick,
367                                           const gchar    *blurb,
368                                           GType           boxed_type,
369                                           GParamFlags     flags);
370 GParamSpec*     g_param_spec_pointer     (const gchar    *name,
371                                           const gchar    *nick,
372                                           const gchar    *blurb,
373                                           GParamFlags     flags);
374 GParamSpec*     g_param_spec_value_array (const gchar    *name,
375                                           const gchar    *nick,
376                                           const gchar    *blurb,
377                                           GParamSpec     *element_spec,
378                                           GParamFlags     flags);
379 GParamSpec*     g_param_spec_object      (const gchar    *name,
380                                           const gchar    *nick,
381                                           const gchar    *blurb,
382                                           GType           object_type,
383                                           GParamFlags     flags);
384
385
386 /* --- internal --- */
387 /* We prefix variable declarations so they can
388  * properly get exported in windows dlls.
389  */
390 #ifndef GOBJECT_VAR
391 #  ifdef G_PLATFORM_WIN32
392 #    ifdef GOBJECT_STATIC_COMPILATION
393 #      define GOBJECT_VAR extern
394 #    else /* !GOBJECT_STATIC_COMPILATION */
395 #      ifdef GOBJECT_COMPILATION
396 #        ifdef DLL_EXPORT
397 #          define GOBJECT_VAR __declspec(dllexport)
398 #        else /* !DLL_EXPORT */
399 #          define GOBJECT_VAR extern
400 #        endif /* !DLL_EXPORT */
401 #      else /* !GOBJECT_COMPILATION */
402 #        define GOBJECT_VAR extern __declspec(dllimport)
403 #      endif /* !GOBJECT_COMPILATION */
404 #    endif /* !GOBJECT_STATIC_COMPILATION */
405 #  else /* !G_PLATFORM_WIN32 */
406 #    define GOBJECT_VAR extern
407 #  endif /* !G_PLATFORM_WIN32 */
408 #endif /* GOBJECT_VAR */
409
410 GOBJECT_VAR GType *g_param_spec_types;
411
412 G_END_DECLS
413
414 #endif /* __G_PARAMSPECS_H__ */