541e51c3b4e70529810b1e92b9414be4c2f9b675
[gnome.gobject-introspection] / tests / everything / everything.h
1 #ifndef __GITESTTYPES_H__
2 #define __GITESTTYPES_H__
3
4 #include <glib-object.h>
5
6 /* basic types */
7 gboolean test_boolean (gboolean in);
8 gint8 test_int8 (gint8 in);
9 guint8 test_uint8 (guint8 in);
10 gint16 test_int16 (gint16 in);
11 guint16 test_uint16 (guint16 in);
12 gint32 test_int32 (gint32 in);
13 guint32 test_uint32 (guint32 in);
14 gint64 test_int64 (gint64 in);
15 guint64 test_uint64 (guint64 in);
16 gint test_int (gint in);
17 guint test_uint (guint in);
18 glong test_long (glong in);
19 gulong test_ulong (gulong in);
20 gssize test_ssize (gssize in);
21 gsize test_size (gsize in);
22 gfloat test_float (gfloat in);
23 gdouble test_double (gdouble in);
24 /* time_t? */
25 GType test_gtype (GType in);
26 #if 0
27 /* utf8 */
28 G_CONST_RETURN char *test_utf8_const_return (void);
29 char *test_utf8_nonconst_return (void);
30 void test_utf8_nonconst_in (char *in);
31 void test_utf8_const_in (const char *in);
32 void test_utf8_out (char **out);
33 void test_utf8_inout (char **inout);
34 #endif
35 GSList *test_filename_return (void);
36 /* non-basic-types */
37 /* array */
38 gboolean test_strv_in (char **arr);
39 int test_array_int_in (int n_ints, int *ints);
40 char *test_array_gtype_in (int n_types, GType *types);
41 char **test_strv_out (void);
42 /* interface */
43 /* GList */
44 G_CONST_RETURN GList *test_glist_nothing_return (void);
45 GList *test_glist_nothing_return2 (void);
46 GList *test_glist_container_return (void);
47 GList *test_glist_everything_return (void);
48 void test_glist_nothing_in (const GList *in);
49 void test_glist_nothing_in2 (GList *in);
50 void test_glist_container_in (GList *in);
51 void test_glist_everything_in (GList *in);
52 void test_glist_free (GList *in);
53
54 /* GSList */
55 G_CONST_RETURN GSList *test_gslist_nothing_return (void);
56 GSList *test_gslist_nothing_return2 (void);
57 GSList *test_gslist_container_return (void);
58 GSList *test_gslist_everything_return (void);
59 void test_gslist_nothing_in (const GSList *in);
60 void test_gslist_nothing_in2 (GSList *in);
61 void test_gslist_container_in (GSList *in);
62 void test_gslist_everything_in (GSList *in);
63 void test_gslist_free (GSList *in);
64
65 /* ghash? */
66 /* error? */
67
68 /* enums / flags */
69
70 typedef enum
71 {
72   TEST_VALUE1,
73   TEST_VALUE2,
74   TEST_VALUE3 = 42
75 } TestEnum;
76
77 typedef enum
78 {
79   TEST_FLAG1 = 1 << 0,
80   TEST_FLAG2 = 1 << 1,
81   TEST_FLAG3 = 1 << 2,
82 } TestFlags;
83
84 GType test_enum_get_type (void) G_GNUC_CONST;
85 #define TEST_TYPE_ENUM (test_enum_get_type ())
86 GType test_flags_get_type (void) G_GNUC_CONST;
87 #define TES_TYPE_FLAGS (test_flags_get_type ())
88
89 /* structures */
90 typedef struct _TestStructA TestStructA;
91 typedef struct _TestStructB TestStructB;
92
93 struct _TestStructA
94 {
95   gint some_int;
96   gint8 some_int8;
97   gdouble some_double;
98   TestEnum some_enum;
99 };
100
101 void test_struct_a_clone (TestStructA *a,
102                           TestStructA *a_out);
103
104 struct _TestStructB
105 {
106   gint8 some_int8;
107   TestStructA nested_a;
108 };
109
110 void test_struct_b_clone (TestStructB *b,
111                           TestStructB *b_out);
112
113 /* plain-old-data boxed types */
114 typedef struct _TestSimpleBoxedA TestSimpleBoxedA;
115 typedef struct _TestSimpleBoxedB TestSimpleBoxedB;
116
117 struct _TestSimpleBoxedA
118 {
119   gint some_int;
120   gint8 some_int8;
121   gdouble some_double;
122   TestEnum some_enum;
123 };
124
125 GType             test_simple_boxed_a_get_type (void);
126 TestSimpleBoxedA *test_simple_boxed_a_copy     (TestSimpleBoxedA *a);
127 gboolean          test_simple_boxed_a_equals   (TestSimpleBoxedA *a,
128                                                 TestSimpleBoxedA *other_a);
129
130 struct _TestSimpleBoxedB
131 {
132   gint8 some_int8;
133   TestSimpleBoxedA nested_a;
134 };
135
136 GType             test_simple_boxed_b_get_type (void);
137 TestSimpleBoxedB *test_simple_boxed_b_copy     (TestSimpleBoxedB *b);
138
139 /* opaque boxed */
140 typedef struct _TestBoxed TestBoxed;
141 typedef struct _TestBoxedPrivate TestBoxedPrivate;
142
143 struct _TestBoxed
144 {
145   gint8 some_int8;
146   TestSimpleBoxedA nested_a;
147
148   TestBoxedPrivate *priv;
149 };
150
151 GType      test_boxed_get_type (void);
152 TestBoxed *test_boxed_new      (void);
153 TestBoxed *test_boxed_copy     (TestBoxed *boxed);
154 gboolean   test_boxed_equals   (TestBoxed *boxed,
155                                 TestBoxed *other);
156
157 #define TEST_TYPE_OBJ              (test_obj_get_type ())
158 #define TEST_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_OBJ, TestObj))
159 #define TEST_IS_OBJECT(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_OBJ))
160
161 typedef struct _TestObj          TestObj;
162 typedef struct _TestObjClass     TestObjClass;
163 struct _TestObj
164 {
165   GObject parent_instance;
166 };
167
168 struct _TestObjClass
169 {
170   GObjectClass parent_class;
171 };
172
173 GType      test_obj_get_type (void);
174 TestObj*   test_obj_new_from_file (const char *x, GError **error);
175 double     test_obj_static_method (int x);
176
177 #endif /* __GITESTTYPES_H__ */