Branch data Line data Source code
1 : : /*
2 : : SPDX-License-Identifier: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT
3 : : SPDX-FileCopyrightText: 2007-2010 Johan Dahlin
4 : : SPDX-FileCopyrightText: 2008-2010 Colin Walters <walters@verbum.org>
5 : : SPDX-FileCopyrightText: 2008 Jürg Billeter
6 : : SPDX-FileCopyrightText: 2008 Philip Van Hoof
7 : : SPDX-FileCopyrightText: 2009, 2011-2012 Dan Winship
8 : : SPDX-FileCopyrightText: 2010 Collabora, Ltd.
9 : : SPDX-FileCopyrightText: 2010 litl, LLC
10 : : SPDX-FileCopyrightText: 2010 Sugar Labs
11 : : SPDX-FileCopyrightText: 2011 Owen Taylor
12 : : SPDX-FileCopyrightText: 2011 Red Hat, Inc.
13 : : SPDX-FileCopyrightText: 2011 Torsten Schönfeld
14 : : SPDX-FileCopyrightText: 2018 Christoph Reiter
15 : : SPDX-FileCopyrightText: 2020 Centricular
16 : : SPDX-FileCopyrightText: 2024 Simon McVittie
17 : : SPDX-FileCopyrightText: 2024 Philip Chimento <philip.chimento@gmail.com>
18 : : */
19 : :
20 : : #include <time.h>
21 : :
22 : : #include "foo.h"
23 : :
24 : : /**
25 : : * SECTION:standalone_section
26 : : *
27 : : * This documentation section isn't associated with an object
28 : : * in particular, but it should be serialized in the gir nevertheless.
29 : : */
30 : :
31 : : /* A hidden type not exposed publicly, similar to GUPNP's XML wrapper
32 : : object */
33 : : typedef struct _RegressFooHidden RegressFooHidden;
34 : :
35 : : void regress_foo_private_function (RegressFooObject *regress_foo);
36 : : void regress_foo_do_regress_foo (RegressFooInterface *self, int x);
37 : : RegressFooHidden *regress_foo_hidden_copy (const RegressFooHidden *boxed);
38 : : void regress_foo_hidden_free (RegressFooHidden *boxed);
39 : : GType regress_foo_hidden_get_type (void);
40 : : RegressFooBoxed *regress_foo_boxed_copy (const RegressFooBoxed *boxed);
41 : : void regress_foo_boxed_free (RegressFooBoxed *boxed);
42 : : void regress_foo_dbus_data_free (RegressFooDBusData *boxed);
43 : : RegressFooDBusData *regress_foo_dbus_data_copy (const RegressFooDBusData *boxed);
44 : :
45 : : typedef struct
46 : : {
47 : : int i;
48 : : } PrivateStruct;
49 : :
50 : : void
51 : 0 : regress_foo_private_function (RegressFooObject *regress_foo G_GNUC_UNUSED)
52 : : {
53 : 0 : }
54 : :
55 : : GType
56 : 36 : regress_foo_interface_get_type (void)
57 : : {
58 : : static GType object_type = 0;
59 : :
60 [ + + ]: 36 : if (!object_type)
61 : : {
62 : 2 : object_type = g_type_register_static_simple (G_TYPE_INTERFACE,
63 : : "RegressFooInterface",
64 : : sizeof (RegressFooInterfaceIface),
65 : : NULL, 0, NULL, 0);
66 : :
67 : 2 : g_type_interface_add_prerequisite (object_type, G_TYPE_OBJECT);
68 : : }
69 : :
70 : 36 : return object_type;
71 : : }
72 : :
73 : : void
74 : 4 : regress_foo_interface_do_regress_foo (RegressFooInterface *self, int x)
75 : : {
76 : 4 : REGRESS_FOO_INTERFACE_GET_INTERFACE (self)->do_regress_foo (self, x);
77 : 4 : }
78 : :
79 : : void
80 : 2 : regress_foo_interface_static_method (int x G_GNUC_UNUSED)
81 : : {
82 : 2 : }
83 : :
84 : : enum
85 : : {
86 : : PROP_0,
87 : : PROP_STRING,
88 : : PROP_HIDDEN
89 : : };
90 : :
91 : : enum
92 : : {
93 : : SIGNAL,
94 : : LAST_SIGNAL
95 : : };
96 : :
97 : : static guint regress_foo_object_signals[LAST_SIGNAL] = { 0 };
98 : :
99 : : static void
100 : 2 : regress_foo_regress_foo_interface_init (gpointer g_iface,
101 : : gpointer iface_data G_GNUC_UNUSED)
102 : : {
103 : 2 : RegressFooInterfaceIface *iface = (RegressFooInterfaceIface *) g_iface;
104 : 2 : iface->do_regress_foo = regress_foo_do_regress_foo;
105 : 2 : }
106 : :
107 : : enum
108 : : {
109 : : SUBIFACE_DESTROY_EVENT,
110 : : SUBIFACE_LAST_SIGNAL
111 : : };
112 : :
113 : : static void
114 : : regress_foo_sub_interface_class_init (gpointer g_class, gpointer class_data);
115 : :
116 : : static guint regress_foo_subiface_signals[SUBIFACE_LAST_SIGNAL] = { 0 };
117 : :
118 : : GType
119 : 12 : regress_foo_sub_interface_get_type (void)
120 : : {
121 : : static GType object_type = 0;
122 : :
123 [ + + ]: 12 : if (!object_type)
124 : : {
125 : 2 : object_type = g_type_register_static_simple (G_TYPE_INTERFACE,
126 : : "RegressFooSubInterface",
127 : : sizeof (RegressFooSubInterfaceIface),
128 : : regress_foo_sub_interface_class_init, 0, NULL, 0);
129 : :
130 : 2 : g_type_interface_add_prerequisite (object_type, REGRESS_FOO_TYPE_INTERFACE);
131 : : }
132 : :
133 : 12 : return object_type;
134 : : }
135 : :
136 : : static void
137 : 2 : regress_foo_sub_interface_class_init (gpointer g_class G_GNUC_UNUSED,
138 : : gpointer class_data G_GNUC_UNUSED)
139 : : {
140 : 2 : regress_foo_subiface_signals[SUBIFACE_DESTROY_EVENT] =
141 : 2 : g_signal_new ("destroy-event", REGRESS_FOO_TYPE_SUBINTERFACE,
142 : : G_SIGNAL_RUN_LAST,
143 : : G_STRUCT_OFFSET (RegressFooSubInterfaceIface, destroy_event),
144 : : NULL, NULL, NULL,
145 : : G_TYPE_NONE,
146 : : 0,
147 : : G_TYPE_NONE);
148 : 2 : }
149 : :
150 : : void
151 : 1 : regress_foo_sub_interface_do_bar (RegressFooSubInterface *self)
152 : : {
153 : 1 : REGRESS_FOO_SUBINTERFACE_GET_INTERFACE (self)->do_bar (self);
154 : 1 : }
155 : :
156 : : /**
157 : : * regress_foo_sub_interface_do_baz:
158 : : * @self:
159 : : * @callback: (scope call):
160 : : * @user_data:
161 : : */
162 : : void
163 : 0 : regress_foo_sub_interface_do_baz (RegressFooSubInterface *self, GCallback callback, gpointer user_data)
164 : : {
165 : 0 : REGRESS_FOO_SUBINTERFACE_GET_INTERFACE (self)->do_baz (self, callback, user_data);
166 : 0 : }
167 : :
168 [ + + + - : 46 : G_DEFINE_TYPE_EXTENDED (RegressFooObject, regress_foo_object, G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE (REGRESS_FOO_TYPE_INTERFACE, regress_foo_regress_foo_interface_init));
+ + ]
169 : :
170 : : static void
171 : 12 : regress_foo_object_set_property (GObject *object,
172 : : guint prop_id,
173 : : const GValue *value G_GNUC_UNUSED,
174 : : GParamSpec *pspec)
175 : : {
176 [ + + - ]: 12 : switch (prop_id)
177 : : {
178 : 6 : case PROP_STRING:
179 : 6 : break;
180 : 6 : case PROP_HIDDEN:
181 : 6 : break;
182 : 0 : default:
183 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
184 : 0 : break;
185 : : }
186 : 12 : }
187 : :
188 : : static void
189 : 1 : regress_foo_object_get_property (GObject *object,
190 : : guint prop_id,
191 : : GValue *value G_GNUC_UNUSED,
192 : : GParamSpec *pspec)
193 : : {
194 [ + - - ]: 1 : switch (prop_id)
195 : : {
196 : 1 : case PROP_STRING:
197 : 1 : break;
198 : 0 : case PROP_HIDDEN:
199 : 0 : break;
200 : 0 : default:
201 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
202 : 0 : break;
203 : : }
204 : 1 : }
205 : :
206 : : static void
207 : 2 : regress_foo_object_class_init (RegressFooObjectClass *klass)
208 : : {
209 : : GObjectClass *gobject_class;
210 : :
211 : 2 : gobject_class = G_OBJECT_CLASS (klass);
212 : :
213 : 2 : gobject_class->set_property = regress_foo_object_set_property;
214 : 2 : gobject_class->get_property = regress_foo_object_get_property;
215 : :
216 : 2 : g_object_class_install_property (gobject_class,
217 : : PROP_STRING,
218 : : g_param_spec_string ("string",
219 : : "String nick",
220 : : "The String Property Blurb",
221 : : NULL,
222 : : G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
223 : 2 : g_object_class_install_property (gobject_class,
224 : : PROP_HIDDEN,
225 : : g_param_spec_boxed ("hidden",
226 : : "hidden property",
227 : : "should not be exposed",
228 : : regress_foo_hidden_get_type (),
229 : : G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
230 : 2 : regress_foo_object_signals[SIGNAL] =
231 : 2 : g_signal_new ("signal",
232 : : G_OBJECT_CLASS_TYPE (gobject_class),
233 : : G_SIGNAL_RUN_LAST,
234 : : 0,
235 : : NULL, NULL,
236 : : (GSignalCMarshaller) g_cclosure_marshal_STRING__OBJECT_POINTER,
237 : : G_TYPE_STRING, 2, G_TYPE_OBJECT, G_TYPE_POINTER);
238 : 2 : }
239 : :
240 : : static void
241 : 6 : regress_foo_object_init (RegressFooObject *object G_GNUC_UNUSED)
242 : : {
243 : 6 : }
244 : :
245 : : RegressFooObject *
246 : 1 : regress_foo_object_new (void)
247 : : {
248 : 1 : return g_object_new (REGRESS_FOO_TYPE_OBJECT, NULL);
249 : : }
250 : :
251 : : GObject *
252 : 1 : regress_foo_object_new_as_super (void)
253 : : {
254 : 1 : return g_object_new (REGRESS_FOO_TYPE_OBJECT, NULL);
255 : : }
256 : :
257 : : /**
258 : : * regress_foo_object_external_type:
259 : : * @object: a #RegressFooObject
260 : : *
261 : : * Returns: (transfer none): %NULL always
262 : : */
263 : : UtilityObject *
264 : 2 : regress_foo_object_external_type (RegressFooObject *object G_GNUC_UNUSED)
265 : : {
266 : 2 : return NULL;
267 : : }
268 : :
269 : : void
270 : 2 : regress_foo_object_various (RegressFooObject *object G_GNUC_UNUSED,
271 : : void *data G_GNUC_UNUSED,
272 : : GType some_type G_GNUC_UNUSED)
273 : : {
274 : 2 : }
275 : :
276 : : void
277 : 0 : regress_foo_object_take_all (RegressFooObject *object G_GNUC_UNUSED,
278 : : int x G_GNUC_UNUSED,
279 : : ...)
280 : : {
281 : 0 : }
282 : :
283 : : void
284 : 2 : regress_foo_do_regress_foo (RegressFooInterface *self G_GNUC_UNUSED,
285 : : int x G_GNUC_UNUSED)
286 : : {
287 : 2 : }
288 : :
289 : : void
290 : 2 : regress_foo_object_is_it_time_yet (RegressFooObject *object G_GNUC_UNUSED,
291 : : time_t time G_GNUC_UNUSED)
292 : : {
293 : 2 : }
294 : :
295 : : void
296 : 2 : regress_foo_object_seek (RegressFooObject *object G_GNUC_UNUSED, off_t offset G_GNUC_UNUSED)
297 : : {
298 : 2 : }
299 : :
300 : : /**
301 : : * regress_foo_object_new_cookie: (skip)
302 : : * @object:
303 : : * @target:
304 : : *
305 : : * Not sure why this test is here...
306 : : */
307 : : RegressFooObjectCookie
308 : 0 : regress_foo_object_new_cookie (RegressFooObject *object G_GNUC_UNUSED,
309 : : const char *target G_GNUC_UNUSED)
310 : : {
311 : 0 : return NULL;
312 : : }
313 : :
314 : : const char *
315 : 2 : regress_foo_object_get_name (RegressFooObject *object G_GNUC_UNUSED)
316 : : {
317 : 2 : return "regress_foo";
318 : : }
319 : :
320 : : char *
321 : 4 : regress_foo_object_dup_name (RegressFooObject *object G_GNUC_UNUSED)
322 : : {
323 : 2 : return g_strdup ("regress_foo");
324 : : }
325 : :
326 : : void
327 : 2 : regress_foo_object_handle_glyph (RegressFooObject *object G_GNUC_UNUSED, UtilityGlyph glyph G_GNUC_UNUSED)
328 : : {
329 : 2 : }
330 : :
331 : : gboolean
332 : 2 : regress_foo_object_virtual_method (RegressFooObject *object, int first_param)
333 : : {
334 : 2 : RegressFooObjectClass *klass = REGRESS_FOO_OBJECT_GET_CLASS (object);
335 [ + + ]: 2 : if (!klass->virtual_method)
336 : 1 : return FALSE;
337 : 1 : return klass->virtual_method (object, first_param);
338 : : }
339 : :
340 : : /**
341 : : * regress_foo_object_read: (virtual read_fn)
342 : : * @object: obj
343 : : * @offset: offset
344 : : * @length: length
345 : : *
346 : : * Read some stuff.
347 : : */
348 : : void
349 : 2 : regress_foo_object_read (RegressFooObject *object G_GNUC_UNUSED,
350 : : int offset G_GNUC_UNUSED,
351 : : int length G_GNUC_UNUSED)
352 : : {
353 : 2 : }
354 : :
355 : : /**
356 : : * regress_foo_object_static_meth:
357 : : *
358 : : * Returns:
359 : : */
360 : : int
361 : 1 : regress_foo_object_static_meth (void)
362 : : {
363 : 1 : return 77;
364 : : }
365 : :
366 : : /**
367 : : * regress_foo_object_skipped_method: (skip)
368 : : * @object: obj
369 : : *
370 : : * This is only useful from C.
371 : : */
372 : : void
373 : 0 : regress_foo_object_skipped_method (RegressFooObject *object G_GNUC_UNUSED)
374 : : {
375 : 0 : }
376 : :
377 [ + + + - : 6 : G_DEFINE_ABSTRACT_TYPE (RegressFooSubobject, regress_foo_subobject, REGRESS_FOO_TYPE_OBJECT);
+ - ]
378 : :
379 : : static void
380 : 2 : regress_foo_subobject_class_init (RegressFooSubobjectClass *klass G_GNUC_UNUSED)
381 : : {
382 : 2 : }
383 : :
384 : : static void
385 : 1 : regress_foo_subobject_init (RegressFooSubobject *object G_GNUC_UNUSED)
386 : : {
387 : 1 : }
388 : :
389 : : /**
390 : : * regress_foo_object_get_default:
391 : : *
392 : : * This function is intended to match clutter_stage_get_default which
393 : : * uses a C sugar return type.
394 : : *
395 : : * Return value: (type RegressFooSubobject) (transfer none): The global #RegressFooSubobject
396 : : */
397 : : RegressFooObject *
398 : 1 : regress_foo_object_get_default (void)
399 : : {
400 : 1 : return NULL;
401 : : }
402 : :
403 : : int
404 : 1 : regress_foo_init (void)
405 : : {
406 : 1 : return REGRESS_FOO_SUCCESS_INT;
407 : : }
408 : :
409 : : /**
410 : : * regress_foo_init_argv:
411 : : * @argc:
412 : : * @argv: (array length=argc) (allow-none):
413 : : */
414 : : int
415 : 1 : regress_foo_init_argv (int argc G_GNUC_UNUSED,
416 : : char **argv G_GNUC_UNUSED)
417 : : {
418 : 1 : return REGRESS_FOO_SUCCESS_INT;
419 : : }
420 : :
421 : : /**
422 : : * regress_foo_init_argv_address:
423 : : * @argc: (inout):
424 : : * @argv: (array length=argc) (inout) (allow-none):
425 : : */
426 : : int
427 : 1 : regress_foo_init_argv_address (int *argc G_GNUC_UNUSED,
428 : : char ***argv G_GNUC_UNUSED)
429 : : {
430 : 1 : return REGRESS_FOO_SUCCESS_INT;
431 : : }
432 : :
433 : : GType
434 : 2 : regress_foo_enum_type_get_type (void)
435 : : {
436 : : static GType etype = 0;
437 [ + - ]: 2 : if (G_UNLIKELY (etype == 0))
438 : : {
439 : : static const GEnumValue values[] = {
440 : : { REGRESS_FOO_ENUM_ALPHA, "REGRESS_FOO_ENUM_ALPHA", "alpha" },
441 : : { REGRESS_FOO_ENUM_BETA, "REGRESS_FOO_ENUM_BETA", "beta" },
442 : : { REGRESS_FOO_ENUM_DELTA, "REGRESS_FOO_ENUM_DELTA", "delta" },
443 : : { 0, NULL, NULL }
444 : : };
445 : 2 : etype = g_enum_register_static (g_intern_static_string ("RegressFooEnumType"), values);
446 : : }
447 : 2 : return etype;
448 : : }
449 : :
450 : : int
451 : 1 : regress_foo_enum_method (RegressFooEnumType regress_foo_enum G_GNUC_UNUSED)
452 : : {
453 : 1 : return 0;
454 : : }
455 : :
456 : : int
457 : 2 : regress_foo_enum_type_method (RegressFooEnumType regress_foo_enum)
458 : : {
459 : 2 : return (regress_foo_enum + 1) % 3;
460 : : }
461 : :
462 : : RegressFooEnumType
463 : 2 : regress_foo_enum_type_returnv (int x)
464 : : {
465 : 2 : return (x + 1) % 3;
466 : : }
467 : :
468 : : GType
469 : 2 : regress_foo_flags_type_get_type (void)
470 : : {
471 : : static GType etype = 0;
472 [ + - ]: 2 : if (G_UNLIKELY (etype == 0))
473 : : {
474 : : static const GFlagsValue values[] = {
475 : : { REGRESS_FOO_FLAGS_FIRST, "REGRESS_FOO_FLAGS_FIRST", "first" },
476 : : { REGRESS_FOO_FLAGS_SECOND, "REGRESS_FOO_FLAGS_SECOND", "second" },
477 : : { REGRESS_FOO_FLAGS_THIRD, "REGRESS_FOO_FLAGS_THIRD", "third" },
478 : : { 0, NULL, NULL }
479 : : };
480 : 2 : etype = g_flags_register_static (g_intern_static_string ("RegressFooFlagsType"), values);
481 : : }
482 : 2 : return etype;
483 : : }
484 : :
485 : : struct _RegressFooBoxed
486 : : {
487 : : int private;
488 : : };
489 : :
490 : : RegressFooBoxed *
491 : 0 : regress_foo_boxed_copy (const RegressFooBoxed *boxed)
492 : : {
493 : : #if GLIB_CHECK_VERSION(2, 67, 5)
494 : 0 : return (RegressFooBoxed *) g_memdup2 (boxed, sizeof (RegressFooBoxed));
495 : : #else
496 : : return (RegressFooBoxed *) g_memdup (boxed, sizeof (RegressFooBoxed));
497 : : #endif
498 : : }
499 : :
500 : : void
501 : 1 : regress_foo_boxed_free (RegressFooBoxed *boxed)
502 : : {
503 : 1 : g_slice_free (RegressFooBoxed, boxed);
504 : 1 : }
505 : :
506 : : GType
507 : 7 : regress_foo_boxed_get_type (void)
508 : : {
509 : : static GType our_type = 0;
510 : :
511 [ + + ]: 7 : if (our_type == 0)
512 : 2 : our_type = g_boxed_type_register_static ("RegressFooBoxed",
513 : : (GBoxedCopyFunc) regress_foo_boxed_copy,
514 : : (GBoxedFreeFunc) regress_foo_boxed_free);
515 : 7 : return our_type;
516 : : }
517 : :
518 : : RegressFooBoxed *
519 : 1 : regress_foo_boxed_new (void)
520 : : {
521 : 1 : return g_slice_new0 (RegressFooBoxed);
522 : : }
523 : :
524 : : void
525 : 1 : regress_foo_boxed_method (RegressFooBoxed *boxed G_GNUC_UNUSED)
526 : : {
527 : 1 : }
528 : :
529 : : /* RegressFooDbus */
530 : : struct _RegressFooDBusData
531 : : {
532 : : double private;
533 : : };
534 : :
535 : : RegressFooDBusData *
536 : 0 : regress_foo_dbus_data_copy (const RegressFooDBusData *boxed)
537 : : {
538 : : #if GLIB_CHECK_VERSION(2, 67, 5)
539 : 0 : return (RegressFooDBusData *) g_memdup2 (boxed, sizeof (RegressFooDBusData));
540 : : #else
541 : : return (RegressFooDBusData *) g_memdup (boxed, sizeof (RegressFooDBusData));
542 : : #endif
543 : : }
544 : :
545 : : void
546 : 0 : regress_foo_dbus_data_free (RegressFooDBusData *boxed)
547 : : {
548 : 0 : g_slice_free (RegressFooDBusData, boxed);
549 : 0 : }
550 : :
551 : : GType
552 : 1 : regress_foo_dbus_data_get_type (void)
553 : : {
554 : : static GType our_type = 0;
555 : :
556 [ + - ]: 1 : if (our_type == 0)
557 : 1 : our_type = g_boxed_type_register_static ("RegressFooDBusData",
558 : : (GBoxedCopyFunc) regress_foo_dbus_data_copy,
559 : : (GBoxedFreeFunc) regress_foo_dbus_data_free);
560 : 1 : return our_type;
561 : : }
562 : :
563 : : static RegressFooBRect *
564 : 1 : regress_foo_brect_copy (const RegressFooBRect *boxed)
565 : : {
566 : : #if GLIB_CHECK_VERSION(2, 67, 5)
567 : 1 : return (RegressFooBRect *) g_memdup2 (boxed, sizeof (RegressFooBRect));
568 : : #else
569 : : return (RegressFooBRect *) g_memdup (boxed, sizeof (RegressFooBRect));
570 : : #endif
571 : : }
572 : :
573 : : GType
574 : 11 : regress_foo_brect_get_type (void)
575 : : {
576 : : static GType our_type = 0;
577 : :
578 [ + + ]: 11 : if (our_type == 0)
579 : 2 : our_type = g_boxed_type_register_static ("RegressFooBRect",
580 : : (GBoxedCopyFunc) regress_foo_brect_copy,
581 : : (GBoxedFreeFunc) g_free);
582 : 11 : return our_type;
583 : : }
584 : :
585 : : RegressFooBRect *
586 : 1 : regress_foo_brect_new (double x, double y)
587 : : {
588 : 1 : RegressFooBRect *retval = g_new(RegressFooBRect, 1);
589 : 1 : retval->x = x;
590 : 1 : retval->y = y;
591 : 1 : return retval;
592 : : }
593 : :
594 : : void
595 : 2 : regress_foo_brect_add (RegressFooBRect *b1 G_GNUC_UNUSED, RegressFooBRect *b2 G_GNUC_UNUSED)
596 : : {
597 : 2 : }
598 : :
599 : : static RegressFooBUnion *
600 : 0 : regress_foo_bunion_copy (const RegressFooBUnion *boxed)
601 : : {
602 : : #if GLIB_CHECK_VERSION(2, 67, 5)
603 : 0 : return (RegressFooBUnion *) g_memdup2 (boxed, sizeof (RegressFooBUnion));
604 : : #else
605 : : return (RegressFooBUnion *) g_memdup (boxed, sizeof (RegressFooBUnion));
606 : : #endif
607 : : }
608 : :
609 : : GType
610 : 1 : regress_foo_bunion_get_type (void)
611 : : {
612 : : static GType our_type = 0;
613 : :
614 [ + - ]: 1 : if (our_type == 0)
615 : 1 : our_type = g_boxed_type_register_static ("RegressFooBUnion",
616 : : (GBoxedCopyFunc) regress_foo_bunion_copy,
617 : : (GBoxedFreeFunc) g_free);
618 : 1 : return our_type;
619 : : }
620 : :
621 : : RegressFooBUnion *
622 : 0 : regress_foo_bunion_new (void)
623 : : {
624 : 0 : return g_new0(RegressFooBUnion, 1);
625 : : }
626 : :
627 : : void
628 : 1 : regress_foo_test_unsigned (unsigned int uint G_GNUC_UNUSED)
629 : : {
630 : 1 : }
631 : :
632 : : /**
633 : : * regress_foo_test_string_array:
634 : : * @array: (array zero-terminated=1):
635 : : */
636 : : void
637 : 1 : regress_foo_test_string_array (char **array G_GNUC_UNUSED)
638 : : {
639 : 1 : }
640 : :
641 : : /**
642 : : * regress_foo_test_string_array_with_g:
643 : : * @array: (array zero-terminated=1):
644 : : */
645 : : void
646 : 1 : regress_foo_test_string_array_with_g (gchar **array G_GNUC_UNUSED)
647 : : {
648 : 1 : }
649 : :
650 : : /**
651 : : * regress_foo_test_array:
652 : : *
653 : : * Returns: (element-type utf8) (transfer container):
654 : : */
655 : : GArray *
656 : 1 : regress_foo_test_array (void)
657 : : {
658 : 1 : return NULL;
659 : : }
660 : :
661 : : /**
662 : : * regress_foo_rectangle_new: (skip)
663 : : *
664 : : * This is a C convenience constructor; we have to (skip)
665 : : * it because it's not a boxed type.
666 : : */
667 : : RegressFooRectangle *
668 : 0 : regress_foo_rectangle_new (int x, int y, int width, int height)
669 : : {
670 : 0 : RegressFooRectangle *r = g_slice_new (RegressFooRectangle);
671 : 0 : r->x = x;
672 : 0 : r->y = y;
673 : 0 : r->width = width;
674 : 0 : r->height = height;
675 : 0 : return r;
676 : : }
677 : :
678 : : /**
679 : : * regress_foo_rectangle_add:
680 : : * @r1: add to this rect
681 : : * @r2: source rectangle
682 : : */
683 : : void
684 : 2 : regress_foo_rectangle_add (RegressFooRectangle *r1 G_GNUC_UNUSED,
685 : : const RegressFooRectangle *r2 G_GNUC_UNUSED)
686 : : {
687 : 2 : }
688 : :
689 : : void
690 : 1 : regress_foo_method_external_references (UtilityObject *object G_GNUC_UNUSED,
691 : : UtilityEnumType e G_GNUC_UNUSED,
692 : : UtilityFlagType f G_GNUC_UNUSED,
693 : : UtilityStruct s G_GNUC_UNUSED)
694 : : {
695 : 1 : }
696 : :
697 : : /* RegressFooHidden */
698 : :
699 : : struct _RegressFooHidden
700 : : {
701 : : char *frob;
702 : : };
703 : :
704 : : RegressFooHidden *
705 : 0 : regress_foo_hidden_copy (const RegressFooHidden *boxed)
706 : : {
707 : : #if GLIB_CHECK_VERSION(2, 67, 5)
708 : 0 : return (RegressFooHidden *) g_memdup2 (boxed, sizeof (RegressFooHidden));
709 : : #else
710 : : return (RegressFooHidden *) g_memdup (boxed, sizeof (RegressFooHidden));
711 : : #endif
712 : : }
713 : :
714 : : void
715 : 0 : regress_foo_hidden_free (RegressFooHidden *boxed)
716 : : {
717 : 0 : g_slice_free (RegressFooHidden, boxed);
718 : 0 : }
719 : :
720 : : GType
721 : 2 : regress_foo_hidden_get_type (void)
722 : : {
723 : : static GType our_type = 0;
724 : :
725 [ + - ]: 2 : if (our_type == 0)
726 : 2 : our_type = g_boxed_type_register_static ("RegressFooHidden",
727 : : (GBoxedCopyFunc) regress_foo_hidden_copy,
728 : : (GBoxedFreeFunc) regress_foo_hidden_free);
729 : 2 : return our_type;
730 : : }
731 : :
732 : : GType
733 : 1 : regress_foo_error_get_type (void)
734 : : {
735 : : static GType etype = 0;
736 [ + - ]: 1 : if (G_UNLIKELY (etype == 0))
737 : : {
738 : : static const GEnumValue values[] = {
739 : : { REGRESS_FOO_ERROR_GOOD, "REGRESS_FOO_ERROR_GOOD", "good" },
740 : : { REGRESS_FOO_ERROR_BAD, "REGRESS_FOO_ERROR_BAD", "bad" },
741 : : { REGRESS_FOO_ERROR_UGLY, "REGRESS_FOO_ERROR_UGLY", "ugly" },
742 : : { 0, NULL, NULL }
743 : : };
744 : 1 : etype = g_enum_register_static (g_intern_static_string ("RegressFooError"), values);
745 : : }
746 : 1 : return etype;
747 : : }
748 : :
749 : : GQuark
750 : 1 : regress_foo_error_quark (void)
751 : : {
752 : 1 : return g_quark_from_static_string ("regress_foo-error-quark");
753 : : }
754 : :
755 : : void
756 : 0 : regress_foo_some_variant (guint x G_GNUC_UNUSED,
757 : : va_list args G_GNUC_UNUSED)
758 : : {
759 : 0 : }
760 : :
761 : : GType regress_foo_tile_handler_get_type (void);
762 : :
763 : : /* This setup of a totally hidden parent class matches
764 : : * http://bugzilla.gnome.org/show_bug.cgi?id=561360
765 : : */
766 : : #define REGRESS_FOO_TYPE_TILE_HANDLER (regress_foo_tile_handler_get_type ())
767 : : #define REGRESS_FOO_TILE_HANDLER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), REGRESS_FOO_TYPE_TILE_HANDLER, RegressFooTileHandler))
768 : : #define REGRESS_FOO_IS_TILE_HANDLER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), REGRESS_FOO_TYPE_TILE_HANDLER))
769 : :
770 : : struct _RegressFooTileHandler
771 : : {
772 : : RegressFooObject parent_instance;
773 : : };
774 : :
775 : : struct _RegressFooTileHandlerClass
776 : : {
777 : : RegressFooObjectClass parent_class;
778 : : };
779 : :
780 : : typedef struct _RegressFooTileHandler RegressFooTileHandler;
781 : : typedef struct _RegressFooTileHandlerClass RegressFooTileHandlerClass;
782 : :
783 [ + + + - : 6 : G_DEFINE_TYPE (RegressFooTileHandler, regress_foo_tile_handler, REGRESS_FOO_TYPE_OBJECT);
+ - ]
784 : :
785 : : static void
786 : 2 : regress_foo_tile_handler_class_init (RegressFooTileHandlerClass *klass G_GNUC_UNUSED)
787 : : {
788 : 2 : }
789 : :
790 : : static void
791 : 1 : regress_foo_tile_handler_init (RegressFooTileHandler *object G_GNUC_UNUSED)
792 : : {
793 : 1 : }
794 : :
795 : : struct _RegressFooBuffer
796 : : {
797 : : RegressFooTileHandler parent_instance;
798 : : };
799 : :
800 : : struct _RegressFooBufferClass
801 : : {
802 : : RegressFooTileHandlerClass parent_class;
803 : : };
804 : :
805 [ + + + - : 9 : G_DEFINE_TYPE (RegressFooBuffer, regress_foo_buffer, REGRESS_FOO_TYPE_TILE_HANDLER);
+ + ]
806 : :
807 : : static void
808 : 2 : regress_foo_buffer_class_init (RegressFooBufferClass *klass G_GNUC_UNUSED)
809 : : {
810 : 2 : }
811 : :
812 : : static void
813 : 1 : regress_foo_buffer_init (RegressFooBuffer *object G_GNUC_UNUSED)
814 : : {
815 : 1 : }
816 : :
817 : : void
818 : 1 : regress_foo_buffer_some_method (RegressFooBuffer *buffer G_GNUC_UNUSED)
819 : : {
820 : 1 : }
821 : :
822 : : struct _RegressFooOtherObject
823 : : {
824 : : GObject parent_instance;
825 : : };
826 : :
827 : : struct _RegressFooOtherObjectClass
828 : : {
829 : : GObjectClass parent_class;
830 : : };
831 : :
832 [ + + + - : 6 : G_DEFINE_TYPE (RegressFooOtherObject, regress_foo_other_object, G_TYPE_OBJECT);
+ - ]
833 : :
834 : : static void
835 : 2 : regress_foo_other_object_class_init (RegressFooOtherObjectClass *klass G_GNUC_UNUSED)
836 : : {
837 : 2 : }
838 : :
839 : : static void
840 : 1 : regress_foo_other_object_init (RegressFooOtherObject *object G_GNUC_UNUSED)
841 : : {
842 : 1 : }
843 : :
844 : : #define REGRESS_FOO_DEFINE_SHOULD_NOT_BE_EXPOSED "should not be exposed"
845 : :
846 : : /**
847 : : * regress_foo_skip_me: (skip)
848 : : * @fs: a #RegressFooSkippable
849 : : *
850 : : * Does something that's only interesting from C and should not be
851 : : * exposed to language bindings.
852 : : */
853 : : void
854 : 0 : regress_foo_skip_me (RegressFooSkippable fs G_GNUC_UNUSED)
855 : : {
856 : 0 : }
857 : :
858 : : /**
859 : : * RegressFooForeignStruct: (foreign)
860 : : *
861 : : */
862 : :
863 : : RegressFooForeignStruct *
864 : 0 : regress_foo_foreign_struct_new (void)
865 : : {
866 : 0 : return g_slice_new0 (RegressFooForeignStruct);
867 : : }
868 : :
869 : : RegressFooForeignStruct *
870 : 0 : regress_foo_foreign_struct_copy (RegressFooForeignStruct *original)
871 : : {
872 : : RegressFooForeignStruct *copy;
873 : 0 : copy = regress_foo_foreign_struct_new ();
874 : 0 : copy->regress_foo = original->regress_foo;
875 : 0 : return copy;
876 : : }
877 : :
878 : : /**
879 : : * regress_foo_test_varargs_callback: (skip)
880 : : *
881 : : */
882 : : void
883 : 0 : regress_foo_test_varargs_callback (gint i G_GNUC_UNUSED,
884 : : RegressFooVarargsCallback callback G_GNUC_UNUSED)
885 : : {
886 : 0 : }
887 : :
888 : : /**
889 : : * regress_foo_test_varargs_callback2: (skip)
890 : : *
891 : : */
892 : : void
893 : 0 : regress_foo_test_varargs_callback2 (RegressFooVarargsCallback callback G_GNUC_UNUSED)
894 : : {
895 : 0 : }
896 : :
897 : : /**
898 : : * regress_foo_test_varargs_callback3: (skip)
899 : : *
900 : : */
901 : : void
902 : 0 : regress_foo_test_varargs_callback3 (RegressFooVarargsCallback callback G_GNUC_UNUSED,
903 : : RegressFooVarargsCallback callback2 G_GNUC_UNUSED)
904 : : {
905 : 0 : }
906 : :
907 : : /**
908 : : * regress_foo_object_a_global_method:
909 : : * @obj: a #UtilityObject
910 : : *
911 : : * This shouldn't be scanned as a method of UtilityObject.
912 : : */
913 : : void
914 : 1 : regress_foo_object_a_global_method (UtilityObject *obj G_GNUC_UNUSED)
915 : : {
916 : 1 : }
917 : :
918 : : /**
919 : : * regress_foo_object_append_new_stack_layer:
920 : : *
921 : : * This shouldn't be scanned as a constructor.
922 : : *
923 : : * Returns: (transfer none):
924 : : */
925 : : RegressFooOtherObject *
926 : 2 : regress_foo_object_append_new_stack_layer (RegressFooObject *obj G_GNUC_UNUSED,
927 : : int x G_GNUC_UNUSED)
928 : : {
929 : 2 : return NULL;
930 : : }
931 : :
932 : : /**
933 : : * regress_foo_not_a_constructor_new:
934 : : *
935 : : * This should be scanned as a top-level function, and shouldn't cause
936 : : * a "Can't find matching type for constructor" warning.
937 : : *
938 : : * Returns: (transfer none):
939 : : */
940 : : RegressFooObject *
941 : 1 : regress_foo_not_a_constructor_new (void)
942 : : {
943 : 1 : return NULL;
944 : : }
|