| 1 |
/* |
| 2 |
SPDX-License-Identifier: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT |
| 3 |
SPDX-FileCopyrightText: 2008-2009 Dan Winship |
| 4 |
SPDX-FileCopyrightText: 2008-2010 Colin Walters <[email protected]> |
| 5 |
SPDX-FileCopyrightText: 2008-2011 Johan Dahlin |
| 6 |
SPDX-FileCopyrightText: 2008 Owen Taylor |
| 7 |
SPDX-FileCopyrightText: 2008 Tommi Komulainen |
| 8 |
SPDX-FileCopyrightText: 2008 Tristan Van Berkom |
| 9 |
SPDX-FileCopyrightText: 2009-2010 Andreas Rottmann <[email protected]> |
| 10 |
SPDX-FileCopyrightText: 2010 litl, LLC |
| 11 |
SPDX-FileCopyrightText: 2010 Pavel Holejsovsky |
| 12 |
SPDX-FileCopyrightText: 2010 Red Hat, Inc. |
| 13 |
SPDX-FileCopyrightText: 2011 Jasper St. Pierre |
| 14 |
SPDX-FileCopyrightText: 2013 Stef Walter |
| 15 |
SPDX-FileCopyrightText: 2015 Christoph Reiter |
| 16 |
SPDX-FileCopyrightText: 2020 Centricular |
| 17 |
*/ |
| 18 |
|
| 19 |
#pragma once |
| 20 |
|
| 21 |
#include <glib-object.h> |
| 22 |
#include <glib.h> |
| 23 |
|
| 24 |
#include "gitestmacros.h" |
| 25 |
|
| 26 |
typedef enum /*< flags,prefix=ANN >*/ |
| 27 |
{ |
| 28 |
ANN_FLAG_FOO = 1, |
| 29 |
ANN_FLAG_BAR = 2, |
| 30 |
/** |
| 31 |
* ANN_FLAG_FOOBAR: |
| 32 |
* |
| 33 |
* Since: 1.4 |
| 34 |
*/ |
| 35 |
ANN_FLAG_FOOBAR = 3, |
| 36 |
} RegressAnnotationBitfield; |
| 37 |
|
| 38 |
/** |
| 39 |
* RegressAnnotationCallback: |
| 40 |
* @in: (in) (transfer none): array of ints |
| 41 |
* |
| 42 |
* This is a callback. |
| 43 |
* Return value: (transfer none): array of ints |
| 44 |
*/ |
| 45 |
typedef const gint *(*RegressAnnotationCallback) (const gint *in); |
| 46 |
|
| 47 |
/** |
| 48 |
* RegressAnnotationListCallback: |
| 49 |
* @in: (in) (transfer none) (element-type utf8): list of strings |
| 50 |
* |
| 51 |
* This is a callback taking a list. |
| 52 |
* Return value: (transfer container) (element-type utf8): list of strings |
| 53 |
*/ |
| 54 |
typedef GList *(*RegressAnnotationListCallback) (GList *in); |
| 55 |
|
| 56 |
/** |
| 57 |
* RegressAnnotationNotifyFunc: |
| 58 |
* @data: (closure): The user data |
| 59 |
* |
| 60 |
* This is a callback with a 'closure' argument that is not named |
| 61 |
* 'user_data' and hence has to be annotated. |
| 62 |
*/ |
| 63 |
typedef void (*RegressAnnotationNotifyFunc) (gpointer data); |
| 64 |
|
| 65 |
/** |
| 66 |
* RegressAnnotationObject: (attributes org.example.Test=cows) |
| 67 |
* |
| 68 |
* This is an object used to test annotations. |
| 69 |
*/ |
| 70 |
typedef struct _RegressAnnotationObject RegressAnnotationObject; |
| 71 |
typedef struct _RegressAnnotationObjectClass RegressAnnotationObjectClass; |
| 72 |
|
| 73 |
typedef void (*RegressAnnotationForeachFunc) (RegressAnnotationObject *object, |
| 74 |
const char *item, |
| 75 |
gpointer user_data); |
| 76 |
|
| 77 |
struct _RegressAnnotationObject |
| 78 |
{ |
| 79 |
GObject parent_instance; |
| 80 |
/*< private >*/ |
| 81 |
void *user_data; |
| 82 |
GDestroyNotify destroy_notify; |
| 83 |
}; |
| 84 |
|
| 85 |
struct _RegressAnnotationObjectClass |
| 86 |
{ |
| 87 |
GObjectClass parent_class; |
| 88 |
}; |
| 89 |
|
| 90 |
GI_TEST_EXTERN |
| 91 |
GType regress_annotation_object_get_type (void); |
| 92 |
|
| 93 |
GI_TEST_EXTERN |
| 94 |
gint regress_annotation_object_method (RegressAnnotationObject *object); |
| 95 |
|
| 96 |
GI_TEST_EXTERN |
| 97 |
gint regress_annotation_object_out (RegressAnnotationObject *object, |
| 98 |
int *outarg); |
| 99 |
|
| 100 |
GI_TEST_EXTERN |
| 101 |
GObject *regress_annotation_object_create_object (RegressAnnotationObject *object); |
| 102 |
|
| 103 |
GI_TEST_EXTERN |
| 104 |
GObject *regress_annotation_object_allow_none (RegressAnnotationObject *object, |
| 105 |
const gchar *somearg); |
| 106 |
|
| 107 |
GI_TEST_EXTERN |
| 108 |
GObject *regress_annotation_object_notrans (RegressAnnotationObject *object); |
| 109 |
|
| 110 |
GI_TEST_EXTERN |
| 111 |
gint regress_annotation_object_inout (RegressAnnotationObject *object, |
| 112 |
int *inoutarg); |
| 113 |
|
| 114 |
GI_TEST_EXTERN |
| 115 |
gint regress_annotation_object_inout2 (RegressAnnotationObject *object, |
| 116 |
int *inoutarg); |
| 117 |
|
| 118 |
GI_TEST_EXTERN |
| 119 |
gint regress_annotation_object_inout3 (RegressAnnotationObject *object, |
| 120 |
int *inoutarg); |
| 121 |
|
| 122 |
GI_TEST_EXTERN |
| 123 |
gint regress_annotation_object_in (RegressAnnotationObject *object, |
| 124 |
int *inarg); |
| 125 |
|
| 126 |
GI_TEST_EXTERN |
| 127 |
gint regress_annotation_object_calleeowns (RegressAnnotationObject *object, |
| 128 |
GObject **toown); |
| 129 |
|
| 130 |
GI_TEST_EXTERN |
| 131 |
gint regress_annotation_object_calleesowns (RegressAnnotationObject *object, |
| 132 |
GObject **toown1, |
| 133 |
GObject **toown2); |
| 134 |
|
| 135 |
GI_TEST_EXTERN |
| 136 |
GList *regress_annotation_object_get_strings (RegressAnnotationObject *object); |
| 137 |
|
| 138 |
GI_TEST_EXTERN |
| 139 |
GHashTable *regress_annotation_object_get_hash (RegressAnnotationObject *object); |
| 140 |
|
| 141 |
GI_TEST_EXTERN |
| 142 |
void regress_annotation_object_with_voidp (RegressAnnotationObject *object, |
| 143 |
void *data); |
| 144 |
|
| 145 |
GI_TEST_EXTERN |
| 146 |
GSList *regress_annotation_object_get_objects (RegressAnnotationObject *object); |
| 147 |
|
| 148 |
GI_TEST_EXTERN |
| 149 |
void regress_annotation_object_use_buffer (RegressAnnotationObject *object, |
| 150 |
guchar *bytes); |
| 151 |
|
| 152 |
GI_TEST_EXTERN |
| 153 |
void regress_annotation_object_compute_sum (RegressAnnotationObject *object, |
| 154 |
int *nums); |
| 155 |
|
| 156 |
GI_TEST_EXTERN |
| 157 |
void regress_annotation_object_compute_sum_n (RegressAnnotationObject *object, |
| 158 |
int *nums, |
| 159 |
int n_nums); |
| 160 |
|
| 161 |
GI_TEST_EXTERN |
| 162 |
void regress_annotation_object_compute_sum_nz (RegressAnnotationObject *object, |
| 163 |
int *nums, |
| 164 |
int n_nums); |
| 165 |
|
| 166 |
GI_TEST_EXTERN |
| 167 |
void regress_annotation_object_parse_args (RegressAnnotationObject *object, |
| 168 |
int *argc, |
| 169 |
char ***argv); |
| 170 |
|
| 171 |
GI_TEST_EXTERN |
| 172 |
gboolean regress_annotation_object_string_out (RegressAnnotationObject *object, |
| 173 |
char **str_out); |
| 174 |
|
| 175 |
GI_TEST_EXTERN |
| 176 |
void regress_annotation_object_foreach (RegressAnnotationObject *object, |
| 177 |
RegressAnnotationForeachFunc func, |
| 178 |
gpointer user_data); |
| 179 |
|
| 180 |
GI_TEST_EXTERN |
| 181 |
void regress_annotation_object_set_data (RegressAnnotationObject *object, |
| 182 |
const guchar *data, |
| 183 |
gsize length); |
| 184 |
|
| 185 |
GI_TEST_EXTERN |
| 186 |
void regress_annotation_object_set_data2 (RegressAnnotationObject *object, |
| 187 |
const gchar *data, |
| 188 |
gsize length); |
| 189 |
|
| 190 |
GI_TEST_EXTERN |
| 191 |
void regress_annotation_object_set_data3 (RegressAnnotationObject *object, |
| 192 |
gpointer data, |
| 193 |
gsize length); |
| 194 |
|
| 195 |
GI_TEST_EXTERN |
| 196 |
GObject *regress_annotation_object_do_not_use (RegressAnnotationObject *object); |
| 197 |
|
| 198 |
GI_TEST_EXTERN |
| 199 |
void regress_annotation_object_watch (RegressAnnotationObject *object, |
| 200 |
RegressAnnotationForeachFunc func, |
| 201 |
gpointer user_data); |
| 202 |
|
| 203 |
GI_TEST_EXTERN |
| 204 |
void regress_annotation_object_watch_full (RegressAnnotationObject *object, |
| 205 |
RegressAnnotationForeachFunc func, |
| 206 |
gpointer user_data, |
| 207 |
GDestroyNotify destroy); |
| 208 |
|
| 209 |
GI_TEST_EXTERN |
| 210 |
void regress_annotation_object_hidden_self (gpointer object); |
| 211 |
|
| 212 |
GI_TEST_EXTERN |
| 213 |
void regress_annotation_init (int *argc, |
| 214 |
char ***argv); |
| 215 |
|
| 216 |
GI_TEST_EXTERN |
| 217 |
char **regress_annotation_return_array (int *length); |
| 218 |
|
| 219 |
GI_TEST_EXTERN |
| 220 |
void regress_annotation_versioned (void); |
| 221 |
|
| 222 |
GI_TEST_EXTERN |
| 223 |
char **regress_annotation_string_zero_terminated (void); |
| 224 |
|
| 225 |
GI_TEST_EXTERN |
| 226 |
void regress_annotation_string_zero_terminated_out (char ***out); |
| 227 |
|
| 228 |
GI_TEST_EXTERN |
| 229 |
void regress_annotation_string_array_length (guint n_properties, const gchar *const properties[]); |
| 230 |
|
| 231 |
GI_TEST_EXTERN |
| 232 |
void regress_annotation_object_extra_annos (RegressAnnotationObject *object); |
| 233 |
|
| 234 |
GI_TEST_EXTERN |
| 235 |
void regress_annotation_custom_destroy (RegressAnnotationCallback callback, |
| 236 |
RegressAnnotationNotifyFunc destroy, |
| 237 |
gpointer data); |
| 238 |
|
| 239 |
GI_TEST_EXTERN |
| 240 |
void regress_annotation_custom_destroy_cleanup (void); |
| 241 |
|
| 242 |
GI_TEST_EXTERN |
| 243 |
char *regress_annotation_get_source_file (void); |
| 244 |
|
| 245 |
GI_TEST_EXTERN |
| 246 |
void regress_annotation_set_source_file (const char *fname); |
| 247 |
|
| 248 |
GI_TEST_EXTERN |
| 249 |
gint regress_annotation_attribute_func (RegressAnnotationObject *object, |
| 250 |
const gchar *data); |
| 251 |
|
| 252 |
GI_TEST_EXTERN |
| 253 |
void regress_annotation_invalid_regress_annotation (int foo); |
| 254 |
|
| 255 |
/** |
| 256 |
* RegressAnnotationStruct: |
| 257 |
* |
| 258 |
* This is a test of an array of object in an field of a struct. |
| 259 |
*/ |
| 260 |
struct RegressAnnotationStruct |
| 261 |
{ |
| 262 |
RegressAnnotationObject *objects[10]; |
| 263 |
}; |
| 264 |
|
| 265 |
/** |
| 266 |
* RegressAnnotationFields: |
| 267 |
* @field1: Some documentation |
| 268 |
* @arr: (array length=len): an array of length @len |
| 269 |
* @len: the length of array |
| 270 |
* |
| 271 |
* This is a struct for testing field documentation and annotations |
| 272 |
*/ |
| 273 |
struct RegressAnnotationFields |
| 274 |
{ |
| 275 |
int field1; |
| 276 |
guchar *arr; |
| 277 |
gulong len; |
| 278 |
/** |
| 279 |
* RegressAnnotationFields.field4: |
| 280 |
* |
| 281 |
* A new field, breaking ABI is fun! |
| 282 |
* |
| 283 |
* Since: 1.4 |
| 284 |
*/ |
| 285 |
guint field4; |
| 286 |
}; |
| 287 |
|
| 288 |
GI_TEST_EXTERN |
| 289 |
void regress_annotation_ptr_array (GPtrArray *array); |
| 290 |
|
| 291 |
GI_TEST_EXTERN |
| 292 |
GObject *regress_annotation_test_parsing_bug630862 (void); |
| 293 |
|
| 294 |
GI_TEST_EXTERN |
| 295 |
void regress_annotation_space_after_comment_bug631690 (void); |
| 296 |
|
| 297 |
GI_TEST_EXTERN |
| 298 |
gchar *regress_annotation_return_filename (void); |
| 299 |
|
| 300 |
GI_TEST_EXTERN |
| 301 |
GObject *regress_annotation_transfer_floating (GObject *object); |
| 302 |
|
| 303 |
/* This one we can handle properly */ |
| 304 |
#define REGRESS_ANNOTATION_CALCULATED_DEFINE (10 * 10) |
| 305 |
|
| 306 |
/** |
| 307 |
* REGRESS_ANNOTATION_CALCULATED_LARGE: (value 10000000000UL) |
| 308 |
* |
| 309 |
* Constant to define a calculated large value |
| 310 |
* |
| 311 |
* Since: 1.4 |
| 312 |
*/ |
| 313 |
#define REGRESS_ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000)) |
| 314 |
|
| 315 |
/** |
| 316 |
* REGRESS_ANNOTATION_CALCULATED_LARGE_DIV: (value 1000000UL) |
| 317 |
* |
| 318 |
* Constant to define a calculated large value |
| 319 |
*/ |
| 320 |
#define REGRESS_ANNOTATION_CALCULATED_LARGE_DIV (1000 / G_GINT64_CONSTANT (10000000)) |