3 * Copyright (C) 2006-2014 Jürg Billeter
4 * Copyright (C) 2006-2008 Raffaele Sandrini
5 * Copyright (C) 2007 Mathias Hasselmann
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * As a special exception, if you use inline functions from this file, this
22 * file does not by itself cause the resulting executable to be covered by
23 * the GNU Lesser General Public License.
26 * Jürg Billeter <j@bitron.ch>
27 * Raffaele Sandrini <rasa@gmx.ch>
28 * Mathias Hasselmann <mathias.hasselmann@gmx.de>
32 [GIR (name = "gboolean")]
33 [CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", marshaller_type_name = "BOOLEAN", get_value_function = "g_value_get_boolean", set_value_function = "g_value_set_boolean", default_value = "FALSE", type_signature = "b")]
36 public string to_string () {
44 public static bool parse (string str) {
51 public static bool try_parse (string str, out bool result = null) {
55 } else if (str == "false") {
66 [GIR (name = "gint8")]
67 [CCode (cname = "gchar", cprefix = "g_ascii_", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_schar", set_value_function = "g_value_set_schar", default_value = "\'\\0\'", type_signature = "y")]
68 [IntegerType (rank = 2, min = 0, max = 127)]
70 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
71 public string to_string (string format = "%c");
72 public bool isalnum ();
73 public bool isalpha ();
74 public bool iscntrl ();
75 public bool isdigit ();
76 public bool isgraph ();
77 public bool islower ();
78 public bool isprint ();
79 public bool ispunct ();
80 public bool isspace ();
81 public bool isupper ();
82 public bool isxdigit ();
83 public int digit_value ();
84 public int xdigit_value ();
85 public char tolower ();
86 public char toupper ();
88 [CCode (cname = "MIN")]
89 public static char min (char a, char b);
90 [CCode (cname = "MAX")]
91 public static char max (char a, char b);
92 [CCode (cname = "CLAMP")]
93 public char clamp (char low, char high);
97 [GIR (name = "guint8")]
98 [CCode (cname = "guchar", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "\'\\0\'", type_signature = "y")]
99 [IntegerType (rank = 3, min = 0, max = 255)]
100 public struct uchar {
101 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
102 public string to_string (string format = "%hhu");
104 [CCode (cname = "MIN")]
105 public static uchar min (uchar a, uchar b);
106 [CCode (cname = "MAX")]
107 public static uchar max (uchar a, uchar b);
108 [CCode (cname = "CLAMP")]
109 public uchar clamp (uchar low, uchar high);
113 [GIR (name = "gint")]
114 [CCode (cname = "gint", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", default_value_on_error = "-1", type_signature = "i")]
115 [IntegerType (rank = 6)]
117 [CCode (cname = "G_MININT")]
118 public const int MIN;
119 [CCode (cname = "G_MAXINT")]
120 public const int MAX;
122 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
123 public string to_string (string format = "%i");
125 [CCode (cname = "MIN")]
126 public static int min (int a, int b);
127 [CCode (cname = "MAX")]
128 public static int max (int a, int b);
129 [CCode (cname = "CLAMP")]
130 public int clamp (int low, int high);
132 [CCode (cname = "GINT_TO_POINTER")]
133 public void* to_pointer ();
134 [CCode (cname = "GPOINTER_TO_INT")]
135 public static int from_pointer (void* p);
137 [CCode (cname = "abs", cheader_filename = "stdlib.h")]
140 [CCode (cname = "GINT_TO_BE")]
141 public int to_big_endian ();
142 [CCode (cname = "GINT_TO_LE")]
143 public int to_little_endian ();
145 [CCode (cname = "GINT_FROM_BE")]
146 public static int from_big_endian (int val);
147 [CCode (cname = "GINT_FROM_LE")]
148 public static int from_little_endian (int val);
150 [CCode (cname = "atoi", cheader_filename = "stdlib.h")]
151 public static int parse (string str);
155 [GIR (name = "guint")]
156 [CCode (cname = "guint", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "u")]
157 [IntegerType (rank = 7)]
159 [CCode (cname = "0")]
160 public const uint MIN;
161 [CCode (cname = "G_MAXUINT")]
162 public const uint MAX;
164 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
165 public string to_string (string format = "%u");
167 [CCode (cname = "MIN")]
168 public static uint min (uint a, uint b);
169 [CCode (cname = "MAX")]
170 public static uint max (uint a, uint b);
171 [CCode (cname = "CLAMP")]
172 public uint clamp (uint low, uint high);
174 [CCode (cname = "GUINT_TO_POINTER")]
175 public void* to_pointer ();
176 [CCode (cname = "GPOINTER_TO_UINT")]
177 public static uint from_pointer (void* p);
179 [CCode (cname = "GUINT_TO_BE")]
180 public uint to_big_endian ();
181 [CCode (cname = "GUINT_TO_LE")]
182 public uint to_little_endian ();
184 [CCode (cname = "GUINT_FROM_BE")]
185 public static uint from_big_endian (uint val);
186 [CCode (cname = "GUINT_FROM_LE")]
187 public static uint from_little_endian (uint val);
191 [GIR (name = "gshort")]
192 [CCode (cname = "gshort", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", default_value_on_error = "-1", type_signature = "n")]
193 [IntegerType (rank = 4, min = -32768, max = 32767)]
194 public struct short {
195 [CCode (cname = "G_MINSHORT")]
196 public const short MIN;
197 [CCode (cname = "G_MAXSHORT")]
198 public const short MAX;
200 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
201 public string to_string (string format = "%hi");
203 [CCode (cname = "MIN")]
204 public static short min (short a, short b);
205 [CCode (cname = "MAX")]
206 public static short max (short a, short b);
207 [CCode (cname = "CLAMP")]
208 public short clamp (short low, short high);
209 [CCode (cname = "abs", cheader_filename = "stdlib.h")]
214 [GIR (name = "gushort")]
215 [CCode (cname = "gushort", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "q")]
216 [IntegerType (rank = 5, min = 0, max = 65535)]
217 public struct ushort {
218 [CCode (cname = "0U")]
219 public const ushort MIN;
220 [CCode (cname = "G_MAXUSHORT")]
221 public const ushort MAX;
223 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
224 public string to_string (string format = "%hu");
226 [CCode (cname = "MIN")]
227 public static ushort min (ushort a, ushort b);
228 [CCode (cname = "MAX")]
229 public static ushort max (ushort a, ushort b);
230 [CCode (cname = "CLAMP")]
231 public ushort clamp (ushort low, ushort high);
235 [GIR (name = "glong")]
236 [CCode (cname = "glong", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L", default_value_on_error = "-1L")]
237 [IntegerType (rank = 8)]
239 [CCode (cname = "G_MINLONG")]
240 public const long MIN;
241 [CCode (cname = "G_MAXLONG")]
242 public const long MAX;
244 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
245 public string to_string (string format = "%li");
247 [CCode (cname = "MIN")]
248 public static long min (long a, long b);
249 [CCode (cname = "MAX")]
250 public static long max (long a, long b);
251 [CCode (cname = "CLAMP")]
252 public long clamp (long low, long high);
253 [CCode (cname = "labs", cheader_filename = "stdlib.h")]
256 [CCode (cname = "GLONG_TO_BE")]
257 public long to_big_endian ();
258 [CCode (cname = "GLONG_TO_LE")]
259 public long to_little_endian ();
261 [CCode (cname = "GLONG_FROM_BE")]
262 public static long from_big_endian (long val);
263 [CCode (cname = "GLONG_FROM_LE")]
264 public static long from_little_endian (long val);
266 [CCode (cname = "strtol", cheader_filename = "stdlib.h")]
267 static long strtol (string nptr, out char* endptr, uint _base);
269 public static long parse (string str) {
270 return strtol (str, null, 0);
273 public static bool try_parse (string str, out long result = null, out unowned string unparsed = null) {
275 result = strtol (str, out endptr, 0);
276 if (endptr == (char*) str + str.length) {
280 unparsed = (string) endptr;
287 [GIR (name = "gulong")]
288 [CCode (cname = "gulong", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")]
289 [IntegerType (rank = 9)]
290 public struct ulong {
291 [CCode (cname = "0UL")]
292 public const ulong MIN;
293 [CCode (cname = "G_MAXULONG")]
294 public const ulong MAX;
296 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
297 public string to_string (string format = "%lu");
299 [CCode (cname = "MIN")]
300 public static ulong min (ulong a, ulong b);
301 [CCode (cname = "MAX")]
302 public static ulong max (ulong a, ulong b);
303 [CCode (cname = "CLAMP")]
304 public ulong clamp (ulong low, ulong high);
306 [CCode (cname = "GULONG_TO_BE")]
307 public ulong to_big_endian ();
308 [CCode (cname = "GULONG_TO_LE")]
309 public ulong to_little_endian ();
311 [CCode (cname = "GULONG_FROM_BE")]
312 public static ulong from_big_endian (ulong val);
313 [CCode (cname = "GULONG_FROM_LE")]
314 public static ulong from_little_endian (ulong val);
316 [CCode (cname = "strtoul", cheader_filename = "stdlib.h")]
317 static ulong strtoul (string nptr, out char* endptr, uint _base);
319 public static ulong parse (string str) {
320 return strtoul (str, null, 0);
323 public static bool try_parse (string str, out ulong result = null, out unowned string unparsed = null) {
325 result = strtoul (str, out endptr, 0);
326 if (endptr == (char*) str + str.length) {
330 unparsed = (string) endptr;
337 [GIR (name = "gulong")]
338 [CCode (cname = "gsize", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")]
339 [IntegerType (rank = 9)]
340 public struct size_t {
341 [CCode (cname = "0UL")]
342 public const ulong MIN;
343 [Version (since = "2.4")]
344 [CCode (cname = "G_MAXSIZE")]
345 public const ulong MAX;
347 [Version (since = "2.6")]
348 [CCode (cname = "G_GSIZE_FORMAT")]
349 public const string FORMAT;
350 [Version (since = "2.6")]
351 [CCode (cname = "G_GSIZE_MODIFIER")]
352 public const string FORMAT_MODIFIER;
354 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
355 public string to_string (string format = "%" + FORMAT);
357 [CCode (cname = "GSIZE_TO_POINTER")]
358 public void* to_pointer ();
359 [CCode (cname = "GPOINTER_TO_SIZE")]
360 public static size_t from_pointer (void* p);
362 [CCode (cname = "MIN")]
363 public static size_t min (size_t a, size_t b);
364 [CCode (cname = "MAX")]
365 public static size_t max (size_t a, size_t b);
366 [CCode (cname = "CLAMP")]
367 public size_t clamp (size_t low, size_t high);
371 [GIR (name = "glong")]
372 [CCode (cname = "gssize", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L", default_value_on_error = "-1L")]
373 [IntegerType (rank = 8)]
374 public struct ssize_t {
375 [Version (since = "2.14")]
376 [CCode (cname = "G_MINSSIZE")]
377 public const long MIN;
378 [Version (since = "2.14")]
379 [CCode (cname = "G_MAXSSIZE")]
380 public const long MAX;
382 [Version (since = "2.6")]
383 [CCode (cname = "G_GSSIZE_FORMAT")]
384 public const string FORMAT;
385 [CCode (cname = "G_GSIZE_MODIFIER")]
386 public const string FORMAT_MODIFIER;
388 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
389 public string to_string (string format = "%" + FORMAT);
391 [CCode (cname = "MIN")]
392 public static ssize_t min (ssize_t a, ssize_t b);
393 [CCode (cname = "MAX")]
394 public static ssize_t max (ssize_t a, ssize_t b);
395 [CCode (cname = "CLAMP")]
396 public ssize_t clamp (ssize_t low, ssize_t high);
400 [GIR (name = "gulong")]
401 [CCode (cname = "guintptr", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")]
402 [IntegerType (rank = 9)]
403 public struct uintptr {
404 [CCode (cname = "0UL")]
405 public const ulong MIN;
406 [CCode (cname = "G_MAXSIZE")]
407 public const ulong MAX;
409 [CCode (cname = "G_GUINTPTR_FORMAT")]
410 public const string FORMAT;
411 [CCode (cname = "G_GINTPTR_MODIFIER")]
412 public const string FORMAT_MODIFIER;
414 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
415 public string to_string (string format = "%" + FORMAT);
417 [CCode (cname = "GSIZE_TO_POINTER")]
418 public void* to_pointer ();
419 [CCode (cname = "GPOINTER_TO_SIZE")]
420 public static uintptr from_pointer (void* p);
422 [CCode (cname = "MIN")]
423 public static uintptr min (uintptr a, uintptr b);
424 [CCode (cname = "MAX")]
425 public static uintptr max (uintptr a, uintptr b);
426 [CCode (cname = "CLAMP")]
427 public uintptr clamp (uintptr low, uintptr high);
431 [GIR (name = "glong")]
432 [CCode (cname = "gintptr", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L")]
433 [IntegerType (rank = 8)]
434 public struct intptr {
435 [CCode (cname = "G_MINSSIZE")]
436 public const long MIN;
437 [CCode (cname = "G_MAXSSIZE")]
438 public const long MAX;
440 [CCode (cname = "G_GINTPTR_FORMAT")]
441 public const string FORMAT;
442 [CCode (cname = "G_GINTPTR_MODIFIER")]
443 public const string FORMAT_MODIFIER;
445 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
446 public string to_string (string format = "%" + FORMAT);
448 [CCode (cname = "MIN")]
449 public static intptr min (intptr a, intptr b);
450 [CCode (cname = "MAX")]
451 public static intptr max (intptr a, intptr b);
452 [CCode (cname = "CLAMP")]
453 public intptr clamp (intptr low, intptr high);
457 [GIR (name = "gint8")]
458 [CCode (cname = "gint8", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "0", default_value_on_error = "-1", type_signature = "y")]
459 [IntegerType (rank = 1, min = -128, max = 127)]
461 [Version (since = "2.4")]
462 [CCode (cname = "G_MININT8")]
463 public const int8 MIN;
464 [Version (since = "2.4")]
465 [CCode (cname = "G_MAXINT8")]
466 public const int8 MAX;
468 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
469 public string to_string (string format = "%hhi");
471 [CCode (cname = "MIN")]
472 public static int8 min (int8 a, int8 b);
473 [CCode (cname = "MAX")]
474 public static int8 max (int8 a, int8 b);
475 [CCode (cname = "CLAMP")]
476 public int8 clamp (int8 low, int8 high);
480 [GIR (name = "guint8")]
481 [CCode (cname = "guint8", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "0U", type_signature = "y")]
482 [IntegerType (rank = 3, min = 0, max = 255)]
483 public struct uint8 {
484 [CCode (cname = "0U")]
485 public const uint8 MIN;
486 [Version (since = "2.4")]
487 [CCode (cname = "G_MAXUINT8")]
488 public const uint8 MAX;
490 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
491 public string to_string (string format = "%hhu");
493 [CCode (cname = "MIN")]
494 public static uint8 min (uint8 a, uint8 b);
495 [CCode (cname = "MAX")]
496 public static uint8 max (uint8 a, uint8 b);
497 [CCode (cname = "CLAMP")]
498 public uint8 clamp (uint8 low, uint8 high);
502 [GIR (name = "gint16")]
503 [CCode (cname = "gint16", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", default_value_on_error = "-1", type_signature = "n")]
504 [IntegerType (rank = 4, min = -32768, max = 32767)]
505 public struct int16 {
506 [Version (since = "2.4")]
507 [CCode (cname = "G_MININT16")]
508 public const int16 MIN;
509 [Version (since = "2.4")]
510 [CCode (cname = "G_MAXINT16")]
511 public const int16 MAX;
513 [CCode (cname = "G_GINT16_FORMAT")]
514 public const string FORMAT;
515 [Version (since = "2.4")]
516 [CCode (cname = "G_GINT16_MODIFIER")]
517 public const string FORMAT_MODIFIER;
519 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
520 public string to_string (string format = "%" + FORMAT);
522 [CCode (cname = "MIN")]
523 public static int16 min (int16 a, int16 b);
524 [CCode (cname = "MAX")]
525 public static int16 max (int16 a, int16 b);
526 [CCode (cname = "CLAMP")]
527 public int16 clamp (int16 low, int16 high);
529 [CCode (cname = "GINT16_TO_BE")]
530 public int16 to_big_endian ();
531 [CCode (cname = "GINT16_TO_LE")]
532 public int16 to_little_endian ();
534 [CCode (cname = "GINT16_FROM_BE")]
535 public static int16 from_big_endian (int16 val);
536 [CCode (cname = "GINT16_FROM_LE")]
537 public static int16 from_little_endian (int16 val);
541 [GIR (name = "guint16")]
542 [CCode (cname = "guint16", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "q")]
543 [IntegerType (rank = 5, min = 0, max = 65535)]
544 public struct uint16 {
545 [CCode (cname = "0U")]
546 public const uint16 MIN;
547 [Version (since = "2.4")]
548 [CCode (cname = "G_MAXUINT16")]
549 public const uint16 MAX;
551 [CCode (cname = "G_GUINT16_FORMAT")]
552 public const string FORMAT;
553 [CCode (cname = "G_GINT16_MODIFIER")]
554 public const string FORMAT_MODIFIER;
556 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
557 public string to_string (string format = "%hu");
559 [CCode (cname = "MIN")]
560 public static uint16 min (uint16 a, uint16 b);
561 [CCode (cname = "MAX")]
562 public static uint16 max (uint16 a, uint16 b);
563 [CCode (cname = "CLAMP")]
564 public uint16 clamp (uint16 low, uint16 high);
566 [CCode (cname = "GUINT16_TO_BE")]
567 public uint16 to_big_endian ();
568 [CCode (cname = "GUINT16_TO_LE")]
569 public uint16 to_little_endian ();
571 [CCode (cname = "GUINT16_FROM_BE")]
572 public static uint16 from_big_endian (uint16 val);
573 [CCode (cname = "GUINT16_FROM_LE")]
574 public static uint16 from_little_endian (uint16 val);
576 [CCode (cname = "g_htons")]
577 public static uint16 to_network (uint16 val);
578 [CCode (cname = "g_ntohs")]
579 public static uint16 from_network (uint16 val);
581 [CCode (cname = "GUINT16_SWAP_BE_PDP")]
582 public uint16 swap_big_endian_pdp ();
583 [CCode (cname = "GUINT16_SWAP_LE_BE")]
584 public uint16 swap_little_endian_big_endian ();
585 [CCode (cname = "GUINT16_SWAP_LE_PDP")]
586 public uint16 swap_little_endian_pdp ();
590 [GIR (name = "gint32")]
591 [CCode (cname = "gint32", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", default_value_on_error = "-1", type_signature = "i")]
592 [IntegerType (rank = 6)]
593 public struct int32 {
594 [Version (since = "2.4")]
595 [CCode (cname = "G_MININT32")]
596 public const int32 MIN;
597 [Version (since = "2.4")]
598 [CCode (cname = "G_MAXINT32")]
599 public const int32 MAX;
601 [CCode (cname = "G_GINT32_FORMAT")]
602 public const string FORMAT;
603 [Version (since = "2.4")]
604 [CCode (cname = "G_GINT32_MODIFIER")]
605 public const string FORMAT_MODIFIER;
607 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
608 public string to_string (string format = "%i");
610 [CCode (cname = "MIN")]
611 public static int32 min (int32 a, int32 b);
612 [CCode (cname = "MAX")]
613 public static int32 max (int32 a, int32 b);
614 [CCode (cname = "CLAMP")]
615 public int32 clamp (int32 low, int32 high);
617 [CCode (cname = "GINT32_TO_BE")]
618 public int32 to_big_endian ();
619 [CCode (cname = "GINT32_TO_LE")]
620 public int32 to_little_endian ();
622 [CCode (cname = "GINT32_FROM_BE")]
623 public static int32 from_big_endian (int32 val);
624 [CCode (cname = "GINT32_FROM_LE")]
625 public static int32 from_little_endian (int32 val);
629 [GIR (name = "guint32")]
630 [CCode (cname = "guint32", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "u")]
631 [IntegerType (rank = 7)]
632 public struct uint32 {
633 [CCode (cname = "0U")]
634 public const uint32 MIN;
635 [Version (since = "2.4")]
636 [CCode (cname = "G_MAXUINT32")]
637 public const uint32 MAX;
639 [CCode (cname = "G_GUINT32_FORMAT")]
640 public const string FORMAT;
641 [CCode (cname = "G_GINT32_MODIFIER")]
642 public const string FORMAT_MODIFIER;
644 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
645 public string to_string (string format = "%u");
647 [CCode (cname = "MIN")]
648 public static uint32 min (uint32 a, uint32 b);
649 [CCode (cname = "MAX")]
650 public static uint32 max (uint32 a, uint32 b);
651 [CCode (cname = "CLAMP")]
652 public uint32 clamp (uint32 low, uint32 high);
654 [CCode (cname = "GUINT32_TO_BE")]
655 public uint32 to_big_endian ();
656 [CCode (cname = "GUINT32_TO_LE")]
657 public uint32 to_little_endian ();
659 [CCode (cname = "GUINT32_FROM_BE")]
660 public static uint32 from_big_endian (uint32 val);
661 [CCode (cname = "GUINT32_FROM_LE")]
662 public static uint32 from_little_endian (uint32 val);
664 [CCode (cname = "g_htonl")]
665 public static uint32 to_network (uint32 val);
666 [CCode (cname = "g_ntohl")]
667 public static uint32 from_network (uint32 val);
669 [CCode (cname = "GUINT32_SWAP_BE_PDP")]
670 public uint32 swap_big_endian_pdp ();
671 [CCode (cname = "GUINT32_SWAP_LE_BE")]
672 public uint32 swap_little_endian_big_endian ();
673 [CCode (cname = "GUINT32_SWAP_LE_PDP")]
674 public uint32 swap_little_endian_pdp ();
678 [GIR (name = "gint64")]
679 [CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64", get_value_function = "g_value_get_int64", set_value_function = "g_value_set_int64", default_value = "0LL", default_value_on_error = "-1LL", type_signature = "x")]
680 [IntegerType (rank = 10)]
681 public struct int64 {
682 [CCode (cname = "G_MININT64")]
683 public const int64 MIN;
684 [CCode (cname = "G_MAXINT64")]
685 public const int64 MAX;
687 [CCode (cname = "G_GINT64_FORMAT")]
688 public const string FORMAT;
689 [Version (since = "2.4")]
690 [CCode (cname = "G_GINT64_MODIFIER")]
691 public const string FORMAT_MODIFIER;
693 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
694 public string to_string (string format = "%" + FORMAT);
696 [CCode (cname = "MIN")]
697 public static int64 min (int64 a, int64 b);
698 [CCode (cname = "MAX")]
699 public static int64 max (int64 a, int64 b);
700 [CCode (cname = "CLAMP")]
701 public int64 clamp (int64 low, int64 high);
702 [CCode (cname = "llabs", cheader_filename = "stdlib.h")]
705 [CCode (cname = "GINT64_TO_BE")]
706 public int64 to_big_endian ();
707 [CCode (cname = "GINT64_TO_LE")]
708 public int64 to_little_endian ();
710 [CCode (cname = "GINT64_FROM_BE")]
711 public static int64 from_big_endian (int64 val);
712 [CCode (cname = "GINT64_FROM_LE")]
713 public static int64 from_little_endian (int64 val);
715 [CCode (cname = "GUINT64_SWAP_LE_BE")]
716 public uint64 swap_little_endian_big_endian ();
718 [CCode (cname = "g_ascii_strtoll")]
719 static int64 ascii_strtoll (string nptr, out char* endptr, uint _base);
721 [Version (since = "2.12")]
722 public static int64 parse (string str) {
723 return ascii_strtoll (str, null, 0);
726 [Version (since = "2.12")]
727 public static bool try_parse (string str, out int64 result = null, out unowned string unparsed = null) {
729 result = ascii_strtoll (str, out endptr, 0);
730 if (endptr == (char*) str + str.length) {
734 unparsed = (string) endptr;
739 [CCode (cname = "g_ascii_string_to_signed")]
740 [Version (since = "2.54")]
741 public static bool from_string (string str, [CCode (pos = 5.1)] out int64 out_num = null, uint @base = 10U, int64 min = int64.MIN, int64 max = int64.MAX) throws GLib.NumberParserError;
745 [GIR (name = "guint64")]
746 [CCode (cname = "guint64", cheader_filename = "glib.h", type_id = "G_TYPE_UINT64", marshaller_type_name = "UINT64", get_value_function = "g_value_get_uint64", set_value_function = "g_value_set_uint64", default_value = "0ULL", type_signature = "t")]
747 [IntegerType (rank = 11)]
748 public struct uint64 {
749 [CCode (cname = "0ULL")]
750 public const uint64 MIN;
751 [CCode (cname = "G_MAXUINT64")]
752 public const uint64 MAX;
754 [CCode (cname = "G_GUINT64_FORMAT")]
755 public const string FORMAT;
756 [CCode (cname = "G_GINT64_MODIFIER")]
757 public const string FORMAT_MODIFIER;
759 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
760 public string to_string (string format = "%" + FORMAT);
762 [CCode (cname = "MIN")]
763 public static uint64 min (uint64 a, uint64 b);
764 [CCode (cname = "MAX")]
765 public static uint64 max (uint64 a, uint64 b);
766 [CCode (cname = "CLAMP")]
767 public uint64 clamp (uint64 low, uint64 high);
769 [CCode (cname = "GUINT64_TO_BE")]
770 public uint64 to_big_endian ();
771 [CCode (cname = "GUINT64_TO_LE")]
772 public uint64 to_little_endian ();
774 [CCode (cname = "GUINT64_FROM_BE")]
775 public static uint64 from_big_endian (uint64 val);
776 [CCode (cname = "GUINT64_FROM_LE")]
777 public static uint64 from_little_endian (uint64 val);
779 [CCode (cname = "g_ascii_strtoull")]
780 static uint64 ascii_strtoull (string nptr, out char* endptr, uint _base);
782 public static uint64 parse (string str) {
783 return ascii_strtoull (str, null, 0);
786 public static bool try_parse (string str, out uint64 result = null, out unowned string unparsed = null) {
788 result = ascii_strtoull (str, out endptr, 0);
789 if (endptr == (char*) str + str.length) {
793 unparsed = (string) endptr;
798 [CCode (cname = "g_ascii_string_to_unsigned")]
799 [Version (since = "2.54")]
800 public static bool from_string (string str, [CCode (pos = 5.1)] out uint64 out_num = null, uint @base = 10U, uint64 min = uint64.MIN, uint64 max = uint64.MAX) throws GLib.NumberParserError;
804 [GIR (name = "gfloat")]
805 [CCode (cname = "gfloat", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_FLOAT", marshaller_type_name = "FLOAT", get_value_function = "g_value_get_float", set_value_function = "g_value_set_float", default_value = "0.0F", default_value_on_error = "-1.0F")]
806 [FloatingType (rank = 1)]
807 public struct float {
808 [CCode (cname = "FLT_ROUNDS")]
809 public const int ROUNDS;
810 [CCode (cname = "FLT_RADIX")]
811 public const int RADIX;
812 [CCode (cname = "FLT_MANT_DIG")]
813 public const int MANT_DIG;
814 [CCode (cname = "FLT_DIG")]
815 public const int DIG;
817 [CCode (cname = "FLT_MIN_EXP")]
818 public const int MIN_EXP;
819 [CCode (cname = "FLT_MAX_EXP")]
820 public const int MAX_EXP;
822 [CCode (cname = "FLT_MIN_10_EXP")]
823 public const int MIN_10_EXP;
824 [CCode (cname = "FLT_MAX_10_EXP")]
825 public const int MAX_10_EXP;
827 [CCode (cname = "FLT_EPSILON")]
828 public const float EPSILON;
829 [CCode (cname = "FLT_MIN")]
830 public const float MIN;
831 [CCode (cname = "FLT_MAX")]
832 public const float MAX;
834 [CCode (cname = "NAN")]
835 public const float NAN;
836 [CCode (cname = "INFINITY")]
837 public const float INFINITY;
839 [CCode (cname = "isnan")]
840 public bool is_nan ();
841 [CCode (cname = "isfinite")]
842 public bool is_finite ();
843 [CCode (cname = "isnormal")]
844 public bool is_normal ();
845 [CCode (cname = "isinf")]
846 public int is_infinity ();
848 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
849 public string to_string (string format = "%g");
851 [CCode (cname = "MIN")]
852 public static float min (float a, float b);
853 [CCode (cname = "MAX")]
854 public static float max (float a, float b);
855 [CCode (cname = "CLAMP")]
856 public float clamp (float low, float high);
857 [CCode (cname = "fabsf")]
862 [GIR (name = "gdouble")]
863 [CCode (cname = "gdouble", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_DOUBLE", marshaller_type_name = "DOUBLE", get_value_function = "g_value_get_double", set_value_function = "g_value_set_double", default_value = "0.0", default_value_on_error = "-1.0", type_signature = "d")]
864 [FloatingType (rank = 2)]
865 public struct double {
866 [CCode (cname = "DBL_MANT_DIG")]
867 public const int MANT_DIG;
868 [CCode (cname = "DBL_DIG")]
869 public const int DIG;
871 [CCode (cname = "DBL_MIN_EXP")]
872 public const int MIN_EXP;
873 [CCode (cname = "DBL_MAX_EXP")]
874 public const int MAX_EXP;
876 [CCode (cname = "DBL_MIN_10_EXP")]
877 public const int MIN_10_EXP;
878 [CCode (cname = "DBL_MAX_10_EXP")]
879 public const int MAX_10_EXP;
881 [CCode (cname = "DBL_EPSILON")]
882 public const double EPSILON;
883 [CCode (cname = "DBL_MIN")]
884 public const double MIN;
885 [CCode (cname = "DBL_MAX")]
886 public const double MAX;
888 [CCode (cname = "((double) NAN)")]
889 public const double NAN;
890 [CCode (cname = "((double) INFINITY)")]
891 public const double INFINITY;
893 [CCode (cname = "isnan")]
894 public bool is_nan ();
895 [CCode (cname = "isfinite")]
896 public bool is_finite ();
897 [CCode (cname = "isnormal")]
898 public bool is_normal ();
899 [CCode (cname = "isinf")]
900 public int is_infinity ();
902 [CCode (cname = "MIN")]
903 public static double min (double a, double b);
904 [CCode (cname = "MAX")]
905 public static double max (double a, double b);
906 [CCode (cname = "CLAMP")]
907 public double clamp (double low, double high);
908 [CCode (cname = "fabs")]
909 public double abs ();
911 [CCode (cname = "G_ASCII_DTOSTR_BUF_SIZE")]
912 public const int DTOSTR_BUF_SIZE;
913 [CCode (cname = "g_ascii_dtostr", instance_pos = -1)]
914 public unowned string to_str (char[] buffer);
915 [CCode (cname = "g_ascii_formatd", instance_pos = -1)]
916 public unowned string format (char[] buffer, string format = "%g");
918 public string to_string () {
919 return this.to_str(new char[DTOSTR_BUF_SIZE]);
922 [CCode (cname = "g_ascii_strtod")]
923 static double ascii_strtod (string nptr, out char* endptr);
925 public static double parse (string str) {
926 return ascii_strtod (str, null);
929 public static bool try_parse (string str, out double result = null, out unowned string unparsed = null) {
931 result = ascii_strtod (str, out endptr);
932 if (endptr == (char*) str + str.length) {
936 unparsed = (string) endptr;
942 [GIR (name = "glong")]
943 [CCode (cheader_filename = "time.h", has_type_id = false, default_value = "0")]
944 [IntegerType (rank = 8)]
945 public struct time_t {
946 [CCode (cname = "time")]
947 public time_t (out time_t result = null);
951 [CCode (cheader_filename="stdarg.h", cprefix="va_", has_type_id = false, destroy_function = "va_end", lvalue_access = false)]
952 public struct va_list {
953 [CCode (cname = "va_start")]
955 [CCode (cname = "va_copy")]
956 public va_list.copy (va_list src);
957 [CCode (generic_type_pos = 1.1, simple_generics = true)]
958 public unowned G arg<G> ();
962 [GIR (name = "gunichar")]
963 [CCode (cname = "gunichar", cprefix = "g_unichar_", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "u")]
964 [IntegerType (rank = 7)]
965 public struct unichar {
966 public bool validate ();
967 public bool isalnum ();
968 public bool isalpha ();
969 public bool iscntrl ();
970 public bool isdigit ();
971 public bool isgraph ();
972 public bool islower ();
973 [Version (since = "2.14")]
974 public bool ismark ();
975 public bool isprint ();
976 public bool ispunct ();
977 public bool isspace ();
978 public bool isupper ();
979 public bool isxdigit ();
980 public bool istitle ();
981 public bool isdefined ();
982 public bool iswide ();
983 [Version (since = "2.12")]
984 public bool iswide_cjk ();
985 [Version (since = "2.14")]
986 public bool iszerowidth ();
987 public unichar toupper ();
988 public unichar tolower ();
989 public unichar totitle ();
990 public int digit_value ();
991 public int xdigit_value ();
992 public GLib.UnicodeType type ();
993 public GLib.UnicodeBreakType break_type ();
994 [Version (since = "2.14")]
995 public GLib.UnicodeScript get_script();
997 public int to_utf8 (string? outbuf);
999 public string to_string () {
1000 string str = (string) new char[7];
1005 [Version (since = "2.30")]
1006 public bool compose (unichar b, out unichar ch);
1007 [Version (since = "2.30")]
1008 public bool decompose (out unichar a, out unichar b);
1009 [Version (since = "2.30")]
1010 public size_t fully_decompose (bool compat, unichar[] result);
1012 [CCode (cname = "MIN")]
1013 public static unichar min (unichar a, unichar b);
1014 [CCode (cname = "MAX")]
1015 public static unichar max (unichar a, unichar b);
1016 [CCode (cname = "CLAMP")]
1017 public unichar clamp (unichar low, unichar high);
1019 [CCode (cname = "G_UNICHAR_MAX_DECOMPOSITION_LENGTH")]
1020 public const int MAX_DECOMPOSITION_LENGTH;
1022 [CCode (cname = "G_GUINT32_FORMAT")]
1023 public const string FORMAT;
1024 [CCode (cname = "G_GINT32_MODIFIER")]
1025 public const string FORMAT_MODIFIER;
1029 [GIR (name = "guint16")]
1030 [CCode (cname = "gunichar2", cheader_filename = "glib.h", default_value = "0U", type_signature = "q", has_type_id = false)]
1031 [IntegerType (rank = 5)]
1032 public struct unichar2 {
1033 [CCode (cname = "G_GUINT16_FORMAT")]
1034 public const string FORMAT;
1035 [CCode (cname = "G_GINT16_MODIFIER")]
1036 public const string FORMAT_MODIFIER;
1041 [GIR (name = "utf8")]
1042 [CCode (cname = "gchar", const_cname = "const gchar", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string", type_signature = "s")]
1043 public class string {
1044 [Version (replacement = "string.index_of")]
1045 [CCode (cname = "strstr")]
1046 public unowned string? str (string needle);
1047 [Version (replacement = "string.last_index_of")]
1048 [CCode (cname = "g_strrstr")]
1049 public unowned string? rstr (string needle);
1050 [CCode (cname = "g_strrstr_len")]
1051 public unowned string? rstr_len (ssize_t haystack_len, string needle);
1053 [CCode (cname = "strstr")]
1054 static char* strstr (char* haystack, char* needle);
1055 [CCode (cname = "g_strrstr")]
1056 static char* strrstr (char* haystack, char* needle);
1057 [CCode (cname = "g_utf8_strchr")]
1058 static char* utf8_strchr (char* str, ssize_t len, unichar c);
1059 [CCode (cname = "g_utf8_strrchr")]
1060 static char* utf8_strrchr (char* str, ssize_t len, unichar c);
1062 public int index_of (string needle, int start_index = 0) {
1063 char* result = strstr ((char*) this + start_index, (char*) needle);
1065 if (result != null) {
1066 return (int) (result - (char*) this);
1072 public int last_index_of (string needle, int start_index = 0) {
1073 char* result = strrstr ((char*) this + start_index, (char*) needle);
1075 if (result != null) {
1076 return (int) (result - (char*) this);
1082 public int index_of_char (unichar c, int start_index = 0) {
1083 char* result = utf8_strchr ((char*) this + start_index, -1, c);
1085 if (result != null) {
1086 return (int) (result - (char*) this);
1092 public int last_index_of_char (unichar c, int start_index = 0) {
1093 char* result = utf8_strrchr ((char*) this + start_index, -1, c);
1095 if (result != null) {
1096 return (int) (result - (char*) this);
1102 [Version (since = "2.2")]
1103 [CCode (cname = "g_str_has_prefix")]
1104 public bool has_prefix (string prefix);
1105 [Version (since = "2.2")]
1106 [CCode (cname = "g_str_has_suffix")]
1107 public bool has_suffix (string suffix);
1108 [CCode (cname = "g_strdup_printf"), PrintfFormat]
1109 public string printf (...);
1110 [CCode (cname = "g_strdup_vprintf")]
1111 public string vprintf (va_list args);
1112 [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat]
1113 public int scanf (string format, ...);
1114 [CCode (cname = "g_strconcat")]
1115 public string concat (string string2, ...);
1116 [CCode (cname = "g_strescape")]
1117 public string escape (string? exceptions = null);
1118 [CCode (cname = "g_strcompress")]
1119 public string compress ();
1120 [CCode (cname = "g_strsplit", array_length = false, array_null_terminated = true)]
1121 public string[] split (string delimiter, int max_tokens = 0);
1122 [Version (since = "2.4")]
1123 [CCode (cname = "g_strsplit_set", array_length = false, array_null_terminated = true)]
1124 public string[] split_set (string delimiters, int max_tokens = 0);
1125 [CCode (cname = "g_stpcpy")]
1126 private static void* copy_to_buffer (void* dest, string src);
1127 [CCode (cname = "_vala_g_strjoinv")]
1128 public static string joinv (string? separator, string?[]? str_array) {
1129 if (separator == null) {
1132 if (str_array != null && (str_array.length > 0 || (str_array.length == -1 && str_array[0] != null))) {
1135 for (i = 0 ; (str_array.length != -1 && i < str_array.length) || (str_array.length == -1 && str_array[i] != null) ; i++) {
1136 len += (str_array[i] != null) ? ((!) str_array[i]).length : 0;
1141 str_array.length = i;
1142 len += ((!) separator).length * (i - 1);
1144 string* res = GLib.malloc (len);
1145 void* ptr = string.copy_to_buffer ((void*) res, (!) str_array[0]);
1146 for (i = 1 ; i < str_array.length ; i++) {
1147 ptr = string.copy_to_buffer (ptr, (!) separator);
1148 ptr = string.copy_to_buffer (ptr, (str_array[i] != null) ? ((!) str_array[i]) : "");
1156 [CCode (cname = "g_strjoin")]
1157 public static string join (string separator, ...);
1158 [CCode (cname = "g_strnfill")]
1159 public static string nfill (size_t length, char fill_char);
1161 public char get (long index) {
1162 return ((char*) this)[index];
1165 // checks whether valid string character starts at specified index
1166 // embedded NULs are not supported by the string class
1167 public bool valid_char (int index) {
1168 uint8 c = ((uint8*) this)[index];
1169 if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) {
1176 [CCode (cname = "g_utf8_next_char")]
1177 public unowned string next_char ();
1178 [CCode (cname = "g_utf8_next_char")]
1179 static char* utf8_next_char (char* str);
1180 public bool get_next_char (ref int index, out unichar c) {
1181 c = utf8_get_char ((char*) this + index);
1183 index = (int) (utf8_next_char ((char*) this + index) - (char*) this);
1189 [CCode (cname = "g_utf8_get_char")]
1190 static unichar utf8_get_char (char* str);
1191 public unichar get_char (long index = 0) {
1192 return utf8_get_char ((char*) this + index);
1194 [CCode (cname = "g_utf8_get_char_validated")]
1195 public unichar get_char_validated (ssize_t max_len = -1);
1197 [Version (replacement = "string.index_of_nth_char")]
1198 [CCode (cname = "g_utf8_offset_to_pointer")]
1199 public unowned string utf8_offset (long offset);
1200 public unowned string offset (long offset) {
1201 return (string) ((char*) this + offset);
1203 [Version (replacement = "string.char_count")]
1204 public long pointer_to_offset (string pos) {
1205 return (long) ((char*) pos - (char*) this);
1208 [CCode (cname = "g_utf8_offset_to_pointer")]
1209 char* utf8_offset_to_pointer (long offset);
1211 public int index_of_nth_char (long c) {
1212 return (int) (this.utf8_offset_to_pointer (c) - (char*) this);
1215 [CCode (cname = "g_utf8_prev_char")]
1216 public unowned string prev_char ();
1217 [CCode (cname = "g_utf8_prev_char")]
1218 static char* utf8_prev_char (char* str);
1219 public bool get_prev_char (ref int index, out unichar c) {
1221 index = (int) (utf8_prev_char ((char*) this + index) - (char*) this);
1222 c = utf8_get_char ((char*) this + index);
1230 [Version (replacement = "string.length")]
1231 [CCode (cname = "strlen")]
1233 [Version (replacement = "string.index_of_char")]
1234 [CCode (cname = "g_utf8_strchr")]
1235 public unowned string chr (ssize_t len, unichar c);
1236 [Version (replacement = "string.last_index_of_char")]
1237 [CCode (cname = "g_utf8_strrchr")]
1238 public unowned string rchr (ssize_t len, unichar c);
1239 [Version (since = "2.2")]
1240 [CCode (cname = "g_utf8_strreverse")]
1241 public string reverse (ssize_t len = -1);
1242 [CCode (cname = "g_utf8_validate")]
1243 public bool validate (ssize_t max_len = -1, out char* end = null);
1244 [Version (since = "2.52")]
1245 [CCode (cname = "g_utf8_make_valid")]
1246 public string make_valid (ssize_t len = -1);
1247 [CCode (cname = "g_utf8_normalize")]
1248 public string normalize (ssize_t len = -1, GLib.NormalizeMode mode = GLib.NormalizeMode.DEFAULT);
1250 [CCode (cname = "g_utf8_strup")]
1251 public string up (ssize_t len = -1);
1252 [CCode (cname = "g_utf8_strdown")]
1253 public string down (ssize_t len = -1);
1254 [CCode (cname = "g_utf8_casefold")]
1255 public string casefold (ssize_t len = -1);
1256 [CCode (cname = "g_utf8_collate")]
1257 public int collate (string str2);
1258 [CCode (cname = "g_utf8_collate_key")]
1259 public string collate_key (ssize_t len = -1);
1260 [Version (since = "2.8")]
1261 [CCode (cname = "g_utf8_collate_key_for_filename")]
1262 public string collate_key_for_filename (ssize_t len = -1);
1264 [CCode (cname = "g_locale_to_utf8")]
1265 public string locale_to_utf8 (ssize_t len, out size_t bytes_read, out size_t bytes_written, out GLib.Error error = null);
1267 [CCode (cname = "g_strchomp")]
1268 public unowned string _chomp();
1269 public string chomp () {
1270 string result = this.dup ();
1275 [CCode (cname = "g_strchug")]
1276 public unowned string _chug();
1277 public string chug () {
1278 string result = this.dup ();
1283 [CCode (cname = "g_strstrip")]
1284 public unowned string _strip ();
1285 public string strip () {
1286 string result = this.dup ();
1291 [CCode (cname = "g_strdelimit")]
1292 public unowned string _delimit (string delimiters, char new_delimiter);
1293 public string delimit (string delimiters, char new_delimiter) {
1294 string result = this.dup ();
1295 result._delimit (delimiters, new_delimiter);
1299 [CCode (cname = "g_str_hash")]
1300 public uint hash ();
1302 [Version (since = "2.40")]
1303 [CCode (cname = "g_str_is_ascii")]
1304 public bool is_ascii ();
1305 [Version (since = "2.40")]
1306 [CCode (instance_pos = "1.5", cname = "g_str_match_string")]
1307 public bool match_string (string search_term, bool accept_alternates);
1308 [Version (since = "2.40")]
1309 [CCode (cname = "g_str_to_ascii")]
1310 public string to_ascii (string? from_locale = null);
1311 [Version (replacement = "int.parse")]
1312 [CCode (cname = "atoi")]
1313 public int to_int ();
1314 [Version (replacement = "long.parse")]
1315 [CCode (cname = "strtol")]
1316 public long to_long (out unowned string endptr = null, int _base = 0);
1317 [Version (replacement = "double.parse")]
1318 [CCode (cname = "g_ascii_strtod")]
1319 public double to_double (out unowned string endptr = null);
1320 [Version (replacement = "ulong.parse")]
1321 [CCode (cname = "strtoul")]
1322 public ulong to_ulong (out unowned string endptr = null, int _base = 0);
1323 [Version (replacement = "int64.parse")]
1324 [CCode (cname = "g_ascii_strtoll")]
1325 public int64 to_int64 (out unowned string endptr = null, int _base = 0);
1326 [Version (replacement = "uint64.parse", since = "2.2")]
1327 [CCode (cname = "g_ascii_strtoull")]
1328 public uint64 to_uint64 (out unowned string endptr = null, int _base = 0);
1329 [CCode (cname = "g_str_tokenize_and_fold", array_length = false, array_null_terminated = true)]
1330 [Version (since = "2.40")]
1331 public string[] tokenize_and_fold (string transit_locale, [CCode (array_length = false, array_null_terminated = true)] out string[] ascii_alternates);
1333 [Version (replacement = "bool.parse")]
1334 public bool to_bool () {
1335 if (this == "true") {
1342 [Version (replacement = "string.length")]
1343 [CCode (cname = "strlen")]
1344 public size_t size ();
1346 [CCode (cname = "g_ascii_strcasecmp")]
1347 public int ascii_casecmp (string s2);
1348 [CCode (cname = "g_ascii_strncasecmp")]
1349 public int ascii_ncasecmp (string s2, size_t n);
1350 [CCode (cname = "g_ascii_strup")]
1351 public string ascii_up (ssize_t len = -1);
1352 [CCode (cname = "g_ascii_strdown")]
1353 public string ascii_down (ssize_t len = -1);
1355 [CCode (cname = "g_utf8_skip")]
1356 public static char[] skip;
1358 /* modifies string in place */
1359 [CCode (cname = "g_strcanon")]
1360 public void canon (string valid_chars, char substitutor);
1362 [CCode (cname = "g_strdup")]
1363 public string dup ();
1364 [Version (replacement = "string.substring")]
1365 [CCode (cname = "g_strndup")]
1366 public string ndup (size_t n);
1368 [CCode (cname = "memchr")]
1369 static char* memchr (char* s, int c, size_t n);
1371 // strnlen is not available on all systems
1372 static long strnlen (char* str, long maxlen) {
1373 char* end = memchr (str, 0, maxlen);
1377 return (long) (end - str);
1381 [CCode (cname = "g_strndup")]
1382 static string strndup (char* str, size_t n);
1384 public string substring (long offset, long len = -1) {
1386 if (offset >= 0 && len >= 0) {
1387 // avoid scanning whole string
1388 string_length = strnlen ((char*) this, offset + len);
1390 string_length = this.length;
1394 offset = string_length + offset;
1395 GLib.return_val_if_fail (offset >= 0, null);
1397 GLib.return_val_if_fail (offset <= string_length, null);
1400 len = string_length - offset;
1402 GLib.return_val_if_fail (offset + len <= string_length, null);
1403 return strndup ((char*) this + offset, len);
1406 public string slice (long start, long end) {
1407 long string_length = this.length;
1409 start = string_length + start;
1412 end = string_length + end;
1414 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1415 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1416 GLib.return_val_if_fail (start <= end, null);
1417 return strndup ((char*) this + start, end - start);
1420 public string splice (long start, long end, string? str = null) {
1421 long string_length = this.length;
1423 start = string_length + start;
1426 end = string_length + end;
1428 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1429 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1430 GLib.return_val_if_fail (start <= end, null);
1436 str_size = ((!)(str)).length;
1439 string* result = GLib.malloc0 (this.length - (end - start) + str_size + 1);
1441 char* dest = (char*) result;
1443 GLib.Memory.copy (dest, this, start);
1446 GLib.Memory.copy (dest, str, str_size);
1449 GLib.Memory.copy (dest, (char*) this + end, string_length - end);
1451 return (owned) result;
1454 public bool contains (string needle) {
1455 return strstr ((char*) this, (char*) needle) != null;
1458 public string replace (string old, string replacement) {
1459 if (*((char*) this) == '\0' || *((char*) old) == '\0' || old == replacement)
1463 var regex = new GLib.Regex (GLib.Regex.escape_string (old));
1464 return regex.replace_literal (this, -1, 0, replacement);
1465 } catch (GLib.RegexError e) {
1466 GLib.assert_not_reached ();
1470 [CCode (cname = "g_utf8_strlen")]
1471 public int char_count (ssize_t max = -1);
1474 [CCode (cname = "strlen")]
1478 public uint8[] data {
1480 unowned uint8[] res = (uint8[]) this;
1481 res.length = (int) this.length;
1486 public char[] to_utf8 () {
1487 char[] result = new char[this.length + 1];
1489 GLib.Memory.copy (result, this, this.length);
1493 public unowned string to_string () {
1497 [CCode (cname = "g_utf8_to_utf16")]
1498 public string16 to_utf16 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1499 [CCode (cname = "g_utf8_to_ucs4")]
1500 public string32 to_utf32 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1501 [CCode (cname = "g_utf8_to_ucs4_fast")]
1502 public string32 to_utf32_fast (long len = -1, out long items_written = null);
1508 [GIR (name = "gunichar")]
1509 [CCode (cname = "gunichar", const_cname = "const gunichar", free_function = "g_free", cheader_filename = "glib.h")]
1510 public class string32 {
1511 [CCode (cname = "g_ucs4_to_utf16")]
1512 public string16 to_utf16 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1513 [CCode (cname = "g_ucs4_to_utf8")]
1514 public string to_utf8 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1516 public string? to_string () {
1518 return this.to_utf8 ();
1519 } catch (GLib.ConvertError e) {
1527 [GIR (name = "guint16")]
1528 [CCode (cname = "gunichar2", const_cname = "const gunichar2", free_function = "g_free", cheader_filename = "glib.h")]
1529 public class string16 {
1530 [CCode (cname = "g_utf16_to_ucs4")]
1531 public string32 to_utf32 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1532 [CCode (cname = "g_utf16_to_utf8")]
1533 public string to_utf8 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1535 public string? to_string () {
1537 return this.to_utf8 ();
1538 } catch (GLib.ConvertError e) {
1544 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
1546 [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
1548 [CCode (cname = "G_E")]
1549 public const double E;
1551 [CCode (cname = "G_PI")]
1552 public const double PI;
1554 [CCode (cname = "G_LN2")]
1555 public const double LN2;
1557 [CCode (cname = "G_LN10")]
1558 public const double LN10;
1560 [CCode (cname = "G_PI_2")]
1561 public const double PI_2;
1563 [CCode (cname = "G_PI_4")]
1564 public const double PI_4;
1566 [CCode (cname = "G_SQRT2")]
1567 public const double SQRT2;
1569 [CCode (cname = "G_LOG_2_BASE_10")]
1570 public const double LOG_2_BASE_10;
1572 /* generated from <bits/mathcalls.h> of glibc */
1573 public static double acos (double x);
1574 public static float acosf (float x);
1575 public static double asin (double x);
1576 public static float asinf (float x);
1577 public static double atan (double x);
1578 public static float atanf (float x);
1579 public static double atan2 (double y, double x);
1580 public static float atan2f (float y, float x);
1581 public static double cos (double x);
1582 public static float cosf (float x);
1583 public static double sin (double x);
1584 public static float sinf (float x);
1585 public static double tan (double x);
1586 public static float tanf (float x);
1587 public static double cosh (double x);
1588 public static float coshf (float x);
1589 public static double sinh (double x);
1590 public static float sinhf (float x);
1591 public static double tanh (double x);
1592 public static float tanhf (float x);
1593 public static void sincos (double x, out double sinx, out double cosx);
1594 public static void sincosf (float x, out float sinx, out float cosx);
1595 public static double acosh (double x);
1596 public static float acoshf (float x);
1597 public static double asinh (double x);
1598 public static float asinhf (float x);
1599 public static double atanh (double x);
1600 public static float atanhf (float x);
1601 public static double exp (double x);
1602 public static float expf (float x);
1603 public static double frexp (double x, out int exponent);
1604 public static float frexpf (float x, out int exponent);
1605 public static double ldexp (double x, int exponent);
1606 public static float ldexpf (float x, int exponent);
1607 public static double log (double x);
1608 public static float logf (float x);
1609 public static double log10 (double x);
1610 public static float log10f (float x);
1611 public static double modf (double x, out double iptr);
1612 public static float modff (float x, out float iptr);
1613 [CCode (feature_test_macro = "_GNU_SOURCE")]
1614 public static double exp10 (double x);
1615 [CCode (feature_test_macro = "_GNU_SOURCE")]
1616 public static float exp10f (float x);
1617 [CCode (feature_test_macro = "_GNU_SOURCE")]
1618 public static double pow10 (double x);
1619 [CCode (feature_test_macro = "_GNU_SOURCE")]
1620 public static float pow10f (float x);
1621 public static double expm1 (double x);
1622 public static float expm1f (float x);
1623 public static double log1p (double x);
1624 public static float log1pf (float x);
1625 public static double logb (double x);
1626 public static float logbf (float x);
1627 public static double exp2 (double x);
1628 public static float exp2f (float x);
1629 public static double log2 (double x);
1630 public static float log2f (float x);
1631 public static double pow (double x, double y);
1632 public static float powf (float x, float y);
1633 public static double sqrt (double x);
1634 public static float sqrtf (float x);
1635 public static double hypot (double x, double y);
1636 public static float hypotf (float x, float y);
1637 public static double cbrt (double x);
1638 public static float cbrtf (float x);
1639 public static double ceil (double x);
1640 public static float ceilf (float x);
1641 public static double fabs (double x);
1642 public static float fabsf (float x);
1643 public static double floor (double x);
1644 public static float floorf (float x);
1645 public static double fmod (double x, double y);
1646 public static float fmodf (float x, float y);
1647 public static int isinf (double value);
1648 public static int isinff (float value);
1649 public static int finite (double value);
1650 public static int finitef (float value);
1651 public static double drem (double x, double y);
1652 public static float dremf (float x, float y);
1653 public static double significand (double x);
1654 public static float significandf (float x);
1655 public static double copysign (double x, double y);
1656 public static float copysignf (float x, float y);
1657 public static double nan (string tagb);
1658 public static float nanf (string tagb);
1659 public static int isnan (double value);
1660 public static int isnanf (float value);
1661 public static double j0 (double x0);
1662 public static float j0f (float x0);
1663 public static double j1 (double x0);
1664 public static float j1f (float x0);
1665 public static double jn (int x0, double x1);
1666 public static float jnf (int x0, float x1);
1667 public static double y0 (double x0);
1668 public static float y0f (float x0);
1669 public static double y1 (double x0);
1670 public static float y1f (float x0);
1671 public static double yn (int x0, double x1);
1672 public static float ynf (int x0, float x1);
1673 public static double erf (double x0);
1674 public static float erff (float x0);
1675 public static double erfc (double x0);
1676 public static float erfcf (float x0);
1677 public static double lgamma (double x0);
1678 public static float lgammaf (float x0);
1679 public static double tgamma (double x0);
1680 public static float tgammaf (float x0);
1681 public static double gamma (double x0);
1682 public static float gammaf (float x0);
1683 public static double lgamma_r (double x0, out int signgamp);
1684 public static float lgamma_rf (float x0, out int signgamp);
1685 public static double rint (double x);
1686 public static float rintf (float x);
1687 public static double nextafter (double x, double y);
1688 public static float nextafterf (float x, float y);
1689 public static double nexttoward (double x, double y);
1690 public static float nexttowardf (float x, double y);
1691 public static double remainder (double x, double y);
1692 public static float remainderf (float x, float y);
1693 public static double scalbn (double x, int n);
1694 public static float scalbnf (float x, int n);
1695 public static int ilogb (double x);
1696 public static int ilogbf (float x);
1697 public static double scalbln (double x, long n);
1698 public static float scalblnf (float x, long n);
1699 public static double nearbyint (double x);
1700 public static float nearbyintf (float x);
1701 public static double round (double x);
1702 public static float roundf (float x);
1703 public static double trunc (double x);
1704 public static float truncf (float x);
1705 public static double remquo (double x, double y, out int quo);
1706 public static float remquof (float x, float y, out int quo);
1707 public static long lrint (double x);
1708 public static long lrintf (float x);
1709 public static int64 llrint (double x);
1710 public static int64 llrintf (float x);
1711 public static long lround (double x);
1712 public static long lroundf (float x);
1713 public static int64 llround (double x);
1714 public static int64 llroundf (float x);
1715 public static double fdim (double x, double y);
1716 public static float fdimf (float x, float y);
1717 public static double fmax (double x, double y);
1718 public static float fmaxf (float x, float y);
1719 public static double fmin (double x, double y);
1720 public static float fminf (float x, float y);
1721 public static double fma (double x, double y, double z);
1722 public static float fmaf (float x, float y, float z);
1723 public static double scalb (double x, double n);
1724 public static float scalbf (float x, float n);
1728 [CCode (cprefix = "G_", cname = "int", has_type_id = false)]
1729 public enum ByteOrder {
1730 [CCode (cname = "G_BYTE_ORDER")]
1737 public const ByteOrder BYTE_ORDER;
1739 /* Atomic Operations */
1741 [Version (since = "2.4")]
1742 namespace AtomicInt {
1743 public static int get ([CCode (type = "volatile gint *")] ref int atomic);
1744 public static void set ([CCode (type = "volatile gint *")] ref int atomic, int newval);
1745 [Version (since = "2.30")]
1746 public static int add ([CCode (type = "volatile gint *")] ref int atomic, int val);
1747 [Version (deprecated_since = "2.30", replacement = "add")]
1748 public static int exchange_and_add ([CCode (type = "volatile gint *")] ref int atomic, int val);
1749 public static bool compare_and_exchange ([CCode (type = "volatile gint *")] ref int atomic, int oldval, int newval);
1750 public static void inc ([CCode (type = "volatile gint *")] ref int atomic);
1751 public static bool dec_and_test ([CCode (type = "volatile gint *")] ref int atomic);
1754 [Version (since = "2.4")]
1755 namespace AtomicPointer {
1756 public static void* get ([CCode (type = "volatile gpointer *")] void** atomic);
1757 public static void set ([CCode (type = "volatile gpointer *")] void** atomic, void* newval);
1758 public static bool compare_and_exchange ([CCode (type = "volatile gpointer *")] void** atomic, void* oldval, void* newval);
1761 /* The Main Event Loop */
1764 [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
1765 public class MainLoop {
1766 public MainLoop (MainContext? context = null, bool is_running = false);
1768 public void quit ();
1769 public bool is_running ();
1770 public unowned MainContext get_context ();
1773 namespace Priority {
1774 public const int HIGH;
1775 public const int DEFAULT;
1776 public const int HIGH_IDLE;
1777 public const int DEFAULT_IDLE;
1778 public const int LOW;
1782 [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
1783 public class MainContext {
1784 public MainContext ();
1785 public static unowned MainContext @default ();
1786 public bool iteration (bool may_block);
1787 public bool pending ();
1788 public unowned Source find_source_by_id (uint source_id);
1789 public unowned Source find_source_by_user_data (void* user_data);
1790 public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data);
1791 public void wakeup ();
1792 public bool acquire ();
1793 public void release ();
1794 [Version (since = "2.10")]
1795 public bool is_owner ();
1796 public bool wait (Cond cond, Mutex mutex);
1797 public bool prepare (out int priority);
1798 public int query (int max_priority, out int timeout_, PollFD[] fds);
1799 public bool check (int max_priority, PollFD[] fds);
1800 public void dispatch ();
1801 public void set_poll_func (PollFunc func);
1802 public PollFunc get_poll_func ();
1803 public void add_poll (ref PollFD fd, int priority);
1804 public void remove_poll (ref PollFD fd);
1805 public int depth ();
1806 [Version (since = "2.12")]
1807 [CCode (cname = "g_main_current_source")]
1808 public static unowned Source current_source ();
1809 [Version (since = "2.22")]
1810 public static unowned MainContext? get_thread_default ();
1811 [Version (since = "2.32")]
1812 public static MainContext ref_thread_default ();
1813 [Version (since = "2.22")]
1814 public void push_thread_default ();
1815 [Version (since = "2.22")]
1816 public void pop_thread_default ();
1817 [Version (since = "2.28")]
1818 [CCode (cname = "g_main_context_invoke_full")]
1819 public void invoke (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1820 [Version (since = "2.28")]
1821 public void invoke_full (int priority, owned SourceFunc function);
1824 [CCode (has_target = false)]
1825 public delegate int PollFunc (PollFD[] ufds, int timeout_);
1827 [CCode (cname = "GSource")]
1828 public class TimeoutSource : Source {
1829 public TimeoutSource (uint interval);
1830 [Version (since = "2.14")]
1831 public TimeoutSource.seconds (uint interval);
1835 [CCode (cname = "g_timeout_add_full")]
1836 public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1837 public static uint add_full (int priority, uint interval, owned SourceFunc function);
1838 [Version (since = "2.14")]
1839 [CCode (cname = "g_timeout_add_seconds_full")]
1840 public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1841 [Version (since = "2.14")]
1842 public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function);
1845 [CCode (cname = "GSource")]
1846 public class IdleSource : Source {
1847 public IdleSource ();
1851 [CCode (cname = "g_idle_add_full")]
1852 public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1853 public static uint add_full (int priority, owned SourceFunc function);
1854 public static bool remove_by_data (void* data);
1857 [CCode (type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0")]
1858 [IntegerType (rank = 6)]
1859 public struct Pid : int {
1860 [CCode (cname = "G_PID_FORMAT")]
1861 [Version (since = "2.50")]
1862 public const string FORMAT;
1865 public delegate void ChildWatchFunc (Pid pid, int status);
1867 [CCode (cname = "GSource")]
1868 public class ChildWatchSource : Source {
1869 public ChildWatchSource (Pid pid);
1872 namespace ChildWatch {
1873 [Version (since = "2.4")]
1874 [CCode (cname = "g_child_watch_add_full")]
1875 public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1876 [Version (since = "2.4")]
1877 public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function);
1880 public struct PollFD {
1882 public IOCondition events;
1883 public IOCondition revents;
1887 [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
1888 public abstract class Source {
1889 protected Source ();
1890 [Version (since = "2.12")]
1891 public void set_funcs (SourceFuncs funcs);
1892 public uint attach (MainContext? context = null);
1893 public void destroy ();
1894 [Version (since = "2.12")]
1895 public bool is_destroyed ();
1896 public void set_priority (int priority);
1897 public int get_priority ();
1898 public void set_can_recurse (bool can_recurse);
1899 public bool get_can_recurse ();
1900 public uint get_id ();
1901 [Version (since = "2.26")]
1902 public unowned string? get_name ();
1903 [Version (since = "2.26")]
1904 public void set_name (string? name);
1905 [Version (since = "2.26")]
1906 public static void set_name_by_id (uint tag, string? name);
1907 public unowned MainContext get_context ();
1908 public void set_callback (owned SourceFunc func);
1909 public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs);
1910 [Version (since = "2.36")]
1911 public void* add_unix_fd (int fd, IOCondition events);
1912 [Version (since = "2.36")]
1913 public void remove_unix_fd (void* tag);
1914 [Version (since = "2.36")]
1915 public void modify_unix_fd (void* tag, IOCondition new_events);
1916 [Version (since = "2.36")]
1917 public IOCondition query_unix_fd (void* tag);
1918 public void add_poll (ref PollFD fd);
1919 public void remove_poll (ref PollFD fd);
1920 [Version (since = "2.28")]
1921 public void add_child_source (Source child_source);
1922 [Version (since = "2.28")]
1923 public void remove_child_source (Source child_source);
1924 [Version (since = "2.28")]
1925 public int64 get_time ();
1926 [Version (deprecated_since = "2.28", replacement = "get_time")]
1927 public void get_current_time (out TimeVal timeval);
1928 [Version (since = "2.36")]
1929 public void set_ready_time (int64 ready_time);
1930 public int64 get_ready_time ();
1931 public static bool remove (uint id);
1932 public static bool remove_by_funcs_user_data (void* user_data);
1933 public static bool remove_by_user_data (void* user_data);
1934 [Version (since = "2.32")]
1935 [CCode (cname = "G_SOURCE_CONTINUE")]
1936 public const bool CONTINUE;
1937 [Version (since = "2.32")]
1938 [CCode (cname = "G_SOURCE_REMOVE")]
1939 public const bool REMOVE;
1941 protected abstract bool prepare (out int timeout_);
1942 protected abstract bool check ();
1943 protected abstract bool dispatch (SourceFunc? _callback);
1946 [CCode (has_target = false)]
1947 public delegate void SourceDummyMarshal ();
1949 [CCode (has_target = false)]
1950 public delegate bool SourcePrepareFunc (Source source, out int timeout_);
1951 [CCode (has_target = false)]
1952 public delegate bool SourceCheckFunc (Source source);
1953 [CCode (has_target = false)]
1954 public delegate bool SourceDispatchFunc (Source source, SourceFunc? _callback);
1955 [CCode (has_target = false)]
1956 public delegate void SourceFinalizeFunc (Source source);
1958 public struct SourceFuncs {
1959 public SourcePrepareFunc prepare;
1960 public SourceCheckFunc check;
1961 public SourceDispatchFunc dispatch;
1962 public SourceFinalizeFunc finalize;
1965 [CCode (has_target = false)]
1966 public delegate void SourceCallbackRefFunc (void* cb_data);
1967 [CCode (has_target = false)]
1968 public delegate void SourceCallbackUnrefFunc (void* cb_data);
1969 [CCode (has_target = false)]
1970 public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
1973 public class SourceCallbackFuncs {
1974 public SourceCallbackRefFunc @ref;
1975 public SourceCallbackUnrefFunc unref;
1976 public SourceCallbackGetFunc @get;
1979 public delegate bool SourceFunc ();
1981 public errordomain ThreadError {
1983 public static GLib.Quark quark ();
1986 /* Thread support */
1988 [CCode (scope = "async")]
1989 public delegate G ThreadFunc<G> ();
1990 public delegate void Func<G> (G data);
1992 [Version (since = "2.36")]
1993 public uint get_num_processors ();
1995 [CCode (has_type_id = false)]
1996 public enum ThreadPriority {
2004 [Version (since = "2.32")]
2005 [CCode (ref_function = "g_thread_ref", unref_function = "g_thread_unref")]
2006 public class Thread<T> {
2007 [Version (since = "2.32")]
2008 public Thread (string? name, owned ThreadFunc<T> func);
2009 [Version (since = "2.32")]
2010 [CCode (cname = "g_thread_try_new")]
2011 public Thread.try (string? name, owned ThreadFunc<T> func) throws GLib.Error;
2012 public static bool supported ();
2013 [Version (deprecated_since = "2.32", replacement = "new Thread<T> ()")]
2014 [CCode (simple_generics = true)]
2015 public static unowned Thread<T> create<T> (owned ThreadFunc<T> func, bool joinable) throws ThreadError;
2016 [Version (deprecated_since = "2.32", replacement = "new Thread<T> ()")]
2017 [CCode (simple_generics = true)]
2018 public static unowned Thread<T> create_full<T> (owned ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
2019 [CCode (simple_generics = true)]
2020 public static unowned Thread<T> self<T> ();
2023 [Version (deprecated_since = "2.32")]
2024 public void set_priority (ThreadPriority priority);
2025 public static void yield ();
2026 public static void exit (T retval);
2027 [Version (deprecated_since = "2.32", since = "2.10")]
2028 public static void @foreach (Func<Thread> thread_func);
2030 [CCode (cname = "g_usleep")]
2031 public static void usleep (ulong microseconds);
2034 [Version (since = "2.32")]
2035 [CCode (destroy_function = "g_mutex_clear", lvalue_access = false)]
2036 public struct Mutex {
2038 public void @lock ();
2039 public bool trylock ();
2040 public void unlock ();
2043 [Version (since = "2.44")]
2044 [CCode (destroy_function = "g_mutex_locker_free")]
2045 public struct MutexLocker {
2046 public MutexLocker (Mutex mutex);
2047 public void free ();
2050 [Version (since = "2.32")]
2051 [CCode (destroy_function = "g_rec_mutex_clear")]
2052 public struct RecMutex {
2054 public void lock ();
2055 public bool trylock ();
2056 public void unlock ();
2059 [Version (since = "2.32")]
2060 [CCode (destroy_function = "g_rw_lock_clear")]
2061 public struct RWLock {
2063 public void writer_lock ();
2064 public bool writer_trylock ();
2065 public void writer_unlock ();
2066 public void reader_lock ();
2067 public bool reader_trylock ();
2068 public void reader_unlock ();
2071 [Version (deprecated_since = "2.32", replacement = "Mutex")]
2072 [CCode (destroy_function = "g_static_mutex_free", default_value = "G_STATIC_MUTEX_INIT")]
2073 public struct StaticMutex {
2074 public StaticMutex ();
2075 public void lock ();
2076 public bool trylock ();
2077 public void unlock ();
2078 public void lock_full ();
2081 [Version (deprecated_since = "2.32", replacement = "RecMutex")]
2082 [CCode (destroy_function = "g_static_rec_mutex_free", default_value = "G_STATIC_REC_MUTEX_INIT")]
2083 public struct StaticRecMutex {
2084 public StaticRecMutex ();
2085 public void lock ();
2086 public bool trylock ();
2087 public void unlock ();
2088 public void lock_full ();
2091 [Version (deprecated_since = "2.32", replacement = "RWLock")]
2092 [CCode (destroy_function = "g_static_rw_lock_free", default_value = "G_STATIC_RW_LOCK_INIT")]
2093 public struct StaticRWLock {
2094 public StaticRWLock ();
2095 public void reader_lock ();
2096 public bool reader_trylock ();
2097 public void reader_unlock ();
2098 public void writer_lock ();
2099 public bool writer_trylock ();
2100 public void writer_unlock ();
2104 [CCode (ref_function = "", unref_function = "")]
2105 public class Private {
2106 public Private (DestroyNotify? destroy_func = null);
2107 public void* get ();
2108 public void set (void* data);
2109 public void replace (void* data);
2112 [CCode (destroy_function = "g_static_private_free", default_value = "G_STATIC_PRIVATE_INIT")]
2113 [Version (deprecated_since = "2.32")]
2114 public struct StaticPrivate {
2115 public StaticPrivate ();
2116 public void* get ();
2117 public void set (void* data, DestroyNotify? destroy_func);
2120 [Version (since = "2.32")]
2121 [CCode (destroy_function = "g_cond_clear", lvalue_access = false)]
2122 public struct Cond {
2124 public void @signal ();
2125 public void broadcast ();
2126 public void wait (Mutex mutex);
2127 [Version (deprecated_since = "2.32", replacement = "wait_until")]
2128 public bool timed_wait (Mutex mutex, TimeVal abs_time);
2129 [Version (since = "2.32")]
2130 public bool wait_until (Mutex mutex, int64 end_time);
2133 [CCode (cname = "GThreadFunc")]
2134 public delegate G OnceFunc<G> ();
2136 [Version (since = "2.4")]
2137 [CCode (default_value = "G_ONCE_INIT")]
2138 public struct Once<G> {
2139 [CCode (cname = "g_once")]
2140 public unowned G once (OnceFunc<G> function);
2141 [Version (since = "2.14")]
2142 public static bool init_enter ([CCode (ctype="volatile gsize *")] size_t *value);
2143 [Version (since = "2.14")]
2144 public static void init_leave ([CCode (ctype="volatile gsize *")] size_t *value, size_t set_value);
2145 public OnceStatus status;
2148 [CCode (cprefix = "G_ONCE_STATUS_", has_type_id = false)]
2149 public enum OnceStatus {
2157 [CCode (cname = "GFunc")]
2158 public delegate void ThreadPoolFunc<G> (owned G data);
2161 [CCode (free_function = "g_thread_pool_free")]
2162 public class ThreadPool<T> {
2163 [Version (deprecated_since = "vala-0.18", replacement = "ThreadPool.with_owned_data")]
2164 public ThreadPool (Func<T> func, int max_threads, bool exclusive) throws ThreadError;
2165 [CCode (cname = "g_thread_pool_new")]
2166 public ThreadPool.with_owned_data (ThreadPoolFunc<T> func, int max_threads, bool exclusive) throws ThreadError;
2167 [Version (deprecated_since = "vala-0.18", replacement = "add")]
2168 public void push (T data) throws ThreadError;
2169 [CCode (cname = "g_thread_pool_push")]
2170 public void add (owned T data) throws ThreadError;
2171 public void set_max_threads (int max_threads) throws ThreadError;
2172 public int get_max_threads ();
2173 public uint get_num_threads ();
2174 [Version (since = "2.46")]
2175 public bool move_to_front (T data);
2176 public uint unprocessed ();
2177 [CCode (cname = "g_thread_pool_free")]
2178 void _free (bool immediate, bool wait);
2179 [CCode (cname = "vala__g_thread_pool_free_wrapper")]
2180 public static void free (owned ThreadPool? pool, bool immediate, bool wait) {
2181 ThreadPool* ptr = (owned) pool;
2183 ((ThreadPool)ptr)._free (immediate, wait);
2186 public static void set_max_unused_threads (int max_threads);
2187 public static int get_max_unused_threads ();
2188 public static uint get_num_unused_threads ();
2189 public static void stop_unused_threads ();
2190 [Version (since = "2.10")]
2191 public void set_sort_function (CompareDataFunc<T> func);
2192 [Version (since = "2.10")]
2193 public static void set_max_idle_time (uint interval);
2194 [Version (since = "2.10")]
2195 public static uint get_max_idle_time ();
2198 /* Asynchronous Queues */
2201 [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
2202 public class AsyncQueue<G> {
2203 [Version (since = "2.16")]
2204 [CCode (cname = "g_async_queue_new_full", simple_generics = true)]
2205 public AsyncQueue ();
2206 public void push (owned G data);
2207 [Version (since = "2.10")]
2208 public void push_sorted (owned G data, CompareDataFunc<G> func);
2210 public G? try_pop ();
2211 public G? timed_pop (ref TimeVal end_time);
2212 public int length ();
2213 [Version (since = "2.10")]
2214 public void sort (CompareDataFunc<G> func);
2215 public void @lock ();
2216 public void unlock ();
2217 public void ref_unlocked ();
2218 public void unref_and_unlock ();
2219 [Version (since = "2.46")]
2220 public void push_front (owned G data);
2221 [Version (since = "2.46")]
2222 public void push_front_unlocked (owned G data);
2223 public void push_unlocked (owned G data);
2224 [Version (since = "2.10")]
2225 public void push_sorted_unlocked (owned G data, CompareDataFunc<G> func);
2226 public G pop_unlocked ();
2227 [Version (since = "2.46")]
2228 public bool remove (G data);
2229 [Version (since = "2.46")]
2230 public bool remove_unlocked (G data);
2231 public G? try_pop_unlocked ();
2232 public G? timed_pop_unlocked (ref TimeVal end_time);
2233 public G? timeout_pop (uint64 timeout);
2234 public G? timeout_pop_unlocked (uint64 timeout);
2235 public int length_unlocked ();
2236 public void sort_unlocked (CompareDataFunc<G> func);
2239 /* Memory Allocation */
2241 public static void* malloc (size_t n_bytes);
2242 public static void* malloc0 (size_t n_bytes);
2243 public static void* realloc (void* mem, size_t n_bytes);
2245 public static void* try_malloc (size_t n_bytes);
2246 [Version (since = "2.8")]
2247 public static void* try_malloc0 (size_t n_bytes);
2248 public static void* try_realloc (void* mem, size_t n_bytes);
2250 public static void free (void* mem);
2252 public class MemVTable {
2255 [CCode (cname = "glib_mem_profiler_table")]
2256 public static MemVTable mem_profiler_table;
2258 public static void mem_set_vtable (MemVTable vtable);
2259 public static void mem_profile ();
2261 [CCode (cheader_filename = "string.h")]
2263 [CCode (cname = "memcmp")]
2264 public static int cmp (void* s1, void* s2, size_t n);
2265 [CCode (cname = "memcpy")]
2266 public static void* copy (void* dest, void* src, size_t n);
2267 [CCode (cname = "memset")]
2268 public static void* set (void* dest, int src, size_t n);
2269 [CCode (cname = "g_memmove")]
2270 public static void* move (void* dest, void* src, size_t n);
2271 [CCode (cname = "g_memdup")]
2272 public static void* dup (void* mem, uint n);
2275 [Version (since = "2.10")]
2277 public static void* alloc (size_t block_size);
2278 public static void* alloc0 (size_t block_size);
2279 [Version (since = "2.14")]
2280 public static void* copy (size_t block_size, void* mem_block);
2281 [CCode (cname = "g_slice_free1")]
2282 public static void free (size_t block_size, void* mem_block);
2283 public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset);
2284 public static int64 get_config (SliceConfig ckey);
2285 [CCode (array_length_cname = "n_values", array_length_type = "guint")]
2286 public static int64[] get_config_state (SliceConfig ckey, int64 address);
2287 public static void set_config (SliceConfig ckey, int64 value);
2290 [CCode (cprefix = "G_SLICE_CONFIG_", has_type_id = false)]
2291 public enum SliceConfig {
2303 [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
2304 public class IOChannel {
2305 [CCode (cname = "g_io_channel_unix_new")]
2306 public IOChannel.unix_new (int fd);
2307 public int unix_get_fd ();
2308 [CCode (cname = "g_io_channel_win32_new_fd")]
2309 public IOChannel.win32_new_fd (int fd);
2310 [CCode (cname = "g_io_channel_win32_new_socket")]
2311 public IOChannel.win32_socket (int socket);
2312 [CCode (cname = "g_io_channel_win32_new_messages")]
2313 public IOChannel.win32_messages (size_t hwnd);
2314 public void init ();
2315 public IOChannel.file (string filename, string mode) throws FileError;
2316 public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError;
2317 public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
2318 public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError;
2319 public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError;
2320 public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError;
2321 public IOStatus write_chars (char[] buf, out size_t bytes_written) throws ConvertError, IOChannelError;
2322 public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
2323 public IOStatus flush () throws IOChannelError;
2324 public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
2325 public IOStatus shutdown (bool flush) throws IOChannelError;
2326 [CCode (cname = "g_io_create_watch")]
2327 public IOSource create_watch (IOCondition condition);
2328 [CCode (cname = "g_io_add_watch")]
2329 public uint add_watch (IOCondition condition, IOFunc func);
2330 [CCode (cname = "g_io_add_watch_full")]
2331 public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func);
2332 public size_t get_buffer_size ();
2333 public void set_buffer_size (size_t size);
2334 public IOCondition get_buffer_condition ();
2335 public IOFlags get_flags ();
2336 public IOStatus set_flags (IOFlags flags) throws IOChannelError;
2337 public unowned string get_line_term (out int length);
2338 public void set_line_term (string line_term, int length);
2339 public bool get_buffered ();
2340 public void set_buffered (bool buffered);
2341 public unowned string get_encoding ();
2342 public IOStatus set_encoding (string? encoding) throws IOChannelError;
2343 public bool get_close_on_unref ();
2344 public void set_close_on_unref (bool do_close);
2348 [CCode (cname = "GSource")]
2349 public class IOSource : Source {
2350 [CCode (cname = "g_io_create_watch")]
2351 public IOSource (IOChannel channel, IOCondition condition);
2352 [CCode (cname = "g_source_set_callback")]
2353 public void set_callback ([CCode (type = "GSourceFunc")] owned IOFunc func);
2356 [CCode (cprefix = "G_SEEK_", has_type_id = false)]
2357 public enum SeekType {
2363 [CCode (has_type_id = false)]
2364 public enum IOStatus {
2371 public errordomain IOChannelError {
2381 public static GLib.Quark quark ();
2385 [CCode (cprefix = "G_IO_")]
2386 public enum IOCondition {
2395 public delegate bool IOFunc (IOChannel source, IOCondition condition);
2397 [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)]
2399 public enum IOFlags {
2411 /* Error Reporting */
2415 [CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
2416 public class Error {
2418 public Error (Quark domain, int code, string format, ...);
2419 public Error.literal (Quark domain, int code, string message);
2421 public Error.valist (Quark domain, int code, string format, va_list args);
2422 public Error copy ();
2423 public bool matches (Quark domain, int code);
2424 [CCode (cname = "g_prefix_error")]
2425 public static void prefix (out Error? dest, string format, ...);
2426 [CCode (cname = "g_propagate_error")]
2427 public static void propagate (out Error? dest, owned Error src);
2428 [CCode (cname = "g_propagate_prefixed_error")]
2429 public static void propagate_prefixed (out Error? dest, owned Error src, string format, ...);
2430 [CCode (cname = "g_set_error")]
2431 public static void @set (out Error? dest, Quark domain, int code, string format, ...);
2432 [CCode (cname = "g_set_error_literal")]
2433 public static void set_literal (out Error? dest, Quark domain, int code, string message);
2435 public Quark domain;
2437 public string message;
2440 /* Message Output and Debugging Functions */
2443 public static void print (string format, ...);
2444 public static void set_print_handler (PrintFunc func);
2445 [CCode (has_target = false)]
2446 public delegate void PrintFunc (string text);
2448 public static void printerr (string format, ...);
2449 public static void set_printerr_handler (PrintFunc func);
2451 public static void return_if_fail (bool expr);
2452 [CCode (sentinel = "")]
2453 public static void return_val_if_fail (bool expr, ...);
2455 public static void return_if_reached ();
2457 [CCode (sentinel = "")]
2458 public static void return_val_if_reached (...);
2459 [Version (since = "2.16")]
2460 public static void warn_if_fail (bool expr);
2461 [Version (since = "2.16")]
2462 public static void warn_if_reached ();
2465 public static void assert (bool expr);
2467 [Version (since = "2.46")]
2468 public static void assert_cmpmem (uint8[] m1, uint8[] m2);
2470 public static void assert_error (Error? error, Quark error_domain, int error_code);
2472 [Version (since = "2.38")]
2473 public static void assert_false (bool expr);
2475 [Version (since = "2.38")]
2476 public static void assert_true (bool expr);
2478 [Version (since = "2.38")]
2479 public static void assert_null (void* expr);
2481 public static void assert_no_error (Error? error);
2483 [Version (since = "2.40")]
2484 public static void assert_nonnull (void* expr);
2486 public static void assert_not_reached ();
2488 public static void on_error_query (string? prg_name = null);
2489 public static void on_error_stack_trace (string? prg_name = null);
2490 [CCode (cname = "G_BREAKPOINT")]
2491 public static void breakpoint ();
2493 /* Message Logging */
2495 [CCode (cprefix = "G_LOG_", has_type_id = false)]
2497 public enum LogLevelFlags {
2502 /* GLib log levels */
2513 [CCode (cprefix = "G_LOG_WRITER_", has_type_id = false)]
2514 [Version (since = "2.50")]
2515 public enum LogWriterOutput {
2520 [CCode (has_type_id = false, simple_generics = true)]
2521 [Version (since = "2.50")]
2522 public struct LogField<T> {
2523 public unowned string key;
2524 public unowned T @value;
2525 public ssize_t length;
2528 public void logv (string? log_domain, LogLevelFlags log_level, string format, va_list args);
2531 public void log (string? log_domain, LogLevelFlags log_level, string format, ...);
2533 [Version (since = "2.50")]
2534 public void log_structured (string? log_domain, LogLevelFlags log_levels, ...);
2535 [Version (since = "2.50")]
2536 public void log_structured_array (LogLevelFlags log_levels, LogField[] fields);
2538 [Version (since = "2.50")]
2539 public void log_variant (string? log_domain, LogLevelFlags log_levels, GLib.Variant fields);
2543 public void message (string format, ...);
2546 public void warning (string format, ...);
2549 public void critical (string format, ...);
2553 public void error (string format, ...);
2556 [Version (since = "2.6")]
2557 public void debug (string format, ...);
2560 [Version (since = "2.40")]
2561 public void info (string format, ...);
2562 [CCode (cname = "G_DEBUG_HERE")]
2563 [Version (since = "2.50")]
2564 public void debug_here ();
2566 public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message);
2567 [Version (since = "2.50")]
2568 public delegate LogWriterOutput LogWriterFunc (LogLevelFlags log_level, LogField[] fields);
2571 public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
2572 [Version (since = "2.46")]
2573 public static void set_handler_full (string? log_domain, LogLevelFlags log_levels, owned LogFunc log_func);
2574 [Version (since = "2.6")]
2575 public static void set_default_handler (LogFunc log_func);
2576 [CCode (delegate_target = false)]
2577 public static GLib.LogFunc default_handler;
2578 public static LogLevelFlags set_fatal_mask (string log_domain, LogLevelFlags log_levels);
2579 public static LogLevelFlags set_always_fatal (LogLevelFlags log_levels);
2580 public static void remove_handler (string? log_domain, uint handler_id);
2582 public const string FILE;
2583 public const int LINE;
2584 public const string METHOD;
2586 [Version (since = "2.50")]
2587 public static void set_writer_func (owned LogWriterFunc func);
2588 [Version (since = "2.50")]
2589 public static bool writer_supports_color (int output_fd);
2590 [Version (since = "2.50")]
2591 public static bool writer_is_journald (int output_fd);
2592 [Version (since = "2.50")]
2593 public static string writer_format_fields (LogLevelFlags log_levels, LogField[] fields, bool use_color);
2594 [Version (since = "2.50")]
2595 public static LogWriterOutput writer_journald (LogLevelFlags log_levels, LogField[] fields, void* user_data);
2596 [Version (since = "2.50")]
2597 public static LogWriterOutput writer_standard_streams (LogLevelFlags log_levels, LogField[] fields, void* user_data);
2598 [Version (since = "2.50")]
2599 public static LogWriterOutput writer_default (LogLevelFlags log_levels, LogField[] fields, void* user_data);
2602 [CCode (has_type_id = false)]
2603 public struct DebugKey {
2608 public uint parse_debug_string (string? debug_string, DebugKey[] keys);
2610 /* String Utility Functions */
2612 public string strdup (string str);
2613 [CCode (array_length = false, array_null_terminated = true)]
2614 public string[] strdupv ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2616 public void strfreev (string** str_array);
2617 [Version (since = "2.6")]
2618 public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2619 [Version (since = "2.44")]
2620 public bool strv_contains ([CCode (array_length = false, array_null_terminated = true)] string[] str_array, string str);
2622 [CCode (cname = "errno", cheader_filename = "errno.h")]
2624 public unowned string strerror (int errnum);
2626 /* Character Set Conversions */
2628 public static string convert (string str, ssize_t len, string to_codeset, string from_codeset, out size_t bytes_read = null, out size_t bytes_written = null) throws ConvertError;
2629 public static string convert_with_fallback (string str, ssize_t len, string to_codeset, string from_codeset, string? fallback = null, out size_t bytes_read = null, out size_t bytes_written = null) throws ConvertError;
2630 public static string convert_with_iconv (string str, ssize_t len, IConv converter, out size_t bytes_read = null, out size_t bytes_written = null) throws ConvertError;
2631 public static bool get_charset (out unowned string charset);
2632 public static bool get_filename_charsets ([CCode (array_length = false, array_null_terminated = true)] out unowned string[] charsets);
2635 public struct IConv {
2636 public static IConv open (string to_codeset, string from_codeset);
2637 [CCode (cname = "g_iconv")]
2638 public size_t iconv ([CCode (array_length = false)] ref char[] inbuf, ref size_t inbytes_left, [CCode (array_length = false)] ref char[] outbuf, ref size_t outbytes_left);
2639 public int close ();
2642 namespace Filename {
2643 public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2644 public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2645 public static string from_uri (string uri, out string hostname = null) throws ConvertError;
2646 public static string to_uri (string filename, string? hostname = null) throws ConvertError;
2647 [Version (since = "2.6")]
2648 public static string display_name (string filename);
2649 [Version (since = "2.6")]
2650 public static string display_basename (string filename);
2653 public errordomain ConvertError {
2660 public static GLib.Quark quark ();
2663 /* Base64 Encoding */
2665 [Version (since = "2.12")]
2667 public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save);
2668 public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
2669 public static string encode (uchar[] data);
2670 public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
2671 [CCode (array_length_type = "size_t")]
2672 public static uchar[] decode (string text);
2675 /* Data Checksums */
2677 [Version (since = "2.16")]
2678 [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)]
2679 public enum ChecksumType {
2683 [Version (since = "2.52")]
2685 [Version (since = "2.36")]
2688 public ssize_t get_length ();
2692 [Version (since = "2.16")]
2693 [CCode (free_function = "g_checksum_free")]
2694 public class Checksum {
2695 public Checksum (ChecksumType checksum_type);
2696 public Checksum copy ();
2697 public void update ([CCode (array_length = false)] uchar[] data, size_t length);
2698 public unowned string get_string ();
2699 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2700 [CCode (cname = "g_compute_checksum_for_data")]
2701 public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
2702 [CCode (cname = "g_compute_checksum_for_string")]
2703 public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1);
2704 [Version (since = "2.34")]
2705 [CCode (cname = "g_compute_checksum_for_bytes")]
2706 public static string compute_for_bytes (ChecksumType checksum_type, Bytes data);
2709 /* Secure HMAC Digests */
2712 [Version (since = "2.30")]
2713 [CCode (ref_function = "g_hmac_ref", unref_function = "g_hmac_unref")]
2715 public Hmac (ChecksumType digest_type, [CCode (array_length_type = "gsize")] uint8[] key);
2716 public Hmac copy ();
2717 public void update ([CCode (array_length_type = "gssize")] uint8[] data);
2718 public unowned string get_string ();
2719 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2720 [Version (since = "2.30")]
2721 [CCode (cname = "g_compute_hmac_for_data")]
2722 public static string compute_for_data (ChecksumType checksum_type, uint8[] key, uint8[] data);
2723 [Version (since = "2.30")]
2724 [CCode (cname = "g_compute_hmac_for_string")]
2725 public static string compute_for_string (ChecksumType checksum_type, uint8[] key, string str, size_t length = -1);
2726 [Version (since = "2.50")]
2727 [CCode (cname = "g_compute_hmac_for_bytes")]
2728 public static string compute_hmac_for_bytes (ChecksumType checksum_type, Bytes key, Bytes data);
2731 /* Date and Time Functions */
2733 [CCode (has_type_id = false)]
2734 public struct TimeVal {
2736 public long tv_usec;
2738 [CCode (cname = "g_get_current_time")]
2740 [CCode (cname = "g_get_current_time")]
2741 public void get_current_time ();
2742 public void add (long microseconds);
2743 [Version (since = "2.12")]
2744 [CCode (instance_pos = -1)]
2745 public bool from_iso8601 (string iso_date);
2746 [Version (since = "2.12")]
2747 public string to_iso8601 ();
2750 [Version (since = "2.28")]
2751 public static int64 get_monotonic_time ();
2752 [Version (since = "2.28")]
2753 public static int64 get_real_time ();
2755 public struct DateDay : uchar {
2756 [CCode (cname = "G_DATE_BAD_DAY")]
2757 public static DateDay BAD_DAY;
2759 [CCode (cname = "g_date_valid_day")]
2760 public bool valid ();
2763 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2764 public enum DateMonth {
2779 [CCode (cname = "g_date_get_days_in_month")]
2780 public uchar get_days_in_month (DateYear year);
2781 [CCode (cname = "g_date_valid_month")]
2782 public bool valid ();
2785 public struct DateYear : ushort {
2786 [CCode (cname = "G_DATE_BAD_YEAR")]
2787 public static DateDay BAD_YEAR;
2789 [CCode (cname = "g_date_is_leap_year")]
2790 public bool is_leap_year ();
2791 [CCode (cname = "g_date_get_monday_weeks_in_year")]
2792 public uchar get_monday_weeks_in_year ();
2793 [CCode (cname = "g_date_get_sunday_weeks_in_year")]
2794 public uchar get_sunday_weeks_in_year ();
2795 [CCode (cname = "g_date_valid_year")]
2796 public bool valid ();
2799 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2800 public enum DateWeekday {
2810 [CCode (cname = "g_date_valid_weekday")]
2811 public bool valid ();
2814 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2815 public enum DateDMY {
2821 [CCode (type_id = "G_TYPE_DATE")]
2822 public struct Date {
2823 public void clear (uint n_dates = 1);
2824 [Version (since = "2.56")]
2825 public Date copy ();
2826 public void set_day (DateDay day);
2827 public void set_month (DateMonth month);
2828 public void set_year (DateYear year);
2829 public void set_dmy (DateDay day, int month, DateYear y);
2830 public void set_julian (uint julian_day);
2831 [Version (since = "2.10")]
2832 public void set_time_t (time_t timet);
2833 [Version (since = "2.10")]
2834 public void set_time_val (TimeVal timeval);
2835 public void set_parse (string str);
2836 public void add_days (uint n_days);
2837 public void subtract_days (uint n_days);
2838 public void add_months (uint n_months);
2839 public void subtract_months (uint n_months);
2840 public void add_years (uint n_years);
2841 public void subtract_years (uint n_years);
2842 public int days_between (Date date2);
2843 public int compare (Date rhs);
2844 public void clamp (Date min_date, Date max_date);
2845 public void order (Date date2);
2846 public DateDay get_day ();
2847 public DateMonth get_month ();
2848 public DateYear get_year ();
2849 public uint get_julian ();
2850 public DateWeekday get_weekday ();
2851 public uint get_day_of_year ();
2852 public bool is_first_of_month ();
2853 public bool is_last_of_month ();
2854 public uint get_monday_week_of_year ();
2855 public uint get_sunday_week_of_year ();
2856 [Version (since = "2.6")]
2857 public uint get_iso8601_week_of_year ();
2858 [CCode (instance_pos = -1)]
2859 public size_t strftime (char[] s, string format);
2860 [CCode (cname = "g_date_to_struct_tm")]
2861 public void to_time (out Time tm);
2862 public bool valid ();
2863 public static uchar get_days_in_month (DateMonth month, DateYear year);
2864 public static bool valid_day (DateDay day);
2865 public static bool valid_dmy (DateDay day, DateMonth month, DateYear year);
2866 public static bool valid_julian (uint julian_date);
2867 public static bool valid_weekday (DateWeekday weekday);
2870 [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)]
2871 public struct Time {
2872 [CCode (cname = "tm_sec")]
2874 [CCode (cname = "tm_min")]
2876 [CCode (cname = "tm_hour")]
2878 [CCode (cname = "tm_mday")]
2880 [CCode (cname = "tm_mon")]
2882 [CCode (cname = "tm_year")]
2884 [CCode (cname = "tm_wday")]
2886 [CCode (cname = "tm_yday")]
2887 public int day_of_year;
2888 [CCode (cname = "tm_isdst")]
2891 [CCode (cname = "gmtime_r")]
2892 static void gmtime_r (ref time_t time, out Time result);
2893 [CCode (cname = "localtime_r")]
2894 static void localtime_r (ref time_t time, out Time result);
2896 public static Time gm (time_t time) {
2898 gmtime_r (ref time, out result);
2901 public static Time local (time_t time) {
2903 localtime_r (ref time, out result);
2907 public string to_string () {
2908 return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
2911 public string format (string format) {
2912 var buffer = new char[64];
2913 this.strftime (buffer, format);
2914 return (string) buffer;
2917 [CCode (cname = "mktime")]
2918 public time_t mktime ();
2920 [CCode (cname = "strftime", instance_pos = -1)]
2921 public size_t strftime (char[] s, string format);
2922 [CCode (cname = "strptime", instance_pos = -1)]
2923 public unowned string? strptime (string buf, string format);
2927 [Version (since = "2.26")]
2928 [CCode (cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64", get_value_function = "g_value_get_int64", set_value_function = "g_value_set_int64", default_value = "0LL", type_signature = "x")]
2929 [IntegerType (rank = 10)]
2930 public struct TimeSpan : int64 {
2931 public const TimeSpan DAY;
2932 public const TimeSpan HOUR;
2933 public const TimeSpan MINUTE;
2934 public const TimeSpan SECOND;
2935 public const TimeSpan MILLISECOND;
2939 [Version (since = "2.26")]
2940 [CCode (ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")]
2941 public class DateTime {
2942 public DateTime.now (TimeZone tz);
2943 public DateTime.now_local ();
2944 public DateTime.now_utc ();
2945 [Version (since = "2.56")]
2946 public DateTime.from_iso8601 (string text, TimeZone default_tz);
2947 public DateTime.from_unix_local (int64 t);
2948 public DateTime.from_unix_utc (int64 t);
2949 public DateTime.from_timeval_local (TimeVal tv);
2950 public DateTime.from_timeval_utc (TimeVal tv);
2951 public DateTime (TimeZone tz, int year, int month, int day, int hour, int minute, double seconds);
2952 public DateTime.local (int year, int month, int day, int hour, int minute, double seconds);
2953 public DateTime.utc (int year, int month, int day, int hour, int minute, double seconds);
2954 public DateTime add (TimeSpan timespan);
2955 public DateTime add_years (int years);
2956 public DateTime add_months (int months);
2957 public DateTime add_weeks (int weeks);
2958 public DateTime add_days (int days);
2959 public DateTime add_hours (int hours);
2960 public DateTime add_minutes (int minutes);
2961 public DateTime add_seconds (double seconds);
2962 public DateTime add_full (int years, int months, int days, int hours = 0, int minutes = 0, double seconds = 0);
2963 public int compare (DateTime dt);
2964 public TimeSpan difference (DateTime begin);
2965 public uint hash ();
2966 public bool equal (DateTime dt);
2967 public void get_ymd (out int year, out int month, out int day);
2968 public int get_year ();
2969 public int get_month ();
2970 public int get_day_of_month ();
2971 public int get_week_numbering_year ();
2972 public int get_week_of_year ();
2973 public int get_day_of_week ();
2974 public int get_day_of_year ();
2975 public int get_hour ();
2976 public int get_minute ();
2977 public int get_second ();
2978 public int get_microsecond ();
2979 public double get_seconds ();
2980 [Version (since = "2.58")]
2981 public unowned TimeZone get_timezone ();
2982 public int64 to_unix ();
2983 public bool to_timeval (out TimeVal tv);
2984 public TimeSpan get_utc_offset ();
2985 public unowned string get_timezone_abbreviation ();
2986 public bool is_daylight_savings ();
2987 public DateTime to_timezone (TimeZone tz);
2988 public DateTime to_local ();
2989 public DateTime to_utc ();
2990 public string format (string format);
2991 public string to_string () {
2992 return this.format ("%FT%H:%M:%S%z");
2996 public enum TimeType {
3003 [Version (since = "2.26")]
3004 [CCode (ref_function = "g_time_zone_ref", unref_function = "g_time_zone_unref")]
3005 public class TimeZone {
3006 public TimeZone (string identifier);
3007 public TimeZone.utc ();
3008 public TimeZone.local ();
3009 [Version (since = "2.58")]
3010 public TimeZone.offset (int32 seconds);
3011 public int find_interval (TimeType type, int64 time);
3012 public int adjust_time (TimeType type, ref int64 time);
3013 public unowned string get_abbreviation (int interval);
3014 [Version (since = "2.58")]
3015 public unowned string get_identifier ();
3016 public int32 get_offset (int interval);
3017 public bool is_dst (int interval);
3020 /* Random Numbers */
3023 [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
3025 public Rand.with_seed (uint32 seed);
3026 [Version (since = "2.4")]
3027 public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
3029 public void set_seed (uint32 seed);
3030 [Version (since = "2.4")]
3031 public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
3032 public bool boolean ();
3033 [CCode (cname = "g_rand_int")]
3034 public uint32 next_int ();
3035 public int32 int_range (int32 begin, int32 end);
3036 [CCode (cname = "g_rand_double")]
3037 public double next_double ();
3038 public double double_range (double begin, double end);
3042 public static void set_seed (uint32 seed);
3043 public static bool boolean ();
3044 [CCode (cname = "g_random_int")]
3045 public static uint32 next_int ();
3046 public static int32 int_range (int32 begin, int32 end);
3047 [CCode (cname = "g_random_double")]
3048 public static double next_double ();
3049 public static double double_range (double begin, double end);
3053 [Version (since = "2.52")]
3054 public static bool string_is_valid (string str);
3055 [Version (since = "2.52")]
3056 public static string string_random ();
3059 /* Miscellaneous Utility Functions */
3061 namespace Environment {
3062 [Version (since = "2.2")]
3063 [CCode (cname = "g_get_application_name")]
3064 public static unowned string? get_application_name ();
3065 [Version (since = "2.2")]
3066 [CCode (cname = "g_set_application_name")]
3067 public static void set_application_name (string application_name);
3068 [CCode (cname = "g_get_prgname")]
3069 public static unowned string get_prgname ();
3070 [CCode (cname = "g_set_prgname")]
3071 public static void set_prgname (string application_name);
3072 [CCode (cname = "g_getenv")]
3073 public static unowned string? get_variable (string variable);
3074 [Version (since = "2.4")]
3075 [CCode (cname = "g_setenv")]
3076 public static bool set_variable (string variable, string value, bool overwrite);
3077 [Version (since = "2.4")]
3078 [CCode (cname = "g_unsetenv")]
3079 public static void unset_variable (string variable);
3080 [Version (since = "2.8")]
3081 [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)]
3082 public static string[] list_variables ();
3083 [CCode (cname = "g_get_user_name")]
3084 public static unowned string get_user_name ();
3085 [CCode (cname = "g_get_real_name")]
3086 public static unowned string get_real_name ();
3087 [Version (since = "2.6")]
3088 [CCode (cname = "g_get_user_cache_dir")]
3089 public static unowned string get_user_cache_dir ();
3090 [Version (since = "2.6")]
3091 [CCode (cname = "g_get_user_data_dir")]
3092 public static unowned string get_user_data_dir ();
3093 [Version (since = "2.6")]
3094 [CCode (cname = "g_get_user_config_dir")]
3095 public static unowned string get_user_config_dir ();
3096 [CCode (cname = "g_get_user_runtime_dir")]
3097 public static unowned string get_user_runtime_dir ();
3098 [Version (since = "2.14")]
3099 [CCode (cname = "g_get_user_special_dir")]
3100 public static unowned string get_user_special_dir (UserDirectory directory);
3101 [Version (since = "2.6")]
3102 [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)]
3103 public static unowned string[] get_system_data_dirs ();
3104 [Version (since = "2.6")]
3105 [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)]
3106 public static unowned string[] get_system_config_dirs ();
3107 [Version (since = "2.8")]
3108 [CCode (cname = "g_get_host_name")]
3109 public static unowned string get_host_name ();
3110 [CCode (cname = "g_get_home_dir")]
3111 public static unowned string get_home_dir ();
3112 [CCode (cname = "g_get_tmp_dir")]
3113 public static unowned string get_tmp_dir ();
3114 [CCode (cname = "g_get_current_dir")]
3115 public static string get_current_dir ();
3116 [CCode (cname = "g_find_program_in_path")]
3117 public static string? find_program_in_path (string program);
3118 [Version (deprecated_since = "2.32")]
3119 [CCode (cname = "g_atexit")]
3120 public static void atexit (VoidFunc func);
3121 [Version (since = "2.8")]
3122 [CCode (cname = "g_chdir")]
3123 public static int set_current_dir (string path);
3127 [Version (since = "2.28")]
3128 [CCode (cname = "g_get_environ", array_length = false, array_null_terminated = true)]
3129 public static string[] get ();
3130 [Version (since = "2.32")]
3131 [CCode (cname = "g_environ_getenv")]
3132 public static unowned string? get_variable ([CCode (array_length = false, array_null_terminated = true)] string[]? envp, string variable);
3133 [Version (since = "2.32")]
3134 [CCode (cname = "g_environ_setenv", array_length = false, array_null_terminated = true)]
3135 public static string[] set_variable ([CCode (array_length = false, array_null_terminated = true)] owned string[]? envp, string variable, string value, bool overwrite = true);
3136 [Version (since = "2.32")]
3137 [CCode (cname = "g_environ_unsetenv", array_length = false, array_null_terminated = true)]
3138 public static string[] unset_variable ([CCode (array_length = false, array_null_terminated = true)] owned string[]? envp, string variable);
3141 [Version (since = "2.14")]
3142 [CCode (has_type_id = false)]
3143 public enum UserDirectory {
3152 [CCode (cname = "G_USER_N_DIRECTORIES")]
3156 namespace Hostname {
3157 public static bool is_non_ascii (string hostname);
3158 public static bool is_ascii_encoded (string hostname);
3159 public static bool is_ip_address (string hostname);
3160 public static string to_ascii (string hostname);
3161 public static string to_unicode (string hostname);
3165 public static bool is_absolute (string file_name);
3166 public static unowned string skip_root (string file_name);
3167 public static string get_basename (string file_name);
3168 public static string get_dirname (string file_name);
3169 [CCode (cname = "g_build_filename")]
3170 public static string build_filename (string first_element, ...);
3171 [Version (since = "2.56")]
3172 [CCode (cname = "g_build_filename_valist")]
3173 public static string build_filename_valist (string first_element, va_list args);
3174 [CCode (cname = "g_build_path")]
3175 public static string build_path (string separator, string first_element, ...);
3177 [CCode (cname = "G_DIR_SEPARATOR")]
3178 public const char DIR_SEPARATOR;
3179 [CCode (cname = "G_DIR_SEPARATOR_S")]
3180 public const string DIR_SEPARATOR_S;
3181 [Version (since = "2.6")]
3182 [CCode (cname = "G_IS_DIR_SEPARATOR")]
3183 public static bool is_dir_separator (unichar c);
3184 [CCode (cname = "G_SEARCHPATH_SEPARATOR")]
3185 public const char SEARCHPATH_SEPARATOR;
3186 [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")]
3187 public const string SEARCHPATH_SEPARATOR_S;
3191 public static int nth_lsf (ulong mask, int nth_bit);
3192 public static int nth_msf (ulong mask, int nth_bit);
3193 public static uint storage (ulong number);
3196 namespace SpacedPrimes {
3197 public static uint closest (uint num);
3200 [CCode (has_target = false)]
3201 public delegate void FreeFunc (void* data);
3202 [CCode (has_target = false)]
3203 public delegate void VoidFunc ();
3205 [Version (deprecated_since = "2.30", replacement = "format_size", since = "2.16")]
3206 public string format_size_for_display (int64 size);
3208 [Version (since = "2.30")]
3209 [CCode (cname = "g_format_size_full")]
3210 public string format_size (uint64 size, FormatSizeFlags flags = FormatSizeFlags.DEFAULT);
3212 [Version (since = "2.30")]
3213 [CCode (cprefix = "G_FORMAT_SIZE_", has_type_id = false)]
3215 public enum FormatSizeFlags {
3221 /* Lexical Scanner */
3222 [CCode (has_target = false)]
3223 public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error);
3226 [CCode (free_function = "g_scanner_destroy")]
3227 public class Scanner {
3228 public unowned string input_name;
3229 public TokenType token;
3230 public TokenValue value;
3232 public uint position;
3233 public TokenType next_token;
3234 public TokenValue next_value;
3235 public uint next_line;
3236 public uint next_position;
3237 public ScannerMsgFunc msg_handler;
3238 public ScannerConfig? config;
3239 public Scanner (ScannerConfig? config_templ);
3240 public void input_file (int input_fd);
3241 public void sync_file_offset ();
3242 public void input_text (string text, uint text_len);
3243 public TokenType peek_next_token ();
3244 public TokenType get_next_token ();
3246 public int cur_line ();
3247 public int cur_position ();
3248 public TokenType cur_token ();
3249 public TokenValue cur_value ();
3250 public uint set_scope (uint scope_id);
3251 public void scope_add_symbol (uint scope_id, string symbol, void* value);
3252 public void scope_foreach_symbol (uint scope_id, HFunc<string, void*> func);
3253 public void* scope_lookup_symbol (uint scope_id, string symbol);
3254 public void scope_remove_symbol (uint scope_id, string symbol);
3255 public void* lookup_symbol (string symbol);
3257 public void warn (string format, ...);
3259 public void error (string format, ...);
3260 public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error);
3263 public struct ScannerConfig {
3264 public string* cset_skip_characters;
3265 public string* cset_identifier_first;
3266 public string* cset_identifier_nth;
3267 public string* cpair_comment_single;
3268 public bool case_sensitive;
3269 public bool skip_comment_multi;
3270 public bool skip_comment_single;
3271 public bool scan_comment_multi;
3272 public bool scan_identifier;
3273 public bool scan_identifier_1char;
3274 public bool scan_identifier_NULL;
3275 public bool scan_symbols;
3276 public bool scan_binary;
3277 public bool scan_octal;
3278 public bool scan_float;
3279 public bool scan_hex;
3280 public bool scan_hex_dollar;
3281 public bool scan_string_sq;
3282 public bool scan_string_dq;
3283 public bool numbers_2_int;
3284 public bool int_2_float;
3285 public bool identifier_2_string;
3286 public bool char_2_token;
3287 public bool symbol_2_token;
3288 public bool scope_0_fallback;
3289 public bool store_int64;
3292 [CCode (lower_case_cprefix="G_CSET_")]
3293 namespace CharacterSet {
3294 public const string A_2_Z;
3295 public const string a_2_z;
3296 public const string DIGITS;
3297 public const string LATINC;
3298 public const string LATINS;
3301 [CCode (cprefix = "G_TOKEN_", has_type_id = false)]
3302 public enum TokenType {
3330 public struct TokenValue {
3331 [CCode (cname="v_symbol")]
3332 public void* symbol;
3333 [CCode (cname="v_identifier")]
3334 public unowned string identifier;
3335 [CCode (cname="v_binary")]
3336 public ulong binary;
3337 [CCode (cname="v_octal")]
3339 [CCode (cname="v_int")]
3341 [CCode (cname="v_int64")]
3343 [CCode (cname="v_float")]
3344 public double float;
3345 [CCode (cname="v_hex")]
3347 [CCode (cname="v_string")]
3348 public unowned string string;
3349 [CCode (cname="v_comment")]
3350 public unowned string comment;
3351 [CCode (cname="v_char")]
3353 [CCode (cname="v_error")]
3357 [CCode (cprefix = "G_ERR_", has_type_id = false)]
3358 public enum ErrorType {
3361 UNEXP_EOF_IN_STRING,
3362 UNEXP_EOF_IN_COMMENT,
3369 /* Automatic String Completion */
3371 [Version (deprecated_since = "2.26")]
3373 [CCode (free_function = "g_completion_free")]
3374 public class Completion {
3375 public Completion (CompletionFunc? func = null);
3376 public List<void*> items;
3377 public CompletionFunc func;
3378 public string prefix;
3379 public List<void*> cache;
3380 public CompletionStrncmpFunc strncmp_func;
3381 public void add_items (List<void*> items);
3382 public void remove_items (List<void*> items);
3383 public void clear_items ();
3384 public unowned List<void*> complete (string prefix, out string? new_prefix = null);
3385 [Version (since = "2.4")]
3386 public unowned List<void*> complete_utf8 (string prefix, out string? new_prefix = null);
3389 [CCode (has_target = false)]
3390 public delegate string CompletionFunc (void* item);
3391 [CCode (has_target = false)]
3392 public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n);
3397 [CCode (free_function = "g_timer_destroy")]
3398 public class Timer {
3400 public void start ();
3401 public void stop ();
3402 [Version (since = "2.4")]
3403 public void @continue ();
3404 public double elapsed (out ulong microseconds = null);
3405 public void reset ();
3408 /* Spawning Processes */
3410 public errordomain SpawnError {
3431 public static GLib.Quark quark ();
3434 [CCode (cprefix = "G_SPAWN_", has_type_id = false)]
3436 public enum SpawnFlags {
3437 LEAVE_DESCRIPTORS_OPEN,
3442 CHILD_INHERITS_STDIN,
3444 SEARCH_PATH_FROM_ENVP
3447 public delegate void SpawnChildSetupFunc ();
3448 [CCode (has_target = false, cheader_filename = "signal.h")]
3449 public delegate void SignalHandlerFunc (int signum);
3451 public unowned string strsignal (int signum);
3453 [CCode (lower_case_cprefix = "g_")]
3455 [Version (since = "2.58")]
3456 public static bool spawn_async_with_fds (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid = null, int stdin_fd = -1, int stdout_fd = -1, int stderr_fd = -1) throws SpawnError;
3457 public static bool spawn_async_with_pipes (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid, out int standard_input = null, out int standard_output = null, out int standard_error = null) throws SpawnError;
3458 public static bool spawn_async (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid) throws SpawnError;
3459 public static bool spawn_sync (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out string standard_output = null, out string standard_error = null, out int exit_status = null) throws SpawnError;
3460 public static bool spawn_command_line_async (string command_line) throws SpawnError;
3461 public static bool spawn_command_line_sync (string command_line, out string standard_output = null, out string standard_error = null, out int exit_status = null) throws SpawnError;
3462 [CCode (cname = "g_spawn_close_pid")]
3463 public static void close_pid (Pid pid);
3464 [Version (since = "2.34")]
3465 [CCode (cname = "g_spawn_check_exit_status")]
3466 public static bool check_exit_status (int exit_status) throws GLib.Error;
3468 /* these macros are required to examine the exit status of a process */
3469 [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")]
3470 public static bool if_exited (int status);
3471 [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")]
3472 public static int exit_status (int status);
3473 [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")]
3474 public static bool if_signaled (int status);
3475 [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")]
3476 public static ProcessSignal term_sig (int status);
3477 [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")]
3478 public static bool core_dump (int status);
3479 [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")]
3480 public static bool if_stopped (int status);
3481 [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")]
3482 public static ProcessSignal stop_sig (int status);
3483 [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")]
3484 public static bool if_continued (int status);
3487 [CCode (cname = "abort", cheader_filename = "stdlib.h")]
3488 public void abort ();
3490 [CCode (cname = "exit", cheader_filename = "stdlib.h")]
3491 public void exit (int status);
3492 [CCode (cname = "raise", cheader_filename = "signal.h")]
3493 public int raise (ProcessSignal sig);
3494 [CCode (cname = "signal", cheader_filename = "signal.h")]
3495 public SignalHandlerFunc @signal (ProcessSignal signum, SignalHandlerFunc handler);
3498 [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")]
3499 public enum ProcessSignal {
3524 /* File Utilities */
3526 public errordomain FileError {
3552 public static GLib.Quark quark ();
3555 [CCode (has_type_id = false)]
3557 public enum FileTest {
3565 [CCode (cname = "int", cprefix = "SEEK_", has_type_id = false)]
3566 public enum FileSeek {
3573 [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
3574 public class FileStream {
3575 [CCode (cname = "EOF", cheader_filename = "stdio.h")]
3576 public const int EOF;
3578 [Version (since = "2.6")]
3579 [CCode (cname = "g_fopen", cheader_filename = "glib/gstdio.h")]
3580 public static FileStream? open (string path, string mode);
3581 [CCode (cname = "fdopen")]
3582 public static FileStream? fdopen (int fildes, string mode);
3583 [CCode (cname = "fprintf")]
3585 public void printf (string format, ...);
3586 [CCode (cname = "vfprintf")]
3587 public void vprintf (string format, va_list args);
3588 [CCode (cname = "fputc", instance_pos = -1)]
3589 public void putc (char c);
3590 [CCode (cname = "fputs", instance_pos = -1)]
3591 public void puts (string s);
3592 [CCode (cname = "fgetc")]
3594 [CCode (cname = "ungetc", instance_pos = -1)]
3595 public int ungetc (int c);
3596 [CCode (cname = "fgets", instance_pos = -1)]
3597 public unowned string? gets (char[] s);
3598 [CCode (cname = "feof")]
3600 [CCode (cname = "fscanf"), ScanfFormat]
3601 public int scanf (string format, ...);
3602 [CCode (cname = "fflush")]
3603 public int flush ();
3604 [CCode (cname = "fseek")]
3605 public int seek (long offset, FileSeek whence);
3606 [CCode (cname = "ftell")]
3607 public long tell ();
3608 [CCode (cname = "rewind")]
3609 public void rewind ();
3610 [CCode (cname = "fileno")]
3611 public int fileno ();
3612 [CCode (cname = "ferror")]
3613 public int error ();
3614 [CCode (cname = "clearerr")]
3615 public void clearerr ();
3616 [CCode (cname = "fread", instance_pos = -1)]
3617 public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3618 [CCode (cname = "fwrite", instance_pos = -1)]
3619 public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3621 public string? read_line () {
3623 StringBuilder? ret = null;
3624 while ((c = getc ()) != EOF) {
3626 ret = new StringBuilder ();
3631 ((!)(ret)).append_c ((char) c);
3636 return ((!)(ret)).str;
3641 [CCode (cname = "struct utimbuf", cheader_filename = "sys/types.h,utime.h")]
3642 public struct UTimBuf {
3643 time_t actime; /* access time */
3644 time_t modtime; /* modification time */
3647 [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
3648 namespace FileUtils {
3649 public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError;
3650 [Version (since = "2.8")]
3651 public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError;
3652 [CCode (cname = "g_file_get_contents")]
3653 public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "size_t")] out uint8[] contents) throws FileError;
3654 [CCode (cname = "g_file_set_contents")]
3655 public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "size_t")] uint8[] contents) throws FileError;
3656 public static bool test (string filename, FileTest test);
3657 public static int open_tmp (string tmpl, out string name_used) throws FileError;
3658 [Version (since = "2.4")]
3659 public static string read_link (string filename) throws FileError;
3660 public static int error_from_errno (int err_no);
3662 [CCode (cname = "g_mkstemp")]
3663 public static int mkstemp (string tmpl);
3664 [Version (since = "2.6")]
3665 [CCode (cname = "g_rename")]
3666 public static int rename (string oldfilename, string newfilename);
3667 [Version (since = "2.6")]
3668 [CCode (cname = "g_remove")]
3669 public static int remove (string filename);
3670 [CCode (cname = "g_unlink")]
3671 public static int unlink (string filename);
3672 [Version (since = "2.8")]
3673 [CCode (cname = "g_chmod")]
3674 public static int chmod (string filename, int mode);
3675 [Version (since = "2.18")]
3676 [CCode (cname = "g_utime")]
3677 public static int utime (string filename, UTimBuf? times = null);
3679 [CCode (cname = "symlink", cheader_filename = "unistd.h")]
3680 public static int symlink (string oldpath, string newpath);
3682 [CCode (cname = "close", cheader_filename = "unistd.h")]
3683 public static int close (int fd);
3685 [Version (since = "2.36")]
3686 [CCode (cname = "g_close")]
3687 public static bool close_checked (int fd) throws FileError;
3690 [CCode (cname = "struct stat", cheader_filename = "sys/stat.h,glib/gstdio.h")]
3691 public struct Stat {
3692 public time_t st_atime;
3693 public time_t st_mtime;
3694 public time_t st_ctime;
3695 [CCode (cname = "g_stat", instance_pos = -1)]
3696 public Stat (string filename);
3697 [Version (since = "2.6")]
3698 [CCode (cname = "g_lstat", instance_pos = -1)]
3699 public Stat.l (string filename);
3703 [CCode (free_function = "g_dir_close")]
3705 public static Dir open (string filename, uint _flags = 0) throws FileError;
3706 public unowned string? read_name ();
3707 public void rewind ();
3710 [CCode (cheader_filename = "glib/gstdio.h")]
3711 namespace DirUtils {
3712 [Version (since = "2.6")]
3713 [CCode (cname = "g_mkdir")]
3714 public static int create (string pathname, int mode);
3715 [Version (since = "2.8")]
3716 [CCode (cname = "g_mkdir_with_parents")]
3717 public static int create_with_parents (string pathname, int mode);
3718 [Version (since = "2.30")]
3719 [CCode (cname = "mkdtemp")]
3720 public static string mkdtemp (owned string template);
3721 [Version (since = "2.30")]
3722 [CCode (cname = "g_dir_make_tmp")]
3723 public static string make_tmp (string tmpl) throws FileError;
3724 [Version (since = "2.6")]
3725 [CCode (cname = "g_rmdir")]
3726 public static int remove (string filename);
3730 [Version (since = "2.22")]
3731 [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref")]
3732 public class MappedFile {
3733 public MappedFile (string filename, bool writable) throws FileError;
3734 public size_t get_length ();
3735 public unowned char* get_contents ();
3736 [Version (since = "2.34")]
3737 public Bytes get_bytes ();
3740 [CCode (cname = "stdin", cheader_filename = "stdio.h")]
3741 public static FileStream stdin;
3743 [CCode (cname = "stdout", cheader_filename = "stdio.h")]
3744 public static FileStream stdout;
3746 [CCode (cname = "stderr", cheader_filename = "stdio.h")]
3747 public static FileStream stderr;
3752 public const string RESERVED_CHARS_ALLOWED_IN_PATH;
3753 public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
3754 public const string RESERVED_CHARS_ALLOWED_IN_USERINFO;
3755 public const string RESERVED_CHARS_GENERIC_DELIMITERS;
3756 public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS;
3758 [Version (since = "2.16")]
3759 public static string? parse_scheme (string uri);
3760 [Version (since = "2.16")]
3761 public static string escape_string (string unescaped, string? reserved_chars_allowed = null, bool allow_utf8 = true);
3762 [Version (since = "2.16")]
3763 public static string? unescape_string (string escaped_string, string? illegal_characters = null);
3764 [Version (since = "2.16")]
3765 public static string? unescape_segment (string? escaped_string, string? escaped_string_end, string? illegal_characters = null);
3766 [Version (since = "2.6")]
3767 [CCode (array_length = false, array_null_terminated = true)]
3768 public static string[] list_extract_uris (string uri_list);
3771 /* Shell-related Utilities */
3773 public errordomain ShellError {
3777 public static GLib.Quark quark ();
3781 public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError;
3782 public static string quote (string unquoted_string);
3783 public static string unquote (string quoted_string) throws ShellError;
3786 /* Commandline option parser */
3788 public errordomain OptionError {
3792 public static GLib.Quark quark ();
3796 [Version (since = "2.6")]
3797 [CCode (free_function = "g_option_context_free")]
3798 public class OptionContext {
3799 public OptionContext (string? parameter_string = null);
3800 [Version (since = "2.12")]
3801 public void set_summary (string summary);
3802 [Version (since = "2.12")]
3803 public unowned string get_summary ();
3804 [Version (since = "2.12")]
3805 public void set_description (string description);
3806 [Version (since = "2.12")]
3807 public unowned string get_description ();
3808 [Version (since = "2.12")]
3809 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3810 [Version (since = "2.12")]
3811 public void set_translation_domain (string domain);
3812 public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError;
3813 [Version (since = "2.40")]
3814 public bool parse_strv ([CCode (array_length = false, array_null_terminated = true)] ref string[] argv) throws OptionError;
3815 public void set_help_enabled (bool help_enabled);
3816 public bool get_help_enabled ();
3817 public void set_ignore_unknown_options (bool ignore_unknown);
3818 public bool get_ignore_unknown_options ();
3819 [Version (since = "2.14")]
3820 public string get_help (bool main_help, OptionGroup? group);
3821 public void add_main_entries ([CCode (array_length = false, array_null_terminated = true)] OptionEntry[] entries, string? translation_domain);
3822 public void add_group (owned OptionGroup group);
3823 public void set_main_group (owned OptionGroup group);
3824 public unowned OptionGroup get_main_group ();
3825 [Version (since = "2.44")]
3826 public void set_strict_posix (bool strict_posix);
3827 [Version (since = "2.44")]
3828 public bool get_strict_posix ();
3831 public delegate unowned string TranslateFunc (string str);
3833 public const string OPTION_REMAINING;
3835 [CCode (has_type_id = false)]
3836 public enum OptionArg {
3849 [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)]
3850 public enum OptionFlags {
3851 [Version (since = "2.42")]
3862 public struct OptionEntry {
3863 public unowned string long_name;
3864 public char short_name;
3867 public OptionArg arg;
3868 public void* arg_data;
3870 public unowned string description;
3871 public unowned string? arg_description;
3876 [Version (since = "2.44")]
3877 [CCode (ref_function = "g_option_group_ref", unref_function = "g_option_group_unref", type_id = "G_TYPE_OPTION_GROUP")]
3879 [Version (since = "2.6")]
3880 [CCode (free_function = "g_option_group_free")]
3882 public class OptionGroup {
3883 public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null);
3884 public void add_entries ([CCode (array_length = false, array_null_terminated = true)] OptionEntry[] entries);
3885 public void set_parse_hooks (OptionParseFunc? pre_parse_func, OptionParseFunc? post_parse_hook);
3886 public void set_error_hook (OptionErrorFunc? error_func);
3887 public void set_translate_func (owned TranslateFunc? func);
3888 public void set_translation_domain (string domain);
3891 [CCode (has_target = false)]
3892 public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError;
3893 [CCode (has_target = false)]
3894 public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error);
3895 [CCode (has_target = false)]
3896 public delegate bool OptionArgFunc (string option_name, string val, void* data) throws OptionError;
3898 /* Perl-compatible regular expressions */
3900 [Version (since = "2.14")]
3901 public errordomain RegexError {
3908 MISSING_CONTROL_CHAR,
3909 UNRECOGNIZED_ESCAPE,
3910 QUANTIFIERS_OUT_OF_ORDER,
3912 UNTERMINATED_CHARACTER_CLASS,
3913 INVALID_ESCAPE_IN_CHARACTER_CLASS,
3916 UNRECOGNIZED_CHARACTER,
3917 POSIX_NAMED_CLASS_OUTSIDE_CLASS,
3918 UNMATCHED_PARENTHESIS,
3919 INEXISTENT_SUBPATTERN_REFERENCE,
3920 UNTERMINATED_COMMENT,
3921 EXPRESSION_TOO_LARGE,
3923 VARIABLE_LENGTH_LOOKBEHIND,
3924 MALFORMED_CONDITION,
3925 TOO_MANY_CONDITIONAL_BRANCHES,
3927 UNKNOWN_POSIX_CLASS_NAME,
3928 POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED,
3931 SINGLE_BYTE_MATCH_IN_LOOKBEHIND,
3933 MISSING_SUBPATTERN_NAME_TERMINATOR,
3934 DUPLICATE_SUBPATTERN_NAME,
3937 SUBPATTERN_NAME_TOO_LONG,
3938 TOO_MANY_SUBPATTERNS,
3939 INVALID_OCTAL_VALUE,
3940 TOO_MANY_BRANCHES_IN_DEFINE,
3942 INCONSISTENT_NEWLINE_OPTIONS,
3943 MISSING_BACK_REFERENCE,
3944 INVALID_RELATIVE_REFERENCE,
3945 BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN,
3946 UNKNOWN_BACKTRACKING_CONTROL_VERB,
3948 MISSING_SUBPATTERN_NAME,
3950 INVALID_DATA_CHARACTER,
3951 EXTRA_SUBPATTERN_NAME,
3952 BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED,
3953 INVALID_CONTROL_CHAR,
3955 NOT_SUPPORTED_IN_CLASS,
3956 TOO_MANY_FORWARD_REFERENCES,
3958 CHARACTER_VALUE_TOO_LARGE;
3959 public static GLib.Quark quark ();
3962 [Version (since = "2.14")]
3963 [CCode (cprefix = "G_REGEX_", has_type_id = false)]
3965 public enum RegexCompileFlags {
3985 [Version (since = "2.14")]
3986 [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)]
3988 public enum RegexMatchFlags {
4007 [Version (since = "2.14")]
4008 [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
4009 public class Regex {
4010 public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
4011 public unowned string get_pattern ();
4012 [Version (since = "2.26")]
4013 public RegexCompileFlags get_compile_flags ();
4014 [Version (since = "2.34")]
4015 public bool get_has_cr_or_lf ();
4016 [Version (since = "2.26")]
4017 public RegexMatchFlags get_match_flags ();
4018 public int get_max_backref ();
4019 [Version (since = "2.38")]
4020 public int get_max_lookbehind ();
4021 public int get_capture_count ();
4022 public int get_string_number (string name);
4023 public static string escape_string (string str, int length = -1);
4024 public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
4025 public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
4026 public bool match_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
4027 public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
4028 public bool match_all_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
4029 [CCode (array_length = false, array_null_terminated = true)]
4030 public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
4031 [CCode (array_length = false, array_null_terminated = true)]
4032 public string[] split (string str, RegexMatchFlags match_options = 0);
4033 [CCode (array_length = false, array_null_terminated = true)]
4034 public string[] split_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError;
4035 public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
4036 public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
4037 public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options, RegexEvalCallback eval) throws RegexError;
4038 public static bool check_replacement (string replacement, out bool has_references = null) throws RegexError;
4041 [Version (since = "2.14")]
4042 public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
4045 [Version (since = "2.30")]
4046 [CCode (ref_function = "g_match_info_ref", unref_function = "g_match_info_unref", type_id = "G_TYPE_MATCH_INFO")]
4047 public class MatchInfo {
4048 public unowned Regex get_regex ();
4049 public unowned string get_string ();
4050 public bool matches ();
4051 public bool next () throws RegexError;
4052 public int get_match_count ();
4053 public bool is_partial_match ();
4054 public string expand_references (string string_to_expand) throws RegexError;
4055 public string? fetch (int match_num);
4056 public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
4057 public string? fetch_named (string name);
4058 public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
4059 [CCode (array_length = false, array_null_terminated = true)]
4060 public string[] fetch_all ();
4063 /* Simple XML Subset Parser
4064 See http://live.gnome.org/Vala/MarkupSample for an example */
4066 public errordomain MarkupError {
4074 public static GLib.Quark quark ();
4077 [CCode (cprefix = "G_MARKUP_", has_type_id = false)]
4079 public enum MarkupParseFlags {
4080 TREAT_CDATA_AS_TEXT,
4081 PREFIX_ERROR_POSITION
4085 [Version (since = "2.36")]
4086 [CCode (ref_function = "g_markup_parse_context_ref", unref_function = "g_markup_parse_context_unref", type_id = "G_TYPE_MARKUP_PARSE_CONTEXT")]
4087 public class MarkupParseContext {
4088 public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
4089 public bool parse (string text, ssize_t text_len) throws MarkupError;
4090 public bool end_parse () throws MarkupError;
4091 [Version (since = "2.2")]
4092 public unowned string get_element ();
4093 [Version (since = "2.16")]
4094 public unowned SList<string> get_element_stack ();
4095 public void get_position (out int line_number, out int char_number);
4096 [Version (since = "2.18")]
4097 public void push (MarkupParser parser, void* user_data);
4098 [Version (since = "2.18")]
4099 public void* pop ();
4100 [Version (since = "2.18")]
4101 public void* get_user_data ();
4104 public delegate void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_names, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_values) throws MarkupError;
4106 public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
4108 public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
4110 public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
4112 public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
4114 public struct MarkupParser {
4115 [CCode (delegate_target = false)]
4116 public unowned MarkupParserStartElementFunc start_element;
4117 [CCode (delegate_target = false)]
4118 public unowned MarkupParserEndElementFunc end_element;
4119 [CCode (delegate_target = false)]
4120 public unowned MarkupParserTextFunc text;
4121 [CCode (delegate_target = false)]
4122 public unowned MarkupParserPassthroughFunc passthrough;
4123 [CCode (delegate_target = false)]
4124 public unowned MarkupParserErrorFunc error;
4128 [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)]
4129 public enum CollectType {
4138 public static string escape_text (string text, ssize_t length = -1);
4139 [Version (since = "2.4")]
4141 public static string printf_escaped (string format, ...);
4142 [Version (since = "2.4")]
4143 public static string vprintf_escaped (string format, va_list args);
4144 [Version (since = "2.16")]
4145 [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")]
4146 public static bool collect_attributes (string element_name, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_names, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_values, ...) throws MarkupError;
4149 /* Key-value file parser */
4151 public errordomain KeyFileError {
4158 public static GLib.Quark quark ();
4162 [Version (since = "2.32")]
4163 [CCode (ref_function = "g_key_file_ref", unref_function = "g_key_file_unref", type_id = "G_TYPE_KEY_FILE")]
4164 public class KeyFile {
4166 public void set_list_separator (char separator);
4167 [Version (since = "2.50")]
4168 public bool load_from_bytes (Bytes bytes, KeyFileFlags @flags) throws KeyFileError;
4169 public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError;
4170 [Version (since = "2.14")]
4171 public bool load_from_dirs (string file, [CCode (array_length = false, array_null_terminated = true)] string[] search_dirs, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
4172 public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError;
4173 public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
4174 // g_key_file_to_data never throws an error according to the documentation
4175 public string to_data (out size_t length = null, out GLib.Error error = null);
4176 public string get_start_group ();
4177 [CCode (array_length_type = "gsize")]
4178 public string[] get_groups ();
4179 [CCode (array_length_type = "gsize")]
4180 public string[] get_keys (string group_name) throws KeyFileError;
4181 public bool has_group (string group_name);
4182 public bool has_key (string group_name, string key) throws KeyFileError;
4183 public string get_value (string group_name, string key) throws KeyFileError;
4184 public string get_string (string group_name, string key) throws KeyFileError;
4185 public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError;
4186 [Version (since = "2.56")]
4187 public string? get_locale_for_key (string group_name, string key, string? locale = null);
4188 public bool get_boolean (string group_name, string key) throws KeyFileError;
4189 public int get_integer (string group_name, string key) throws KeyFileError;
4190 [Version (since = "2.26")]
4191 public int64 get_int64 (string group_name, string key) throws KeyFileError;
4192 [Version (since = "2.26")]
4193 public uint64 get_uint64 (string group_name, string key) throws KeyFileError;
4194 [Version (since = "2.12")]
4195 public double get_double (string group_name, string key) throws KeyFileError;
4196 [CCode (array_length = true, array_length_type = "gsize", array_null_terminated = true)]
4197 public string[] get_string_list (string group_name, string key) throws KeyFileError;
4198 [CCode (array_length_type = "gsize")]
4199 public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError;
4200 [CCode (array_length_type = "gsize")]
4201 public bool[] get_boolean_list (string group_name, string key) throws KeyFileError;
4202 [CCode (array_length_type = "gsize")]
4203 public int[] get_integer_list (string group_name, string key) throws KeyFileError;
4204 [Version (since = "2.12")]
4205 [CCode (array_length_type = "gsize")]
4206 public double[] get_double_list (string group_name, string key) throws KeyFileError;
4207 public string get_comment (string? group_name, string? key) throws KeyFileError;
4208 [Version (since = "2.40")]
4209 public bool save_to_file (string filename) throws GLib.FileError;
4210 public void set_value (string group_name, string key, string value);
4211 public void set_string (string group_name, string key, string str);
4212 public void set_locale_string (string group_name, string key, string locale, string str);
4213 public void set_boolean (string group_name, string key, bool value);
4214 public void set_integer (string group_name, string key, int value);
4215 [Version (since = "2.26")]
4216 public void set_int64 (string group_name, string key, int64 value);
4217 [Version (since = "2.26")]
4218 public void set_uint64 (string group_name, string key, uint64 value);
4219 [Version (since = "2.12")]
4220 public void set_double (string group_name, string key, double value);
4221 public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list);
4222 public void set_locale_string_list (string group_name, string key, string locale, string[] list);
4223 public void set_boolean_list (string group_name, string key, bool[] list);
4224 public void set_integer_list (string group_name, string key, int[] list);
4225 [Version (since = "2.12")]
4226 public void set_double_list (string group_name, string key, double[] list);
4227 public void set_comment (string? group_name, string? key, string comment) throws KeyFileError;
4228 public void remove_group (string group_name) throws KeyFileError;
4229 public void remove_key (string group_name, string key) throws KeyFileError;
4230 public void remove_comment (string group_name, string key) throws KeyFileError;
4233 [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)]
4235 public enum KeyFileFlags {
4241 [Version (since = "2.14")]
4242 [CCode (cprefix = "G_KEY_FILE_DESKTOP_")]
4243 namespace KeyFileDesktop {
4244 public const string GROUP;
4245 public const string KEY_ACTIONS;
4246 public const string KEY_CATEGORIES;
4247 public const string KEY_COMMENT;
4248 public const string KEY_DBUS_ACTIVATABLE;
4249 public const string KEY_EXEC;
4250 public const string KEY_FULLNAME;
4251 public const string KEY_GENERIC_NAME;
4252 public const string KEY_GETTEXT_DOMAIN;
4253 public const string KEY_HIDDEN;
4254 public const string KEY_ICON;
4255 public const string KEY_KEYWORDS;
4256 public const string KEY_MIME_TYPE;
4257 public const string KEY_NAME;
4258 public const string KEY_NOT_SHOW_IN;
4259 public const string KEY_NO_DISPLAY;
4260 public const string KEY_ONLY_SHOW_IN;
4261 public const string KEY_PATH;
4262 public const string KEY_STARTUP_NOTIFY;
4263 public const string KEY_STARTUP_WM_CLASS;
4264 public const string KEY_TERMINAL;
4265 public const string KEY_TRY_EXEC;
4266 public const string KEY_TYPE;
4267 public const string KEY_URL;
4268 public const string KEY_VERSION;
4269 public const string TYPE_APPLICATION;
4270 public const string TYPE_DIRECTORY;
4271 public const string TYPE_LINK;
4274 /* Bookmark file parser */
4277 [Version (since = "2.12")]
4278 [CCode (free_function = "g_bookmark_file_free")]
4279 public class BookmarkFile {
4280 public BookmarkFile ();
4281 public bool load_from_file (string file) throws BookmarkFileError, FileError;
4282 public bool load_from_data (string data, size_t length) throws BookmarkFileError;
4283 public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError, FileError;
4284 public string to_data (out size_t length) throws BookmarkFileError;
4285 public bool to_file (string filename) throws BookmarkFileError, FileError;
4286 public bool has_item (string uri);
4287 public bool has_group (string uri, string group) throws BookmarkFileError;
4288 public bool has_application (string uri, string name) throws BookmarkFileError;
4289 public int get_size ();
4290 public string[] get_uris ();
4291 public string get_title (string uri) throws BookmarkFileError;
4292 public string get_description (string uri) throws BookmarkFileError;
4293 public string get_mime_type (string uri) throws BookmarkFileError;
4294 public bool get_is_private (string uri) throws BookmarkFileError;
4295 public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError;
4296 public time_t get_added (string uri) throws BookmarkFileError;
4297 public time_t get_modified (string uri) throws BookmarkFileError;
4298 public time_t get_visited (string uri) throws BookmarkFileError;
4299 public string[] get_groups (string uri) throws BookmarkFileError;
4300 public string[] get_applications (string uri) throws BookmarkFileError;
4301 public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError;
4302 public void set_title (string uri, string title);
4303 public void set_description (string uri, string description);
4304 public void set_mime_type (string uri, string mime_type);
4305 public void set_is_private (string uri, bool is_private);
4306 public void set_icon (string uri, string href, string mime_type);
4307 public void set_added (string uri, time_t added);
4308 public void set_groups (string uri, string[] groups);
4309 public void set_modified (string uri, time_t modified);
4310 public void set_visited (string uri, time_t visited);
4311 public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError;
4312 public void add_group (string uri, string group);
4313 public void add_application (string uri, string name, string exec);
4314 public bool remove_group (string uri, string group) throws BookmarkFileError;
4315 public bool remove_application (string uri, string name) throws BookmarkFileError;
4316 public bool remove_item (string uri) throws BookmarkFileError;
4317 public bool move_item (string old_uri, string new_uri) throws BookmarkFileError;
4320 public errordomain BookmarkFileError {
4329 public static GLib.Quark quark ();
4335 [CCode (cprefix = "G_TEST_", has_type_id = false)]
4336 public enum FileType {
4342 [Version (since = "2.16")]
4343 public static void minimized_result (double minimized_quantity, string format, ...);
4345 [Version (since = "2.16")]
4346 public static void maximized_result (double maximized_quantity, string format, ...);
4347 [Version (since = "2.16")]
4348 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...);
4349 public static bool quick ();
4350 public static bool slow ();
4351 public static bool thorough ();
4352 public static bool perf ();
4353 public static bool verbose ();
4354 public static bool quiet ();
4355 [Version (since = "2.16")]
4356 public static int run ();
4357 [Version (since = "2.16")]
4358 public static void add_func (string testpath, [CCode (scope = "async")] owned TestFunc test_funcvoid);
4359 [Version (since = "2.16")]
4360 public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9, scope = "async")] owned TestDataFunc test_funcvoid);
4361 [Version (since = "2.34")]
4362 public static void add_data_func_full (string testpath, [CCode (delegate_target_pos = 1.9)] owned TestDataFunc test_func);
4363 [Version (since = "2.34")]
4364 public static void assert_expected_messages ();
4365 [Version (since = "2.38")]
4366 public static string build_filename (GLib.Test.FileType file_type, params string[] path_segments);
4367 [Version (since = "2.34")]
4368 public static void expect_message (string? log_domain, LogLevelFlags log_level, string pattern);
4369 [Version (since = "2.30")]
4370 public static void fail ();
4371 [Version (since = "2.38")]
4372 public static bool failed ();
4373 [Version (since = "2.38")]
4374 public static unowned string get_dir (GLib.Test.FileType file_type);
4375 [Version (since = "2.38")]
4376 public static unowned string get_filename (GLib.Test.FileType file_type, params string[] path_segments);
4377 [Version (since = "2.38")]
4378 public static void incomplete (string? msg = null);
4379 [Version (since = "2.36")]
4380 public static bool initialized ();
4382 [Version (since = "2.16")]
4383 public static void message (string format, ...);
4384 [Version (since = "2.38")]
4385 public static void set_nonfatal_assertions ();
4386 [Version (since = "2.38")]
4387 public static void skip (string? msg = null);
4388 [Version (since = "2.38")]
4389 public static bool subprocess ();
4390 [Version (since = "2.16")]
4391 public static void bug_base (string uri_pattern);
4392 [Version (since = "2.16")]
4393 public static void bug (string bug_uri_snippet);
4394 [Version (since = "2.16")]
4395 public static void timer_start ();
4396 [Version (since = "2.16")]
4397 public static double timer_elapsed ();
4398 [Version (since = "2.16")]
4399 public static double timer_last ();
4400 [Version (since = "2.16", deprecated_since = "2.38", replacement = "trap_subprocess")]
4401 public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags);
4402 [Version (since = "2.16")]
4403 public static bool trap_has_passed ();
4404 [Version (since = "2.16")]
4405 public static bool trap_reached_timeout ();
4406 [Version (since = "2.38")]
4407 public static void trap_subprocess (string? test_path, uint64 usec_timeout, TestSubprocessFlags test_flags);
4408 [Version (since = "2.16")]
4409 public static void trap_assert_passed ();
4410 [Version (since = "2.16")]
4411 public static void trap_assert_failed ();
4412 [Version (since = "2.16")]
4413 public static void trap_assert_stdout (string soutpattern);
4414 [Version (since = "2.16")]
4415 public static void trap_assert_stdout_unmatched (string soutpattern);
4416 [Version (since = "2.16")]
4417 public static void trap_assert_stderr (string serrpattern);
4418 [Version (since = "2.16")]
4419 public static void trap_assert_stderr_unmatched (string serrpattern);
4420 [Version (since = "2.16")]
4421 public static bool rand_bit ();
4422 [Version (since = "2.16")]
4423 public static int32 rand_int ();
4424 [Version (since = "2.16")]
4425 public static int32 rand_int_range (int32 begin, int32 end);
4426 [Version (since = "2.16")]
4427 public static double rand_double ();
4428 [Version (since = "2.16")]
4429 public static double rand_double_range (double begin, double end);
4430 [Version (since = "2.22")]
4431 public static void log_set_fatal_handler (LogFatalFunc log_func);
4434 public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message);
4437 [CCode (cname = "GTestCase", ref_function = "", unref_function = "")]
4438 public class TestCase {
4439 [Version (since = "2.16")]
4440 [CCode (cname = "g_test_create_case")]
4441 public TestCase (string test_name, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_setup, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_func, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_teardown, [CCode (pos = 1.8)] size_t data_size = 0);
4445 [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")]
4446 public class TestSuite {
4447 [Version (since = "2.16")]
4448 [CCode (cname = "g_test_create_suite")]
4449 public TestSuite (string name);
4450 [Version (since = "2.16")]
4451 [CCode (cname = "g_test_get_root")]
4452 public static TestSuite get_root ();
4453 [Version (since = "2.16")]
4454 [CCode (cname = "g_test_suite_add")]
4455 public void add (TestCase test_case);
4456 [Version (since = "2.16")]
4457 [CCode (cname = "g_test_suite_add_suite")]
4458 public void add_suite (TestSuite test_suite);
4461 [Version (since = "2.26")]
4462 [CCode (has_target = false)]
4463 public delegate void TestFunc ();
4464 [Version (since = "2.26")]
4465 public delegate void TestDataFunc ();
4466 [Version (since = "2.26")]
4467 public delegate void TestFixtureFunc (void* fixture);
4469 [CCode (cprefix = "G_TEST_SUBPROCESS_INHERIT_", has_type_id = false)]
4471 public enum TestSubprocessFlags {
4478 [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)]
4479 public enum TestTrapFlags {
4485 /* Doubly-Linked Lists */
4488 [CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
4489 public class List<G> {
4492 [ReturnsModifiedPointer ()]
4493 public void append (owned G data);
4494 [ReturnsModifiedPointer ()]
4495 public void prepend (owned G data);
4496 [ReturnsModifiedPointer ()]
4497 public void insert (owned G data, int position);
4498 [ReturnsModifiedPointer ()]
4499 public void insert_before (List<G> sibling, owned G data);
4500 [ReturnsModifiedPointer ()]
4501 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
4502 [ReturnsModifiedPointer ()]
4503 public void remove (G data);
4504 [ReturnsModifiedPointer ()]
4505 public void remove_link (List<G> llink);
4506 [ReturnsModifiedPointer ()]
4507 public void delete_link (List<G> link_);
4508 [ReturnsModifiedPointer ()]
4509 public void remove_all (G data);
4511 public uint length ();
4512 public List<unowned G> copy ();
4513 [Version (since = "2.34")]
4514 public List<G> copy_deep (CopyFunc<G> func);
4515 [ReturnsModifiedPointer ()]
4516 public void reverse ();
4517 [ReturnsModifiedPointer ()]
4518 public void sort (CompareFunc<G> compare_func);
4519 [Version (since = "2.10")]
4520 [ReturnsModifiedPointer ()]
4521 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
4522 [ReturnsModifiedPointer ()]
4523 public void sort_with_data (CompareDataFunc<G> compare_func);
4524 [ReturnsModifiedPointer ()]
4525 public void concat (owned List<G> list2);
4526 public void @foreach (Func<G> func);
4528 public unowned List<G> first ();
4529 public unowned List<G> last ();
4530 public unowned List<G> nth (uint n);
4531 public unowned G nth_data (uint n);
4532 public unowned List<G> nth_prev (uint n);
4534 public unowned List<G> find (G data);
4535 public unowned List<G> find_custom (G data, CompareFunc<G> func);
4536 [CCode (cname = "g_list_find_custom", simple_generics = true)]
4537 public unowned List<G> search<T> (T data, SearchFunc<G,T> func);
4539 public int position (List<G> llink);
4540 public int index (G data);
4543 public List<G> next;
4544 public unowned List<G> prev;
4547 /* Singly-Linked Lists */
4550 [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
4551 public class SList<G> {
4554 [ReturnsModifiedPointer ()]
4555 public void append (owned G data);
4556 [ReturnsModifiedPointer ()]
4557 public void prepend (owned G data);
4558 [ReturnsModifiedPointer ()]
4559 public void insert (owned G data, int position);
4560 [ReturnsModifiedPointer ()]
4561 public void insert_before (SList<G> sibling, owned G data);
4562 [ReturnsModifiedPointer ()]
4563 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
4564 [ReturnsModifiedPointer ()]
4565 public void remove (G data);
4566 [ReturnsModifiedPointer ()]
4567 public void remove_link (SList<G> llink);
4568 [ReturnsModifiedPointer ()]
4569 public void delete_link (SList<G> link_);
4570 [ReturnsModifiedPointer ()]
4571 public void remove_all (G data);
4573 public uint length ();
4574 public SList<unowned G> copy ();
4575 [Version (since = "2.34")]
4576 public SList<G> copy_deep (CopyFunc<G> func);
4577 [ReturnsModifiedPointer ()]
4578 public void reverse ();
4579 [Version (since = "2.10")]
4580 [ReturnsModifiedPointer ()]
4581 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
4582 [ReturnsModifiedPointer ()]
4583 public void sort (CompareFunc<G> compare_func);
4584 [ReturnsModifiedPointer ()]
4585 public void sort_with_data (CompareDataFunc<G> compare_func);
4586 [ReturnsModifiedPointer ()]
4587 public void concat (owned SList<G> list2);
4588 public void @foreach (Func<G> func);
4590 public unowned SList<G> last ();
4591 public unowned SList<G> nth (uint n);
4592 public unowned G nth_data (uint n);
4594 public unowned SList<G> find (G data);
4595 public unowned SList<G> find_custom (G data, CompareFunc<G> func);
4596 [CCode (cname = "g_slist_find_custom", simple_generics = true)]
4597 public unowned SList<G> search<T> (T data, SearchFunc<G,T> func);
4599 public int position (SList<G> llink);
4600 public int index (G data);
4603 public SList<G> next;
4606 [CCode (has_target = false)]
4607 public delegate int CompareFunc<G> (G a, G b);
4609 public delegate int CompareDataFunc<G> (G a, G b);
4611 [Version (since = "2.16")]
4612 [CCode (cname = "g_strcmp0")]
4613 public static GLib.CompareFunc<string> strcmp;
4615 public delegate G CopyFunc<G> (G src);
4617 [CCode (cname = "GCompareFunc", has_target = false)]
4618 public delegate int SearchFunc<G,T> (G a, T b);
4620 /* Double-ended Queues */
4623 [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
4624 public class Queue<G> {
4625 public unowned List<G> head;
4626 public unowned List<G> tail;
4631 [Version (since = "2.14")]
4632 public void clear ();
4633 public bool is_empty ();
4634 [Version (since = "2.4")]
4635 public uint get_length ();
4636 [Version (since = "2.4")]
4637 public void reverse ();
4638 public Queue copy ();
4639 [Version (since = "2.4")]
4640 public unowned List<G> find (G data);
4641 [Version (since = "2.4")]
4642 public unowned List<G> find_custom (G data, CompareFunc<G> func);
4643 [CCode (cname = "g_queue_find_custom", simple_generics = true)]
4644 public unowned List<G> search<T> (T data, SearchFunc<G,T> func);
4645 [Version (since = "2.4")]
4646 public void sort (CompareDataFunc<G> compare_func);
4647 public void push_head (owned G data);
4648 public void push_tail (owned G data);
4649 [Version (since = "2.4")]
4650 public void push_nth (owned G data, int n);
4651 public G pop_head ();
4652 public G pop_tail ();
4653 [Version (since = "2.4")]
4654 public G pop_nth (uint n);
4655 public unowned G peek_head ();
4656 public unowned G peek_tail ();
4657 [Version (since = "2.4")]
4658 public unowned G peek_nth (uint n);
4659 [Version (since = "2.4")]
4660 public int index (G data);
4661 [Version (since = "2.4")]
4662 public void remove (G data);
4663 [Version (since = "2.4")]
4664 public void remove_all (G data);
4665 [Version (since = "2.4")]
4666 public void delete_link (List<G> link);
4667 [Version (since = "2.4")]
4668 public void unlink (List<G> link);
4669 [Version (since = "2.4")]
4670 public void insert_before (List<G> sibling, owned G data);
4671 [Version (since = "2.4")]
4672 public void insert_after (List<G> sibling, owned G data);
4673 [Version (since = "2.4")]
4674 public void insert_sorted (owned G data, CompareDataFunc<G> func);
4680 [Version (since = "2.14")]
4681 [CCode (free_function = "g_sequence_free")]
4682 public class Sequence<G> {
4683 [CCode (simple_generics = true)]
4685 public int get_length ();
4686 public void @foreach (Func<G> func);
4687 public void sort (CompareDataFunc<G> cmp_func);
4688 public void sort_iter (SequenceIterCompareFunc<G> func);
4689 public SequenceIter<G> get_begin_iter ();
4690 public SequenceIter<G> get_end_iter ();
4691 public SequenceIter<G> get_iter_at_pos (int pos);
4692 public SequenceIter<G> append (owned G data);
4693 public SequenceIter<G> prepend (owned G data);
4694 public SequenceIter<G> insert_sorted (owned G data, CompareDataFunc<G> cmp_func);
4695 [Version (since = "2.48")]
4696 public bool is_empty ();
4697 public SequenceIter<G> insert_sorted_iter (owned G data, SequenceIterCompareFunc<G> iter_cmp);
4698 public SequenceIter<G> search (G data, CompareDataFunc<G> cmp_func);
4699 public SequenceIter<G> search_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
4700 [Version (since = "2.28")]
4701 public SequenceIter<G> lookup (G data, CompareDataFunc<G> cmp_func);
4702 [Version (since = "2.28")]
4703 public SequenceIter<G> lookup_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
4705 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.foreach_range")]
4706 public static void foreach_range (SequenceIter<G> begin, SequenceIter<G> end, Func<G> func);
4707 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.insert_before")]
4708 public static SequenceIter<G> insert_before (SequenceIter<G> iter, owned G data);
4709 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.move_to")]
4710 public static void move (SequenceIter<G> src, SequenceIter<G> dest);
4711 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.swap")]
4712 public static void swap (SequenceIter<G> src, SequenceIter<G> dest);
4713 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.sort_changed")]
4714 public static void sort_changed (SequenceIter<G> iter, CompareDataFunc<G> cmp_func);
4715 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.sort_changed_iter")]
4716 public static void sort_changed_iter (SequenceIter<G> iter, SequenceIterCompareFunc<G> iter_cmp);
4717 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.remove")]
4718 public static void remove (SequenceIter<G> iter);
4719 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.remove_range")]
4720 public static void remove_range (SequenceIter<G> begin, SequenceIter<G> end);
4721 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.move_range")]
4722 public static void move_range (SequenceIter<G> dest, SequenceIter<G> begin, SequenceIter<G> end);
4723 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.get")]
4724 public static unowned G get (SequenceIter<G> iter);
4725 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.set")]
4726 public static void set (SequenceIter<G> iter, owned G data);
4727 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.range_get_midpoint")]
4728 public static SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
4732 [Version (since = "2.14")]
4733 [CCode (ref_function = "", unref_function = "")]
4734 public class SequenceIter<G> {
4735 public bool is_begin ();
4736 public bool is_end ();
4737 public SequenceIter<G> next ();
4738 public SequenceIter<G> prev ();
4739 public int get_position ();
4740 public SequenceIter<G> move (int delta);
4741 public unowned Sequence<G> get_sequence ();
4742 public int compare (SequenceIter<G> other);
4744 [CCode (cname = "g_sequence_foreach_range")]
4745 public void foreach_range (SequenceIter<G> end, Func<G> func);
4746 [CCode (cname = "g_sequence_insert_before")]
4747 public SequenceIter<G> insert_before (owned G data);
4748 [CCode (cname = "g_sequence_move")]
4749 public void move_to (SequenceIter<G> dest);
4750 [CCode (cname = "g_sequence_swap")]
4751 public void swap (SequenceIter<G> dest);
4752 [CCode (cname = "g_sequence_sort_changed")]
4753 public void sort_changed (CompareDataFunc<G> cmp_func);
4754 [CCode (cname = "g_sequence_sort_changed_iter")]
4755 public void sort_changed_iter (SequenceIterCompareFunc<G> iter_cmp);
4756 [CCode (cname = "g_sequence_remove")]
4757 public void remove ();
4758 [CCode (cname = "g_sequence_remove_range")]
4759 public void remove_range (SequenceIter<G> end);
4760 [CCode (cname = "g_sequence_move_range")]
4761 public void move_range (SequenceIter<G> begin, SequenceIter<G> end);
4762 [CCode (cname = "g_sequence_get")]
4763 public unowned G get ();
4764 [CCode (cname = "g_sequence_set")]
4765 public void set (owned G data);
4766 [CCode (cname = "g_sequence_range_get_midpoint")]
4767 public SequenceIter<G> range_get_midpoint (SequenceIter<G> end);
4770 public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
4775 [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
4776 public class HashTable<K,V> {
4777 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
4778 public HashTable (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func);
4779 public HashTable.full (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
4780 public void insert (owned K key, owned V value);
4781 public void replace (owned K key, owned V value);
4782 [Version (since = "2.32", deprecated_since = "vala-0.26", replacement = "GenericSet.add")]
4783 public void add (owned K key);
4784 public unowned V? lookup (K key);
4785 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
4786 [Version (since = "2.32")]
4787 public bool contains (K key);
4788 public bool remove (K key);
4789 [Version (since = "2.12")]
4790 public void remove_all ();
4791 public uint foreach_remove (HRFunc<K,V> predicate);
4792 [CCode (cname = "g_hash_table_lookup")]
4793 public unowned V? @get (K key);
4794 [CCode (cname = "g_hash_table_insert")]
4795 public void @set (owned K key, owned V value);
4796 [Version (since = "2.14")]
4797 public List<unowned K> get_keys ();
4799 [Version (since = "2.40")]
4800 public (unowned K)[] get_keys_as_array ();
4802 [Version (since = "2.14")]
4803 public List<unowned V> get_values ();
4804 public void @foreach (HFunc<K,V> func);
4805 [CCode (cname = "g_hash_table_foreach")]
4806 public void for_each (HFunc<K,V> func);
4807 [Version (since = "2.4")]
4808 public unowned V? find (HRFunc<K,V> predicate);
4809 public uint size ();
4810 public bool steal (K key);
4811 [Version (since = "2.12")]
4812 public void steal_all ();
4813 [Version (since = "2.58")]
4814 public bool steal_extended (K lookup_key, out K stolen_key, out V stolen_value);
4815 [CCode (cname = "_vala_g_hash_table_take")]
4816 public V? take (K key, out bool exists = null) {
4817 GLib.HashTable<K,V>? ht = null;
4819 *htp = this.lookup (key);
4820 exists = this.steal (key);
4823 public uint length {
4824 [CCode (cname = "g_hash_table_size")]
4829 [Version (since = "2.16")]
4830 public struct HashTableIter<K,V> {
4831 public HashTableIter (GLib.HashTable<K,V> table);
4832 public bool next ([CCode (type = "gpointer*")] out unowned K key, [CCode (type = "gpointer*")] out unowned V value);
4833 public void remove ();
4834 public void steal ();
4835 public unowned GLib.HashTable<K,V> get_hash_table ();
4838 [Version (since = "2.32")]
4839 [Compact, CCode (cname = "GHashTable", lower_case_cprefix = "g_hash_table_", ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
4840 public class GenericSet<T> {
4841 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
4842 public GenericSet (HashFunc<T>? hash_func, EqualFunc<T>? equal_func, GLib.DestroyNotify? always_pass_null_here = null);
4843 public void add (owned T value);
4844 public bool contains (T valule);
4845 public bool remove (T value);
4846 public void remove_all ();
4847 public GLib.List<unowned T> get_values ();
4848 [CCode (cname = "g_hash_table_iter_init", instance_pos = -1)]
4849 public GLib.GenericSetIter<T> iterator ();
4850 [CCode (cname = "_vala_g_hash_set_foreach")]
4851 public void @foreach (GLib.Func<T> func) {
4852 ((GLib.HashTable<unowned T,T>) this).foreach ((k, v) => func (v));
4854 public uint length {
4855 [CCode (cname = "g_hash_table_size")]
4860 [Version (since = "2.32")]
4861 [CCode (cname = "GHashTableIter", lower_case_cprefix = "g_hash_table_iter_")]
4862 public struct GenericSetIter<T> {
4863 [CCode (cname = "_vala_hash_set_next_value")]
4864 public unowned T? next_value () {
4866 GLib.HashTableIter<unowned T,T>* htp = vi;
4868 return htp->next (out value, null) ? value : null;
4870 public void remove ();
4873 [CCode (has_target = false)]
4874 public delegate uint HashFunc<K> (K key);
4875 [CCode (has_target = false)]
4876 public delegate bool EqualFunc<G> (G a, G b);
4877 public delegate void HFunc<K,V> (K key, V value);
4878 public delegate bool HRFunc<K,V> (K key, V value);
4880 [CCode (has_target = false)]
4881 public delegate void DestroyNotify (void* data);
4883 [CCode (cname = "g_direct_hash")]
4884 public static GLib.HashFunc<void*> direct_hash;
4885 [CCode (cname = "g_direct_equal")]
4886 public static GLib.EqualFunc<void*> direct_equal;
4887 [CCode (cname = "g_int64_hash")]
4888 public static GLib.HashFunc<int64?> int64_hash;
4889 [Version (since = "2.22")]
4890 [CCode (cname = "g_int64_equal")]
4891 public static GLib.EqualFunc<int64?> int64_equal;
4892 [Version (since = "2.22")]
4893 [CCode (cname = "g_int_hash")]
4894 public static GLib.HashFunc<int?> int_hash;
4895 [CCode (cname = "g_int_equal")]
4896 public static GLib.EqualFunc<int?> int_equal;
4897 [CCode (cname = "g_str_hash")]
4898 public static GLib.HashFunc<string> str_hash;
4899 [CCode (cname = "g_str_equal")]
4900 public static GLib.EqualFunc<string> str_equal;
4901 [CCode (cname = "g_free")]
4902 public static GLib.DestroyNotify g_free;
4903 [CCode (cname = "g_object_unref")]
4904 public static GLib.DestroyNotify g_object_unref;
4905 [CCode (cname = "g_list_free")]
4906 public static GLib.DestroyNotify g_list_free;
4907 [CCode (cname = "((GDestroyNotify) g_variant_unref)")]
4908 public static GLib.DestroyNotify g_variant_unref;
4913 [GIR (name = "String")]
4914 [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
4915 public class StringBuilder {
4916 public StringBuilder (string init = "");
4917 [CCode (cname = "g_string_sized_new")]
4918 public StringBuilder.sized (size_t dfl_size);
4919 public unowned StringBuilder assign (string rval);
4920 public unowned StringBuilder append (string val);
4921 public unowned StringBuilder append_c (char c);
4922 public unowned StringBuilder append_unichar (unichar wc);
4923 public unowned StringBuilder append_len (string val, ssize_t len);
4924 public unowned StringBuilder prepend (string val);
4925 public unowned StringBuilder prepend_c (char c);
4926 public unowned StringBuilder prepend_unichar (unichar wc);
4927 public unowned StringBuilder prepend_len (string val, ssize_t len);
4928 public unowned StringBuilder insert (ssize_t pos, string val);
4929 public unowned StringBuilder insert_len (ssize_t pos, string val, ssize_t len);
4930 public unowned StringBuilder insert_unichar (ssize_t pos, unichar wc);
4931 [Version (since = "2.14")]
4932 public unowned StringBuilder overwrite (size_t pos, string val);
4933 [Version (since = "2.14")]
4934 public unowned StringBuilder overwrite_len (size_t pos, string val, ssize_t len);
4935 public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
4936 public unowned StringBuilder truncate (size_t len = 0);
4939 public void printf (string format, ...);
4941 public void append_printf (string format, ...);
4942 [Version (since = "2.14")]
4943 public void vprintf (string format, va_list args);
4944 [Version (since = "2.14")]
4945 public void append_vprintf (string format, va_list args);
4949 public ssize_t allocated_len;
4951 public uint8[] data {
4953 unowned uint8[] res = (uint8[]) this.str;
4954 res.length = (int) this.len;
4959 [Version (since = "2.34")]
4960 public static Bytes free_to_bytes (owned StringBuilder str);
4966 [CCode (free_function = "g_string_chunk_free")]
4967 public class StringChunk {
4968 public StringChunk (size_t size);
4969 public unowned string insert (string str);
4970 public unowned string insert_const (string str);
4971 [Version (since = "2.4")]
4972 public unowned string insert_len (string str, ssize_t len);
4973 [Version (since = "2.14")]
4974 public void clear ();
4977 /* Pointer Arrays */
4980 [Version (since = "2.22", deprecated_since = "vala-0.26", replacement="GenericArray")]
4981 [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
4982 public class PtrArray {
4984 [Version (since = "2.22")]
4985 public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func);
4986 [CCode (cname = "g_ptr_array_sized_new")]
4987 public PtrArray.sized (uint reserved_size);
4988 public void add (void* data);
4989 [Version (since = "2.4")]
4990 public void foreach (GLib.Func<void*> func);
4991 [CCode (cname = "g_ptr_array_index")]
4992 public void* index(uint index);
4993 public bool remove (void* data);
4994 public void* remove_index (uint index);
4995 public bool remove_fast (void *data);
4996 public void remove_index_fast (uint index);
4997 [Version (since = "2.4")]
4998 public void remove_range (uint index, uint length);
4999 public void sort (CompareFunc<void**> compare_func);
5000 public void sort_with_data (CompareDataFunc<void**> compare_func);
5001 [Version (since = "2.22")]
5002 public void set_free_func (GLib.DestroyNotify? element_free_function);
5003 public void set_size (int length);
5006 public void** pdata;
5010 [CCode (cname = "GPtrArray", cprefix = "g_ptr_array_", ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
5011 [GIR (name = "PtrArray")]
5012 public class GenericArray<G> {
5013 [Version (since = "2.30")]
5014 [CCode (cname = "g_ptr_array_new_full", simple_generics = true)]
5015 public GenericArray (uint reserved_size = 0);
5016 public void add (owned G data);
5017 [Version (since = "2.54")]
5018 public bool find (G needle, out uint index = null);
5019 [Version (since = "2.54")]
5020 public bool find_with_equal_func (G needle, GLib.EqualFunc<G>? equal_func, out uint index = null);
5021 public void foreach (GLib.Func<G> func);
5022 [CCode (cname = "g_ptr_array_index")]
5023 public unowned G get (uint index);
5024 [Version (since = "2.40")]
5025 public void insert (int index, owned G data);
5026 public bool remove (G data);
5027 public void remove_index (uint index);
5028 public bool remove_fast (G data);
5029 public void remove_index_fast (uint index);
5030 public void remove_range (uint index, uint length);
5031 public void set (uint index, owned G data) {
5032 this.add ((owned) data);
5033 this.remove_index_fast (index);
5035 [CCode (cname = "vala_g_ptr_array_sort")]
5036 public void sort (GLib.CompareFunc<G> compare_func) {
5037 this._sort_with_data ((a, b) => {
5038 return compare_func ((G**) (*a), (G**) (*b));
5041 [CCode (cname = "g_ptr_array_sort_with_data")]
5042 public void _sort_with_data (GLib.CompareDataFunc<G**> compare_func);
5043 [CCode (cname = "vala_g_ptr_array_sort_with_data")]
5044 public void sort_with_data (GLib.CompareDataFunc<G> compare_func) {
5045 this._sort_with_data ((a, b) => {
5046 return compare_func ((G**) (*a), (G**) (*b));
5049 [Version (since = "2.58")]
5050 public G steal_index (uint index);
5051 [Version (since = "2.58")]
5052 public G steal_index_fast (uint index);
5054 private void set_size (int length);
5057 get { return (int) this.len; }
5058 set { this.set_size (value); }
5061 [CCode (cname = "pdata", array_length_cname = "len", array_length_type = "guint")]
5068 [Version (since = "2.32")]
5069 [CCode (cprefix = "g_bytes_", ref_function = "g_bytes_ref", unref_function = "g_bytes_unref", type_id = "G_TYPE_BYTES")]
5070 public class Bytes {
5071 public Bytes ([CCode (array_length_type = "gsize")] uint8[] data);
5072 public Bytes.take ([CCode (array_length_type = "gsize")] owned uint8[] data);
5073 public Bytes.static ([CCode (array_length_type = "gsize")] uint8[] data);
5074 public Bytes.with_free_func ([CCode (array_length_type = "gsize")] owned uint8[] data, GLib.DestroyNotify? free_func, void* user_data);
5075 public Bytes.from_bytes (GLib.Bytes bytes, size_t offset, size_t length);
5077 [CCode (cname = "g_bytes_new_with_free_func", simple_generics = true)]
5078 public static Bytes new_with_owner<T> ([CCode (array_length_type = "gsize")] uint8[] data, [CCode (destroy_notify_pos = 1.9)] owned T? owner = null);
5080 [CCode (array_length_type = "gsize")]
5081 public unowned uint8[] get_data ();
5082 public size_t get_size ();
5083 public uint hash ();
5084 public int compare (GLib.Bytes bytes2);
5085 public static uint8[] unref_to_data (owned GLib.Bytes bytes);
5086 public static GLib.ByteArray unref_to_array (owned GLib.Bytes bytes);
5088 [CCode (cname = "_vala_g_bytes_get")]
5089 public uint8 get (int index) {
5090 unowned uint8[] data = this.get_data ();
5094 [CCode (cname = "_vala_g_bytes_slice")]
5095 public GLib.Bytes slice (size_t start, size_t end) {
5096 return new GLib.Bytes.from_bytes (this, start, end - start);
5100 [CCode (cname = "_vala_g_bytes_get_length")]
5102 return (int) this.get_size ();
5110 [Version (since = "2.22")]
5111 [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")]
5112 public class ByteArray {
5113 public ByteArray ();
5114 [CCode (cname = "g_byte_array_sized_new")]
5115 public ByteArray.sized (uint reserved_size);
5116 [Version (since = "2.32")]
5117 public ByteArray.take (owned uint8[] data);
5118 public void append (uint8[] data);
5119 [Version (since = "2.32")]
5120 public static GLib.Bytes free_to_bytes (owned GLib.ByteArray array);
5121 public void prepend (uint8[] data);
5122 public void remove_index (uint index);
5123 public void remove_index_fast (uint index);
5124 [Version (since = "2.4")]
5125 public void remove_range (uint index, uint length);
5126 public void sort (CompareFunc<int8> compare_func);
5127 public void sort_with_data (CompareDataFunc<int8> compare_func);
5128 public void set_size (uint length);
5131 [CCode (array_length_cname = "len", array_length_type = "guint")]
5132 public uint8[] data;
5137 public delegate bool NodeTraverseFunc (Node node);
5138 public delegate void NodeForeachFunc (Node node);
5140 [CCode (cprefix = "G_TRAVERSE_")]
5141 public enum TraverseFlags {
5151 [CCode (dup_function = "g_node_copy", free_function = "g_node_destroy")]
5152 public class Node<G> {
5153 public Node(owned G? data = null);
5154 public Node<unowned G> copy ();
5155 public Node<G> copy_deep (CopyFunc<G> copy_func);
5156 public unowned Node<G> insert (int position, owned Node<G> node);
5157 public unowned Node<G> insert_before (Node<G> sibling, owned Node<G> node);
5158 public unowned Node<G> insert_after (Node<G> sibling, owned Node<G> node);
5159 public unowned Node<G> append (owned Node<G> node);
5160 public unowned Node<G> prepend (owned Node<G> node);
5161 public unowned Node<G> insert_data (int position, owned G data);
5162 public unowned Node<G> insert_data_before (Node<G> sibling, owned G data);
5163 public unowned Node<G> append_data (owned G data);
5164 public unowned Node<G> prepend_data (owned G data);
5165 public void reverse_children ();
5166 public void traverse (TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func);
5167 public void children_foreach (TraverseFlags flags, NodeForeachFunc func);
5168 public unowned Node<G> get_root ();
5169 public unowned Node<G> find (TraverseType order, TraverseFlags flags, G data);
5170 public unowned Node<G> find_child (TraverseFlags flags, G data);
5171 public int child_index (G data);
5172 public int child_position (Node<G> child);
5173 public unowned Node<G> first_child ();
5174 public unowned Node<G> last_child ();
5175 public unowned Node<G> nth_child (uint n);
5176 public unowned Node<G> first_sibling ();
5177 public unowned Node<G> next_sibling ();
5178 public unowned Node<G> prev_sibling ();
5179 public unowned Node<G> last_sibling ();
5181 [CCode (cname = "G_NODE_IS_LEAF")]
5182 public bool is_leaf ();
5183 [CCode (cname = "G_NODE_IS_ROOT")]
5184 public bool is_root ();
5185 public bool is_ancestor (Node<G> descendant);
5187 public uint depth ();
5188 public uint n_nodes (TraverseFlags flags);
5189 public uint n_children ();
5190 public uint max_height ();
5192 [CCode (cname = "g_node_unlink")]
5193 public void _unlink ();
5194 [CCode (cname = "g_node_unlink_vala")]
5195 public Node<G> unlink ()
5199 return (Node<G>) (owned) ptr;
5206 public Node children;
5211 [CCode (type_id = "G_TYPE_UINT")]
5212 public struct Quark : uint32 {
5213 public static Quark from_string (string str);
5214 public static Quark try_string (string str);
5215 public unowned string to_string ();
5218 /* Keyed Data Lists */
5220 [CCode (cname = "GData*")]
5221 public struct Datalist<G> {
5223 public void clear ();
5224 [Version (since = "2.34")]
5225 public G id_dup_data (Quark key_id, DuplicateFunc<G> dup_func);
5226 public unowned G id_get_data (Quark key_id);
5227 public void id_set_data (Quark key_id, owned G data);
5228 public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
5229 public void id_remove_data (Quark key_id);
5230 public G id_remove_no_notify (Quark key_id);
5231 [Version (since = "2.34")]
5232 public bool id_replace_data (Quark key_id, G oldval, owned G newval, GLib.DestroyNotify? destroy, out GLib.DestroyNotify? old_destroy);
5233 public void @foreach (DataForeachFunc<G> func);
5234 public unowned G get_data (string key);
5235 public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
5236 public G remove_no_notify (string key);
5237 public void set_data (string key, owned G data);
5238 public void remove_data (string key);
5241 public delegate void DataForeachFunc<G> (Quark key_id, G data);
5242 public delegate G DuplicateFunc<G> (G data);
5247 [Version (since = "2.22")]
5248 [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")]
5249 public class Array<G> {
5250 [CCode (cname = "len")]
5252 [CCode (cname = "data", array_length_cname = "len", array_length_type = "uint")]
5255 public Array (bool zero_terminated = true, bool clear = true, ulong element_size = 0);
5256 [CCode (cname = "g_array_sized_new")]
5257 public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
5258 public void append_val (owned G value);
5259 public void append_vals (void* data, uint len);
5260 public void prepend_val (owned G value);
5261 public void prepend_vals (void* data, uint len);
5262 public void insert_val (uint index, owned G value);
5263 public void insert_vals (uint index, void* data, uint len);
5264 [CCode (cname = "g_array_remove_index")]
5265 public void _remove_index (uint index);
5266 [CCode (cname = "g_array_remove_index_fast")]
5267 public void _remove_index_fast (uint index);
5268 [CCode (cname = "g_array_remove_range")]
5269 public void _remove_range (uint index, uint length);
5270 [CCode (cname = "vala_g_array_remove_index")]
5271 public G remove_index (uint index) {
5272 assert (length > index);
5274 _remove_index (index);
5277 [CCode (cname = "vala_g_array_remove_index_fast")]
5278 public G remove_index_fast (uint index) {
5279 assert (length > index);
5281 _remove_index_fast (index);
5284 [CCode (cname = "vala_g_array_remove_range")]
5285 public G[] remove_range (uint index, uint length) {
5286 assert (this.length >= index + length);
5287 G[] ga = new G[length];
5288 for (uint i = 0; i < length; i++) {
5289 ga[i] = data[i + index];
5291 _remove_range (index, length);
5294 public void sort (CompareFunc<G> compare_func);
5295 public void sort_with_data (CompareDataFunc<G> compare_func);
5296 [CCode (generic_type_pos = 0.1)]
5297 public unowned G index (uint index);
5298 public void set_size (uint length);
5303 public delegate bool TraverseFunc<K,V> (K key, V value);
5305 [CCode (cprefix = "G_", has_type_id = false)]
5306 public enum TraverseType {
5313 public delegate int TreeSearchFunc<K> (K key);
5316 [Version (since = "2.22")]
5317 [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")]
5318 public class Tree<K,V> {
5319 [CCode (cname = "g_tree_new_full", simple_generics = true)]
5320 public Tree (CompareDataFunc<K> key_compare_func);
5321 [Version (deprecated_since = "vala-0.20", replacement = "Tree ()")]
5322 public Tree.with_data (CompareDataFunc<K> key_compare_func);
5323 public Tree.full (CompareDataFunc<K> key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
5324 public void insert (owned K key, owned V value);
5325 public void replace (owned K key, owned V value);
5326 public int nnodes ();
5327 public int height ();
5328 public unowned V lookup (K key);
5329 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
5330 public void foreach (TraverseFunc<K,V> traverse_func);
5331 public unowned V search (TreeSearchFunc<K> search_func);
5332 [CCode (cname = "g_tree_search")]
5333 public unowned V search_key (CompareFunc<K> search_func, K key);
5334 public bool remove (K key);
5335 public bool steal (K key);
5338 /* Internationalization */
5340 [Version (since = "2.4")]
5341 [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5342 public static unowned string _ ([FormatArg] string str);
5343 [Version (since = "2.4")]
5344 [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5345 public static unowned string Q_ ([FormatArg] string str);
5346 [Version (since = "2.4")]
5347 [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5348 public static unowned string N_ ([FormatArg] string str);
5349 [Version (since = "2.16")]
5350 [CCode (cname = "C_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5351 public static unowned string C_ (string context, [FormatArg] string str);
5352 [Version (since = "2.18")]
5353 [CCode (cname = "NC_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5354 public static unowned string NC_ (string context, [FormatArg] string str);
5355 [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5356 public static unowned string ngettext (string msgid, [FormatArg] string msgid_plural, ulong n);
5357 [Version (since = "2.18")]
5358 [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")]
5359 public static unowned string dgettext (string? domain, [FormatArg] string msgid);
5360 [Version (since = "2.26")]
5361 [CCode (cname = "g_dcgettext", cheader_filename = "glib/gi18n-lib.h")]
5362 public static unowned string dcgettext (string? domain, [FormatArg] string msgid, int category);
5363 [Version (since = "2.18")]
5364 [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")]
5365 public static unowned string dngettext (string? domain, string msgid, [FormatArg] string msgid_plural, ulong n);
5366 [Version (since = "2.16")]
5367 [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")]
5368 public static unowned string dpgettext (string? domain, [FormatArg] string msgctxid, size_t msgidoffset);
5369 [Version (since = "2.18")]
5370 [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")]
5371 public static unowned string dpgettext2 (string? domain, string context, [FormatArg] string msgid);
5373 [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
5374 public enum LocaleCategory {
5385 [CCode (cname = "setlocale", cheader_filename = "locale.h")]
5386 public static unowned string? setlocale (LocaleCategory category = GLib.LocaleCategory.ALL, string? locale = "");
5387 [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")]
5388 public static unowned string? bindtextdomain (string domainname, string? dirname);
5389 [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")]
5390 public static unowned string? textdomain (string? domainname);
5391 [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")]
5392 public static unowned string? bind_textdomain_codeset (string domainname, string? codeset);
5393 [Version (since = "2.6")]
5394 [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)]
5395 public static unowned string[] get_language_names ();
5396 [Version (since = "2.58")]
5397 [CCode (cname = "g_get_language_names_with_category", array_length = false, array_null_terminated = true)]
5398 public static unowned string[] get_language_names_with_category (string category_name);
5399 [Version (since = "2.4")]
5400 [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")]
5401 public static unowned string strip_context (string msgid, string msgval);
5405 public class PatternSpec {
5406 public PatternSpec (string pattern);
5407 public bool equal (PatternSpec pspec);
5408 [CCode (cname = "g_pattern_match")]
5409 public bool match (uint string_length, string str, string? str_reversed);
5410 [CCode (cname = "g_pattern_match_string")]
5411 public bool match_string (string str);
5412 [CCode (cname = "g_pattern_match_simple")]
5413 public static bool match_simple (string pattern, string str);
5416 [CCode (lower_case_cprefix = "glib_version_")]
5418 [CCode (cname = "glib_major_version")]
5419 public const uint major;
5420 [CCode (cname = "glib_minor_version")]
5421 public const uint minor;
5422 [CCode (cname = "glib_micro_version")]
5423 public const uint micro;
5424 [CCode (cname = "glib_check_version")]
5425 public static unowned string? check (uint required_major, uint required_minor = 0, uint required_micro = 0);
5427 [CCode (cname = "GLIB_MAJOR_VERSION")]
5428 public const uint MAJOR;
5429 [CCode (cname = "GLIB_MINOR_VERSION")]
5430 public const uint MINOR;
5431 [CCode (cname = "GLIB_MICRO_VERSION")]
5432 public const uint MICRO;
5433 [CCode (cname = "GLIB_CHECK_VERSION")]
5434 public static bool CHECK (uint required_major, uint required_minor = 0, uint required_micro = 0);
5436 [CCode (cname = "G_ENCODE_VERSION")]
5437 public static uint encode (uint major, uint minor);
5439 public const uint CUR_STABLE;
5440 public const uint PREV_STABLE;
5441 public const uint MIN_REQUIRED;
5442 public const uint MAX_ALLOWED;
5444 public const uint @2_26;
5445 public const uint @2_28;
5446 public const uint @2_30;
5447 public const uint @2_32;
5448 public const uint @2_34;
5449 public const uint @2_36;
5450 public const uint @2_38;
5451 public const uint @2_40;
5452 public const uint @2_42;
5453 public const uint @2_44;
5454 public const uint @2_46;
5455 public const uint @2_48;
5456 public const uint @2_50;
5457 public const uint @2_52;
5458 public const uint @2_54;
5459 public const uint @2_56;
5461 [CCode (cname = "glib_binary_age")]
5462 public const uint binary_age;
5463 [CCode (cname = "glib_interface_age")]
5464 public const uint interface_age;
5468 public enum OSType {
5469 [CCode (cname = "G_WIN32_OS_ANY")]
5471 [CCode (cname = "G_WIN32_OS_WORKSTATION")]
5473 [CCode (cname = "G_WIN32_OS_SERVER")]
5476 [Version (since = "2.44")]
5477 public bool check_windows_version (int major, int minor, int spver, GLib.Win32.OSType os_type);
5479 public string error_message (int error);
5480 public string getlocale ();
5481 [Version (since = "2.16")]
5482 public string get_package_installation_directory_of_module (void* hmodule);
5483 public uint get_windows_version ();
5484 [Version (since = "2.8")]
5485 public string locale_filename_from_utf8 (string utf8filename);
5486 [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")]
5487 public bool have_widechar_api ();
5488 [CCode (cname = "G_WIN32_IS_NT_BASED")]
5489 public bool is_nt_based ();
5490 [Version (since = "2.40")]
5491 [CCode (array_length = false, array_null_terminated = true)]
5492 public string[] get_command_line ();
5497 [Version (since = "2.24")]
5498 [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
5499 public class VariantType {
5500 [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
5501 public static VariantType BOOLEAN;
5502 [CCode (cname = "G_VARIANT_TYPE_BYTE")]
5503 public static VariantType BYTE;
5504 [CCode (cname = "G_VARIANT_TYPE_INT16")]
5505 public static VariantType INT16;
5506 [CCode (cname = "G_VARIANT_TYPE_UINT16")]
5507 public static VariantType UINT16;
5508 [CCode (cname = "G_VARIANT_TYPE_INT32")]
5509 public static VariantType INT32;
5510 [CCode (cname = "G_VARIANT_TYPE_UINT32")]
5511 public static VariantType UINT32;
5512 [CCode (cname = "G_VARIANT_TYPE_INT64")]
5513 public static VariantType INT64;
5514 [CCode (cname = "G_VARIANT_TYPE_UINT64")]
5515 public static VariantType UINT64;
5516 [CCode (cname = "G_VARIANT_TYPE_HANDLE")]
5517 public static VariantType HANDLE;
5518 [CCode (cname = "G_VARIANT_TYPE_DOUBLE")]
5519 public static VariantType DOUBLE;
5520 [CCode (cname = "G_VARIANT_TYPE_STRING")]
5521 public static VariantType STRING;
5522 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")]
5523 public static VariantType OBJECT_PATH;
5524 [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")]
5525 public static VariantType SIGNATURE;
5526 [CCode (cname = "G_VARIANT_TYPE_VARIANT")]
5527 public static VariantType VARIANT;
5528 [CCode (cname = "G_VARIANT_TYPE_UNIT")]
5529 public static VariantType UNIT;
5530 [CCode (cname = "G_VARIANT_TYPE_ANY")]
5531 public static VariantType ANY;
5532 [CCode (cname = "G_VARIANT_TYPE_BASIC")]
5533 public static VariantType BASIC;
5534 [CCode (cname = "G_VARIANT_TYPE_MAYBE")]
5535 public static VariantType MAYBE;
5536 [CCode (cname = "G_VARIANT_TYPE_ARRAY")]
5537 public static VariantType ARRAY;
5538 [CCode (cname = "G_VARIANT_TYPE_TUPLE")]
5539 public static VariantType TUPLE;
5540 [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")]
5541 public static VariantType DICT_ENTRY;
5542 [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")]
5543 public static VariantType DICTIONARY;
5544 [CCode (cname = "G_VARIANT_TYPE_STRING_ARRAY")]
5545 public static VariantType STRING_ARRAY;
5546 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH_ARRAY")]
5547 public static VariantType OBJECT_PATH_ARRAY;
5548 [CCode (cname = "G_VARIANT_TYPE_BYTESTRING")]
5549 public static VariantType BYTESTRING;
5550 [CCode (cname = "G_VARIANT_TYPE_BYTESTRING_ARRAY")]
5551 public static VariantType BYTESTRING_ARRAY;
5552 [Version (since = "2.30")]
5553 [CCode (cname = "G_VARIANT_TYPE_VARDICT")]
5554 public static VariantType VARDICT;
5556 public static bool string_is_valid (string type_string);
5557 public static bool string_scan (string type_string, char *limit, out char* endptr);
5559 public VariantType (string type_string);
5560 public size_t get_string_length ();
5561 public char* peek_string ();
5562 public string dup_string ();
5564 public bool is_definite ();
5565 public bool is_container ();
5566 public bool is_basic ();
5567 public bool is_maybe ();
5568 public bool is_array ();
5569 public bool is_tuple ();
5570 public bool is_dict_entry ();
5571 public bool is_variant ();
5573 public uint hash ();
5574 public bool equal (VariantType other);
5575 public bool is_subtype_of (VariantType supertype);
5577 public unowned VariantType element ();
5578 public unowned VariantType first ();
5579 public unowned VariantType next ();
5580 public unowned VariantType n_items ();
5581 public unowned VariantType key ();
5582 public unowned VariantType value ();
5584 public VariantType.array (VariantType element);
5585 public VariantType.maybe (VariantType element);
5586 public VariantType.tuple (VariantType[] items);
5587 public VariantType.dict_entry (VariantType key, VariantType value);
5591 [Version (since = "2.24")]
5592 [CCode (ref_function = "g_variant_ref", unref_function = "g_variant_unref", ref_sink_function = "g_variant_ref_sink", type_id = "G_TYPE_VARIANT", marshaller_type_name = "VARIANT", param_spec_function = "g_param_spec_variant", get_value_function = "g_value_get_variant", set_value_function = "g_value_set_variant", take_value_function = "g_value_take_variant", type_signature = "v")]
5593 public class Variant {
5594 [CCode (has_type_id = false)]
5596 BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64,
5597 UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH,
5598 SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY
5601 public unowned VariantType get_type ();
5602 public unowned string get_type_string ();
5603 public bool is_of_type (VariantType type);
5604 public bool is_container ();
5605 [Version (since = "2.26")]
5606 public bool is_floating ();
5607 public Class classify ();
5608 [Version (since = "2.26")]
5609 public int compare (Variant other);
5611 public Variant.boolean (bool value);
5612 public Variant.byte (uint8 value);
5613 public Variant.int16 (int16 value);
5614 public Variant.uint16 (uint16 value);
5615 public Variant.int32 (int32 value);
5616 public Variant.uint32 (uint32 value);
5617 public Variant.int64 (int64 value);
5618 public Variant.uint64 (uint64 value);
5619 public Variant.handle (int32 value);
5620 public Variant.double (double value);
5621 public Variant.string (string value);
5622 [Version (since = "2.26")]
5623 public Variant.bytestring (string value);
5624 public Variant.object_path (string object_path);
5625 public static bool is_object_path (string object_path);
5626 public Variant.signature (string signature);
5627 public static bool is_signature (string signature);
5629 public bool get_boolean ();
5630 public uint8 get_byte ();
5631 public int16 get_int16 ();
5632 public uint16 get_uint16 ();
5633 public int32 get_int32 ();
5634 public uint32 get_uint32 ();
5635 public int64 get_int64 ();
5636 public uint64 get_uint64 ();
5637 public int32 get_handle ();
5638 public double get_double ();
5639 public unowned string get_string (out size_t length = null);
5640 public string dup_string (out size_t length = null);
5641 [Version (since = "2.26")]
5642 public unowned string get_bytestring ();
5643 [Version (since = "2.26")]
5644 public string dup_bytestring (out size_t length);
5646 public Variant.strv (string[] value);
5647 [CCode (array_length_type = "size_t")]
5649 public (unowned string)[] get_strv ();
5651 public string*[] get_strv ();
5653 [CCode (array_length_type = "size_t")]
5654 public string[] dup_strv ();
5656 [Version (since = "2.26")]
5657 public Variant.bytestring_array (string[] value);
5658 [Version (since = "2.26")]
5659 [CCode (array_length_type = "size_t")]
5661 public (unowned string)[] get_bytestring_array ();
5663 public string*[] get_bytestring_array ();
5665 [Version (since = "2.26")]
5666 [CCode (array_length_type = "size_t")]
5667 public string[] dup_bytestring_array ();
5669 [Version (since = "2.30")]
5670 public Variant.objv (string[] value);
5671 [Version (since = "2.30")]
5672 [CCode (array_length_type = "size_t")]
5674 public (unowned string)[] get_objv ();
5676 public string*[] get_objv ();
5678 [Version (since = "2.30")]
5679 [CCode (array_length_type = "size_t")]
5680 public string[] dup_objv ();
5682 public Variant (string format, ...);
5683 // note: the function changes its behaviour when end_ptr is null, so 'out char *' is wrong
5684 public Variant.va (string format, char **end_ptr, va_list *app);
5685 public void get (string format, ...);
5686 public void get_va (string format, char **end_ptr, va_list *app);
5688 public Variant.variant (Variant value);
5689 public Variant.maybe (VariantType? child_type, Variant? child);
5690 public Variant.array (VariantType? child_type, Variant[] children);
5691 [Version (since = "2.32")]
5692 [CCode (simple_generics = true)]
5693 public static Variant new_fixed_array<T> (VariantType? element_type, [CCode (array_length_type = "gsize")] T[] elements, size_t element_size);
5694 public Variant.tuple (Variant[] children);
5695 public Variant.dict_entry (Variant key, Variant value);
5696 public Variant get_variant ();
5697 public Variant? get_maybe ();
5699 public size_t n_children ();
5700 public Variant get_child_value (size_t index);
5701 public void get_child (size_t index, string format_string, ...);
5703 [Version (since = "2.28")]
5704 public Variant? lookup_value (string key, VariantType? expected_type);
5705 [Version (since = "2.28")]
5706 public bool lookup (string key, string format_string, ...);
5708 public size_t get_size ();
5709 public void *get_data ();
5710 public void store (void *data);
5712 public string print (bool type_annotate);
5713 public StringBuilder print_string (StringBuilder? builder, bool type_annotate);
5715 public uint hash ();
5716 public bool equal (Variant other);
5718 public Variant byteswap ();
5719 public Variant get_normal_form ();
5720 public bool is_normal_form ();
5721 [CCode (returns_floating_reference = true, simple_generics = true)]
5722 public static Variant new_from_data<T> (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null);
5724 [CCode (cname = "g_variant_iter_new")]
5725 public VariantIter iterator ();
5727 public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError;
5728 public Variant.parsed (string format_string, ...);
5730 [Version (since = "2.34")]
5731 public bool check_format_string (string format_string, bool copy_only);
5733 [Version (since = "2.36")]
5734 public Variant.from_bytes (VariantType type, Bytes bytes, bool trusted);
5735 [Version (since = "2.36")]
5736 public Bytes get_data_as_bytes ();
5738 [Version (since = "2.38")]
5739 public Variant.printf (string format_string, ...);
5740 [Version (since = "2.38")]
5741 public Variant.take_string (owned string str);
5743 [Version (since = "2.40")]
5744 public static void parse_error_print_context (GLib.VariantParseError error, string source_str);
5747 [Version (since = "2.24")]
5748 public errordomain VariantParseError {
5750 BASIC_TYPE_EXPECTED,
5752 DEFINITE_TYPE_EXPECTED,
5755 INVALID_FORMAT_STRING,
5756 INVALID_OBJECT_PATH,
5758 INVALID_TYPE_STRING,
5760 NUMBER_OUT_OF_RANGE,
5765 UNTERMINATED_STRING_CONSTANT,
5767 public static GLib.Quark quark ();
5771 [Version (since = "2.24")]
5772 public class VariantIter {
5773 public VariantIter (Variant value);
5774 public size_t n_children ();
5775 public Variant? next_value ();
5776 public bool next (string format_string, ...);
5780 [Version (since = "2.24")]
5781 [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref")]
5782 public class VariantBuilder {
5783 public VariantBuilder (VariantType type);
5784 public void open (VariantType type);
5785 public void close ();
5786 public void add_value (Variant value);
5787 public void add (string format_string, ...);
5788 [CCode (returns_floating_reference = true)]
5789 public Variant end ();
5792 [Version (since = "2.40")]
5793 [Compact, CCode (ref_function = "g_variant_dict_ref", unref_function = "g_variant_dict_unref")]
5794 public class VariantDict {
5795 public VariantDict (GLib.Variant? from_asv = null);
5796 public bool lookup (string key, string format_string, ...);
5797 public GLib.Variant lookup_value (string key, GLib.VariantType expected_type);
5798 public bool contains (string key);
5799 public void insert (string key, string format_string, ...);
5800 public void insert_value (string key, GLib.Variant value);
5801 public bool remove (string key);
5802 public void clear ();
5803 [CCode (returns_floating_reference = true)]
5804 public GLib.Variant end ();
5807 [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string", type_signature = "o")]
5808 public class ObjectPath : string {
5809 [CCode (cname = "g_strdup")]
5810 public ObjectPath (string path);
5813 [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string")]
5814 public class BusName : string {
5815 [CCode (cname = "g_strdup")]
5816 public BusName (string bus_name);
5819 [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]
5820 public static bool likely (bool expression);
5821 [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")]
5822 public static bool unlikely (bool expression);
5823 [Version (since = "2.20")]
5824 [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")]
5825 public static void static_assert (bool expression);
5827 [CCode (simple_generics = true, cname = "g_qsort_with_data")]
5828 private static void _qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func);
5830 [CCode (cname = "_vala_g_qsort_with_data")]
5831 public static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func) {
5832 _qsort_with_data<T*> (elems, size, (a, b) => {
5833 return compare_func (*a, *b);
5837 [Version (since = "2.54")]
5838 public errordomain NumberParserError {
5841 public static GLib.Quark quark ();
5844 /* Unix-specific functions. All of these have to include glib-unix.h. */
5846 [Version (since = "2.30")]
5847 [CCode (cheader_filename = "glib-unix.h", cname = "g_unix_signal_add_full")]
5848 public static uint signal_add (int signum, owned GLib.SourceFunc handler, [CCode (pos = 0.9)] int priority = Priority.DEFAULT);
5850 [CCode (cheader_filename = "glib-unix.h", cname = "GSource")]
5851 public class SignalSource : GLib.Source {
5852 public SignalSource (int signum);
5855 [Version (since = "2.30")]
5856 [CCode (cheader_filename = "glib-unix.h")]
5857 public static bool open_pipe ([CCode (array_length = false, array_null_terminated = false)] int[] fds, int flags) throws GLib.Error;
5858 [Version (since = "2.30")]
5859 [CCode (cheader_filename = "glib-unix.h")]
5860 public static bool set_fd_nonblocking (int fd, bool nonblock) throws GLib.Error;
5863 [CCode (cname = "GUnicodeScript", cprefix = "G_UNICODE_SCRIPT_", has_type_id = false)]
5864 public enum UnicodeScript {
5906 CANADIAN_ABORIGINAL,
5949 /* Unicode-5.2 additions */
5952 EGYPTIAN_HIEROGLYPHS, /* Egyp */
5953 IMPERIAL_ARAMAIC, /* Armi */
5954 INSCRIPTIONAL_PAHLAVI, /* Phli */
5955 INSCRIPTIONAL_PARTHIAN, /* Prti */
5956 JAVANESE, /* Java */
5959 MEETEI_MAYEK, /* Mtei */
5960 OLD_SOUTH_ARABIAN, /* Sarb */
5961 OLD_TURKIC, /* Orkh */
5962 SAMARITAN, /* Samr */
5963 TAI_THAM, /* Lana */
5964 TAI_VIET, /* Tavt */
5966 /* Unicode-6.0 additions */
5971 /* Unicode-6.1 additions */
5973 MEROITIC_CURSIVE, /* Merc */
5974 MEROITIC_HIEROGLYPHS, /* Mero */
5977 SORA_SOMPENG, /* Sora */
5980 /* Unicode 7.0 additions */
5981 BASSA_VAH, /* Bass */
5982 CAUCASIAN_ALBANIAN, /* Aghb */
5983 DUPLOYAN, /* Dupl */
5987 KHUDAWADI, /* Sind */
5988 LINEAR_A, /* Lina */
5989 MAHAJANI, /* Mahj */
5990 MANICHAEAN, /* Manu */
5991 MENDE_KIKAKUI, /* Mend */
5994 NABATAEAN, /* Nbat */
5995 OLD_NORTH_ARABIAN, /* Narb */
5996 OLD_PERMIC, /* Perm */
5997 PAHAWH_HMONG, /* Hmng */
5998 PALMYRENE, /* Palm */
5999 PAU_CIN_HAU, /* Pauc */
6000 PSALTER_PAHLAVI, /* Phlp */
6003 WARANG_CITI, /* Wara */
6005 /* Unicode 8.0 additions */
6007 ANATOLIAN_HIEROGLYPHS, /* Hluw */
6010 OLD_HUNGARIAN, /* Hung */
6011 SIGNWRITING, /* Sgnw */
6013 /* Unicode 9.0 additions */
6015 BHAIKSUKI, /* Bhks */
6021 /* Unicode 10.0 additions */
6022 MASARAM_GONDI, /* Gonm */
6025 ZANABAZAR_SQUARE, /* Zanb */
6027 /* Unicode 11.0 additions */
6029 GUNJALA_GONDI, /* Gong */
6030 HANIFI_ROHINGYA, /* Rohg */
6032 MEDEFAIDRIN, /* Medf */
6033 OLD_SOGDIAN, /* Sogo */
6036 [CCode (cname = "g_unicode_script_to_iso15924")]
6037 public uint32 to_iso15924 ();
6038 [CCode (cname = "g_unicode_script_from_iso15924")]
6039 public static GLib.UnicodeScript from_iso15924 (uint32 iso15924);
6042 [CCode (cname = "GUnicodeType", cprefix = "G_UNICODE_", has_type_id = false)]
6043 public enum UnicodeType {
6060 CONNECT_PUNCTUATION,
6064 INITIAL_PUNCTUATION,
6072 PARAGRAPH_SEPARATOR,
6076 [CCode (cname = "GUnicodeBreakType", cprefix = "G_UNICODE_BREAK_", has_type_id = false)]
6077 public enum UnicodeBreakType {
6113 HANGUL_LVT_SYLLABLE,
6115 CONDITIONAL_JAPANESE_STARTER,
6123 [CCode (cname = "GNormalizeMode", cprefix = "G_NORMALIZE_", has_type_id = false)]
6124 public enum NormalizeMode {