fix spelling of GHashTable. #561135
[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  * annotation_object_get_hash:
166  * @object: a #GObject
167  *
168  * This is a test for returning a hash table mapping strings to
169  * objects.
170  *
171  * Return value: (element-type utf8 GObject): hash table
172  */
173 GHashTable*
174 annotation_object_get_hash (AnnotationObject *object)
175 {
176   GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal,
177                                             g_free, g_object_unref);
178   g_hash_table_insert (hash, g_strdup ("one"), g_object_ref (object));
179   g_hash_table_insert (hash, g_strdup ("two"), g_object_ref (object));
180   return hash;
181 }
182
183 /**
184  * annotation_object_with_voidp
185  * @data: Opaque pointer handle
186  */
187 void
188 annotation_object_with_voidp (AnnotationObject *object, void *data)
189 {
190
191 }
192
193 /**
194  * annotation_object_get_objects:
195  * @object: a #GObject
196  *
197  * This is a test for returning a list of objects.
198  * The list itself should be freed, but not the internal objects,
199  * intentionally similar example to gtk_container_get_children
200  *
201  * Return value: (element-type AnnotationObject) (transfer container): list of objects
202  */
203 GSList*
204 annotation_object_get_objects (AnnotationObject *object)
205 {
206   GSList *list = NULL;
207   list = g_slist_prepend (list, object);
208   return list;
209 }
210
211 /**
212  * annotation_object_create_object:
213  * @object: a #GObject
214  *
215  * Test returning a caller-owned object
216  *
217  * Return value: (transfer): The object
218  **/
219 GObject*
220 annotation_object_create_object (AnnotationObject *object)
221 {
222         return g_object_ref (object);
223 }
224
225 void
226 annotation_object_use_buffer   (AnnotationObject *object,
227                                 guchar           *bytes)
228 {
229
230 }
231
232 /**
233  * annotation_object_compute_sum:
234  * @object: a #GObject
235  * @nums: (array): Sequence of numbers
236  *
237  * Test taking a zero-terminated array
238  **/
239 void
240 annotation_object_compute_sum  (AnnotationObject *object,
241                                 int              *nums)
242 {
243
244 }
245
246 /**
247  * annotation_object_compute_sum_n:
248  * @object: a #GObject
249  * @nums: (array length=n_nums): Sequence of numbers
250  * @n_nums: Length of number array
251  *
252  * Test taking an array with length parameter
253  **/
254 void
255 annotation_object_compute_sum_n(AnnotationObject *object,
256                                 int              *nums,
257                                 int               n_nums)
258 {
259
260 }
261
262 /**
263  * annotation_object_compute_sum_nz:
264  * @object: a #AnnotationObject
265  * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers
266  * @n_nums: Length of number array
267  *
268  * Test taking a zero-terminated array with length parameter
269  **/
270 void
271 annotation_object_compute_sum_nz(AnnotationObject *object,
272                                  int             *nums,
273                                  int              n_nums)
274 {
275
276 }
277
278 /**
279  * annotation_object_parse_args:
280  * @object: a #AnnotationObject
281  * @argc: (inout): Length of the argument vector
282  * @argv: (inout) (array length=argc zero-terminated=1): Argument vector
283  *
284  * Test taking a zero-terminated array with length parameter
285  **/
286 void
287 annotation_object_parse_args(AnnotationObject *object,
288                              int              *argc,
289                              char           ***argv)
290 {
291
292 }
293
294 /**
295  * annotation_object_allow_none:
296  * @object: a #GObject
297  * @somearg: (allow-none):
298  **/
299 GObject*
300 annotation_object_allow_none (AnnotationObject *object, const gchar *somearg)
301 {
302   return NULL;
303 }
304
305 /**
306  * annotation_object_notrans:
307  * @object: a #GObject
308  *
309  * Returns: (transfer none): An object, not referenced
310  **/
311
312 GObject*
313 annotation_object_notrans (AnnotationObject *object)
314 {
315   return NULL;
316 }
317
318 /**
319  * annotation_object_do_not_use:
320  * @object: a #GObject
321  *
322  * Deprecated: 0.12: Use annotation_object_create_object() instead.
323  **/
324 GObject*
325 annotation_object_do_not_use (AnnotationObject *object)
326 {
327   return NULL;
328 }
329
330 /**
331  * annotation_init:
332  * @argc: (inout): The number of args. 
333  * @argv: (inout) (array length=argc zero-terminated=1): The arguments.
334  **/
335 void
336 annotation_init (int *argc, char ***argv)
337 {
338
339 }
340
341
342 static char backslash_parsing_tester_2 = '\\';