annotation.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. #ifndef __REGRESS_ANNOTATION_OBJECT_H__
  2. #define __REGRESS_ANNOTATION_OBJECT_H__
  3. #include "gitestmacros.h"
  4. #include <glib-object.h>
  5. typedef enum /*< flags,prefix=ANN >*/
  6. {
  7. ANN_FLAG_FOO = 1,
  8. ANN_FLAG_BAR = 2
  9. } RegressAnnotationBitfield;
  10. /**
  11. * RegressAnnotationCallback:
  12. * @in: (in) (transfer none): array of ints
  13. *
  14. * This is a callback.
  15. * Return value: (transfer none): array of ints
  16. */
  17. typedef const gint* (*RegressAnnotationCallback) (const gint *in);
  18. /**
  19. * RegressAnnotationListCallback:
  20. * @in: (in) (transfer none) (element-type utf8): list of strings
  21. *
  22. * This is a callback taking a list.
  23. * Return value: (transfer container) (element-type utf8): list of strings
  24. */
  25. typedef GList* (*RegressAnnotationListCallback) (GList *in);
  26. /**
  27. * RegressAnnotationNotifyFunc:
  28. * @data: (closure): The user data
  29. *
  30. * This is a callback with a 'closure' argument that is not named
  31. * 'user_data' and hence has to be annotated.
  32. */
  33. typedef void (*RegressAnnotationNotifyFunc) (gpointer data);
  34. /**
  35. * RegressAnnotationObject: (attributes org.example.Test=cows)
  36. *
  37. * This is an object used to test annotations.
  38. */
  39. typedef struct _RegressAnnotationObject RegressAnnotationObject;
  40. typedef struct _RegressAnnotationObjectClass RegressAnnotationObjectClass;
  41. typedef void (*RegressAnnotationForeachFunc) (RegressAnnotationObject *object,
  42. const char *item,
  43. gpointer user_data);
  44. struct _RegressAnnotationObject
  45. {
  46. GObject parent_instance;
  47. };
  48. struct _RegressAnnotationObjectClass
  49. {
  50. GObjectClass parent_class;
  51. };
  52. _GI_TEST_EXTERN
  53. GType regress_annotation_object_get_type (void);
  54. _GI_TEST_EXTERN
  55. gint regress_annotation_object_method (RegressAnnotationObject *object);
  56. _GI_TEST_EXTERN
  57. gint regress_annotation_object_out (RegressAnnotationObject *object,
  58. int *outarg);
  59. _GI_TEST_EXTERN
  60. GObject* regress_annotation_object_create_object(RegressAnnotationObject *object);
  61. _GI_TEST_EXTERN
  62. GObject* regress_annotation_object_allow_none (RegressAnnotationObject *object,
  63. const gchar *somearg);
  64. _GI_TEST_EXTERN
  65. GObject* regress_annotation_object_notrans (RegressAnnotationObject *object);
  66. _GI_TEST_EXTERN
  67. gint regress_annotation_object_inout (RegressAnnotationObject *object,
  68. int *inoutarg);
  69. _GI_TEST_EXTERN
  70. gint regress_annotation_object_inout2 (RegressAnnotationObject *object,
  71. int *inoutarg);
  72. _GI_TEST_EXTERN
  73. gint regress_annotation_object_inout3 (RegressAnnotationObject *object,
  74. int *inoutarg);
  75. _GI_TEST_EXTERN
  76. gint regress_annotation_object_in (RegressAnnotationObject *object,
  77. int *inarg);
  78. _GI_TEST_EXTERN
  79. gint regress_annotation_object_calleeowns (RegressAnnotationObject *object,
  80. GObject **toown);
  81. _GI_TEST_EXTERN
  82. gint regress_annotation_object_calleesowns (RegressAnnotationObject *object,
  83. GObject **toown1,
  84. GObject **toown2);
  85. _GI_TEST_EXTERN
  86. GList* regress_annotation_object_get_strings (RegressAnnotationObject *object);
  87. _GI_TEST_EXTERN
  88. GHashTable*regress_annotation_object_get_hash (RegressAnnotationObject *object);
  89. _GI_TEST_EXTERN
  90. void regress_annotation_object_with_voidp (RegressAnnotationObject *object,
  91. void *data);
  92. _GI_TEST_EXTERN
  93. GSList* regress_annotation_object_get_objects (RegressAnnotationObject *object);
  94. _GI_TEST_EXTERN
  95. void regress_annotation_object_use_buffer (RegressAnnotationObject *object,
  96. guchar *bytes);
  97. _GI_TEST_EXTERN
  98. void regress_annotation_object_compute_sum (RegressAnnotationObject *object,
  99. int *nums);
  100. _GI_TEST_EXTERN
  101. void regress_annotation_object_compute_sum_n(RegressAnnotationObject *object,
  102. int *nums,
  103. int n_nums);
  104. _GI_TEST_EXTERN
  105. void regress_annotation_object_compute_sum_nz(RegressAnnotationObject *object,
  106. int *nums,
  107. int n_nums);
  108. _GI_TEST_EXTERN
  109. void regress_annotation_object_parse_args (RegressAnnotationObject *object,
  110. int *argc,
  111. char ***argv);
  112. _GI_TEST_EXTERN
  113. gboolean regress_annotation_object_string_out (RegressAnnotationObject *object,
  114. char **str_out);
  115. _GI_TEST_EXTERN
  116. void regress_annotation_object_foreach (RegressAnnotationObject *object,
  117. RegressAnnotationForeachFunc func,
  118. gpointer user_data);
  119. _GI_TEST_EXTERN
  120. void regress_annotation_object_set_data (RegressAnnotationObject *object,
  121. const guchar *data,
  122. gsize length);
  123. _GI_TEST_EXTERN
  124. void regress_annotation_object_set_data2 (RegressAnnotationObject *object,
  125. const gchar *data,
  126. gsize length);
  127. _GI_TEST_EXTERN
  128. void regress_annotation_object_set_data3 (RegressAnnotationObject *object,
  129. gpointer data,
  130. gsize length);
  131. _GI_TEST_EXTERN
  132. GObject* regress_annotation_object_do_not_use (RegressAnnotationObject *object);
  133. _GI_TEST_EXTERN
  134. void regress_annotation_object_watch (RegressAnnotationObject *object,
  135. RegressAnnotationForeachFunc func,
  136. gpointer user_data);
  137. _GI_TEST_EXTERN
  138. void regress_annotation_object_watch_full (RegressAnnotationObject *object,
  139. RegressAnnotationForeachFunc func,
  140. gpointer user_data,
  141. GDestroyNotify destroy);
  142. _GI_TEST_EXTERN
  143. void regress_annotation_object_hidden_self (gpointer object);
  144. _GI_TEST_EXTERN
  145. void regress_annotation_init (int *argc,
  146. char ***argv);
  147. _GI_TEST_EXTERN
  148. char ** regress_annotation_return_array (int *length);
  149. _GI_TEST_EXTERN
  150. void regress_annotation_versioned (void);
  151. _GI_TEST_EXTERN
  152. char ** regress_annotation_string_zero_terminated (void);
  153. _GI_TEST_EXTERN
  154. void regress_annotation_string_zero_terminated_out (char ***out);
  155. _GI_TEST_EXTERN
  156. void regress_annotation_string_array_length (guint n_properties, const gchar * const properties[]);
  157. _GI_TEST_EXTERN
  158. void regress_annotation_object_extra_annos (RegressAnnotationObject *object);
  159. _GI_TEST_EXTERN
  160. void regress_annotation_custom_destroy (RegressAnnotationCallback callback,
  161. RegressAnnotationNotifyFunc destroy,
  162. gpointer data);
  163. _GI_TEST_EXTERN
  164. char * regress_annotation_get_source_file (void);
  165. _GI_TEST_EXTERN
  166. void regress_annotation_set_source_file (const char *fname);
  167. _GI_TEST_EXTERN
  168. gint regress_annotation_attribute_func (RegressAnnotationObject *object,
  169. const gchar *data);
  170. _GI_TEST_EXTERN
  171. void regress_annotation_invalid_regress_annotation (int foo);
  172. /**
  173. * RegressAnnotationStruct:
  174. *
  175. * This is a test of an array of object in an field of a struct.
  176. */
  177. struct RegressAnnotationStruct
  178. {
  179. RegressAnnotationObject *objects[10];
  180. };
  181. /**
  182. * RegressAnnotationFields:
  183. * @field1: Some documentation
  184. * @arr: (array length=len): an array of length @len
  185. * @len: the length of array
  186. *
  187. * This is a struct for testing field documentation and annotations
  188. */
  189. struct RegressAnnotationFields
  190. {
  191. int field1;
  192. guchar *arr;
  193. gulong len;
  194. };
  195. _GI_TEST_EXTERN
  196. void regress_annotation_ptr_array (GPtrArray *array);
  197. _GI_TEST_EXTERN
  198. GObject * regress_annotation_test_parsing_bug630862 (void);
  199. _GI_TEST_EXTERN
  200. void regress_annotation_space_after_comment_bug631690 (void);
  201. _GI_TEST_EXTERN
  202. gchar* regress_annotation_return_filename (void);
  203. _GI_TEST_EXTERN
  204. GObject * regress_annotation_transfer_floating(void);
  205. /* This one we can handle properly */
  206. #define REGRESS_ANNOTATION_CALCULATED_DEFINE (10 * 10)
  207. /**
  208. * REGRESS_ANNOTATION_CALCULATED_LARGE: (value 10000000000UL)
  209. *
  210. * Constant to define a calculated large value
  211. *
  212. * Since: 1.4
  213. */
  214. #define REGRESS_ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000))
  215. /**
  216. * REGRESS_ANNOTATION_CALCULATED_LARGE_DIV: (value 1000000UL)
  217. *
  218. * Constant to define a calculated large value
  219. */
  220. #define REGRESS_ANNOTATION_CALCULATED_LARGE_DIV (1000 / G_GINT64_CONSTANT (10000000))
  221. #endif /* __REGRESS_ANNOTATION_OBJECT_H__ */