Debian Codegraph @

subprojects/gobject-introspection-tests/utility.h

raw
1 /*
2 SPDX-License-Identifier: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT
3 SPDX-FileCopyrightText: 2008 Colin Walters <[email protected]>
4 SPDX-FileCopyrightText: 2008 Johan Dahlin
5 SPDX-FileCopyrightText: 2008-2009 Andreas Rottmann <[email protected]>
6 */
7
8 #pragma once
9
10 #include <glib-object.h>
11 #include <glib.h>
12
13 #include "gitestmacros.h"
14
15 #define UTILITY_TYPE_OBJECT (utility_object_get_type ())
16 #define UTILITY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), UTILITY_TYPE_OBJECT, UtilityObject))
17 #define UTILITY_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), UTILITY_TYPE_OBJECT))
18
19 typedef struct _UtilityObject UtilityObject;
20 typedef struct _UtilityObjectClass UtilityObjectClass;
21
22 struct _UtilityObject
23 {
24 GObject parent_instance;
25 /*< private >*/
26 void *user_data;
27 GDestroyNotify destroy_notify;
28 };
29
30 struct _UtilityObjectClass
31 {
32 GObjectClass parent_class;
33 };
34
35 /* This one is similar to Pango.Glyph */
36 typedef guint32 UtilityGlyph;
37
38 typedef struct
39 {
40 int tag;
41 union
42 {
43 gpointer v_pointer;
44 double v_real;
45 long v_integer;
46 } value;
47 } UtilityTaggedValue;
48
49 typedef union
50 {
51 guint8 value;
52 struct
53 {
54 guint8 first_nibble : 4;
55 guint8 second_nibble : 4;
56 } parts;
57 } UtilityByte;
58
59 /* This one is similiar to Soup.Buffer */
60 typedef struct
61 {
62 const char *data;
63 gsize length;
64 } UtilityBuffer;
65
66 typedef void (*UtilityFileFunc) (const char *path, gpointer user_data);
67
68 GI_TEST_EXTERN
69 GType utility_object_get_type (void) G_GNUC_CONST;
70
71 GI_TEST_EXTERN
72 void utility_object_watch_dir (UtilityObject *object,
73 const char *path,
74 UtilityFileFunc func,
75 gpointer user_data,
76 GDestroyNotify destroy);
77
78 typedef enum
79 {
80 UTILITY_ENUM_A,
81 UTILITY_ENUM_B,
82 UTILITY_ENUM_C
83 } UtilityEnumType;
84
85 /* The shift operators here should imply bitfield */
86 typedef enum
87 {
88 UTILITY_FLAG_A = 1 << 0,
89 UTILITY_FLAG_B = 1 << 1,
90 UTILITY_FLAG_C = 1 << 2
91 } UtilityFlagType;
92
93 typedef struct
94 {
95 int field;
96 guint bitfield1 : 3;
97 guint bitfield2 : 2;
98 guint8 data[16];
99 } UtilityStruct;
100
101 typedef union
102 {
103 char *pointer;
104 glong integer;
105 double real;
106 } UtilityUnion;
107
108 GI_TEST_EXTERN
109 void utility_dir_foreach (const char *path, UtilityFileFunc func, gpointer user_data);