File: gitypes.h

package info (click to toggle)
gobject-introspection 1.84.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 72,336 kB
  • sloc: ansic: 562,269; python: 23,692; xml: 16,240; yacc: 1,711; perl: 1,624; sh: 1,139; lex: 510; cpp: 487; makefile: 182; javascript: 15; lisp: 1
file content (481 lines) | stat: -rw-r--r-- 15,858 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
 * GObject introspection: types
 *
 * Copyright (C) 2005 Matthias Clasen
 * Copyright (C) 2008,2009 Red Hat, Inc.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#pragma once

#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
#error "Only <girepository.h> can be included directly."
#endif

#include <stdint.h>

#include <glib.h>
#include <glib-object.h>

#include "gi-visibility.h"

G_BEGIN_DECLS

/* Documented in gibaseinfo.c */
typedef struct _GIBaseInfo GIBaseInfo;
typedef struct _GIBaseInfoClass GIBaseInfoClass;

/* Documented in gicallableinfo.c */
typedef struct _GICallableInfo GICallableInfo;
GI_AVAILABLE_IN_ALL GType gi_callable_info_get_type (void);

/* Documented in gifunctioninfo.c */
typedef struct _GIFunctionInfo GIFunctionInfo;
GI_AVAILABLE_IN_ALL GType gi_function_info_get_type (void);

/* Documented in gicallbackinfo.c */
typedef struct _GICallbackInfo GICallbackInfo;
GI_AVAILABLE_IN_ALL GType gi_callback_info_get_type (void);

/* Documented in giregisteredtypeinfo.c */
typedef struct _GIRegisteredTypeInfo GIRegisteredTypeInfo;
GI_AVAILABLE_IN_ALL GType gi_registered_type_info_get_type (void);

/* Documented in gistructinfo.c */
typedef struct _GIStructInfo GIStructInfo;
GI_AVAILABLE_IN_ALL GType gi_struct_info_get_type (void);

/* Documented in giunioninfo.c */
typedef struct _GIUnionInfo GIUnionInfo;
GI_AVAILABLE_IN_ALL GType gi_union_info_get_type (void);

/* Documented in gienuminfo.c */
typedef struct _GIEnumInfo GIEnumInfo;
GI_AVAILABLE_IN_ALL GType gi_enum_info_get_type (void);

/* Documented in giflagsinfo.c */
typedef struct _GIFlagsInfo GIFlagsInfo;
GI_AVAILABLE_IN_ALL GType gi_flags_info_get_type (void);

/* Documented in giobjectinfo.c */
typedef struct _GIObjectInfo GIObjectInfo;
GI_AVAILABLE_IN_ALL GType gi_object_info_get_type (void);

/* Documented in giinterfaceinfo.c */
typedef struct _GIInterfaceInfo GIInterfaceInfo;
GI_AVAILABLE_IN_ALL GType gi_interface_info_get_type (void);

/* Documented in giboxedinfo.c */
typedef struct _GIBoxedInfo GIBoxedInfo;
GI_AVAILABLE_IN_ALL GType gi_boxed_info_get_type (void);

/* Documented in giconstantinfo.c */
typedef struct _GIConstantInfo GIConstantInfo;
GI_AVAILABLE_IN_ALL GType gi_constant_info_get_type (void);

/* Documented in givalueinfo.c */
typedef struct _GIValueInfo GIValueInfo;
GI_AVAILABLE_IN_ALL GType gi_value_info_get_type (void);

/* Documented in gisignalinfo.c */
typedef struct _GISignalInfo GISignalInfo;
GI_AVAILABLE_IN_ALL GType gi_signal_info_get_type (void);

/* Documented in givfuncinfo.c */
typedef struct _GIVFuncInfo GIVFuncInfo;
GI_AVAILABLE_IN_ALL GType gi_vfunc_info_get_type (void);

/* Documented in gipropertyinfo.c */
typedef struct _GIPropertyInfo GIPropertyInfo;
GI_AVAILABLE_IN_ALL GType gi_property_info_get_type (void);

/* Documented in gifieldinfo.c */
typedef struct _GIFieldInfo GIFieldInfo;
GI_AVAILABLE_IN_ALL GType gi_field_info_get_type (void);

/* Documented in giarginfo.c */
typedef struct _GIArgInfo GIArgInfo;
GI_AVAILABLE_IN_ALL GType gi_arg_info_get_type (void);

/* Documented in gitypeinfo.c */
typedef struct _GITypeInfo GITypeInfo;
GI_AVAILABLE_IN_ALL GType gi_type_info_get_type (void);

/* Documented in giunresolvedinfo.c */
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
GI_AVAILABLE_IN_ALL GType gi_unresolved_info_get_type (void);

union _GIArgument
{
  gboolean        v_boolean;
  int8_t          v_int8;
  uint8_t         v_uint8;
  int16_t         v_int16;
  uint16_t        v_uint16;
  int32_t         v_int32;
  uint32_t        v_uint32;
  int64_t         v_int64;
  uint64_t        v_uint64;
  float           v_float;
  double          v_double;
  short           v_short;
  unsigned short  v_ushort;
  int             v_int;
  unsigned int    v_uint;
  long            v_long;
  unsigned long   v_ulong;
  gssize          v_ssize;
  size_t          v_size;
  char           *v_string;
  void           *v_pointer;
};

/**
 * GIArgument:
 * @v_boolean: boolean value
 * @v_int8: 8-bit signed integer value
 * @v_uint8: 8-bit unsigned integer value
 * @v_int16: 16-bit signed integer value
 * @v_uint16: 16-bit unsigned integer value
 * @v_int32: 32-bit signed integer value
 * @v_uint32: 32-bit unsigned integer value
 * @v_int64: 64-bit signed integer value
 * @v_uint64: 64-bit unsigned integer value
 * @v_float: single float value
 * @v_double: double float value
 * @v_short: signed short integer value
 * @v_ushort: unsigned short integer value
 * @v_int: signed integer value
 * @v_uint: unsigned integer value
 * @v_long: signed long integer value
 * @v_ulong: unsigned long integer value
 * @v_ssize: sized `size_t` value
 * @v_size: unsigned `size_t` value
 * @v_string: nul-terminated string value
 * @v_pointer: arbitrary pointer value
 *
 * Stores an argument of varying type.
 *
 * Since: 2.80
 */
typedef union _GIArgument GIArgument;

/**
 * GIInfoType:
 * @GI_INFO_TYPE_INVALID: invalid type
 * @GI_INFO_TYPE_FUNCTION: function, see [class@GIRepository.FunctionInfo]
 * @GI_INFO_TYPE_CALLBACK: callback, see [class@GIRepository.FunctionInfo]
 * @GI_INFO_TYPE_STRUCT: struct, see [class@GIRepository.StructInfo]
 * @GI_INFO_TYPE_BOXED: boxed, see [class@GIRepository.StructInfo] or
 *   [class@GIRepository.UnionInfo]
 * @GI_INFO_TYPE_ENUM: enum, see [class@GIRepository.EnumInfo]
 * @GI_INFO_TYPE_FLAGS: flags, see [class@GIRepository.EnumInfo]
 * @GI_INFO_TYPE_OBJECT: object, see [class@GIRepository.ObjectInfo]
 * @GI_INFO_TYPE_INTERFACE: interface, see [class@GIRepository.InterfaceInfo]
 * @GI_INFO_TYPE_CONSTANT: constant, see [class@GIRepository.ConstantInfo]
 * @GI_INFO_TYPE_UNION: union, see [class@GIRepository.UnionInfo]
 * @GI_INFO_TYPE_VALUE: enum value, see [class@GIRepository.ValueInfo]
 * @GI_INFO_TYPE_SIGNAL: signal, see [class@GIRepository.SignalInfo]
 * @GI_INFO_TYPE_VFUNC: virtual function, see [class@GIRepository.VFuncInfo]
 * @GI_INFO_TYPE_PROPERTY: [class@GObject.Object] property, see
 *   [class@GIRepository.PropertyInfo]
 * @GI_INFO_TYPE_FIELD: struct or union field, see
 *   [class@GIRepository.FieldInfo]
 * @GI_INFO_TYPE_ARG: argument of a function or callback, see
 *   [class@GIRepository.ArgInfo]
 * @GI_INFO_TYPE_TYPE: type information, see [class@GIRepository.TypeInfo]
 * @GI_INFO_TYPE_UNRESOLVED: unresolved type, a type which is not present in
 *   the typelib, or any of its dependencies, see
 *   [class@GIRepository.UnresolvedInfo]
 * @GI_INFO_TYPE_CALLABLE: an abstract type representing any callable (function,
 *   callback, vfunc), see [class@GIRepository.CallableInfo]
 * @GI_INFO_TYPE_REGISTERED_TYPE: an abstract type representing any registered
 *   type (enum, interface, object, struct, union), see
 *   [class@GIRepository.RegisteredTypeInfo]
 *
 * The type of a [class@GIRepository.BaseInfo] struct.
 *
 * See [const@GIRepository.INFO_TYPE_N_TYPES] for the total number of elements
 * in this enum.
 *
 * Since: 2.80
 */
typedef enum
{
  GI_INFO_TYPE_INVALID,
  GI_INFO_TYPE_FUNCTION,
  GI_INFO_TYPE_CALLBACK,
  GI_INFO_TYPE_STRUCT,
  GI_INFO_TYPE_BOXED,
  GI_INFO_TYPE_ENUM,             /*  5 */
  GI_INFO_TYPE_FLAGS,
  GI_INFO_TYPE_OBJECT,
  GI_INFO_TYPE_INTERFACE,
  GI_INFO_TYPE_CONSTANT,
  GI_INFO_TYPE_UNION,            /* 10 */
  GI_INFO_TYPE_VALUE,
  GI_INFO_TYPE_SIGNAL,
  GI_INFO_TYPE_VFUNC,
  GI_INFO_TYPE_PROPERTY,
  GI_INFO_TYPE_FIELD,            /* 15 */
  GI_INFO_TYPE_ARG,
  GI_INFO_TYPE_TYPE,
  GI_INFO_TYPE_UNRESOLVED,
  GI_INFO_TYPE_CALLABLE,
  GI_INFO_TYPE_REGISTERED_TYPE,  /* 20 */
  /* keep GI_INFO_TYPE_N_TYPES in sync with this */
} GIInfoType;

/**
 * GI_INFO_TYPE_N_TYPES:
 *
 * Number of entries in [enum@GIRepository.InfoType].
 *
 * Since: 2.80
 */
#define GI_INFO_TYPE_N_TYPES (GI_INFO_TYPE_REGISTERED_TYPE + 1)

/**
 * GITransfer:
 * @GI_TRANSFER_NOTHING: Transfer nothing from the callee (function or the type
 *   instance the property belongs to) to the caller. The callee retains the
 *   ownership of the transfer and the caller doesn’t need to do anything to
 *   free up the resources of this transfer.
 * @GI_TRANSFER_CONTAINER: Transfer the container (list, array, hash table) from
 *   the callee to the caller. The callee retains the ownership of the
 *   individual items in the container and the caller has to free up the
 *   container resources ([func@GLib.List.free],
 *   [func@GLib.HashTable.destroy], etc) of this transfer.
 * @GI_TRANSFER_EVERYTHING: Transfer everything, e.g. the container and its
 *   contents from the callee to the caller. This is the case when the callee
 *   creates a copy of all the data it returns. The caller is responsible for
 *   cleaning up the container and item resources of this transfer.
 *
 * `GITransfer` specifies who’s responsible for freeing the resources after an
 * ownership transfer is complete.
 *
 * The transfer is the exchange of data between two parts, from the callee to
 * the caller.
 *
 * The callee is either a function/method/signal or an object/interface where a
 * property is defined. The caller is the side accessing a property or calling a
 * function.
 *
 * In the case of a containing type such as a list, an array or a hash table the
 * container itself is specified differently from the items within the
 * container. Each container is freed differently, check the documentation for
 * the types themselves for information on how to free them.
 *
 * Since: 2.80
 */
typedef enum {
  GI_TRANSFER_NOTHING,
  GI_TRANSFER_CONTAINER,
  GI_TRANSFER_EVERYTHING
} GITransfer;

/**
 * GIDirection:
 * @GI_DIRECTION_IN: ‘in’ argument.
 * @GI_DIRECTION_OUT: ‘out’ argument.
 * @GI_DIRECTION_INOUT: ‘in and out’ argument.
 *
 * The direction of a [class@GIRepository.ArgInfo].
 *
 * Since: 2.80
 */
typedef enum  {
  GI_DIRECTION_IN,
  GI_DIRECTION_OUT,
  GI_DIRECTION_INOUT
} GIDirection;

/**
 * GIScopeType:
 * @GI_SCOPE_TYPE_INVALID: The argument is not of callback type.
 * @GI_SCOPE_TYPE_CALL: The callback and associated `user_data` is only
 *   used during the call to this function.
 * @GI_SCOPE_TYPE_ASYNC: The callback and associated `user_data` is
 *   only used until the callback is invoked, and the callback.
 *   is invoked always exactly once.
 * @GI_SCOPE_TYPE_NOTIFIED: The callback and associated
 *   `user_data` is used until the caller is notified via the
 *   [type@GLib.DestroyNotify].
 * @GI_SCOPE_TYPE_FOREVER: The callback and associated `user_data` is
 *   used until the process terminates
 *
 * Scope type of a [class@GIRepository.ArgInfo] representing callback,
 * determines how the callback is invoked and is used to decided when the invoke
 * structs can be freed.
 *
 * Since: 2.80
 */
typedef enum {
  GI_SCOPE_TYPE_INVALID,
  GI_SCOPE_TYPE_CALL,
  GI_SCOPE_TYPE_ASYNC,
  GI_SCOPE_TYPE_NOTIFIED,
  GI_SCOPE_TYPE_FOREVER
} GIScopeType;

/**
 * GITypeTag:
 * @GI_TYPE_TAG_VOID: void
 * @GI_TYPE_TAG_BOOLEAN: boolean
 * @GI_TYPE_TAG_INT8: 8-bit signed integer
 * @GI_TYPE_TAG_UINT8: 8-bit unsigned integer
 * @GI_TYPE_TAG_INT16: 16-bit signed integer
 * @GI_TYPE_TAG_UINT16: 16-bit unsigned integer
 * @GI_TYPE_TAG_INT32: 32-bit signed integer
 * @GI_TYPE_TAG_UINT32: 32-bit unsigned integer
 * @GI_TYPE_TAG_INT64: 64-bit signed integer
 * @GI_TYPE_TAG_UINT64: 64-bit unsigned integer
 * @GI_TYPE_TAG_FLOAT: float
 * @GI_TYPE_TAG_DOUBLE: double floating point
 * @GI_TYPE_TAG_GTYPE: a [type@GObject.Type]
 * @GI_TYPE_TAG_UTF8: a UTF-8 encoded string
 * @GI_TYPE_TAG_FILENAME: a filename, encoded in the same encoding
 *   as the native filesystem is using.
 * @GI_TYPE_TAG_ARRAY: an array
 * @GI_TYPE_TAG_INTERFACE: an extended interface object
 * @GI_TYPE_TAG_GLIST: a [type@GLib.List]
 * @GI_TYPE_TAG_GSLIST: a [type@GLib.SList]
 * @GI_TYPE_TAG_GHASH: a [type@GLib.HashTable]
 * @GI_TYPE_TAG_ERROR: a [type@GLib.Error]
 * @GI_TYPE_TAG_UNICHAR: Unicode character
 *
 * The type tag of a [class@GIRepository.TypeInfo].
 *
 * Since: 2.80
 */
typedef enum {
  /* Basic types */
  GI_TYPE_TAG_VOID      =  0,
  GI_TYPE_TAG_BOOLEAN   =  1,
  GI_TYPE_TAG_INT8      =  2,  /* Start of GI_TYPE_TAG_IS_NUMERIC types */
  GI_TYPE_TAG_UINT8     =  3,
  GI_TYPE_TAG_INT16     =  4,
  GI_TYPE_TAG_UINT16    =  5,
  GI_TYPE_TAG_INT32     =  6,
  GI_TYPE_TAG_UINT32    =  7,
  GI_TYPE_TAG_INT64     =  8,
  GI_TYPE_TAG_UINT64    =  9,
  GI_TYPE_TAG_FLOAT     = 10,
  GI_TYPE_TAG_DOUBLE    = 11,  /* End of numeric types */
  GI_TYPE_TAG_GTYPE     = 12,
  GI_TYPE_TAG_UTF8      = 13,
  GI_TYPE_TAG_FILENAME  = 14,
  /* Non-basic types; compare with GI_TYPE_TAG_IS_BASIC */
  GI_TYPE_TAG_ARRAY     = 15,  /* container (see GI_TYPE_TAG_IS_CONTAINER) */
  GI_TYPE_TAG_INTERFACE = 16,
  GI_TYPE_TAG_GLIST     = 17,  /* container */
  GI_TYPE_TAG_GSLIST    = 18,  /* container */
  GI_TYPE_TAG_GHASH     = 19,  /* container */
  GI_TYPE_TAG_ERROR     = 20,
  /* Another basic type */
  GI_TYPE_TAG_UNICHAR   = 21
  /* Note - there is currently only room for 32 tags */
} GITypeTag;

/**
 * GI_TYPE_TAG_N_TYPES:
 *
 * Number of entries in [enum@GIRepository.TypeTag].
 *
 * Since: 2.80
 */
#define GI_TYPE_TAG_N_TYPES (GI_TYPE_TAG_UNICHAR+1)

/**
 * GIArrayType:
 * @GI_ARRAY_TYPE_C: a C array, `char[]` for instance
 * @GI_ARRAY_TYPE_ARRAY: a [type@GLib.Array] array
 * @GI_ARRAY_TYPE_PTR_ARRAY: a [type@GLib.PtrArray] array
 * @GI_ARRAY_TYPE_BYTE_ARRAY: a [type@GLib.ByteArray] array
 *
 * The type of array in a [class@GIRepository.TypeInfo].
 *
 * Since: 2.80
 */
typedef enum {
  GI_ARRAY_TYPE_C,
  GI_ARRAY_TYPE_ARRAY,
  GI_ARRAY_TYPE_PTR_ARRAY,
  GI_ARRAY_TYPE_BYTE_ARRAY
} GIArrayType;

/**
 * GIFieldInfoFlags:
 * @GI_FIELD_IS_READABLE: field is readable.
 * @GI_FIELD_IS_WRITABLE: field is writable.
 *
 * Flags for a [class@GIRepository.FieldInfo].
 *
 * Since: 2.80
 */

typedef enum
{
  GI_FIELD_IS_READABLE = 1 << 0,
  GI_FIELD_IS_WRITABLE = 1 << 1
} GIFieldInfoFlags;

/**
 * GIVFuncInfoFlags:
 * @GI_VFUNC_MUST_CHAIN_UP: chains up to the parent type
 * @GI_VFUNC_MUST_OVERRIDE: overrides
 * @GI_VFUNC_MUST_NOT_OVERRIDE: does not override
 * @GI_VFUNC_THROWS: includes a [type@GLib.Error]
 *
 * Flags of a [class@GIRepository.VFuncInfo] struct.
 *
 * Since: 2.80
 */
typedef enum
{
  GI_VFUNC_MUST_CHAIN_UP     = 1 << 0,
  GI_VFUNC_MUST_OVERRIDE     = 1 << 1,
  GI_VFUNC_MUST_NOT_OVERRIDE = 1 << 2,
  GI_VFUNC_THROWS =            1 << 3
} GIVFuncInfoFlags;

/**
 * GIFunctionInfoFlags:
 * @GI_FUNCTION_IS_METHOD: is a method.
 * @GI_FUNCTION_IS_CONSTRUCTOR: is a constructor.
 * @GI_FUNCTION_IS_GETTER: is a getter of a [class@GIRepository.PropertyInfo].
 * @GI_FUNCTION_IS_SETTER: is a setter of a [class@GIRepository.PropertyInfo].
 * @GI_FUNCTION_WRAPS_VFUNC: represents a virtual function.
 * @GI_FUNCTION_THROWS: the function may throw an error.
 *
 * Flags for a [class@GIRepository.FunctionInfo] struct.
 *
 * Since: 2.80
 */
typedef enum
{
  GI_FUNCTION_IS_METHOD      = 1 << 0,
  GI_FUNCTION_IS_CONSTRUCTOR = 1 << 1,
  GI_FUNCTION_IS_GETTER      = 1 << 2,
  GI_FUNCTION_IS_SETTER      = 1 << 3,
  GI_FUNCTION_WRAPS_VFUNC    = 1 << 4,
  GI_FUNCTION_THROWS         = 1 << 5
} GIFunctionInfoFlags;

G_END_DECLS