8b1890349179c871c00cf88a45313e176a5bbd49
[gnome.gobject-introspection] / gir / everything.h
1 #ifndef __GITESTTYPES_H__
2 #define __GITESTTYPES_H__
3
4 #include <glib-object.h>
5 #include <time.h>
6
7 /* basic types */
8 gboolean test_boolean (gboolean in);
9 gint8 test_int8 (gint8 in);
10 guint8 test_uint8 (guint8 in);
11 gint16 test_int16 (gint16 in);
12 guint16 test_uint16 (guint16 in);
13 gint32 test_int32 (gint32 in);
14 guint32 test_uint32 (guint32 in);
15 gint64 test_int64 (gint64 in);
16 guint64 test_uint64 (guint64 in);
17 gshort test_short (gshort in);
18 gushort test_ushort (gushort in);
19 gint test_int (gint in);
20 guint test_uint (guint in);
21 glong test_long (glong in);
22 gulong test_ulong (gulong in);
23 gssize test_ssize (gssize in);
24 gsize test_size (gsize in);
25 gfloat test_float (gfloat in);
26 gdouble test_double (gdouble in);
27 time_t test_timet (time_t in);
28 GType test_gtype (GType in);
29
30 /* utf8 */
31 G_CONST_RETURN char *test_utf8_const_return (void);
32 char *test_utf8_nonconst_return (void);
33 void test_utf8_nonconst_in (char *in);
34 void test_utf8_const_in (const char *in);
35 void test_utf8_out (char **out);
36 void test_utf8_inout (char **inout);
37 GSList *test_filename_return (void);
38
39 /* multiple output arguments */
40 void test_multi_double_args (gdouble in, gdouble *one, gdouble *two);
41 void test_utf8_out_out (char **out0, char **out1);
42 char *test_utf8_out_nonconst_return (char **out);
43
44 /* non-basic-types */
45 /* array */
46 gboolean test_strv_in (char **arr);
47 int test_array_int_in (int n_ints, int *ints);
48 void test_array_int_out (int *n_ints, int **ints);
49 void test_array_int_inout (int *n_ints, int **ints);
50 int test_array_gint8_in (int n_ints, gint8 *ints);
51 int test_array_gint16_in (int n_ints, gint16 *ints);
52 gint32 test_array_gint32_in (int n_ints, gint32 *ints);
53 gint64 test_array_gint64_in (int n_ints, gint64 *ints);
54 char *test_array_gtype_in (int n_types, GType *types);
55 char **test_strv_out_container (void);
56 char **test_strv_out (void);
57 const char * const * test_strv_out_c (void);
58 void   test_strv_outarg (char ***retp);
59 int test_array_fixed_size_int_in (int *ints);
60 void test_array_fixed_size_int_out (int **ints);
61 int *test_array_fixed_size_int_return (void);
62
63 /* transfer tests */
64 int test_array_int_in_take (int n_ints, int *ints);
65 gboolean test_strv_in_container (char **arr);
66
67 int *test_array_int_full_out(int *len);
68 int *test_array_int_none_out(int *len);
69
70 /* interface */
71 /* GList */
72 G_CONST_RETURN GList *test_glist_nothing_return (void);
73 GList *test_glist_nothing_return2 (void);
74 GList *test_glist_container_return (void);
75 GList *test_glist_everything_return (void);
76 void test_glist_nothing_in (const GList *in);
77 void test_glist_nothing_in2 (GList *in);
78 void test_glist_container_in (GList *in);
79 void test_glist_everything_in (GList *in);
80 void test_glist_free (GList *in);
81
82 /* GSList */
83 G_CONST_RETURN GSList *test_gslist_nothing_return (void);
84 GSList *test_gslist_nothing_return2 (void);
85 GSList *test_gslist_container_return (void);
86 GSList *test_gslist_everything_return (void);
87 void test_gslist_nothing_in (const GSList *in);
88 void test_gslist_nothing_in2 (GSList *in);
89 void test_gslist_container_in (GSList *in);
90 void test_gslist_everything_in (GSList *in);
91 void test_gslist_free (GSList *in);
92
93 /* GHashTable */
94 G_CONST_RETURN GHashTable *test_ghash_null_return (void);
95 G_CONST_RETURN GHashTable *test_ghash_nothing_return (void);
96 GHashTable *test_ghash_nothing_return2 (void);
97 GHashTable *test_ghash_container_return (void);
98 GHashTable *test_ghash_everything_return (void);
99 void test_ghash_null_in (const GHashTable *in);
100 void test_ghash_nothing_in (const GHashTable *in);
101 void test_ghash_nothing_in2 (GHashTable *in);
102 void test_ghash_container_in (GHashTable *in);
103 void test_ghash_everything_in (GHashTable *in);
104 void test_ghash_free (GHashTable *in);
105 GHashTable *test_ghash_nested_everything_return (void);
106 GHashTable *test_ghash_nested_everything_return2 (void);
107
108 /* error? */
109
110 /* closure */
111 int test_closure (GClosure *closure);
112 int test_closure_one_arg (GClosure *closure, int arg);
113
114 /* value */
115 int test_int_value_arg(const GValue *v);
116 const GValue *test_value_return(int i);
117
118 /* enums / flags */
119
120 typedef enum
121 {
122   TEST_VALUE1,
123   TEST_VALUE2,
124   TEST_VALUE3 = 42
125 } TestEnum;
126
127 typedef enum
128 {
129   TEST_FLAG1 = 1 << 0,
130   TEST_FLAG2 = 1 << 1,
131   TEST_FLAG3 = 1 << 2,
132 } TestFlags;
133
134 GType test_enum_get_type (void) G_GNUC_CONST;
135 #define TEST_TYPE_ENUM (test_enum_get_type ())
136 GType test_flags_get_type (void) G_GNUC_CONST;
137 #define TES_TYPE_FLAGS (test_flags_get_type ())
138
139 const gchar * test_enum_param(TestEnum e);
140
141 /* structures */
142 typedef struct _TestStructA TestStructA;
143 typedef struct _TestStructB TestStructB;
144
145 struct _TestStructA
146 {
147   gint some_int;
148   gint8 some_int8;
149   gdouble some_double;
150   TestEnum some_enum;
151 };
152
153 void test_struct_a_clone (TestStructA *a,
154                           TestStructA *a_out);
155
156 struct _TestStructB
157 {
158   gint8 some_int8;
159   TestStructA nested_a;
160 };
161
162 void test_struct_b_clone (TestStructB *b,
163                           TestStructB *b_out);
164
165 /* This one has a non-basic member */
166 struct _TestStructC
167 {
168   gint another_int;
169   GObject *obj;
170 };
171
172 /* plain-old-data boxed types */
173 typedef struct _TestSimpleBoxedA TestSimpleBoxedA;
174 typedef struct _TestSimpleBoxedB TestSimpleBoxedB;
175
176 struct _TestSimpleBoxedA
177 {
178   gint some_int;
179   gint8 some_int8;
180   gdouble some_double;
181   TestEnum some_enum;
182 };
183
184 GType                   test_simple_boxed_a_get_type     (void);
185 TestSimpleBoxedA *      test_simple_boxed_a_copy         (TestSimpleBoxedA *a);
186 gboolean                test_simple_boxed_a_equals       (TestSimpleBoxedA *a,
187                                                           TestSimpleBoxedA *other_a);
188 const TestSimpleBoxedA *test_simple_boxed_a_const_return (void);
189
190
191 struct _TestSimpleBoxedB
192 {
193   gint8 some_int8;
194   TestSimpleBoxedA nested_a;
195 };
196
197 GType             test_simple_boxed_b_get_type (void);
198 TestSimpleBoxedB *test_simple_boxed_b_copy     (TestSimpleBoxedB *b);
199
200 /* opaque boxed */
201 #define TEST_TYPE_BOXED (test_boxed_get_type())
202
203 typedef struct _TestBoxed TestBoxed;
204 typedef struct _TestBoxedPrivate TestBoxedPrivate;
205
206 struct _TestBoxed
207 {
208   gint8 some_int8;
209   TestSimpleBoxedA nested_a;
210
211   TestBoxedPrivate *priv;
212 };
213
214 GType      test_boxed_get_type (void);
215 TestBoxed *test_boxed_new      (void);
216 TestBoxed *test_boxed_copy     (TestBoxed *boxed);
217 gboolean   test_boxed_equals   (TestBoxed *boxed,
218                                 TestBoxed *other);
219
220 /* gobject */
221 #define TEST_TYPE_OBJ              (test_obj_get_type ())
222 #define TEST_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_OBJ, TestObj))
223 #define TEST_IS_OBJECT(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_OBJ))
224 #define TEST_OBJ_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_OBJ, TestObjClass))
225
226 typedef struct _TestObj          TestObj;
227 typedef struct _TestObjClass     TestObjClass;
228
229 /**
230  * TestObj:
231  * @bare: (allow-none):
232  */
233 struct _TestObj
234 {
235   GObject parent_instance;
236
237   GObject *bare;
238   TestBoxed *boxed;
239 };
240
241 struct _TestObjClass
242 {
243   GObjectClass parent_class;
244
245   int (*matrix) (TestObj *obj, const char *somestr);
246
247   guint test_signal;
248   guint test_signal_with_static_scope_arg;
249 };
250
251 GType      test_obj_get_type (void);
252 TestObj*   test_obj_new_from_file (const char *x, GError **error);
253 void       test_obj_set_bare (TestObj *obj, GObject *bare);
254 int        test_obj_instance_method (TestObj *obj);
255 double     test_obj_static_method (int x);
256
257 /* virtual */
258 int        test_obj_do_matrix (TestObj *obj, const char *somestr);
259
260 /* inheritance */
261 #define TEST_TYPE_SUB_OBJ           (test_sub_obj_get_type ())
262 #define TEST_SUB_OBJECT(object)     (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_SUB_OBJ, TestSubObj))
263 #define TEST_IS_SUB_OBJECT(object)  (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_SUB_OBJ))
264 #define TEST_SUB_OBJ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SUB_OBJ, TestSubObjClass))
265
266 typedef struct _TestSubObj         TestSubObj;
267 typedef struct _TestSubObjClass    TestSubObjClass;
268
269 struct _TestSubObj
270 {
271   TestObj parent_instance;
272 };
273
274 struct _TestSubObjClass
275 {
276   TestObjClass parent_class;
277 };
278
279 GType       test_sub_obj_get_type (void);
280 TestSubObj* test_sub_obj_new (void);
281 void        test_sub_obj_unset_bare (TestSubObj *obj);
282 int         test_sub_obj_instance_method (TestSubObj *obj);
283
284 /* callback */
285 typedef int (*TestCallback) ();
286 typedef int (*TestCallbackUserData) (gpointer user_data);
287
288 int test_callback (TestCallback callback);
289 int test_callback_user_data (TestCallbackUserData callback,
290                              gpointer user_data);
291 int test_callback_destroy_notify (TestCallbackUserData callback,
292                                   gpointer user_data,
293                                   GDestroyNotify notify);
294 int test_callback_thaw_notifications (void);
295
296 void test_callback_async (TestCallbackUserData callback, gpointer user_data);
297 int test_callback_thaw_async (void);
298
299 int test_callback_infinite (TestCallbackUserData callback,
300                            gpointer user_data);
301
302 /* interface */
303 #define TEST_TYPE_INTERFACE              (test_interface_get_type ())
304 #define TEST_INTERFACE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_INTERFACE, TestInterface))
305 #define TEST_IS_INTERFACE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_INTERFACE))
306 #define TEST_INTERFACE_GET_IFACE(obj)    (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_INTERFACE, TestInterfaceIface))
307
308 typedef struct _TestInterfaceIface TestInterfaceIface;
309
310 struct _TestInterfaceIface {
311     GTypeInterface base_iface;
312 };
313
314 GType test_interface_get_type (void) G_GNUC_CONST;
315
316 /* gobject with non-standard prefix */
317 #define TEST_TYPE_WI_802_1X              (test_wi_802_1x_get_type ())
318 #define TEST_WI_802_1X(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_WI_802_1X, TestWi8021x))
319 #define TEST_IS_WI_802_1X(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_WI_802_1X))
320 #define TEST_WI_802_1X_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_WI_802_1X, TestWi8021xClass))
321
322 typedef struct
323 {
324   GObject parent_instance;
325
326   gboolean testbool;
327 } TestWi8021x;
328
329 typedef struct
330 {
331   GObjectClass parent_class;
332 } TestWi8021xClass;
333
334 GType        test_wi_802_1x_get_type (void);
335 TestWi8021x* test_wi_802_1x_new (void);
336 gboolean     test_wi_802_1x_get_testbool (TestWi8021x *obj);
337 void         test_wi_802_1x_set_testbool (TestWi8021x *obj, gboolean v);
338 int          test_wi_802_1x_static_method (int x);
339
340 #endif /* __GITESTTYPES_H__ */