Bug Summary

File:_build/../libbean/cparamspecs.c
Warning:line 806, column 7
Value stored to 'string' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name cparamspecs.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/rootdir/_build -fcoverage-compilation-dir=/rootdir/_build -resource-dir /usr/lib/llvm-19/lib/clang/19 -I libbean/libean-2.0.so.0.0.0.p -I libbean -I ../libbean -I . -I .. -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gobject-introspection-1.0 -D _FILE_OFFSET_BITS=64 -D HAVE_CONFIG_H -D G_LOG_DOMAIN="libbean" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib/x86_64-linux-gnu" -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -ferror-limit 19 -fvisibility=hidden -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2025-08-03-105933-13762-1 -x c ../libbean/cparamspecs.c
1/* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
3 * Copyright (C) 2010 Christian Persch
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21/*
22 * MT safe
23 */
24
25
26#include "config.h"
27
28#include <string.h>
29
30#include "cparamspecs.h"
31
32
33#define G_FLOAT_EPSILON(1e-30f) (1e-30f)
34#define G_DOUBLE_EPSILON(1e-90) (1e-90)
35
36
37/* --- param spec functions --- */
38static void
39param_char_init (CParamSpec *pspec)
40{
41 CParamSpecChar *cspec = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec)))));
42
43 cspec->minimum = 0x7f;
44 cspec->maximum = 0x80;
45 cspec->default_value = 0;
46}
47
48static void
49param_char_set_default (CParamSpec *pspec,
50 GValue *value)
51{
52 value->data[0].v_int = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec)))))->default_value;
53}
54
55static gboolean
56param_char_is_valid (CParamSpec *pspec,
57 const GValue *value)
58{
59 CParamSpecChar *cspec = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec)))));
60 gint oval = value->data[0].v_int;
61
62 return cspec->minimum <= oval && oval <= cspec->maximum;
63}
64
65static gboolean
66param_char_validate (CParamSpec *pspec,
67 GValue *value)
68{
69 CParamSpecChar *cspec = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec)))));
70 gint oval = value->data[0].v_int;
71
72 value->data[0].v_int = CLAMP (value->data[0].v_int, cspec->minimum, cspec->maximum)(((value->data[0].v_int) > (cspec->maximum)) ? (cspec
->maximum) : (((value->data[0].v_int) < (cspec->minimum
)) ? (cspec->minimum) : (value->data[0].v_int)))
;
73
74 return value->data[0].v_int != oval;
75}
76
77static void
78param_uchar_init (CParamSpec *pspec)
79{
80 CParamSpecUChar *uspec = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec)))));
81
82 uspec->minimum = 0;
83 uspec->maximum = 0xff;
84 uspec->default_value = 0;
85}
86
87static void
88param_uchar_set_default (CParamSpec *pspec,
89 GValue *value)
90{
91 value->data[0].v_uint = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec)))))->default_value;
92}
93
94static gboolean
95param_uchar_is_valid (CParamSpec *pspec,
96 const GValue *value)
97{
98 CParamSpecUChar *uspec = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec)))));
99 guint oval = value->data[0].v_uint;
100
101 return uspec->minimum <= oval && oval <= uspec->maximum;
102}
103
104static gboolean
105param_uchar_validate (CParamSpec *pspec,
106 GValue *value)
107{
108 CParamSpecUChar *uspec = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec)))));
109 guint oval = value->data[0].v_uint;
110
111 value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum)(((value->data[0].v_uint) > (uspec->maximum)) ? (uspec
->maximum) : (((value->data[0].v_uint) < (uspec->
minimum)) ? (uspec->minimum) : (value->data[0].v_uint))
)
;
112
113 return value->data[0].v_uint != oval;
114}
115
116static void
117param_boolean_set_default (CParamSpec *pspec,
118 GValue *value)
119{
120 value->data[0].v_int = C_PARAM_SPEC_BOOLEAN (pspec)((((CParamSpecBoolean*) (void *) ((pspec)))))->default_value;
121}
122
123static gboolean
124param_boolean_is_valid (CParamSpec *pspec,
125 const GValue *value)
126{
127 int oval = value->data[0].v_int;
128
129 return oval == FALSE(0) || oval == TRUE(!(0));
130}
131
132static gboolean
133param_boolean_validate (CParamSpec *pspec,
134 GValue *value)
135{
136 gint oval = value->data[0].v_int;
137
138 value->data[0].v_int = value->data[0].v_int != FALSE(0);
139
140 return value->data[0].v_int != oval;
141}
142
143static void
144param_int_init (CParamSpec *pspec)
145{
146 CParamSpecInt *ispec = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec)))));
147
148 ispec->minimum = 0x7fffffff;
149 ispec->maximum = 0x80000000;
150 ispec->default_value = 0;
151}
152
153static void
154param_int_set_default (CParamSpec *pspec,
155 GValue *value)
156{
157 value->data[0].v_int = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec)))))->default_value;
158}
159
160static gboolean
161param_int_is_valid (CParamSpec *pspec,
162 const GValue *value)
163{
164 CParamSpecInt *ispec = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec)))));
165 int oval = value->data[0].v_int;
166
167 return ispec->minimum <= oval && oval <= ispec->maximum;
168}
169
170static gboolean
171param_int_validate (CParamSpec *pspec,
172 GValue *value)
173{
174 CParamSpecInt *ispec = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec)))));
175 gint oval = value->data[0].v_int;
176
177 value->data[0].v_int = CLAMP (value->data[0].v_int, ispec->minimum, ispec->maximum)(((value->data[0].v_int) > (ispec->maximum)) ? (ispec
->maximum) : (((value->data[0].v_int) < (ispec->minimum
)) ? (ispec->minimum) : (value->data[0].v_int)))
;
178
179 return value->data[0].v_int != oval;
180}
181
182static gint
183param_int_values_cmp (CParamSpec *pspec,
184 const GValue *value1,
185 const GValue *value2)
186{
187 if (value1->data[0].v_int < value2->data[0].v_int)
188 return -1;
189 else
190 return value1->data[0].v_int > value2->data[0].v_int;
191}
192
193static void
194param_uint_init (CParamSpec *pspec)
195{
196 CParamSpecUInt *uspec = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec)))));
197
198 uspec->minimum = 0;
199 uspec->maximum = 0xffffffff;
200 uspec->default_value = 0;
201}
202
203static void
204param_uint_set_default (CParamSpec *pspec,
205 GValue *value)
206{
207 value->data[0].v_uint = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec)))))->default_value;
208}
209
210static gboolean
211param_uint_is_valid (CParamSpec *pspec,
212 const GValue *value)
213{
214 CParamSpecUInt *uspec = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec)))));
215 guint oval = value->data[0].v_uint;
216
217 return uspec->minimum <= oval && oval <= uspec->maximum;
218}
219
220static gboolean
221param_uint_validate (CParamSpec *pspec,
222 GValue *value)
223{
224 CParamSpecUInt *uspec = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec)))));
225 guint oval = value->data[0].v_uint;
226
227 value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum)(((value->data[0].v_uint) > (uspec->maximum)) ? (uspec
->maximum) : (((value->data[0].v_uint) < (uspec->
minimum)) ? (uspec->minimum) : (value->data[0].v_uint))
)
;
228
229 return value->data[0].v_uint != oval;
230}
231
232static gint
233param_uint_values_cmp (CParamSpec *pspec,
234 const GValue *value1,
235 const GValue *value2)
236{
237 if (value1->data[0].v_uint < value2->data[0].v_uint)
238 return -1;
239 else
240 return value1->data[0].v_uint > value2->data[0].v_uint;
241}
242
243static void
244param_long_init (CParamSpec *pspec)
245{
246 CParamSpecLong *lspec = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec)))));
247
248#if SIZEOF_LONG == 4
249 lspec->minimum = 0x7fffffff;
250 lspec->maximum = 0x80000000;
251#else /* SIZEOF_LONG != 4 (8) */
252 lspec->minimum = 0x7fffffffffffffff;
253 lspec->maximum = 0x8000000000000000;
254#endif
255 lspec->default_value = 0;
256}
257
258static void
259param_long_set_default (CParamSpec *pspec,
260 GValue *value)
261{
262 value->data[0].v_long = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec)))))->default_value;
263}
264
265static gboolean
266param_long_is_valid (CParamSpec *pspec,
267 const GValue *value)
268{
269 CParamSpecLong *lspec = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec)))));
270 glong oval = value->data[0].v_long;
271
272 return lspec->minimum <= oval && oval <= lspec->maximum;
273}
274
275static gboolean
276param_long_validate (CParamSpec *pspec,
277 GValue *value)
278{
279 CParamSpecLong *lspec = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec)))));
280 glong oval = value->data[0].v_long;
281
282 value->data[0].v_long = CLAMP (value->data[0].v_long, lspec->minimum, lspec->maximum)(((value->data[0].v_long) > (lspec->maximum)) ? (lspec
->maximum) : (((value->data[0].v_long) < (lspec->
minimum)) ? (lspec->minimum) : (value->data[0].v_long))
)
;
283
284 return value->data[0].v_long != oval;
285}
286
287static gint
288param_long_values_cmp (CParamSpec *pspec,
289 const GValue *value1,
290 const GValue *value2)
291{
292 if (value1->data[0].v_long < value2->data[0].v_long)
293 return -1;
294 else
295 return value1->data[0].v_long > value2->data[0].v_long;
296}
297
298static void
299param_ulong_init (CParamSpec *pspec)
300{
301 CParamSpecULong *uspec = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec)))));
302
303 uspec->minimum = 0;
304#if SIZEOF_LONG == 4
305 uspec->maximum = 0xffffffff;
306#else /* SIZEOF_LONG != 4 (8) */
307 uspec->maximum = 0xffffffffffffffff;
308#endif
309 uspec->default_value = 0;
310}
311
312static void
313param_ulong_set_default (CParamSpec *pspec,
314 GValue *value)
315{
316 value->data[0].v_ulong = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec)))))->default_value;
317}
318
319static gboolean
320param_ulong_is_valid (CParamSpec *pspec,
321 const GValue *value)
322{
323 CParamSpecULong *uspec = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec)))));
324 gulong oval = value->data[0].v_ulong;
325
326 return uspec->minimum <= oval && oval <= uspec->maximum;
327}
328
329static gboolean
330param_ulong_validate (CParamSpec *pspec,
331 GValue *value)
332{
333 CParamSpecULong *uspec = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec)))));
334 gulong oval = value->data[0].v_ulong;
335
336 value->data[0].v_ulong = CLAMP (value->data[0].v_ulong, uspec->minimum, uspec->maximum)(((value->data[0].v_ulong) > (uspec->maximum)) ? (uspec
->maximum) : (((value->data[0].v_ulong) < (uspec->
minimum)) ? (uspec->minimum) : (value->data[0].v_ulong)
))
;
337
338 return value->data[0].v_ulong != oval;
339}
340
341static gint
342param_ulong_values_cmp (CParamSpec *pspec,
343 const GValue *value1,
344 const GValue *value2)
345{
346 if (value1->data[0].v_ulong < value2->data[0].v_ulong)
347 return -1;
348 else
349 return value1->data[0].v_ulong > value2->data[0].v_ulong;
350}
351
352static void
353param_int64_init (CParamSpec *pspec)
354{
355 CParamSpecInt64 *lspec = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec)))));
356
357 lspec->minimum = G_MININT64((gint64) (-(0x7fffffffffffffffL) - (1L)));
358 lspec->maximum = G_MAXINT64(0x7fffffffffffffffL);
359 lspec->default_value = 0;
360}
361
362static void
363param_int64_set_default (CParamSpec *pspec,
364 GValue *value)
365{
366 value->data[0].v_int64 = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec)))))->default_value;
367}
368
369static gboolean
370param_int64_is_valid (CParamSpec *pspec,
371 const GValue *value)
372{
373 CParamSpecInt64 *lspec = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec)))));
374 gint64 oval = value->data[0].v_int64;
375
376 return lspec->minimum <= oval && oval <= lspec->maximum;
377}
378
379static gboolean
380param_int64_validate (CParamSpec *pspec,
381 GValue *value)
382{
383 CParamSpecInt64 *lspec = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec)))));
384 gint64 oval = value->data[0].v_int64;
385
386 value->data[0].v_int64 = CLAMP (value->data[0].v_int64, lspec->minimum, lspec->maximum)(((value->data[0].v_int64) > (lspec->maximum)) ? (lspec
->maximum) : (((value->data[0].v_int64) < (lspec->
minimum)) ? (lspec->minimum) : (value->data[0].v_int64)
))
;
387
388 return value->data[0].v_int64 != oval;
389}
390
391static gint
392param_int64_values_cmp (CParamSpec *pspec,
393 const GValue *value1,
394 const GValue *value2)
395{
396 if (value1->data[0].v_int64 < value2->data[0].v_int64)
397 return -1;
398 else
399 return value1->data[0].v_int64 > value2->data[0].v_int64;
400}
401
402static void
403param_uint64_init (CParamSpec *pspec)
404{
405 CParamSpecUInt64 *uspec = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec)))));
406
407 uspec->minimum = 0;
408 uspec->maximum = G_MAXUINT64(0xffffffffffffffffUL);
409 uspec->default_value = 0;
410}
411
412static void
413param_uint64_set_default (CParamSpec *pspec,
414 GValue *value)
415{
416 value->data[0].v_uint64 = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec)))))->default_value;
417}
418
419static gboolean
420param_uint64_is_valid (CParamSpec *pspec,
421 const GValue *value)
422{
423 CParamSpecUInt64 *uspec = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec)))));
424 guint64 oval = value->data[0].v_uint64;
425
426 return uspec->minimum <= oval && oval <= uspec->maximum;
427}
428
429static gboolean
430param_uint64_validate (CParamSpec *pspec,
431 GValue *value)
432{
433 CParamSpecUInt64 *uspec = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec)))));
434 guint64 oval = value->data[0].v_uint64;
435
436 value->data[0].v_uint64 = CLAMP (value->data[0].v_uint64, uspec->minimum, uspec->maximum)(((value->data[0].v_uint64) > (uspec->maximum)) ? (uspec
->maximum) : (((value->data[0].v_uint64) < (uspec->
minimum)) ? (uspec->minimum) : (value->data[0].v_uint64
)))
;
437
438 return value->data[0].v_uint64 != oval;
439}
440
441static gint
442param_uint64_values_cmp (CParamSpec *pspec,
443 const GValue *value1,
444 const GValue *value2)
445{
446 if (value1->data[0].v_uint64 < value2->data[0].v_uint64)
447 return -1;
448 else
449 return value1->data[0].v_uint64 > value2->data[0].v_uint64;
450}
451
452static void
453param_unichar_init (CParamSpec *pspec)
454{
455 CParamSpecUnichar *uspec = C_PARAM_SPEC_UNICHAR (pspec)((((CParamSpecUnichar*) (void *) ((pspec)))));
456
457 uspec->default_value = 0;
458}
459
460static void
461param_unichar_set_default (CParamSpec *pspec,
462 GValue *value)
463{
464 value->data[0].v_uint = C_PARAM_SPEC_UNICHAR (pspec)((((CParamSpecUnichar*) (void *) ((pspec)))))->default_value;
465}
466
467static gboolean
468param_unichar_is_valid (CParamSpec *pspec,
469 const GValue *value)
470{
471 return g_unichar_validate (value->data[0].v_uint);
472}
473
474static gboolean
475param_unichar_validate (CParamSpec *pspec,
476 GValue *value)
477{
478 gunichar oval = value->data[0].v_uint;
479 gboolean changed = FALSE(0);
480
481 if (!g_unichar_validate (oval))
482 {
483 value->data[0].v_uint = 0;
484 changed = TRUE(!(0));
485 }
486
487 return changed;
488}
489
490static gint
491param_unichar_values_cmp (CParamSpec *pspec,
492 const GValue *value1,
493 const GValue *value2)
494{
495 if (value1->data[0].v_uint < value2->data[0].v_uint)
496 return -1;
497 else
498 return value1->data[0].v_uint > value2->data[0].v_uint;
499}
500
501static void
502param_enum_init (CParamSpec *pspec)
503{
504 CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec)))));
505
506 espec->enum_class = NULL((void*)0);
507 espec->default_value = 0;
508}
509
510static void
511param_enum_finalize (CParamSpec *pspec)
512{
513 CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec)))));
514 CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_ENUM(c_param_spec_types[10])));
515
516 if (espec->enum_class)
517 {
518 g_type_class_unref (espec->enum_class);
519 espec->enum_class = NULL((void*)0);
520 }
521
522 parent_class->finalize (pspec);
523}
524
525static void
526param_enum_set_default (CParamSpec *pspec,
527 GValue *value)
528{
529 value->data[0].v_long = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec)))))->default_value;
530}
531
532static gboolean
533param_enum_is_valid (CParamSpec *pspec,
534 const GValue *value)
535{
536 CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec)))));
537 glong oval = value->data[0].v_long;
538
539 return g_enum_get_value (espec->enum_class, oval) != NULL((void*)0);
540}
541
542static gboolean
543param_enum_validate (CParamSpec *pspec,
544 GValue *value)
545{
546 CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec)))));
547 glong oval = value->data[0].v_long;
548
549 if (!espec->enum_class ||
550 !g_enum_get_value (espec->enum_class, value->data[0].v_long))
551 value->data[0].v_long = espec->default_value;
552
553 return value->data[0].v_long != oval;
554}
555
556static void
557param_flags_init (CParamSpec *pspec)
558{
559 CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec)))));
560
561 fspec->flags_class = NULL((void*)0);
562 fspec->default_value = 0;
563}
564
565static void
566param_flags_finalize (CParamSpec *pspec)
567{
568 CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec)))));
569 CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_FLAGS(c_param_spec_types[11])));
570
571 if (fspec->flags_class)
572 {
573 g_type_class_unref (fspec->flags_class);
574 fspec->flags_class = NULL((void*)0);
575 }
576
577 parent_class->finalize (pspec);
578}
579
580static void
581param_flags_set_default (CParamSpec *pspec,
582 GValue *value)
583{
584 value->data[0].v_ulong = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec)))))->default_value;
585}
586
587static gboolean
588param_flags_is_valid (CParamSpec *pspec,
589 const GValue *value)
590{
591 CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec)))));
592 gulong oval = value->data[0].v_ulong;
593
594 return (oval & ~fspec->flags_class->mask) == 0;
595}
596static gboolean
597param_flags_validate (CParamSpec *pspec,
598 GValue *value)
599{
600 CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec)))));
601 gulong oval = value->data[0].v_ulong;
602
603 if (fspec->flags_class)
604 value->data[0].v_ulong &= fspec->flags_class->mask;
605 else
606 value->data[0].v_ulong = fspec->default_value;
607
608 return value->data[0].v_ulong != oval;
609}
610
611static void
612param_float_init (CParamSpec *pspec)
613{
614 CParamSpecFloat *fspec = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))));
615
616 fspec->minimum = -G_MAXFLOAT3.40282347e+38F;
617 fspec->maximum = G_MAXFLOAT3.40282347e+38F;
618 fspec->default_value = 0;
619 fspec->epsilon = G_FLOAT_EPSILON(1e-30f);
620}
621
622static void
623param_float_set_default (CParamSpec *pspec,
624 GValue *value)
625{
626 value->data[0].v_float = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))))->default_value;
627}
628
629static gboolean
630param_float_is_valid (CParamSpec *pspec,
631 const GValue *value)
632{
633 CParamSpecFloat *fspec = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))));
634 gfloat oval = value->data[0].v_float;
635
636 return fspec->minimum <= oval && oval <= fspec->maximum;
637}
638
639static gboolean
640param_float_validate (CParamSpec *pspec,
641 GValue *value)
642{
643 CParamSpecFloat *fspec = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))));
644 gfloat oval = value->data[0].v_float;
645
646 value->data[0].v_float = CLAMP (value->data[0].v_float, fspec->minimum, fspec->maximum)(((value->data[0].v_float) > (fspec->maximum)) ? (fspec
->maximum) : (((value->data[0].v_float) < (fspec->
minimum)) ? (fspec->minimum) : (value->data[0].v_float)
))
;
647
648 return value->data[0].v_float != oval;
649}
650
651static gint
652param_float_values_cmp (CParamSpec *pspec,
653 const GValue *value1,
654 const GValue *value2)
655{
656 gfloat epsilon = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))))->epsilon;
657
658 if (value1->data[0].v_float < value2->data[0].v_float)
659 return - (value2->data[0].v_float - value1->data[0].v_float > epsilon);
660 else
661 return value1->data[0].v_float - value2->data[0].v_float > epsilon;
662}
663
664static void
665param_double_init (CParamSpec *pspec)
666{
667 CParamSpecDouble *dspec = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))));
668
669 dspec->minimum = -G_MAXDOUBLE1.7976931348623157e+308;
670 dspec->maximum = G_MAXDOUBLE1.7976931348623157e+308;
671 dspec->default_value = 0;
672 dspec->epsilon = G_DOUBLE_EPSILON(1e-90);
673}
674
675static void
676param_double_set_default (CParamSpec *pspec,
677 GValue *value)
678{
679 value->data[0].v_double = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))))->default_value;
680}
681
682static gboolean
683param_double_is_valid (CParamSpec *pspec,
684 const GValue *value)
685{
686 CParamSpecDouble *dspec = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))));
687 gdouble oval = value->data[0].v_double;
688
689 return dspec->minimum <= oval && oval <= dspec->maximum;
690}
691
692static gboolean
693param_double_validate (CParamSpec *pspec,
694 GValue *value)
695{
696 CParamSpecDouble *dspec = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))));
697 gdouble oval = value->data[0].v_double;
698
699 value->data[0].v_double = CLAMP (value->data[0].v_double, dspec->minimum, dspec->maximum)(((value->data[0].v_double) > (dspec->maximum)) ? (dspec
->maximum) : (((value->data[0].v_double) < (dspec->
minimum)) ? (dspec->minimum) : (value->data[0].v_double
)))
;
700
701 return value->data[0].v_double != oval;
702}
703
704static gint
705param_double_values_cmp (CParamSpec *pspec,
706 const GValue *value1,
707 const GValue *value2)
708{
709 gdouble epsilon = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))))->epsilon;
710
711 if (value1->data[0].v_double < value2->data[0].v_double)
712 return - (value2->data[0].v_double - value1->data[0].v_double > epsilon);
713 else
714 return value1->data[0].v_double - value2->data[0].v_double > epsilon;
715}
716
717static void
718param_string_init (CParamSpec *pspec)
719{
720 CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec)))));
721
722 sspec->default_value = NULL((void*)0);
723 sspec->cset_first = NULL((void*)0);
724 sspec->cset_nth = NULL((void*)0);
725 sspec->substitutor = '_';
726 sspec->null_fold_if_empty = FALSE(0);
727 sspec->ensure_non_null = FALSE(0);
728}
729
730static void
731param_string_finalize (CParamSpec *pspec)
732{
733 CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec)))));
734 CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_STRING(c_param_spec_types[14])));
735
736 g_free (sspec->default_value);
737 g_free (sspec->cset_first);
738 g_free (sspec->cset_nth);
739 sspec->default_value = NULL((void*)0);
740 sspec->cset_first = NULL((void*)0);
741 sspec->cset_nth = NULL((void*)0);
742
743 parent_class->finalize (pspec);
744}
745
746static void
747param_string_set_default (CParamSpec *pspec,
748 GValue *value)
749{
750 value->data[0].v_pointer = g_strdup (C_PARAM_SPEC_STRING (pspec)->default_value)g_strdup_inline (((((CParamSpecString*) (void *) ((pspec)))))
->default_value)
;
751}
752
753static gboolean
754param_string_validate (CParamSpec *pspec,
755 GValue *value)
756{
757 CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec)))));
758 gchar *string = value->data[0].v_pointer;
759 guint changed = 0;
760
761 if (string && string[0])
762 {
763 gchar *s;
764
765 if (sspec->cset_first && !strchr (sspec->cset_first, string[0]))
766 {
767 if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS(1 << 27))
768 {
769 value->data[0].v_pointer = g_strdup (string)g_strdup_inline (string);
770 string = value->data[0].v_pointer;
771 value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27);
772 }
773 string[0] = sspec->substitutor;
774 changed++;
775 }
776 if (sspec->cset_nth)
777 for (s = string + 1; *s; s++)
778 if (!strchr (sspec->cset_nth, *s))
779 {
780 if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS(1 << 27))
781 {
782 value->data[0].v_pointer = g_strdup (string)g_strdup_inline (string);
783 s = (gchar*) value->data[0].v_pointer + (s - string);
784 string = value->data[0].v_pointer;
785 value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27);
786 }
787 *s = sspec->substitutor;
788 changed++;
789 }
790 }
791 if (sspec->null_fold_if_empty && string && string[0] == 0)
792 {
793 if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS(1 << 27)))
794 g_free (value->data[0].v_pointer);
795 else
796 value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27);
797 value->data[0].v_pointer = NULL((void*)0);
798 changed++;
799 string = value->data[0].v_pointer;
800 }
801 if (sspec->ensure_non_null && !string)
802 {
803 value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27);
804 value->data[0].v_pointer = g_strdup ("")g_strdup_inline ("");
805 changed++;
806 string = value->data[0].v_pointer;
Value stored to 'string' is never read
807 }
808
809 return changed;
810}
811
812static gboolean
813param_string_is_valid (CParamSpec *pspec,
814 const GValue *value)
815{
816 CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec)))));
817 gboolean ret = TRUE(!(0));
818
819 if (sspec->cset_first != NULL((void*)0) || sspec->cset_nth != NULL((void*)0) ||
820 sspec->ensure_non_null || sspec->null_fold_if_empty)
821 {
822 GValue tmp_value = G_VALUE_INIT{ 0, { { 0 } } };
823
824 g_value_init (&tmp_value, G_VALUE_TYPE (value)(((GValue*) (value))->g_type));
825 g_value_copy (value, &tmp_value);
826
827 ret = !param_string_validate (pspec, &tmp_value);
828
829 g_value_unset (&tmp_value);
830 }
831
832 return ret;
833}
834
835static gint
836param_string_values_cmp (CParamSpec *pspec,
837 const GValue *value1,
838 const GValue *value2)
839{
840 if (!value1->data[0].v_pointer)
841 return value2->data[0].v_pointer != NULL((void*)0) ? -1 : 0;
842 else if (!value2->data[0].v_pointer)
843 return value1->data[0].v_pointer != NULL((void*)0);
844 else
845 return strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
846}
847
848static void
849param_param_init (CParamSpec *pspec)
850{
851 /* CParamSpecParam *spec = C_PARAM_SPEC_PARAM (pspec); */
852}
853
854static void
855param_param_set_default (CParamSpec *pspec,
856 GValue *value)
857{
858 value->data[0].v_pointer = NULL((void*)0);
859}
860
861static gboolean
862param_param_is_valid (CParamSpec *pspec,
863 const GValue *value)
864{
865 CParamSpec *param = value->data[0].v_pointer;
866
867 if (param == NULL((void*)0))
868 return FALSE(0);
869
870 return g_value_type_compatible (C_PARAM_SPEC_TYPE (param)(((((GTypeClass*) (((GTypeInstance*) (param))->g_class))->
g_type)))
, C_PARAM_SPEC_VALUE_TYPE (pspec)(((((CParamSpec*) (void *) ((pspec)))))->value_type));
871}
872
873static gboolean
874param_param_validate (CParamSpec *pspec,
875 GValue *value)
876{
877 /* CParamSpecParam *spec = C_PARAM_SPEC_PARAM (pspec); */
878 CParamSpec *param = value->data[0].v_pointer;
879 guint changed = 0;
880
881 if (param && !g_value_type_compatible (C_PARAM_SPEC_TYPE (param)(((((GTypeClass*) (((GTypeInstance*) (param))->g_class))->
g_type)))
, C_PARAM_SPEC_VALUE_TYPE (pspec)(((((CParamSpec*) (void *) ((pspec)))))->value_type)))
882 {
883 c_param_spec_unref (param);
884 value->data[0].v_pointer = NULL((void*)0);
885 changed++;
886 }
887
888 return changed;
889}
890
891static void
892param_boxed_init (CParamSpec *pspec)
893{
894 /* CParamSpecBoxed *bspec = C_PARAM_SPEC_BOXED (pspec); */
895}
896
897static void
898param_boxed_set_default (CParamSpec *pspec,
899 GValue *value)
900{
901 value->data[0].v_pointer = NULL((void*)0);
902}
903
904static gint
905param_boxed_values_cmp (CParamSpec *pspec,
906 const GValue *value1,
907 const GValue *value2)
908{
909 guint8 *p1 = value1->data[0].v_pointer;
910 guint8 *p2 = value2->data[0].v_pointer;
911
912 /* not much to compare here, try to at least provide stable lesser/greater result */
913
914 return p1 < p2 ? -1 : p1 > p2;
915}
916
917static void
918param_pointer_init (CParamSpec *pspec)
919{
920 /* CParamSpecPointer *spec = C_PARAM_SPEC_POINTER (pspec); */
921}
922
923static void
924param_pointer_set_default (CParamSpec *pspec,
925 GValue *value)
926{
927 value->data[0].v_pointer = NULL((void*)0);
928}
929
930static gint
931param_pointer_values_cmp (CParamSpec *pspec,
932 const GValue *value1,
933 const GValue *value2)
934{
935 guint8 *p1 = value1->data[0].v_pointer;
936 guint8 *p2 = value2->data[0].v_pointer;
937
938 /* not much to compare here, try to at least provide stable lesser/greater result */
939
940 return p1 < p2 ? -1 : p1 > p2;
941}
942
943static void
944param_value_array_init (CParamSpec *pspec)
945{
946 CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol"
;
947
948 aspec->element_spec = NULL((void*)0);
949 aspec->fixed_n_elements = 0; /* disable */
950}
951
952static inline guint
953value_array_ensure_size (GValueArray *value_array,
954 guint fixed_n_elements)
955{
956 guint changed = 0;
957
958 if (fixed_n_elements)
959 {
960 while (value_array->n_values < fixed_n_elements)
961 {
962 g_value_array_append (value_array, NULL((void*)0));
963 changed++;
964 }
965 while (value_array->n_values > fixed_n_elements)
966 {
967 g_value_array_remove (value_array, value_array->n_values - 1);
968 changed++;
969 }
970 }
971 return changed;
972}
973
974static void
975param_value_array_finalize (CParamSpec *pspec)
976{
977 CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol"
;
978 CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_VALUE_ARRAY(c_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
));
979
980 if (aspec->element_spec)
981 {
982 c_param_spec_unref (aspec->element_spec);
983 aspec->element_spec = NULL((void*)0);
984 }
985
986 parent_class->finalize (pspec);
987}
988
989static void
990param_value_array_set_default (CParamSpec *pspec,
991 GValue *value)
992{
993 CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol"
;
994
995 if (!value->data[0].v_pointer && aspec->fixed_n_elements)
996 value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements);
997
998 if (value->data[0].v_pointer)
999 {
1000 /* g_value_reset (value); already done */
1001 value_array_ensure_size (value->data[0].v_pointer, aspec->fixed_n_elements);
1002 }
1003}
1004
1005static gboolean
1006param_value_array_validate (CParamSpec *pspec,
1007 GValue *value)
1008{
1009 CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol"
;
1010 GValueArray *value_array = value->data[0].v_pointer;
1011 guint changed = 0;
1012
1013 if (!value->data[0].v_pointer && aspec->fixed_n_elements)
1014 value_array = value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements);
1015
1016 if (value->data[0].v_pointer)
1017 {
1018 /* ensure array size validity */
1019 changed += value_array_ensure_size (value_array, aspec->fixed_n_elements);
1020
1021 /* ensure array values validity against a present element spec */
1022 if (aspec->element_spec)
1023 {
1024 CParamSpec *element_spec = aspec->element_spec;
1025 guint i;
1026
1027 for (i = 0; i < value_array->n_values; i++)
1028 {
1029 GValue *element = value_array->values + i;
1030
1031 /* need to fixup value type, or ensure that the array value is initialized at all */
1032 if (!g_value_type_compatible (G_VALUE_TYPE (element)(((GValue*) (element))->g_type), C_PARAM_SPEC_VALUE_TYPE (element_spec)(((((CParamSpec*) (void *) ((element_spec)))))->value_type
)
))
1033 {
1034 if (G_VALUE_TYPE (element)(((GValue*) (element))->g_type) != 0)
1035 g_value_unset (element);
1036 g_value_init (element, C_PARAM_SPEC_VALUE_TYPE (element_spec)(((((CParamSpec*) (void *) ((element_spec)))))->value_type
)
);
1037 c_param_value_set_default (element_spec, element);
1038 changed++;
1039 }
1040 else
1041 {
1042 /* validate array value against element_spec */
1043 changed += c_param_value_validate (element_spec, element);
1044 }
1045 }
1046 }
1047 }
1048
1049 return changed;
1050}
1051
1052static gint
1053param_value_array_values_cmp (CParamSpec *pspec,
1054 const GValue *value1,
1055 const GValue *value2)
1056{
1057 CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol"
;
1058 GValueArray *value_array1 = value1->data[0].v_pointer;
1059 GValueArray *value_array2 = value2->data[0].v_pointer;
1060
1061 if (!value_array1 || !value_array2)
1062 return value_array2 ? -1 : value_array1 != value_array2;
1063
1064 if (value_array1->n_values != value_array2->n_values)
1065 return value_array1->n_values < value_array2->n_values ? -1 : 1;
1066 else if (!aspec->element_spec)
1067 {
1068 /* we need an element specification for comparisons, so there's not much
1069 * to compare here, try to at least provide stable lesser/greater result
1070 */
1071 return value_array1->n_values < value_array2->n_values ? -1 : value_array1->n_values > value_array2->n_values;
1072 }
1073 else /* value_array1->n_values == value_array2->n_values */
1074 {
1075 guint i;
1076
1077 for (i = 0; i < value_array1->n_values; i++)
1078 {
1079 GValue *element1 = value_array1->values + i;
1080 GValue *element2 = value_array2->values + i;
1081 gint cmp;
1082
1083 /* need corresponding element types, provide stable result otherwise */
1084 if (G_VALUE_TYPE (element1)(((GValue*) (element1))->g_type) != G_VALUE_TYPE (element2)(((GValue*) (element2))->g_type))
1085 return G_VALUE_TYPE (element1)(((GValue*) (element1))->g_type) < G_VALUE_TYPE (element2)(((GValue*) (element2))->g_type) ? -1 : 1;
1086 cmp = c_param_values_cmp (aspec->element_spec, element1, element2);
1087 if (cmp)
1088 return cmp;
1089 }
1090 return 0;
1091 }
1092}
1093
1094static void
1095param_object_init (CParamSpec *pspec)
1096{
1097 /* CParamSpecObject *ospec = C_PARAM_SPEC_OBJECT (pspec); */
1098}
1099
1100static void
1101param_object_set_default (CParamSpec *pspec,
1102 GValue *value)
1103{
1104 value->data[0].v_pointer = NULL((void*)0);
1105}
1106
1107static gboolean
1108param_object_is_valid (CParamSpec *pspec,
1109 const GValue *value)
1110{
1111 CParamSpecObject *ospec = C_PARAM_SPEC_OBJECT (pspec)((((CParamSpecObject*) (void *) ((pspec)))));
1112 GObject *object = value->data[0].v_pointer;
1113
1114 return object &&
1115 g_value_type_compatible (G_OBJECT_TYPE (object)(((((GTypeClass*) (((GTypeInstance*) (object))->g_class))->
g_type)))
, C_PARAM_SPEC_VALUE_TYPE (ospec)(((((CParamSpec*) (void *) ((ospec)))))->value_type));
1116}
1117
1118static gboolean
1119param_object_validate (CParamSpec *pspec,
1120 GValue *value)
1121{
1122 CParamSpecObject *ospec = C_PARAM_SPEC_OBJECT (pspec)((((CParamSpecObject*) (void *) ((pspec)))));
1123 GObject *object = value->data[0].v_pointer;
1124 guint changed = 0;
1125
1126 if (object && !g_value_type_compatible (G_OBJECT_TYPE (object)(((((GTypeClass*) (((GTypeInstance*) (object))->g_class))->
g_type)))
, C_PARAM_SPEC_VALUE_TYPE (ospec)(((((CParamSpec*) (void *) ((ospec)))))->value_type)))
1127 {
1128 g_object_unref (object);
1129 value->data[0].v_pointer = NULL((void*)0);
1130 changed++;
1131 }
1132
1133 return changed;
1134}
1135
1136static gint
1137param_object_values_cmp (CParamSpec *pspec,
1138 const GValue *value1,
1139 const GValue *value2)
1140{
1141 guint8 *p1 = value1->data[0].v_pointer;
1142 guint8 *p2 = value2->data[0].v_pointer;
1143
1144 /* not much to compare here, try to at least provide stable lesser/greater result */
1145
1146 return p1 < p2 ? -1 : p1 > p2;
1147}
1148
1149static void
1150param_override_init (CParamSpec *pspec)
1151{
1152 /* CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec); */
1153}
1154
1155static void
1156param_override_finalize (CParamSpec *pspec)
1157{
1158 CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))));
1159 CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_OVERRIDE(c_param_spec_types[20])));
1160
1161 if (ospec->overridden)
1162 {
1163 c_param_spec_unref (ospec->overridden);
1164 ospec->overridden = NULL((void*)0);
1165 }
1166
1167 parent_class->finalize (pspec);
1168}
1169
1170static void
1171param_override_set_default (CParamSpec *pspec,
1172 GValue *value)
1173{
1174 CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))));
1175
1176 c_param_value_set_default (ospec->overridden, value);
1177}
1178
1179static gboolean
1180param_override_is_valid (CParamSpec *pspec,
1181 const GValue *value)
1182{
1183 CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))));
1184
1185 return c_param_value_is_valid (ospec->overridden, value);
1186}
1187
1188static gboolean
1189param_override_validate (CParamSpec *pspec,
1190 GValue *value)
1191{
1192 CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))));
1193
1194 return c_param_value_validate (ospec->overridden, value);
1195}
1196
1197static gint
1198param_override_values_cmp (CParamSpec *pspec,
1199 const GValue *value1,
1200 const GValue *value2)
1201{
1202 CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))));
1203
1204 return c_param_values_cmp (ospec->overridden, value1, value2);
1205}
1206
1207static void
1208param_gtype_init (CParamSpec *pspec)
1209{
1210}
1211
1212static void
1213param_gtype_set_default (CParamSpec *pspec,
1214 GValue *value)
1215{
1216 CParamSpecGType *tspec = C_PARAM_SPEC_GTYPE (pspec)((((CParamSpecGType*) (void *) ((pspec)))));
1217
1218 value->data[0].v_pointer = GTYPE_TO_POINTER (tspec->is_a_type)((gpointer) (guintptr) (tspec->is_a_type));
1219}
1220
1221static gboolean
1222param_gtype_is_valid (CParamSpec *pspec,
1223 const GValue *value)
1224{
1225 CParamSpecGType *tspec = C_PARAM_SPEC_GTYPE (pspec)((((CParamSpecGType*) (void *) ((pspec)))));
1226 GType gtype = GPOINTER_TO_TYPE (value->data[0].v_pointer)((GType) (guintptr) (value->data[0].v_pointer));
1227
1228 return tspec->is_a_type == G_TYPE_NONE((GType) ((1) << (2))) ||
1229 g_type_is_a (gtype, tspec->is_a_type)((gtype) == (tspec->is_a_type) || (g_type_is_a) ((gtype), (
tspec->is_a_type)))
;
1230}
1231
1232static gboolean
1233param_gtype_validate (CParamSpec *pspec,
1234 GValue *value)
1235{
1236 CParamSpecGType *tspec = C_PARAM_SPEC_GTYPE (pspec)((((CParamSpecGType*) (void *) ((pspec)))));
1237 GType gtype = GPOINTER_TO_TYPE (value->data[0].v_pointer)((GType) (guintptr) (value->data[0].v_pointer));
1238 guint changed = 0;
1239
1240 if (tspec->is_a_type != G_TYPE_NONE((GType) ((1) << (2))) && !g_type_is_a (gtype, tspec->is_a_type)((gtype) == (tspec->is_a_type) || (g_type_is_a) ((gtype), (
tspec->is_a_type)))
)
1241 {
1242 value->data[0].v_pointer = GTYPE_TO_POINTER (tspec->is_a_type)((gpointer) (guintptr) (tspec->is_a_type));
1243 changed++;
1244 }
1245
1246 return changed;
1247}
1248
1249static gint
1250param_gtype_values_cmp (CParamSpec *pspec,
1251 const GValue *value1,
1252 const GValue *value2)
1253{
1254 GType p1 = GPOINTER_TO_TYPE (value1->data[0].v_pointer)((GType) (guintptr) (value1->data[0].v_pointer));
1255 GType p2 = GPOINTER_TO_TYPE (value2->data[0].v_pointer)((GType) (guintptr) (value2->data[0].v_pointer));
1256
1257 /* not much to compare here, try to at least provide stable lesser/greater result */
1258
1259 return p1 < p2 ? -1 : p1 > p2;
1260}
1261
1262static void
1263param_variant_init (CParamSpec *pspec)
1264{
1265 CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec)))));
1266
1267 vspec->type = NULL((void*)0);
1268 vspec->default_value = NULL((void*)0);
1269}
1270
1271static void
1272param_variant_finalize (CParamSpec *pspec)
1273{
1274 CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec)))));
1275 CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_VARIANT(c_param_spec_types[22])));
1276
1277 if (vspec->default_value)
1278 g_variant_unref (vspec->default_value);
1279 g_variant_type_free (vspec->type);
1280
1281 parent_class->finalize (pspec);
1282}
1283
1284static void
1285param_variant_set_default (CParamSpec *pspec,
1286 GValue *value)
1287{
1288 value->data[0].v_pointer = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec)))))->default_value;
1289 value->data[1].v_uint |= G_VALUE_NOCOPY_CONTENTS(1 << 27);
1290}
1291
1292static gboolean
1293param_variant_is_valid (CParamSpec *pspec,
1294 const GValue *value)
1295{
1296 CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec)))));
1297 GVariant *variant = value->data[0].v_pointer;
1298
1299 if (variant == NULL((void*)0))
1300 return vspec->default_value == NULL((void*)0);
1301 else
1302 return g_variant_is_of_type (variant, vspec->type);
1303}
1304
1305static gboolean
1306param_variant_validate (CParamSpec *pspec,
1307 GValue *value)
1308{
1309 CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec)))));
1310 GVariant *variant = value->data[0].v_pointer;
1311
1312 if ((variant == NULL((void*)0) && vspec->default_value != NULL((void*)0)) ||
1313 (variant != NULL((void*)0) && !g_variant_is_of_type (variant, vspec->type)))
1314 {
1315 c_param_value_set_default (pspec, value);
1316 return TRUE(!(0));
1317 }
1318
1319 return FALSE(0);
1320}
1321
1322/* g_variant_compare() can only be used with scalar types. */
1323static gboolean
1324variant_is_incomparable (GVariant *v)
1325{
1326 GVariantClass v_class = g_variant_classify (v);
1327
1328 return (v_class == G_VARIANT_CLASS_HANDLE ||
1329 v_class == G_VARIANT_CLASS_VARIANT ||
1330 v_class == G_VARIANT_CLASS_MAYBE||
1331 v_class == G_VARIANT_CLASS_ARRAY ||
1332 v_class == G_VARIANT_CLASS_TUPLE ||
1333 v_class == G_VARIANT_CLASS_DICT_ENTRY);
1334}
1335
1336static gint
1337param_variant_values_cmp (CParamSpec *pspec,
1338 const GValue *value1,
1339 const GValue *value2)
1340{
1341 GVariant *v1 = value1->data[0].v_pointer;
1342 GVariant *v2 = value2->data[0].v_pointer;
1343
1344 if (v1 == NULL((void*)0) && v2 == NULL((void*)0))
1345 return 0;
1346 else if (v1 == NULL((void*)0) && v2 != NULL((void*)0))
1347 return -1;
1348 else if (v1 != NULL((void*)0) && v2 == NULL((void*)0))
1349 return 1;
1350
1351 if (!g_variant_type_equal (g_variant_get_type (v1), g_variant_get_type (v2)) ||
1352 variant_is_incomparable (v1) ||
1353 variant_is_incomparable (v2))
1354 return g_variant_equal (v1, v2) ? 0 : (v1 < v2 ? -1 : 1);
1355
1356 return g_variant_compare (v1, v2);
1357}
1358
1359/* --- type initialization --- */
1360
1361#define set_is_valid_vfunc(type,func){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = func; g_type_class_unref (class); }
{ \
1362 CParamSpecClass *class = g_type_class_ref (type); \
1363 class->value_is_valid = func; \
1364 g_type_class_unref (class); \
1365}
1366
1367GType *c_param_spec_types = NULL((void*)0);
1368
1369void
1370_c_param_spec_types_init (void)
1371{
1372 const guint n_types = 23;
1373 GType type, *spec_types;
1374#ifndef G_DISABLE_ASSERT
1375 GType *spec_types_bound;
1376#endif
1377
1378 c_param_spec_types = g_new0 (GType, n_types)(GType *) (__extension__ ({ gsize __n = (gsize) (n_types); gsize
__s = sizeof (GType); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
1379 spec_types = c_param_spec_types;
1380#ifndef G_DISABLE_ASSERT
1381 spec_types_bound = c_param_spec_types + n_types;
1382#endif
1383
1384 /* C_TYPE_PARAM_CHAR
1385 */
1386 {
1387 const CParamSpecTypeInfo pspec_info = {
1388 sizeof (CParamSpecChar), /* instance_size */
1389 16, /* n_preallocs */
1390 param_char_init, /* instance_init */
1391 G_TYPE_CHAR((GType) ((3) << (2))), /* value_type */
1392 NULL((void*)0), /* finalize */
1393 param_char_set_default, /* value_set_default */
1394 param_char_validate, /* value_validate */
1395 param_int_values_cmp, /* values_cmp */
1396 };
1397 type = c_param_type_register_static (g_intern_static_string ("CParamChar"), &pspec_info);
1398 set_is_valid_vfunc (type, param_char_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_char_is_valid; g_type_class_unref (class
); }
;
1399 *spec_types++ = type;
1400 g_assert (type == C_TYPE_PARAM_CHAR)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_58
= 0; if (type == (c_param_spec_types[0])) _g_boolean_var_58 =
1; _g_boolean_var_58; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1400, ((const char*)
(__func__)), "type == C_TYPE_PARAM_CHAR"); } while (0)
;
1401 }
1402
1403 /* C_TYPE_PARAM_UCHAR
1404 */
1405 {
1406 const CParamSpecTypeInfo pspec_info = {
1407 sizeof (CParamSpecUChar), /* instance_size */
1408 16, /* n_preallocs */
1409 param_uchar_init, /* instance_init */
1410 G_TYPE_UCHAR((GType) ((4) << (2))), /* value_type */
1411 NULL((void*)0), /* finalize */
1412 param_uchar_set_default, /* value_set_default */
1413 param_uchar_validate, /* value_validate */
1414 param_uint_values_cmp, /* values_cmp */
1415 };
1416 type = c_param_type_register_static (g_intern_static_string ("CParamUChar"), &pspec_info);
1417 set_is_valid_vfunc (type, param_uchar_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_uchar_is_valid; g_type_class_unref (class
); }
;
1418 *spec_types++ = type;
1419 g_assert (type == C_TYPE_PARAM_UCHAR)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_59
= 0; if (type == (c_param_spec_types[1])) _g_boolean_var_59 =
1; _g_boolean_var_59; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1419, ((const char*)
(__func__)), "type == C_TYPE_PARAM_UCHAR"); } while (0)
;
1420 }
1421
1422 /* C_TYPE_PARAM_BOOLEAN
1423 */
1424 {
1425 const CParamSpecTypeInfo pspec_info = {
1426 sizeof (CParamSpecBoolean), /* instance_size */
1427 16, /* n_preallocs */
1428 NULL((void*)0), /* instance_init */
1429 G_TYPE_BOOLEAN((GType) ((5) << (2))), /* value_type */
1430 NULL((void*)0), /* finalize */
1431 param_boolean_set_default, /* value_set_default */
1432 param_boolean_validate, /* value_validate */
1433 param_int_values_cmp, /* values_cmp */
1434 };
1435 type = c_param_type_register_static (g_intern_static_string ("CParamBoolean"), &pspec_info);
1436 set_is_valid_vfunc (type, param_boolean_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_boolean_is_valid; g_type_class_unref (
class); }
;
1437 *spec_types++ = type;
1438 g_assert (type == C_TYPE_PARAM_BOOLEAN)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_60
= 0; if (type == (c_param_spec_types[2])) _g_boolean_var_60 =
1; _g_boolean_var_60; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1438, ((const char*)
(__func__)), "type == C_TYPE_PARAM_BOOLEAN"); } while (0)
;
1439 }
1440
1441 /* C_TYPE_PARAM_INT
1442 */
1443 {
1444 const CParamSpecTypeInfo pspec_info = {
1445 sizeof (CParamSpecInt), /* instance_size */
1446 16, /* n_preallocs */
1447 param_int_init, /* instance_init */
1448 G_TYPE_INT((GType) ((6) << (2))), /* value_type */
1449 NULL((void*)0), /* finalize */
1450 param_int_set_default, /* value_set_default */
1451 param_int_validate, /* value_validate */
1452 param_int_values_cmp, /* values_cmp */
1453 };
1454 type = c_param_type_register_static (g_intern_static_string ("CParamInt"), &pspec_info);
1455 set_is_valid_vfunc (type, param_int_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_int_is_valid; g_type_class_unref (class
); }
;
1456 *spec_types++ = type;
1457 g_assert (type == C_TYPE_PARAM_INT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_61
= 0; if (type == (c_param_spec_types[3])) _g_boolean_var_61 =
1; _g_boolean_var_61; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1457, ((const char*)
(__func__)), "type == C_TYPE_PARAM_INT"); } while (0)
;
1458 }
1459
1460 /* C_TYPE_PARAM_UINT
1461 */
1462 {
1463 const CParamSpecTypeInfo pspec_info = {
1464 sizeof (CParamSpecUInt), /* instance_size */
1465 16, /* n_preallocs */
1466 param_uint_init, /* instance_init */
1467 G_TYPE_UINT((GType) ((7) << (2))), /* value_type */
1468 NULL((void*)0), /* finalize */
1469 param_uint_set_default, /* value_set_default */
1470 param_uint_validate, /* value_validate */
1471 param_uint_values_cmp, /* values_cmp */
1472 };
1473 type = c_param_type_register_static (g_intern_static_string ("CParamUInt"), &pspec_info);
1474 set_is_valid_vfunc (type, param_uint_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_uint_is_valid; g_type_class_unref (class
); }
;
1475 *spec_types++ = type;
1476 g_assert (type == C_TYPE_PARAM_UINT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_62
= 0; if (type == (c_param_spec_types[4])) _g_boolean_var_62 =
1; _g_boolean_var_62; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1476, ((const char*)
(__func__)), "type == C_TYPE_PARAM_UINT"); } while (0)
;
1477 }
1478
1479 /* C_TYPE_PARAM_LONG
1480 */
1481 {
1482 const CParamSpecTypeInfo pspec_info = {
1483 sizeof (CParamSpecLong), /* instance_size */
1484 16, /* n_preallocs */
1485 param_long_init, /* instance_init */
1486 G_TYPE_LONG((GType) ((8) << (2))), /* value_type */
1487 NULL((void*)0), /* finalize */
1488 param_long_set_default, /* value_set_default */
1489 param_long_validate, /* value_validate */
1490 param_long_values_cmp, /* values_cmp */
1491 };
1492 type = c_param_type_register_static (g_intern_static_string ("CParamLong"), &pspec_info);
1493 set_is_valid_vfunc (type, param_long_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_long_is_valid; g_type_class_unref (class
); }
;
1494 *spec_types++ = type;
1495 g_assert (type == C_TYPE_PARAM_LONG)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_63
= 0; if (type == (c_param_spec_types[5])) _g_boolean_var_63 =
1; _g_boolean_var_63; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1495, ((const char*)
(__func__)), "type == C_TYPE_PARAM_LONG"); } while (0)
;
1496 }
1497
1498 /* C_TYPE_PARAM_ULONG
1499 */
1500 {
1501 const CParamSpecTypeInfo pspec_info = {
1502 sizeof (CParamSpecULong), /* instance_size */
1503 16, /* n_preallocs */
1504 param_ulong_init, /* instance_init */
1505 G_TYPE_ULONG((GType) ((9) << (2))), /* value_type */
1506 NULL((void*)0), /* finalize */
1507 param_ulong_set_default, /* value_set_default */
1508 param_ulong_validate, /* value_validate */
1509 param_ulong_values_cmp, /* values_cmp */
1510 };
1511 type = c_param_type_register_static (g_intern_static_string ("CParamULong"), &pspec_info);
1512 set_is_valid_vfunc (type, param_ulong_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_ulong_is_valid; g_type_class_unref (class
); }
;
1513 *spec_types++ = type;
1514 g_assert (type == C_TYPE_PARAM_ULONG)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_64
= 0; if (type == (c_param_spec_types[6])) _g_boolean_var_64 =
1; _g_boolean_var_64; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1514, ((const char*)
(__func__)), "type == C_TYPE_PARAM_ULONG"); } while (0)
;
1515 }
1516
1517 /* C_TYPE_PARAM_INT64
1518 */
1519 {
1520 const CParamSpecTypeInfo pspec_info = {
1521 sizeof (CParamSpecInt64), /* instance_size */
1522 16, /* n_preallocs */
1523 param_int64_init, /* instance_init */
1524 G_TYPE_INT64((GType) ((10) << (2))), /* value_type */
1525 NULL((void*)0), /* finalize */
1526 param_int64_set_default, /* value_set_default */
1527 param_int64_validate, /* value_validate */
1528 param_int64_values_cmp, /* values_cmp */
1529 };
1530 type = c_param_type_register_static (g_intern_static_string ("CParamInt64"), &pspec_info);
1531 set_is_valid_vfunc (type, param_int64_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_int64_is_valid; g_type_class_unref (class
); }
;
1532 *spec_types++ = type;
1533 g_assert (type == C_TYPE_PARAM_INT64)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_65
= 0; if (type == (c_param_spec_types[7])) _g_boolean_var_65 =
1; _g_boolean_var_65; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1533, ((const char*)
(__func__)), "type == C_TYPE_PARAM_INT64"); } while (0)
;
1534 }
1535
1536 /* C_TYPE_PARAM_UINT64
1537 */
1538 {
1539 const CParamSpecTypeInfo pspec_info = {
1540 sizeof (CParamSpecUInt64), /* instance_size */
1541 16, /* n_preallocs */
1542 param_uint64_init, /* instance_init */
1543 G_TYPE_UINT64((GType) ((11) << (2))), /* value_type */
1544 NULL((void*)0), /* finalize */
1545 param_uint64_set_default, /* value_set_default */
1546 param_uint64_validate, /* value_validate */
1547 param_uint64_values_cmp, /* values_cmp */
1548 };
1549 type = c_param_type_register_static (g_intern_static_string ("CParamUInt64"), &pspec_info);
1550 set_is_valid_vfunc (type, param_uint64_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_uint64_is_valid; g_type_class_unref (class
); }
;
1551 *spec_types++ = type;
1552 g_assert (type == C_TYPE_PARAM_UINT64)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_66
= 0; if (type == (c_param_spec_types[8])) _g_boolean_var_66 =
1; _g_boolean_var_66; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1552, ((const char*)
(__func__)), "type == C_TYPE_PARAM_UINT64"); } while (0)
;
1553 }
1554
1555 /* C_TYPE_PARAM_UNICHAR
1556 */
1557 {
1558 const CParamSpecTypeInfo pspec_info = {
1559 sizeof (CParamSpecUnichar), /* instance_size */
1560 16, /* n_preallocs */
1561 param_unichar_init, /* instance_init */
1562 G_TYPE_UINT((GType) ((7) << (2))), /* value_type */
1563 NULL((void*)0), /* finalize */
1564 param_unichar_set_default, /* value_set_default */
1565 param_unichar_validate, /* value_validate */
1566 param_unichar_values_cmp, /* values_cmp */
1567 };
1568 type = c_param_type_register_static (g_intern_static_string ("CParamUnichar"), &pspec_info);
1569 set_is_valid_vfunc (type, param_unichar_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_unichar_is_valid; g_type_class_unref (
class); }
;
1570 *spec_types++ = type;
1571 g_assert (type == C_TYPE_PARAM_UNICHAR)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_67
= 0; if (type == (c_param_spec_types[9])) _g_boolean_var_67 =
1; _g_boolean_var_67; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1571, ((const char*)
(__func__)), "type == C_TYPE_PARAM_UNICHAR"); } while (0)
;
1572 }
1573
1574 /* C_TYPE_PARAM_ENUM
1575 */
1576 {
1577 const CParamSpecTypeInfo pspec_info = {
1578 sizeof (CParamSpecEnum), /* instance_size */
1579 16, /* n_preallocs */
1580 param_enum_init, /* instance_init */
1581 G_TYPE_ENUM((GType) ((12) << (2))), /* value_type */
1582 param_enum_finalize, /* finalize */
1583 param_enum_set_default, /* value_set_default */
1584 param_enum_validate, /* value_validate */
1585 param_long_values_cmp, /* values_cmp */
1586 };
1587 type = c_param_type_register_static (g_intern_static_string ("CParamEnum"), &pspec_info);
1588 set_is_valid_vfunc (type, param_enum_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_enum_is_valid; g_type_class_unref (class
); }
;
1589 *spec_types++ = type;
1590 g_assert (type == C_TYPE_PARAM_ENUM)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_68
= 0; if (type == (c_param_spec_types[10])) _g_boolean_var_68
= 1; _g_boolean_var_68; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1590, ((const char*)
(__func__)), "type == C_TYPE_PARAM_ENUM"); } while (0)
;
1591 }
1592
1593 /* C_TYPE_PARAM_FLAGS
1594 */
1595 {
1596 const CParamSpecTypeInfo pspec_info = {
1597 sizeof (CParamSpecFlags), /* instance_size */
1598 16, /* n_preallocs */
1599 param_flags_init, /* instance_init */
1600 G_TYPE_FLAGS((GType) ((13) << (2))), /* value_type */
1601 param_flags_finalize, /* finalize */
1602 param_flags_set_default, /* value_set_default */
1603 param_flags_validate, /* value_validate */
1604 param_ulong_values_cmp, /* values_cmp */
1605 };
1606 type = c_param_type_register_static (g_intern_static_string ("CParamFlags"), &pspec_info);
1607 set_is_valid_vfunc (type, param_flags_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_flags_is_valid; g_type_class_unref (class
); }
;
1608 *spec_types++ = type;
1609 g_assert (type == C_TYPE_PARAM_FLAGS)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_69
= 0; if (type == (c_param_spec_types[11])) _g_boolean_var_69
= 1; _g_boolean_var_69; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1609, ((const char*)
(__func__)), "type == C_TYPE_PARAM_FLAGS"); } while (0)
;
1610 }
1611
1612 /* C_TYPE_PARAM_FLOAT
1613 */
1614 {
1615 const CParamSpecTypeInfo pspec_info = {
1616 sizeof (CParamSpecFloat), /* instance_size */
1617 16, /* n_preallocs */
1618 param_float_init, /* instance_init */
1619 G_TYPE_FLOAT((GType) ((14) << (2))), /* value_type */
1620 NULL((void*)0), /* finalize */
1621 param_float_set_default, /* value_set_default */
1622 param_float_validate, /* value_validate */
1623 param_float_values_cmp, /* values_cmp */
1624 };
1625 type = c_param_type_register_static (g_intern_static_string ("CParamFloat"), &pspec_info);
1626 set_is_valid_vfunc (type, param_float_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_float_is_valid; g_type_class_unref (class
); }
;
1627 *spec_types++ = type;
1628 g_assert (type == C_TYPE_PARAM_FLOAT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_70
= 0; if (type == (c_param_spec_types[12])) _g_boolean_var_70
= 1; _g_boolean_var_70; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1628, ((const char*)
(__func__)), "type == C_TYPE_PARAM_FLOAT"); } while (0)
;
1629 }
1630
1631 /* C_TYPE_PARAM_DOUBLE
1632 */
1633 {
1634 const CParamSpecTypeInfo pspec_info = {
1635 sizeof (CParamSpecDouble), /* instance_size */
1636 16, /* n_preallocs */
1637 param_double_init, /* instance_init */
1638 G_TYPE_DOUBLE((GType) ((15) << (2))), /* value_type */
1639 NULL((void*)0), /* finalize */
1640 param_double_set_default, /* value_set_default */
1641 param_double_validate, /* value_validate */
1642 param_double_values_cmp, /* values_cmp */
1643 };
1644 type = c_param_type_register_static (g_intern_static_string ("CParamDouble"), &pspec_info);
1645 set_is_valid_vfunc (type, param_double_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_double_is_valid; g_type_class_unref (class
); }
;
1646 *spec_types++ = type;
1647 g_assert (type == C_TYPE_PARAM_DOUBLE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_71
= 0; if (type == (c_param_spec_types[13])) _g_boolean_var_71
= 1; _g_boolean_var_71; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1647, ((const char*)
(__func__)), "type == C_TYPE_PARAM_DOUBLE"); } while (0)
;
1648 }
1649
1650 /* C_TYPE_PARAM_STRING
1651 */
1652 {
1653 const CParamSpecTypeInfo pspec_info = {
1654 sizeof (CParamSpecString), /* instance_size */
1655 16, /* n_preallocs */
1656 param_string_init, /* instance_init */
1657 G_TYPE_STRING((GType) ((16) << (2))), /* value_type */
1658 param_string_finalize, /* finalize */
1659 param_string_set_default, /* value_set_default */
1660 param_string_validate, /* value_validate */
1661 param_string_values_cmp, /* values_cmp */
1662 };
1663 type = c_param_type_register_static (g_intern_static_string ("CParamString"), &pspec_info);
1664 set_is_valid_vfunc (type, param_string_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_string_is_valid; g_type_class_unref (class
); }
;
1665 *spec_types++ = type;
1666 g_assert (type == C_TYPE_PARAM_STRING)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_72
= 0; if (type == (c_param_spec_types[14])) _g_boolean_var_72
= 1; _g_boolean_var_72; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1666, ((const char*)
(__func__)), "type == C_TYPE_PARAM_STRING"); } while (0)
;
1667 }
1668
1669 /* C_TYPE_PARAM_PARAM
1670 */
1671 {
1672 const CParamSpecTypeInfo pspec_info = {
1673 sizeof (CParamSpecParam), /* instance_size */
1674 16, /* n_preallocs */
1675 param_param_init, /* instance_init */
1676 C_TYPE_PARAM((GType) ((19) << (2))), /* value_type */
1677 NULL((void*)0), /* finalize */
1678 param_param_set_default, /* value_set_default */
1679 param_param_validate, /* value_validate */
1680 param_pointer_values_cmp, /* values_cmp */
1681 };
1682 type = c_param_type_register_static (g_intern_static_string ("CParamParam"), &pspec_info);
1683 set_is_valid_vfunc (type, param_param_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_param_is_valid; g_type_class_unref (class
); }
;
1684 *spec_types++ = type;
1685 g_assert (type == C_TYPE_PARAM_PARAM)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_73
= 0; if (type == (c_param_spec_types[15])) _g_boolean_var_73
= 1; _g_boolean_var_73; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1685, ((const char*)
(__func__)), "type == C_TYPE_PARAM_PARAM"); } while (0)
;
1686 }
1687
1688 /* C_TYPE_PARAM_BOXED
1689 */
1690 {
1691 const CParamSpecTypeInfo pspec_info = {
1692 sizeof (CParamSpecBoxed), /* instance_size */
1693 4, /* n_preallocs */
1694 param_boxed_init, /* instance_init */
1695 G_TYPE_BOXED((GType) ((18) << (2))), /* value_type */
1696 NULL((void*)0), /* finalize */
1697 param_boxed_set_default, /* value_set_default */
1698 NULL((void*)0), /* value_validate */
1699 param_boxed_values_cmp, /* values_cmp */
1700 };
1701 type = c_param_type_register_static (g_intern_static_string ("CParamBoxed"), &pspec_info);
1702 *spec_types++ = type;
1703 g_assert (type == C_TYPE_PARAM_BOXED)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_74
= 0; if (type == (c_param_spec_types[16])) _g_boolean_var_74
= 1; _g_boolean_var_74; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1703, ((const char*)
(__func__)), "type == C_TYPE_PARAM_BOXED"); } while (0)
;
1704 }
1705
1706 /* C_TYPE_PARAM_POINTER
1707 */
1708 {
1709 const CParamSpecTypeInfo pspec_info = {
1710 sizeof (CParamSpecPointer), /* instance_size */
1711 0, /* n_preallocs */
1712 param_pointer_init, /* instance_init */
1713 G_TYPE_POINTER((GType) ((17) << (2))), /* value_type */
1714 NULL((void*)0), /* finalize */
1715 param_pointer_set_default, /* value_set_default */
1716 NULL((void*)0),
1717 param_pointer_values_cmp, /* values_cmp */
1718 };
1719 type = c_param_type_register_static (g_intern_static_string ("CParamPointer"), &pspec_info);
1720 *spec_types++ = type;
1721 g_assert (type == C_TYPE_PARAM_POINTER)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_75
= 0; if (type == (c_param_spec_types[17])) _g_boolean_var_75
= 1; _g_boolean_var_75; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1721, ((const char*)
(__func__)), "type == C_TYPE_PARAM_POINTER"); } while (0)
;
1722 }
1723
1724 /* C_TYPE_PARAM_VALUE_ARRAY
1725 */
1726 {
1727 /* const */ CParamSpecTypeInfo pspec_info = {
1728 sizeof (CParamSpecValueArray), /* instance_size */
1729 0, /* n_preallocs */
1730 param_value_array_init, /* instance_init */
1731 0xdeadbeef, /* value_type, assigned further down */
1732 param_value_array_finalize, /* finalize */
1733 param_value_array_set_default, /* value_set_default */
1734 param_value_array_validate, /* value_validate */
1735 param_value_array_values_cmp, /* values_cmp */
1736 };
1737 pspec_info.value_type = G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\""
;
1738 type = c_param_type_register_static (g_intern_static_string ("CParamValueArray"), &pspec_info);
1739 *spec_types++ = type;
1740 g_assert (type == C_TYPE_PARAM_VALUE_ARRAY)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_76
= 0; if (type == (c_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
) _g_boolean_var_76 = 1; _g_boolean_var_76; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1740, ((const char*)
(__func__)), "type == C_TYPE_PARAM_VALUE_ARRAY"); } while (0
)
;
1741 }
1742
1743 /* C_TYPE_PARAM_OBJECT
1744 */
1745 {
1746 const CParamSpecTypeInfo pspec_info = {
1747 sizeof (CParamSpecObject), /* instance_size */
1748 16, /* n_preallocs */
1749 param_object_init, /* instance_init */
1750 G_TYPE_OBJECT((GType) ((20) << (2))), /* value_type */
1751 NULL((void*)0), /* finalize */
1752 param_object_set_default, /* value_set_default */
1753 param_object_validate, /* value_validate */
1754 param_object_values_cmp, /* values_cmp */
1755 };
1756 type = c_param_type_register_static (g_intern_static_string ("CParamObject"), &pspec_info);
1757 set_is_valid_vfunc (type, param_object_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_object_is_valid; g_type_class_unref (class
); }
;
1758 *spec_types++ = type;
1759 g_assert (type == C_TYPE_PARAM_OBJECT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_77
= 0; if (type == (c_param_spec_types[19])) _g_boolean_var_77
= 1; _g_boolean_var_77; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1759, ((const char*)
(__func__)), "type == C_TYPE_PARAM_OBJECT"); } while (0)
;
1760 }
1761
1762 /* C_TYPE_PARAM_OVERRIDE
1763 */
1764 {
1765 const CParamSpecTypeInfo pspec_info = {
1766 sizeof (CParamSpecOverride), /* instance_size */
1767 16, /* n_preallocs */
1768 param_override_init, /* instance_init */
1769 G_TYPE_NONE((GType) ((1) << (2))), /* value_type */
1770 param_override_finalize, /* finalize */
1771 param_override_set_default, /* value_set_default */
1772 param_override_validate, /* value_validate */
1773 param_override_values_cmp, /* values_cmp */
1774 };
1775 type = c_param_type_register_static (g_intern_static_string ("CParamOverride"), &pspec_info);
1776 set_is_valid_vfunc (type, param_override_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_override_is_valid; g_type_class_unref (
class); }
;
1777 *spec_types++ = type;
1778 g_assert (type == C_TYPE_PARAM_OVERRIDE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_78
= 0; if (type == (c_param_spec_types[20])) _g_boolean_var_78
= 1; _g_boolean_var_78; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1778, ((const char*)
(__func__)), "type == C_TYPE_PARAM_OVERRIDE"); } while (0)
;
1779 }
1780
1781 /* C_TYPE_PARAM_GTYPE
1782 */
1783 {
1784 CParamSpecTypeInfo pspec_info = {
1785 sizeof (CParamSpecGType), /* instance_size */
1786 0, /* n_preallocs */
1787 param_gtype_init, /* instance_init */
1788 0xdeadbeef, /* value_type, assigned further down */
1789 NULL((void*)0), /* finalize */
1790 param_gtype_set_default, /* value_set_default */
1791 param_gtype_validate, /* value_validate */
1792 param_gtype_values_cmp, /* values_cmp */
1793 };
1794 pspec_info.value_type = G_TYPE_GTYPE(g_gtype_get_type());
1795 type = c_param_type_register_static (g_intern_static_string ("CParamGType"), &pspec_info);
1796 set_is_valid_vfunc (type, param_gtype_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_gtype_is_valid; g_type_class_unref (class
); }
;
1797 *spec_types++ = type;
1798 g_assert (type == C_TYPE_PARAM_GTYPE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_79
= 0; if (type == (c_param_spec_types[21])) _g_boolean_var_79
= 1; _g_boolean_var_79; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1798, ((const char*)
(__func__)), "type == C_TYPE_PARAM_GTYPE"); } while (0)
;
1799 }
1800
1801 /* C_TYPE_PARAM_VARIANT
1802 */
1803 {
1804 const CParamSpecTypeInfo pspec_info = {
1805 sizeof (CParamSpecVariant), /* instance_size */
1806 0, /* n_preallocs */
1807 param_variant_init, /* instance_init */
1808 G_TYPE_VARIANT((GType) ((21) << (2))), /* value_type */
1809 param_variant_finalize, /* finalize */
1810 param_variant_set_default, /* value_set_default */
1811 param_variant_validate, /* value_validate */
1812 param_variant_values_cmp, /* values_cmp */
1813 };
1814 type = c_param_type_register_static (g_intern_static_string ("CParamVariant"), &pspec_info);
1815 set_is_valid_vfunc (type, param_variant_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class->
value_is_valid = param_variant_is_valid; g_type_class_unref (
class); }
;
1816 *spec_types++ = type;
1817 g_assert (type == C_TYPE_PARAM_VARIANT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_80
= 0; if (type == (c_param_spec_types[22])) _g_boolean_var_80
= 1; _g_boolean_var_80; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1817, ((const char*)
(__func__)), "type == C_TYPE_PARAM_VARIANT"); } while (0)
;
1818 }
1819
1820 g_assert (spec_types == spec_types_bound)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_81
= 0; if (spec_types == spec_types_bound) _g_boolean_var_81 =
1; _g_boolean_var_81; }), 1)) ; else g_assertion_message_expr
("libbean", "../libbean/cparamspecs.c", 1820, ((const char*)
(__func__)), "spec_types == spec_types_bound"); } while (0)
;
1821}
1822
1823/* --- CParamSpec initialization --- */
1824
1825/**
1826 * c_param_spec_char:
1827 * @name: canonical name of the property specified
1828 * @nick: (nullable): nick name for the property specified
1829 * @blurb: (nullable): description of the property specified
1830 * @minimum: minimum value for the property specified
1831 * @maximum: maximum value for the property specified
1832 * @default_value: default value for the property specified
1833 * @flags: flags for the property specified
1834 *
1835 * Creates a new #CParamSpecChar instance specifying a %G_TYPE_CHAR property.
1836 *
1837 * Returns: (transfer full): a newly created parameter specification
1838 */
1839CParamSpec*
1840c_param_spec_char (const gchar *name,
1841 const gchar *nick,
1842 const gchar *blurb,
1843 gint8 minimum,
1844 gint8 maximum,
1845 gint8 default_value,
1846 CParamFlags flags)
1847{
1848 CParamSpecChar *cspec;
1849
1850 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_82
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_82 = 1; _g_boolean_var_82; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
1851
1852 cspec = c_param_spec_internal (C_TYPE_PARAM_CHAR(c_param_spec_types[0]),
1853 name,
1854 nick,
1855 blurb,
1856 flags);
1857
1858 cspec->minimum = minimum;
1859 cspec->maximum = maximum;
1860 cspec->default_value = default_value;
1861
1862 return C_PARAM_SPEC (cspec)((((CParamSpec*) (void *) ((cspec)))));
1863}
1864
1865/**
1866 * c_param_spec_uchar:
1867 * @name: canonical name of the property specified
1868 * @nick: (nullable): nick name for the property specified
1869 * @blurb: (nullable): description of the property specified
1870 * @minimum: minimum value for the property specified
1871 * @maximum: maximum value for the property specified
1872 * @default_value: default value for the property specified
1873 * @flags: flags for the property specified
1874 *
1875 * Creates a new #CParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
1876 *
1877 * Returns: (transfer full): a newly created parameter specification
1878 */
1879CParamSpec*
1880c_param_spec_uchar (const gchar *name,
1881 const gchar *nick,
1882 const gchar *blurb,
1883 guint8 minimum,
1884 guint8 maximum,
1885 guint8 default_value,
1886 CParamFlags flags)
1887{
1888 CParamSpecUChar *uspec;
1889
1890 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_83
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_83 = 1; _g_boolean_var_83; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
1891
1892 uspec = c_param_spec_internal (C_TYPE_PARAM_UCHAR(c_param_spec_types[1]),
1893 name,
1894 nick,
1895 blurb,
1896 flags);
1897
1898 uspec->minimum = minimum;
1899 uspec->maximum = maximum;
1900 uspec->default_value = default_value;
1901
1902 return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec)))));
1903}
1904
1905/**
1906 * c_param_spec_boolean:
1907 * @name: canonical name of the property specified
1908 * @nick: (nullable): nick name for the property specified
1909 * @blurb: (nullable): description of the property specified
1910 * @default_value: default value for the property specified
1911 * @flags: flags for the property specified
1912 *
1913 * Creates a new #CParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN
1914 * property. In many cases, it may be more appropriate to use an enum with
1915 * c_param_spec_enum(), both to improve code clarity by using explicitly named
1916 * values, and to allow for more values to be added in future without breaking
1917 * API.
1918 *
1919 * See c_param_spec_internal() for details on property names.
1920 *
1921 * Returns: (transfer full): a newly created parameter specification
1922 */
1923CParamSpec*
1924c_param_spec_boolean (const gchar *name,
1925 const gchar *nick,
1926 const gchar *blurb,
1927 gboolean default_value,
1928 CParamFlags flags)
1929{
1930 CParamSpecBoolean *bspec;
1931
1932 g_return_val_if_fail (default_value == TRUE || default_value == FALSE, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_84
= 0; if (default_value == (!(0)) || default_value == (0)) _g_boolean_var_84
= 1; _g_boolean_var_84; }), 1))) { } else { g_return_if_fail_warning
("libbean", ((const char*) (__func__)), "default_value == TRUE || default_value == FALSE"
); return (((void*)0)); } } while (0)
;
1933
1934 bspec = c_param_spec_internal (C_TYPE_PARAM_BOOLEAN(c_param_spec_types[2]),
1935 name,
1936 nick,
1937 blurb,
1938 flags);
1939
1940 bspec->default_value = default_value;
1941
1942 return C_PARAM_SPEC (bspec)((((CParamSpec*) (void *) ((bspec)))));
1943}
1944
1945/**
1946 * c_param_spec_int:
1947 * @name: canonical name of the property specified
1948 * @nick: (nullable): nick name for the property specified
1949 * @blurb: (nullable): description of the property specified
1950 * @minimum: minimum value for the property specified
1951 * @maximum: maximum value for the property specified
1952 * @default_value: default value for the property specified
1953 * @flags: flags for the property specified
1954 *
1955 * Creates a new #CParamSpecInt instance specifying a %G_TYPE_INT property.
1956 *
1957 * See c_param_spec_internal() for details on property names.
1958 *
1959 * Returns: (transfer full): a newly created parameter specification
1960 */
1961CParamSpec*
1962c_param_spec_int (const gchar *name,
1963 const gchar *nick,
1964 const gchar *blurb,
1965 gint minimum,
1966 gint maximum,
1967 gint default_value,
1968 CParamFlags flags)
1969{
1970 CParamSpecInt *ispec;
1971
1972 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_85
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_85 = 1; _g_boolean_var_85; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
1973
1974 ispec = c_param_spec_internal (C_TYPE_PARAM_INT(c_param_spec_types[3]),
1975 name,
1976 nick,
1977 blurb,
1978 flags);
1979
1980 ispec->minimum = minimum;
1981 ispec->maximum = maximum;
1982 ispec->default_value = default_value;
1983
1984 return C_PARAM_SPEC (ispec)((((CParamSpec*) (void *) ((ispec)))));
1985}
1986
1987/**
1988 * c_param_spec_uint:
1989 * @name: canonical name of the property specified
1990 * @nick: (nullable): nick name for the property specified
1991 * @blurb: (nullable): description of the property specified
1992 * @minimum: minimum value for the property specified
1993 * @maximum: maximum value for the property specified
1994 * @default_value: default value for the property specified
1995 * @flags: flags for the property specified
1996 *
1997 * Creates a new #CParamSpecUInt instance specifying a %G_TYPE_UINT property.
1998 *
1999 * See c_param_spec_internal() for details on property names.
2000 *
2001 * Returns: (transfer full): a newly created parameter specification
2002 */
2003CParamSpec*
2004c_param_spec_uint (const gchar *name,
2005 const gchar *nick,
2006 const gchar *blurb,
2007 guint minimum,
2008 guint maximum,
2009 guint default_value,
2010 CParamFlags flags)
2011{
2012 CParamSpecUInt *uspec;
2013
2014 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_86
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_86 = 1; _g_boolean_var_86; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2015
2016 uspec = c_param_spec_internal (C_TYPE_PARAM_UINT(c_param_spec_types[4]),
2017 name,
2018 nick,
2019 blurb,
2020 flags);
2021
2022 uspec->minimum = minimum;
2023 uspec->maximum = maximum;
2024 uspec->default_value = default_value;
2025
2026 return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec)))));
2027}
2028
2029/**
2030 * c_param_spec_long:
2031 * @name: canonical name of the property specified
2032 * @nick: (nullable): nick name for the property specified
2033 * @blurb: (nullable): description of the property specified
2034 * @minimum: minimum value for the property specified
2035 * @maximum: maximum value for the property specified
2036 * @default_value: default value for the property specified
2037 * @flags: flags for the property specified
2038 *
2039 * Creates a new #CParamSpecLong instance specifying a %G_TYPE_LONG property.
2040 *
2041 * See c_param_spec_internal() for details on property names.
2042 *
2043 * Returns: (transfer full): a newly created parameter specification
2044 */
2045CParamSpec*
2046c_param_spec_long (const gchar *name,
2047 const gchar *nick,
2048 const gchar *blurb,
2049 glong minimum,
2050 glong maximum,
2051 glong default_value,
2052 CParamFlags flags)
2053{
2054 CParamSpecLong *lspec;
2055
2056 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_87
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_87 = 1; _g_boolean_var_87; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2057
2058 lspec = c_param_spec_internal (C_TYPE_PARAM_LONG(c_param_spec_types[5]),
2059 name,
2060 nick,
2061 blurb,
2062 flags);
2063
2064 lspec->minimum = minimum;
2065 lspec->maximum = maximum;
2066 lspec->default_value = default_value;
2067
2068 return C_PARAM_SPEC (lspec)((((CParamSpec*) (void *) ((lspec)))));
2069}
2070
2071/**
2072 * c_param_spec_ulong:
2073 * @name: canonical name of the property specified
2074 * @nick: (nullable): nick name for the property specified
2075 * @blurb: (nullable): description of the property specified
2076 * @minimum: minimum value for the property specified
2077 * @maximum: maximum value for the property specified
2078 * @default_value: default value for the property specified
2079 * @flags: flags for the property specified
2080 *
2081 * Creates a new #CParamSpecULong instance specifying a %G_TYPE_ULONG
2082 * property.
2083 *
2084 * See c_param_spec_internal() for details on property names.
2085 *
2086 * Returns: (transfer full): a newly created parameter specification
2087 */
2088CParamSpec*
2089c_param_spec_ulong (const gchar *name,
2090 const gchar *nick,
2091 const gchar *blurb,
2092 gulong minimum,
2093 gulong maximum,
2094 gulong default_value,
2095 CParamFlags flags)
2096{
2097 CParamSpecULong *uspec;
2098
2099 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_88
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_88 = 1; _g_boolean_var_88; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2100
2101 uspec = c_param_spec_internal (C_TYPE_PARAM_ULONG(c_param_spec_types[6]),
2102 name,
2103 nick,
2104 blurb,
2105 flags);
2106
2107 uspec->minimum = minimum;
2108 uspec->maximum = maximum;
2109 uspec->default_value = default_value;
2110
2111 return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec)))));
2112}
2113
2114/**
2115 * c_param_spec_int64:
2116 * @name: canonical name of the property specified
2117 * @nick: (nullable): nick name for the property specified
2118 * @blurb: (nullable): description of the property specified
2119 * @minimum: minimum value for the property specified
2120 * @maximum: maximum value for the property specified
2121 * @default_value: default value for the property specified
2122 * @flags: flags for the property specified
2123 *
2124 * Creates a new #CParamSpecInt64 instance specifying a %G_TYPE_INT64 property.
2125 *
2126 * See c_param_spec_internal() for details on property names.
2127 *
2128 * Returns: (transfer full): a newly created parameter specification
2129 */
2130CParamSpec*
2131c_param_spec_int64 (const gchar *name,
2132 const gchar *nick,
2133 const gchar *blurb,
2134 gint64 minimum,
2135 gint64 maximum,
2136 gint64 default_value,
2137 CParamFlags flags)
2138{
2139 CParamSpecInt64 *lspec;
2140
2141 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_89
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_89 = 1; _g_boolean_var_89; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2142
2143 lspec = c_param_spec_internal (C_TYPE_PARAM_INT64(c_param_spec_types[7]),
2144 name,
2145 nick,
2146 blurb,
2147 flags);
2148
2149 lspec->minimum = minimum;
2150 lspec->maximum = maximum;
2151 lspec->default_value = default_value;
2152
2153 return C_PARAM_SPEC (lspec)((((CParamSpec*) (void *) ((lspec)))));
2154}
2155
2156/**
2157 * c_param_spec_uint64:
2158 * @name: canonical name of the property specified
2159 * @nick: (nullable): nick name for the property specified
2160 * @blurb: (nullable): description of the property specified
2161 * @minimum: minimum value for the property specified
2162 * @maximum: maximum value for the property specified
2163 * @default_value: default value for the property specified
2164 * @flags: flags for the property specified
2165 *
2166 * Creates a new #CParamSpecUInt64 instance specifying a %G_TYPE_UINT64
2167 * property.
2168 *
2169 * See c_param_spec_internal() for details on property names.
2170 *
2171 * Returns: (transfer full): a newly created parameter specification
2172 */
2173CParamSpec*
2174c_param_spec_uint64 (const gchar *name,
2175 const gchar *nick,
2176 const gchar *blurb,
2177 guint64 minimum,
2178 guint64 maximum,
2179 guint64 default_value,
2180 CParamFlags flags)
2181{
2182 CParamSpecUInt64 *uspec;
2183
2184 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_90
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_90 = 1; _g_boolean_var_90; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2185
2186 uspec = c_param_spec_internal (C_TYPE_PARAM_UINT64(c_param_spec_types[8]),
2187 name,
2188 nick,
2189 blurb,
2190 flags);
2191
2192 uspec->minimum = minimum;
2193 uspec->maximum = maximum;
2194 uspec->default_value = default_value;
2195
2196 return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec)))));
2197}
2198
2199/**
2200 * c_param_spec_unichar:
2201 * @name: canonical name of the property specified
2202 * @nick: (nullable): nick name for the property specified
2203 * @blurb: (nullable): description of the property specified
2204 * @default_value: default value for the property specified
2205 * @flags: flags for the property specified
2206 *
2207 * Creates a new #CParamSpecUnichar instance specifying a %G_TYPE_UINT
2208 * property. #GValue structures for this property can be accessed with
2209 * g_value_set_uint() and g_value_get_uint().
2210 *
2211 * See c_param_spec_internal() for details on property names.
2212 *
2213 * Returns: (transfer full): a newly created parameter specification
2214 */
2215CParamSpec*
2216c_param_spec_unichar (const gchar *name,
2217 const gchar *nick,
2218 const gchar *blurb,
2219 gunichar default_value,
2220 CParamFlags flags)
2221{
2222 CParamSpecUnichar *uspec;
2223
2224 uspec = c_param_spec_internal (C_TYPE_PARAM_UNICHAR(c_param_spec_types[9]),
2225 name,
2226 nick,
2227 blurb,
2228 flags);
2229
2230 uspec->default_value = default_value;
2231
2232 return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec)))));
2233}
2234
2235/**
2236 * c_param_spec_enum:
2237 * @name: canonical name of the property specified
2238 * @nick: (nullable): nick name for the property specified
2239 * @blurb: (nullable): description of the property specified
2240 * @enum_type: a #GType derived from %G_TYPE_ENUM
2241 * @default_value: default value for the property specified
2242 * @flags: flags for the property specified
2243 *
2244 * Creates a new #CParamSpecEnum instance specifying a %G_TYPE_ENUM
2245 * property.
2246 *
2247 * See c_param_spec_internal() for details on property names.
2248 *
2249 * Returns: (transfer full): a newly created parameter specification
2250 */
2251CParamSpec*
2252c_param_spec_enum (const gchar *name,
2253 const gchar *nick,
2254 const gchar *blurb,
2255 GType enum_type,
2256 gint default_value,
2257 CParamFlags flags)
2258{
2259 CParamSpecEnum *espec;
2260 GEnumClass *enum_class;
2261
2262 g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_91
= 0; if (((g_type_fundamental (enum_type)) == ((GType) ((12)
<< (2))))) _g_boolean_var_91 = 1; _g_boolean_var_91; }
), 1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "G_TYPE_IS_ENUM (enum_type)"); return ((
(void*)0)); } } while (0)
;
2263
2264 enum_class = g_type_class_ref (enum_type);
2265
2266 g_return_val_if_fail (g_enum_get_value (enum_class, default_value) != NULL, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_92
= 0; if (g_enum_get_value (enum_class, default_value) != ((void
*)0)) _g_boolean_var_92 = 1; _g_boolean_var_92; }), 1))) { } else
{ g_return_if_fail_warning ("libbean", ((const char*) (__func__
)), "g_enum_get_value (enum_class, default_value) != NULL"); return
(((void*)0)); } } while (0)
;
2267
2268 espec = c_param_spec_internal (C_TYPE_PARAM_ENUM(c_param_spec_types[10]),
2269 name,
2270 nick,
2271 blurb,
2272 flags);
2273
2274 espec->enum_class = enum_class;
2275 espec->default_value = default_value;
2276 C_PARAM_SPEC (espec)((((CParamSpec*) (void *) ((espec)))))->value_type = enum_type;
2277
2278 return C_PARAM_SPEC (espec)((((CParamSpec*) (void *) ((espec)))));
2279}
2280
2281/**
2282 * c_param_spec_flags:
2283 * @name: canonical name of the property specified
2284 * @nick: (nullable): nick name for the property specified
2285 * @blurb: (nullable): description of the property specified
2286 * @flags_type: a #GType derived from %G_TYPE_FLAGS
2287 * @default_value: default value for the property specified
2288 * @flags: flags for the property specified
2289 *
2290 * Creates a new #CParamSpecFlags instance specifying a %G_TYPE_FLAGS
2291 * property.
2292 *
2293 * See c_param_spec_internal() for details on property names.
2294 *
2295 * Returns: (transfer full): a newly created parameter specification
2296 */
2297CParamSpec*
2298c_param_spec_flags (const gchar *name,
2299 const gchar *nick,
2300 const gchar *blurb,
2301 GType flags_type,
2302 guint default_value,
2303 CParamFlags flags)
2304{
2305 CParamSpecFlags *fspec;
2306 GFlagsClass *flags_class;
2307
2308 g_return_val_if_fail (G_TYPE_IS_FLAGS (flags_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_93
= 0; if (((g_type_fundamental (flags_type)) == ((GType) ((13
) << (2))))) _g_boolean_var_93 = 1; _g_boolean_var_93; }
), 1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "G_TYPE_IS_FLAGS (flags_type)"); return (
((void*)0)); } } while (0)
;
2309
2310 flags_class = g_type_class_ref (flags_type);
2311
2312 g_return_val_if_fail ((default_value & flags_class->mask) == default_value, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_94
= 0; if ((default_value & flags_class->mask) == default_value
) _g_boolean_var_94 = 1; _g_boolean_var_94; }), 1))) { } else
{ g_return_if_fail_warning ("libbean", ((const char*) (__func__
)), "(default_value & flags_class->mask) == default_value"
); return (((void*)0)); } } while (0)
;
2313
2314 fspec = c_param_spec_internal (C_TYPE_PARAM_FLAGS(c_param_spec_types[11]),
2315 name,
2316 nick,
2317 blurb,
2318 flags);
2319
2320 fspec->flags_class = flags_class;
2321 fspec->default_value = default_value;
2322 C_PARAM_SPEC (fspec)((((CParamSpec*) (void *) ((fspec)))))->value_type = flags_type;
2323
2324 return C_PARAM_SPEC (fspec)((((CParamSpec*) (void *) ((fspec)))));
2325}
2326
2327/**
2328 * c_param_spec_float:
2329 * @name: canonical name of the property specified
2330 * @nick: (nullable): nick name for the property specified
2331 * @blurb: (nullable): description of the property specified
2332 * @minimum: minimum value for the property specified
2333 * @maximum: maximum value for the property specified
2334 * @default_value: default value for the property specified
2335 * @flags: flags for the property specified
2336 *
2337 * Creates a new #CParamSpecFloat instance specifying a %G_TYPE_FLOAT property.
2338 *
2339 * See c_param_spec_internal() for details on property names.
2340 *
2341 * Returns: (transfer full): a newly created parameter specification
2342 */
2343CParamSpec*
2344c_param_spec_float (const gchar *name,
2345 const gchar *nick,
2346 const gchar *blurb,
2347 gfloat minimum,
2348 gfloat maximum,
2349 gfloat default_value,
2350 CParamFlags flags)
2351{
2352 CParamSpecFloat *fspec;
2353
2354 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_95
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_95 = 1; _g_boolean_var_95; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2355
2356 fspec = c_param_spec_internal (C_TYPE_PARAM_FLOAT(c_param_spec_types[12]),
2357 name,
2358 nick,
2359 blurb,
2360 flags);
2361
2362 fspec->minimum = minimum;
2363 fspec->maximum = maximum;
2364 fspec->default_value = default_value;
2365
2366 return C_PARAM_SPEC (fspec)((((CParamSpec*) (void *) ((fspec)))));
2367}
2368
2369/**
2370 * c_param_spec_double:
2371 * @name: canonical name of the property specified
2372 * @nick: (nullable): nick name for the property specified
2373 * @blurb: (nullable): description of the property specified
2374 * @minimum: minimum value for the property specified
2375 * @maximum: maximum value for the property specified
2376 * @default_value: default value for the property specified
2377 * @flags: flags for the property specified
2378 *
2379 * Creates a new #CParamSpecDouble instance specifying a %G_TYPE_DOUBLE
2380 * property.
2381 *
2382 * See c_param_spec_internal() for details on property names.
2383 *
2384 * Returns: (transfer full): a newly created parameter specification
2385 */
2386CParamSpec*
2387c_param_spec_double (const gchar *name,
2388 const gchar *nick,
2389 const gchar *blurb,
2390 gdouble minimum,
2391 gdouble maximum,
2392 gdouble default_value,
2393 CParamFlags flags)
2394{
2395 CParamSpecDouble *dspec;
2396
2397 g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_96
= 0; if (default_value >= minimum && default_value
<= maximum) _g_boolean_var_96 = 1; _g_boolean_var_96; }),
1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "default_value >= minimum && default_value <= maximum"
); return (((void*)0)); } } while (0)
;
2398
2399 dspec = c_param_spec_internal (C_TYPE_PARAM_DOUBLE(c_param_spec_types[13]),
2400 name,
2401 nick,
2402 blurb,
2403 flags);
2404
2405 dspec->minimum = minimum;
2406 dspec->maximum = maximum;
2407 dspec->default_value = default_value;
2408
2409 return C_PARAM_SPEC (dspec)((((CParamSpec*) (void *) ((dspec)))));
2410}
2411
2412/**
2413 * c_param_spec_string:
2414 * @name: canonical name of the property specified
2415 * @nick: (nullable): nick name for the property specified
2416 * @blurb: (nullable): description of the property specified
2417 * @default_value: (nullable): default value for the property specified
2418 * @flags: flags for the property specified
2419 *
2420 * Creates a new #CParamSpecString instance.
2421 *
2422 * See c_param_spec_internal() for details on property names.
2423 *
2424 * Returns: (transfer full): a newly created parameter specification
2425 */
2426CParamSpec*
2427c_param_spec_string (const gchar *name,
2428 const gchar *nick,
2429 const gchar *blurb,
2430 const gchar *default_value,
2431 CParamFlags flags)
2432{
2433 CParamSpecString *sspec = c_param_spec_internal (C_TYPE_PARAM_STRING(c_param_spec_types[14]),
2434 name,
2435 nick,
2436 blurb,
2437 flags);
2438
2439 g_free (sspec->default_value);
2440 sspec->default_value = g_strdup (default_value)g_strdup_inline (default_value);
2441
2442 return C_PARAM_SPEC (sspec)((((CParamSpec*) (void *) ((sspec)))));
2443}
2444
2445/**
2446 * c_param_spec_param:
2447 * @name: canonical name of the property specified
2448 * @nick: (nullable): nick name for the property specified
2449 * @blurb: (nullable): description of the property specified
2450 * @param_type: a #GType derived from %C_TYPE_PARAM
2451 * @flags: flags for the property specified
2452 *
2453 * Creates a new #CParamSpecParam instance specifying a %C_TYPE_PARAM
2454 * property.
2455 *
2456 * See c_param_spec_internal() for details on property names.
2457 *
2458 * Returns: (transfer full): a newly created parameter specification
2459 */
2460CParamSpec*
2461c_param_spec_param (const gchar *name,
2462 const gchar *nick,
2463 const gchar *blurb,
2464 GType param_type,
2465 CParamFlags flags)
2466{
2467 CParamSpecParam *pspec;
2468
2469 g_return_val_if_fail (C_TYPE_IS_PARAM (param_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_97
= 0; if (((g_type_fundamental (param_type)) == ((GType) ((19
) << (2))))) _g_boolean_var_97 = 1; _g_boolean_var_97; }
), 1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "C_TYPE_IS_PARAM (param_type)"); return (
((void*)0)); } } while (0)
;
2470
2471 pspec = c_param_spec_internal (C_TYPE_PARAM_PARAM(c_param_spec_types[15]),
2472 name,
2473 nick,
2474 blurb,
2475 flags);
2476
2477 C_PARAM_SPEC (pspec)((((CParamSpec*) (void *) ((pspec)))))->value_type = param_type;
2478
2479 return C_PARAM_SPEC (pspec)((((CParamSpec*) (void *) ((pspec)))));
2480}
2481
2482/**
2483 * c_param_spec_boxed:
2484 * @name: canonical name of the property specified
2485 * @nick: (nullable): nick name for the property specified
2486 * @blurb: (nullable): description of the property specified
2487 * @boxed_type: %G_TYPE_BOXED derived type of this property
2488 * @flags: flags for the property specified
2489 *
2490 * Creates a new #CParamSpecBoxed instance specifying a %G_TYPE_BOXED
2491 * derived property.
2492 *
2493 * See c_param_spec_internal() for details on property names.
2494 *
2495 * Returns: (transfer full): a newly created parameter specification
2496 */
2497CParamSpec*
2498c_param_spec_boxed (const gchar *name,
2499 const gchar *nick,
2500 const gchar *blurb,
2501 GType boxed_type,
2502 CParamFlags flags)
2503{
2504 CParamSpecBoxed *bspec;
2505
2506 g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_98
= 0; if (((g_type_fundamental (boxed_type)) == ((GType) ((18
) << (2))))) _g_boolean_var_98 = 1; _g_boolean_var_98; }
), 1))) { } else { g_return_if_fail_warning ("libbean", ((const
char*) (__func__)), "G_TYPE_IS_BOXED (boxed_type)"); return (
((void*)0)); } } while (0)
;
2507 g_return_val_if_fail (G_TYPE_IS_VALUE_TYPE (boxed_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_99
= 0; if ((g_type_check_is_value_type (boxed_type))) _g_boolean_var_99
= 1; _g_boolean_var_99; }), 1))) { } else { g_return_if_fail_warning
("libbean", ((const char*) (__func__)), "G_TYPE_IS_VALUE_TYPE (boxed_type)"
); return (((void*)0)); } } while (0)
;
2508
2509 bspec = c_param_spec_internal (C_TYPE_PARAM_BOXED(c_param_spec_types[16]),
2510 name,
2511 nick,
2512 blurb,
2513 flags);
2514
2515 C_PARAM_SPEC (bspec)((((CParamSpec*) (void *) ((bspec)))))->value_type = boxed_type;
2516
2517 return C_PARAM_SPEC (bspec)((((CParamSpec*) (void *) ((bspec)))));
2518}
2519
2520/**
2521 * c_param_spec_pointer:
2522 * @name: canonical name of the property specified
2523 * @nick: (nullable): nick name for the property specified
2524 * @blurb: (nullable): description of the property specified
2525 * @flags: flags for the property specified
2526 *
2527 * Creates a new #CParamSpecPointer instance specifying a pointer property.
2528 * Where possible, it is better to use c_param_spec_object() or
2529 * c_param_spec_boxed() to expose memory management information.
2530 *
2531 * See c_param_spec_internal() for details on property names.
2532 *
2533 * Returns: (transfer full): a newly created parameter specification
2534 */
2535CParamSpec*
2536c_param_spec_pointer (const gchar *name,
2537 const gchar *nick,
2538 const gchar *blurb,
2539 CParamFlags flags)
2540{
2541 CParamSpecPointer *pspec;
2542
2543 pspec = c_param_spec_internal (C_TYPE_PARAM_POINTER(c_param_spec_types[17]),
2544 name,
2545 nick,
2546 blurb,
2547 flags);
2548
2549 return C_PARAM_SPEC (pspec)((((CParamSpec*) (void *) ((pspec)))));
2550}
2551
2552/**
2553 * c_param_spec_gtype:
2554 * @name: canonical name of the property specified
2555 * @nick: (nullable): nick name for the property specified
2556 * @blurb: (nullable): description of the property specified
2557 * @is_a_type: a #GType whose subtypes are allowed as values
2558 * of the property (use %G_TYPE_NONE for any type)
2559 * @flags: flags for the property specified
2560 *
2561 * Creates a new #CParamSpecGType instance specifying a
2562 * %G_TYPE_GTYPE property.
2563 *
2564 * See c_param_spec_internal() for details on property names.
2565 *
2566 * Since: 2.10
2567 *
2568 * Returns: (transfer full): a newly created parameter specification
2569 */
2570CParamSpec*
2571c_param_spec_gtype (const gchar *name,
2572 const gchar *nick,
2573 const gchar *blurb,
2574 GType is_a_type,
2575 CParamFlags flags)
2576{
2577 CParamSpecGType *tspec;
2578
2579 tspec = c_param_spec_internal (C_TYPE_PARAM_GTYPE(c_param_spec_types[21]),
2580 name,
2581 nick,
2582 blurb,
2583 flags);
2584
2585 tspec->is_a_type = is_a_type;
2586
2587 return C_PARAM_SPEC (tspec)((((CParamSpec*) (void *) ((tspec)))));
2588}
2589
2590/**
2591 * c_param_spec_value_array: (skip)
2592 * @name: canonical name of the property specified
2593 * @nick: (nullable): nick name for the property specified
2594 * @blurb: (nullable): description of the property specified
2595 * @element_spec: a #CParamSpec describing the elements contained in
2596 * arrays of this property, may be %NULL
2597 * @flags: flags for the property specified
2598 *
2599 * Creates a new #CParamSpecValueArray instance specifying a
2600 * %G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a
2601 * %G_TYPE_BOXED type, as such, #GValue structures for this property
2602 * can be accessed with g_value_set_boxed() and g_value_get_boxed().
2603 *
2604 * See c_param_spec_internal() for details on property names.
2605 *
2606 * Returns: a newly created parameter specification
2607 */
2608CParamSpec*
2609c_param_spec_value_array (const gchar *name,
2610 const gchar *nick,
2611 const gchar *blurb,
2612 CParamSpec *element_spec,
2613 CParamFlags flags)
2614{
2615 CParamSpecValueArray *aspec;
2616
2617 g_return_val_if_fail (element_spec == NULL || C_IS_PARAM_SPEC (element_spec), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_100
= 0; if (element_spec == ((void*)0) || (((g_type_check_instance_is_fundamentally_a
((GTypeInstance*) ((element_spec)), (((GType) ((19) <<
(2))))))))) _g_boolean_var_100 = 1; _g_boolean_var_100; }), 1
))) { } else { g_return_if_fail_warning ("libbean", ((const char
*) (__func__)), "element_spec == NULL || C_IS_PARAM_SPEC (element_spec)"
); return (((void*)0)); } } while (0)
;
2618
2619 aspec = c_param_spec_internal (C_TYPE_PARAM_VALUE_ARRAY(c_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol"
,
2620 name,
2621 nick,
2622 blurb,
2623 flags);
2624
2625 if (element_spec)
2626 {
2627 aspec->element_spec = c_param_spec_ref (element_spec);
2628 c_param_spec_sink (element_spec);
2629 }
2630
2631 return C_PARAM_SPEC (aspec)((((CParamSpec*) (void *) ((aspec)))));
2632}
2633
2634/**
2635 * c_param_spec_object:
2636 * @name: canonical name of the property specified
2637 * @nick: (nullable): nick name for the property specified
2638 * @blurb: (nullable): description of the property specified
2639 * @object_type: %G_TYPE_OBJECT derived type of this property
2640 * @flags: flags for the property specified
2641 *
2642 * Creates a new #CParamSpecBoxed instance specifying a %G_TYPE_OBJECT
2643 * derived property.
2644 *
2645 * See c_param_spec_internal() for details on property names.
2646 *
2647 * Returns: (transfer full): a newly created parameter specification
2648 */
2649CParamSpec*
2650c_param_spec_object (const gchar *name,
2651 const gchar *nick,
2652 const gchar *blurb,
2653 GType object_type,
2654 CParamFlags flags)
2655{
2656 CParamSpecObject *ospec;
2657
2658 g_return_val_if_fail (g_type_is_a (object_type, G_TYPE_OBJECT), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_101
= 0; if (((object_type) == (((GType) ((20) << (2)))) ||
(g_type_is_a) ((object_type), (((GType) ((20) << (2)))
)))) _g_boolean_var_101 = 1; _g_boolean_var_101; }), 1))) { }
else { g_return_if_fail_warning ("libbean", ((const char*) (
__func__)), "g_type_is_a (object_type, G_TYPE_OBJECT)"); return
(((void*)0)); } } while (0)
;
2659
2660 ospec = c_param_spec_internal (C_TYPE_PARAM_OBJECT(c_param_spec_types[19]),
2661 name,
2662 nick,
2663 blurb,
2664 flags);
2665
2666 C_PARAM_SPEC (ospec)((((CParamSpec*) (void *) ((ospec)))))->value_type = object_type;
2667
2668 return C_PARAM_SPEC (ospec)((((CParamSpec*) (void *) ((ospec)))));
2669}
2670
2671/**
2672 * c_param_spec_override: (skip)
2673 * @name: the name of the property.
2674 * @overridden: The property that is being overridden
2675 *
2676 * Creates a new property of type #CParamSpecOverride. This is used
2677 * to direct operations to another paramspec, and will not be directly
2678 * useful unless you are implementing a new base type similar to GObject.
2679 *
2680 * Since: 2.4
2681 *
2682 * Returns: the newly created #CParamSpec
2683 */
2684CParamSpec*
2685c_param_spec_override (const gchar *name,
2686 CParamSpec *overridden)
2687{
2688 CParamSpec *pspec;
2689
2690 g_return_val_if_fail (name != NULL, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_102
= 0; if (name != ((void*)0)) _g_boolean_var_102 = 1; _g_boolean_var_102
; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((
const char*) (__func__)), "name != NULL"); return (((void*)0)
); } } while (0)
;
2691 g_return_val_if_fail (C_IS_PARAM_SPEC (overridden), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_103
= 0; if ((((g_type_check_instance_is_fundamentally_a ((GTypeInstance
*) ((overridden)), (((GType) ((19) << (2))))))))) _g_boolean_var_103
= 1; _g_boolean_var_103; }), 1))) { } else { g_return_if_fail_warning
("libbean", ((const char*) (__func__)), "C_IS_PARAM_SPEC (overridden)"
); return (((void*)0)); } } while (0)
;
2692
2693 /* Dereference further redirections for property that was passed in
2694 */
2695 while (TRUE(!(0)))
2696 {
2697 CParamSpec *indirect = c_param_spec_get_redirect_target (overridden);
2698 if (indirect)
2699 overridden = indirect;
2700 else
2701 break;
2702 }
2703
2704 pspec = c_param_spec_internal (C_TYPE_PARAM_OVERRIDE(c_param_spec_types[20]),
2705 name, NULL((void*)0), NULL((void*)0),
2706 overridden->flags);
2707
2708 pspec->value_type = C_PARAM_SPEC_VALUE_TYPE (overridden)(((((CParamSpec*) (void *) ((overridden)))))->value_type);
2709 C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))))->overridden = c_param_spec_ref (overridden);
2710
2711 return pspec;
2712}
2713
2714/**
2715 * c_param_spec_variant:
2716 * @name: canonical name of the property specified
2717 * @nick: (nullable): nick name for the property specified
2718 * @blurb: (nullable): description of the property specified
2719 * @type: a #GVariantType
2720 * @default_value: (nullable) (transfer full): a #GVariant of type @type to
2721 * use as the default value, or %NULL
2722 * @flags: flags for the property specified
2723 *
2724 * Creates a new #CParamSpecVariant instance specifying a #GVariant
2725 * property.
2726 *
2727 * If @default_value is floating, it is consumed.
2728 *
2729 * See c_param_spec_internal() for details on property names.
2730 *
2731 * Returns: (transfer full): the newly created #CParamSpec
2732 *
2733 * Since: 2.26
2734 */
2735CParamSpec*
2736c_param_spec_variant (const gchar *name,
2737 const gchar *nick,
2738 const gchar *blurb,
2739 const GVariantType *type,
2740 GVariant *default_value,
2741 CParamFlags flags)
2742{
2743 CParamSpecVariant *vspec;
2744
2745 g_return_val_if_fail (type != NULL, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_104
= 0; if (type != ((void*)0)) _g_boolean_var_104 = 1; _g_boolean_var_104
; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((
const char*) (__func__)), "type != NULL"); return (((void*)0)
); } } while (0)
;
2746 g_return_val_if_fail (default_value == NULL ||do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_105
= 0; if (default_value == ((void*)0) || g_variant_is_of_type
(default_value, type)) _g_boolean_var_105 = 1; _g_boolean_var_105
; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((
const char*) (__func__)), "default_value == NULL || g_variant_is_of_type (default_value, type)"
); return (((void*)0)); } } while (0)
2747 g_variant_is_of_type (default_value, type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_105
= 0; if (default_value == ((void*)0) || g_variant_is_of_type
(default_value, type)) _g_boolean_var_105 = 1; _g_boolean_var_105
; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((
const char*) (__func__)), "default_value == NULL || g_variant_is_of_type (default_value, type)"
); return (((void*)0)); } } while (0)
;
2748
2749 vspec = c_param_spec_internal (C_TYPE_PARAM_VARIANT(c_param_spec_types[22]),
2750 name,
2751 nick,
2752 blurb,
2753 flags);
2754
2755 vspec->type = g_variant_type_copy (type);
2756 if (default_value)
2757 vspec->default_value = g_variant_ref_sink (default_value);
2758
2759 return C_PARAM_SPEC (vspec)((((CParamSpec*) (void *) ((vspec)))));
2760}