3a67a01a75b844ea9089797c66b50fee19620411
[gnome.gobject-introspection] / tests / scanner / annotation.c
1 #include "annotation.h"
2
3 static char backslash_parsing_tester = '\\';
4
5 G_DEFINE_TYPE (AnnotationObject, annotation_object, G_TYPE_OBJECT);
6
7 static void
8 annotation_object_class_init (AnnotationObjectClass *klass)
9 {
10
11 }
12
13 static void
14 annotation_object_init (AnnotationObject *object)
15 {
16
17 }
18
19 /**
20  * annotation_object_method:
21  * @object: a #GObject
22  *
23  * Return value: an int
24  **/
25 gint
26 annotation_object_method (AnnotationObject *object)
27 {
28   return 1;
29 }
30
31 /**
32  * annotation_object_out:
33  * @object: a #GObject
34  *
35  * This is a test for out arguments
36  *
37  * @outarg: (out): This is an argument test
38  * Return value: an int
39  */
40 gint
41 annotation_object_out (AnnotationObject *object, int *outarg)
42 {
43   *outarg = 2;
44   return 1;
45 }
46
47 /**
48  * annotation_object_in:
49  * @object: a #GObject
50  *
51  * This is a test for in arguments
52  *
53  * @inarg: (in): This is an argument test
54  * Return value: an int
55  */
56 gint
57 annotation_object_in (AnnotationObject *object, int *inarg)
58 {
59   return *inarg;
60 }
61
62
63 /**
64  * annotation_object_inout:
65  * @object: a #GObject
66  *
67  * This is a test for out arguments
68  *
69  * @inoutarg: (inout): This is an argument test
70  * Return value: an int
71  */
72 gint
73 annotation_object_inout (AnnotationObject *object, int *inoutarg)
74 {
75   return *inoutarg += 1;
76 }
77
78 /**
79  * annotation_object_inout2:
80  * @object: a #GObject
81  *
82  * This is a second test for out arguments
83  *
84  * @inoutarg: (inout): This is an argument test
85  * Return value: an int
86  */
87 gint
88 annotation_object_inout2 (AnnotationObject *object, int *inoutarg)
89 {
90   return *inoutarg += 1;
91 }
92
93
94 /**
95  * annotation_object_inout3:
96  * @object: a #GObject
97  *
98  * This is a 3th test for out arguments
99  *
100  * @inoutarg: (inout) (allow-none): This is an argument test
101  * Return value: an int
102  */
103 gint
104 annotation_object_inout3 (AnnotationObject *object, int *inoutarg)
105 {
106   if (inoutarg)
107     return *inoutarg + 1;
108   return 1;
109 }
110
111 /**
112  * annotation_object_calleeowns:
113  * @object: a #GObject
114  *
115  * This is a test for out arguments; GObject defaults to transfer
116  *
117  * @toown: (out): a #GObject
118  * Return value: an int
119  */
120 gint
121 annotation_object_calleeowns (AnnotationObject *object, GObject **toown)
122 {
123   return 1;
124 }
125
126
127 /**
128  * annotation_object_calleesowns:
129  * @object: a #GObject
130  *
131  * This is a test for out arguments, one transferred, other not
132  *
133  * @toown1: (out) (transfer): a #GObject
134  * @toown2: (out) (transfer none): a #GObject
135  * Return value: an int
136  */
137 gint
138 annotation_object_calleesowns (AnnotationObject *object,
139                                GObject **toown1,
140                                GObject **toown2)
141 {
142   return 1;
143 }
144
145
146 /**
147  * annotation_object_get_strings:
148  * @object: a #GObject
149  *
150  * This is a test for returning a list of strings, where
151  * each string needs to be freed.
152  *
153  * Return value: (element-type utf8) (transfer): list of strings
154  */
155 GList*
156 annotation_object_get_strings (AnnotationObject *object)
157 {
158   GList *list = NULL;
159   list = g_list_prepend (list, g_strdup ("annotation"));
160   list = g_list_prepend (list, g_strdup ("bar"));
161   return list;
162 }
163
164
165 /**
166  * annotation_object_with_voidp
167  * @data: Opaque pointer handle
168  */
169 void
170 annotation_object_with_voidp (AnnotationObject *object, void *data)
171 {
172
173 }
174
175 /**
176  * annotation_object_get_objects:
177  * @object: a #GObject
178  *
179  * This is a test for returning a list of objects.
180  * The list itself should be freed, but not the internal objects,
181  * intentionally similar example to gtk_container_get_children
182  *
183  * Return value: (element-type AnnotationObject) (transfer container): list of objects
184  */
185 GSList*
186 annotation_object_get_objects (AnnotationObject *object)
187 {
188   GSList *list = NULL;
189   list = g_slist_prepend (list, object);
190   return list;
191 }
192
193 /**
194  * annotation_object_create_object:
195  * @object: a #GObject
196  *
197  * Test returning a caller-owned object
198  *
199  * Return value: (transfer): The object
200  **/
201 GObject*
202 annotation_object_create_object (AnnotationObject *object)
203 {
204         return g_object_ref (object);
205 }
206
207 void
208 annotation_object_use_buffer   (AnnotationObject *object,
209                                 guchar           *bytes)
210 {
211
212 }
213
214 /**
215  * annotation_object_compute_sum:
216  * @object: a #GObject
217  * @nums: (array): Sequence of numbers
218  *
219  * Test taking a zero-terminated array
220  **/
221 void
222 annotation_object_compute_sum  (AnnotationObject *object,
223                                 int              *nums)
224 {
225
226 }
227
228 /**
229  * annotation_object_compute_sum_n:
230  * @object: a #GObject
231  * @nums: (array length=n_nums): Sequence of numbers
232  * @n_nums: Length of number array
233  *
234  * Test taking an array with length parameter
235  **/
236 void
237 annotation_object_compute_sum_n(AnnotationObject *object,
238                                 int              *nums,
239                                 int               n_nums)
240 {
241
242 }
243
244 /**
245  * annotation_object_compute_sum_nz:
246  * @object: a #AnnotationObject
247  * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers
248  * @n_nums: Length of number array
249  *
250  * Test taking a zero-terminated array with length parameter
251  **/
252 void
253 annotation_object_compute_sum_nz(AnnotationObject *object,
254                                  int             *nums,
255                                  int              n_nums)
256 {
257
258 }
259
260 /**
261  * annotation_object_parse_args:
262  * @object: a #AnnotationObject
263  * @argc: (inout): Length of the argument vector
264  * @argv: (inout) (array length=argc zero-terminated=1): Argument vector
265  *
266  * Test taking a zero-terminated array with length parameter
267  **/
268 void
269 annotation_object_parse_args(AnnotationObject *object,
270                              int              *argc,
271                              char           ***argv)
272 {
273
274 }
275
276 /**
277  * annotation_object_allow_none:
278  * @object: a #GObject
279  * @somearg: (allow-none):
280  **/
281 GObject*
282 annotation_object_allow_none (AnnotationObject *object, const gchar *somearg)
283 {
284   return NULL;
285 }
286
287 /**
288  * annotation_object_notrans:
289  * @object: a #GObject
290  *
291  * Returns: (transfer none): An object, not referenced
292  **/
293
294 GObject*
295 annotation_object_notrans (AnnotationObject *object)
296 {
297   return NULL;
298 }
299
300 /**
301  * annotation_object_do_not_use:
302  * @object: a #GObject
303  *
304  * Deprecated: 0.12: Use annotation_object_create_object() instead.
305  **/
306 GObject*
307 annotation_object_do_not_use (AnnotationObject *object)
308 {
309   return NULL;
310 }
311
312 /**
313  * annotation_init:
314  * @argc: (inout): The number of args. 
315  * @argv: (inout) (array length=argc zero-terminated=1): The arguments.
316  **/
317 void
318 annotation_init (int *argc, char ***argv)
319 {
320
321 }
322
323
324 static char backslash_parsing_tester_2 = '\\';