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")]
860 [CCode (cname = "strtof", cheader_filename = "stdlib.h")]
861 static float strtof (string nptr, out char* endptr);
863 public static float parse (string str) {
864 return strtof (str, null);
867 public static bool try_parse (string str, out float result = null, out unowned string unparsed = null) {
869 result = strtof (str, out endptr);
870 if (endptr == (char*) str + str.length) {
874 unparsed = (string) endptr;
881 [GIR (name = "gdouble")]
882 [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")]
883 [FloatingType (rank = 2)]
884 public struct double {
885 [CCode (cname = "DBL_MANT_DIG")]
886 public const int MANT_DIG;
887 [CCode (cname = "DBL_DIG")]
888 public const int DIG;
890 [CCode (cname = "DBL_MIN_EXP")]
891 public const int MIN_EXP;
892 [CCode (cname = "DBL_MAX_EXP")]
893 public const int MAX_EXP;
895 [CCode (cname = "DBL_MIN_10_EXP")]
896 public const int MIN_10_EXP;
897 [CCode (cname = "DBL_MAX_10_EXP")]
898 public const int MAX_10_EXP;
900 [CCode (cname = "DBL_EPSILON")]
901 public const double EPSILON;
902 [CCode (cname = "DBL_MIN")]
903 public const double MIN;
904 [CCode (cname = "DBL_MAX")]
905 public const double MAX;
907 [CCode (cname = "((double) NAN)")]
908 public const double NAN;
909 [CCode (cname = "((double) INFINITY)")]
910 public const double INFINITY;
912 [CCode (cname = "isnan")]
913 public bool is_nan ();
914 [CCode (cname = "isfinite")]
915 public bool is_finite ();
916 [CCode (cname = "isnormal")]
917 public bool is_normal ();
918 [CCode (cname = "isinf")]
919 public int is_infinity ();
921 [CCode (cname = "MIN")]
922 public static double min (double a, double b);
923 [CCode (cname = "MAX")]
924 public static double max (double a, double b);
925 [CCode (cname = "CLAMP")]
926 public double clamp (double low, double high);
927 [CCode (cname = "fabs")]
928 public double abs ();
930 [CCode (cname = "G_ASCII_DTOSTR_BUF_SIZE")]
931 public const int DTOSTR_BUF_SIZE;
932 [CCode (cname = "g_ascii_dtostr", instance_pos = -1)]
933 public unowned string to_str (char[] buffer);
934 [CCode (cname = "g_ascii_formatd", instance_pos = -1)]
935 public unowned string format (char[] buffer, string format = "%g");
937 public string to_string () {
938 return this.to_str(new char[DTOSTR_BUF_SIZE]);
941 [CCode (cname = "g_ascii_strtod")]
942 static double ascii_strtod (string nptr, out char* endptr);
944 public static double parse (string str) {
945 return ascii_strtod (str, null);
948 public static bool try_parse (string str, out double result = null, out unowned string unparsed = null) {
950 result = ascii_strtod (str, out endptr);
951 if (endptr == (char*) str + str.length) {
955 unparsed = (string) endptr;
961 [GIR (name = "glong")]
962 [CCode (cheader_filename = "time.h", has_type_id = false, default_value = "0")]
963 [IntegerType (rank = 8)]
964 public struct time_t {
965 [CCode (cname = "time")]
966 public time_t (out time_t result = null);
970 [CCode (cheader_filename="stdarg.h", cprefix="va_", has_type_id = false, destroy_function = "va_end", lvalue_access = false)]
971 public struct va_list {
972 [CCode (cname = "va_start")]
974 [CCode (cname = "va_copy")]
975 public va_list.copy (va_list src);
976 [CCode (generic_type_pos = 1.1, simple_generics = true)]
977 public unowned G arg<G> ();
981 [GIR (name = "gunichar")]
982 [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")]
983 [IntegerType (rank = 7)]
984 public struct unichar {
985 public bool validate ();
986 public bool isalnum ();
987 public bool isalpha ();
988 public bool iscntrl ();
989 public bool isdigit ();
990 public bool isgraph ();
991 public bool islower ();
992 [Version (since = "2.14")]
993 public bool ismark ();
994 public bool isprint ();
995 public bool ispunct ();
996 public bool isspace ();
997 public bool isupper ();
998 public bool isxdigit ();
999 public bool istitle ();
1000 public bool isdefined ();
1001 public bool iswide ();
1002 [Version (since = "2.12")]
1003 public bool iswide_cjk ();
1004 [Version (since = "2.14")]
1005 public bool iszerowidth ();
1006 public unichar toupper ();
1007 public unichar tolower ();
1008 public unichar totitle ();
1009 public int digit_value ();
1010 public int xdigit_value ();
1011 public GLib.UnicodeType type ();
1012 public GLib.UnicodeBreakType break_type ();
1013 [Version (since = "2.14")]
1014 public GLib.UnicodeScript get_script();
1016 public int to_utf8 (string? outbuf);
1018 public string to_string () {
1019 string str = (string) new char[7];
1024 [Version (since = "2.30")]
1025 public bool compose (unichar b, out unichar ch);
1026 [Version (since = "2.30")]
1027 public bool decompose (out unichar a, out unichar b);
1028 [Version (since = "2.30")]
1029 public size_t fully_decompose (bool compat, unichar[] result);
1031 [CCode (cname = "MIN")]
1032 public static unichar min (unichar a, unichar b);
1033 [CCode (cname = "MAX")]
1034 public static unichar max (unichar a, unichar b);
1035 [CCode (cname = "CLAMP")]
1036 public unichar clamp (unichar low, unichar high);
1038 [CCode (cname = "G_UNICHAR_MAX_DECOMPOSITION_LENGTH")]
1039 public const int MAX_DECOMPOSITION_LENGTH;
1041 [CCode (cname = "G_GUINT32_FORMAT")]
1042 public const string FORMAT;
1043 [CCode (cname = "G_GINT32_MODIFIER")]
1044 public const string FORMAT_MODIFIER;
1048 [GIR (name = "guint16")]
1049 [CCode (cname = "gunichar2", cheader_filename = "glib.h", default_value = "0U", type_signature = "q", has_type_id = false)]
1050 [IntegerType (rank = 5)]
1051 public struct unichar2 {
1052 [CCode (cname = "G_GUINT16_FORMAT")]
1053 public const string FORMAT;
1054 [CCode (cname = "G_GINT16_MODIFIER")]
1055 public const string FORMAT_MODIFIER;
1060 [GIR (name = "utf8")]
1061 [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")]
1062 public class string {
1063 [Version (replacement = "string.index_of")]
1064 [CCode (cname = "strstr")]
1065 public unowned string? str (string needle);
1066 [Version (replacement = "string.last_index_of")]
1067 [CCode (cname = "g_strrstr")]
1068 public unowned string? rstr (string needle);
1069 [CCode (cname = "g_strrstr_len")]
1070 public unowned string? rstr_len (ssize_t haystack_len, string needle);
1072 [CCode (cname = "strstr")]
1073 static char* strstr (char* haystack, char* needle);
1074 [CCode (cname = "g_strrstr")]
1075 static char* strrstr (char* haystack, char* needle);
1076 [CCode (cname = "g_utf8_strchr")]
1077 static char* utf8_strchr (char* str, ssize_t len, unichar c);
1078 [CCode (cname = "g_utf8_strrchr")]
1079 static char* utf8_strrchr (char* str, ssize_t len, unichar c);
1081 public int index_of (string needle, int start_index = 0) {
1082 char* result = strstr ((char*) this + start_index, (char*) needle);
1084 if (result != null) {
1085 return (int) (result - (char*) this);
1091 public int last_index_of (string needle, int start_index = 0) {
1092 char* result = strrstr ((char*) this + start_index, (char*) needle);
1094 if (result != null) {
1095 return (int) (result - (char*) this);
1101 public int index_of_char (unichar c, int start_index = 0) {
1102 char* result = utf8_strchr ((char*) this + start_index, -1, c);
1104 if (result != null) {
1105 return (int) (result - (char*) this);
1111 public int last_index_of_char (unichar c, int start_index = 0) {
1112 char* result = utf8_strrchr ((char*) this + start_index, -1, c);
1114 if (result != null) {
1115 return (int) (result - (char*) this);
1121 [Version (since = "2.2")]
1122 [CCode (cname = "g_str_has_prefix")]
1123 public bool has_prefix (string prefix);
1124 [Version (since = "2.2")]
1125 [CCode (cname = "g_str_has_suffix")]
1126 public bool has_suffix (string suffix);
1127 [CCode (cname = "g_strdup_printf"), PrintfFormat]
1128 public string printf (...);
1129 [CCode (cname = "g_strdup_vprintf")]
1130 public string vprintf (va_list args);
1131 [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat]
1132 public int scanf (string format, ...);
1133 [CCode (cname = "g_strconcat")]
1134 public string concat (string string2, ...);
1135 [CCode (cname = "g_strescape")]
1136 public string escape (string? exceptions = null);
1137 [CCode (cname = "g_strcompress")]
1138 public string compress ();
1139 [CCode (cname = "g_strsplit", array_length = false, array_null_terminated = true)]
1140 public string[] split (string delimiter, int max_tokens = 0);
1141 [Version (since = "2.4")]
1142 [CCode (cname = "g_strsplit_set", array_length = false, array_null_terminated = true)]
1143 public string[] split_set (string delimiters, int max_tokens = 0);
1144 [CCode (cname = "g_stpcpy")]
1145 private static void* copy_to_buffer (void* dest, string src);
1146 [CCode (cname = "_vala_g_strjoinv")]
1147 public static string joinv (string? separator, string?[]? str_array) {
1148 if (separator == null) {
1151 if (str_array != null && (str_array.length > 0 || (str_array.length == -1 && str_array[0] != null))) {
1154 for (i = 0 ; (str_array.length != -1 && i < str_array.length) || (str_array.length == -1 && str_array[i] != null) ; i++) {
1155 len += (str_array[i] != null) ? ((!) str_array[i]).length : 0;
1160 str_array.length = i;
1161 len += ((!) separator).length * (i - 1);
1163 string* res = GLib.malloc (len);
1164 void* ptr = string.copy_to_buffer ((void*) res, (!) str_array[0]);
1165 for (i = 1 ; i < str_array.length ; i++) {
1166 ptr = string.copy_to_buffer (ptr, (!) separator);
1167 ptr = string.copy_to_buffer (ptr, (str_array[i] != null) ? ((!) str_array[i]) : "");
1175 [CCode (cname = "g_strjoin")]
1176 public static string join (string separator, ...);
1177 [CCode (cname = "g_strnfill")]
1178 public static string nfill (size_t length, char fill_char);
1180 public char get (long index) {
1181 return ((char*) this)[index];
1184 // checks whether valid string character starts at specified index
1185 // embedded NULs are not supported by the string class
1186 public bool valid_char (int index) {
1187 uint8 c = ((uint8*) this)[index];
1188 if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) {
1195 [CCode (cname = "g_utf8_next_char")]
1196 public unowned string next_char ();
1197 [CCode (cname = "g_utf8_next_char")]
1198 static char* utf8_next_char (char* str);
1199 public bool get_next_char (ref int index, out unichar c) {
1200 c = utf8_get_char ((char*) this + index);
1202 index = (int) (utf8_next_char ((char*) this + index) - (char*) this);
1208 [CCode (cname = "g_utf8_get_char")]
1209 static unichar utf8_get_char (char* str);
1210 public unichar get_char (long index = 0) {
1211 return utf8_get_char ((char*) this + index);
1213 [CCode (cname = "g_utf8_get_char_validated")]
1214 public unichar get_char_validated (ssize_t max_len = -1);
1216 [Version (replacement = "string.index_of_nth_char")]
1217 [CCode (cname = "g_utf8_offset_to_pointer")]
1218 public unowned string utf8_offset (long offset);
1219 public unowned string offset (long offset) {
1220 return (string) ((char*) this + offset);
1222 [Version (replacement = "string.char_count")]
1223 public long pointer_to_offset (string pos) {
1224 return (long) ((char*) pos - (char*) this);
1227 [CCode (cname = "g_utf8_offset_to_pointer")]
1228 char* utf8_offset_to_pointer (long offset);
1230 public int index_of_nth_char (long c) {
1231 return (int) (this.utf8_offset_to_pointer (c) - (char*) this);
1234 [CCode (cname = "g_utf8_prev_char")]
1235 public unowned string prev_char ();
1236 [CCode (cname = "g_utf8_prev_char")]
1237 static char* utf8_prev_char (char* str);
1238 public bool get_prev_char (ref int index, out unichar c) {
1240 index = (int) (utf8_prev_char ((char*) this + index) - (char*) this);
1241 c = utf8_get_char ((char*) this + index);
1249 [Version (replacement = "string.length")]
1250 [CCode (cname = "strlen")]
1252 [Version (replacement = "string.index_of_char")]
1253 [CCode (cname = "g_utf8_strchr")]
1254 public unowned string chr (ssize_t len, unichar c);
1255 [Version (replacement = "string.last_index_of_char")]
1256 [CCode (cname = "g_utf8_strrchr")]
1257 public unowned string rchr (ssize_t len, unichar c);
1258 [Version (since = "2.2")]
1259 [CCode (cname = "g_utf8_strreverse")]
1260 public string reverse (ssize_t len = -1);
1261 [CCode (cname = "g_utf8_validate")]
1262 public bool validate (ssize_t max_len = -1, out char* end = null);
1263 [Version (since = "2.52")]
1264 [CCode (cname = "g_utf8_make_valid")]
1265 public string make_valid (ssize_t len = -1);
1266 [CCode (cname = "g_utf8_normalize")]
1267 public string normalize (ssize_t len = -1, GLib.NormalizeMode mode = GLib.NormalizeMode.DEFAULT);
1269 [CCode (cname = "g_utf8_strup")]
1270 public string up (ssize_t len = -1);
1271 [CCode (cname = "g_utf8_strdown")]
1272 public string down (ssize_t len = -1);
1273 [CCode (cname = "g_utf8_casefold")]
1274 public string casefold (ssize_t len = -1);
1275 [CCode (cname = "g_utf8_collate")]
1276 public int collate (string str2);
1277 [CCode (cname = "g_utf8_collate_key")]
1278 public string collate_key (ssize_t len = -1);
1279 [Version (since = "2.8")]
1280 [CCode (cname = "g_utf8_collate_key_for_filename")]
1281 public string collate_key_for_filename (ssize_t len = -1);
1283 [CCode (cname = "g_locale_to_utf8")]
1284 public string locale_to_utf8 (ssize_t len, out size_t bytes_read, out size_t bytes_written, out GLib.Error error = null);
1286 [CCode (cname = "g_strchomp")]
1287 public unowned string _chomp();
1288 public string chomp () {
1289 string result = this.dup ();
1294 [CCode (cname = "g_strchug")]
1295 public unowned string _chug();
1296 public string chug () {
1297 string result = this.dup ();
1302 [CCode (cname = "g_strstrip")]
1303 public unowned string _strip ();
1304 public string strip () {
1305 string result = this.dup ();
1310 [CCode (cname = "g_strdelimit")]
1311 public unowned string _delimit (string delimiters, char new_delimiter);
1312 public string delimit (string delimiters, char new_delimiter) {
1313 string result = this.dup ();
1314 result._delimit (delimiters, new_delimiter);
1318 [CCode (cname = "g_str_hash")]
1319 public uint hash ();
1321 [Version (since = "2.40")]
1322 [CCode (cname = "g_str_is_ascii")]
1323 public bool is_ascii ();
1324 [Version (since = "2.40")]
1325 [CCode (instance_pos = "1.5", cname = "g_str_match_string")]
1326 public bool match_string (string search_term, bool accept_alternates);
1327 [Version (since = "2.40")]
1328 [CCode (cname = "g_str_to_ascii")]
1329 public string to_ascii (string? from_locale = null);
1330 [Version (replacement = "int.parse")]
1331 [CCode (cname = "atoi")]
1332 public int to_int ();
1333 [Version (replacement = "long.parse")]
1334 [CCode (cname = "strtol")]
1335 public long to_long (out unowned string endptr = null, int _base = 0);
1336 [Version (replacement = "double.parse")]
1337 [CCode (cname = "g_ascii_strtod")]
1338 public double to_double (out unowned string endptr = null);
1339 [Version (replacement = "ulong.parse")]
1340 [CCode (cname = "strtoul")]
1341 public ulong to_ulong (out unowned string endptr = null, int _base = 0);
1342 [Version (replacement = "int64.parse")]
1343 [CCode (cname = "g_ascii_strtoll")]
1344 public int64 to_int64 (out unowned string endptr = null, int _base = 0);
1345 [Version (replacement = "uint64.parse", since = "2.2")]
1346 [CCode (cname = "g_ascii_strtoull")]
1347 public uint64 to_uint64 (out unowned string endptr = null, int _base = 0);
1348 [CCode (cname = "g_str_tokenize_and_fold", array_length = false, array_null_terminated = true)]
1349 [Version (since = "2.40")]
1350 public string[] tokenize_and_fold (string transit_locale, [CCode (array_length = false, array_null_terminated = true)] out string[] ascii_alternates);
1352 [Version (replacement = "bool.parse")]
1353 public bool to_bool () {
1354 if (this == "true") {
1361 [Version (replacement = "string.length")]
1362 [CCode (cname = "strlen")]
1363 public size_t size ();
1365 [CCode (cname = "g_ascii_strcasecmp")]
1366 public int ascii_casecmp (string s2);
1367 [CCode (cname = "g_ascii_strncasecmp")]
1368 public int ascii_ncasecmp (string s2, size_t n);
1369 [CCode (cname = "g_ascii_strup")]
1370 public string ascii_up (ssize_t len = -1);
1371 [CCode (cname = "g_ascii_strdown")]
1372 public string ascii_down (ssize_t len = -1);
1374 [CCode (cname = "g_utf8_skip")]
1375 public static char[] skip;
1377 /* modifies string in place */
1378 [CCode (cname = "g_strcanon")]
1379 public void canon (string valid_chars, char substitutor);
1381 [CCode (cname = "g_strdup")]
1382 public string dup ();
1383 [Version (replacement = "string.substring")]
1384 [CCode (cname = "g_strndup")]
1385 public string ndup (size_t n);
1387 [CCode (cname = "memchr")]
1388 static char* memchr (char* s, int c, size_t n);
1390 // strnlen is not available on all systems
1391 static long strnlen (char* str, long maxlen) {
1392 char* end = memchr (str, 0, maxlen);
1396 return (long) (end - str);
1400 [CCode (cname = "g_strndup")]
1401 static string strndup (char* str, size_t n);
1403 public string substring (long offset, long len = -1) {
1405 if (offset >= 0 && len >= 0) {
1406 // avoid scanning whole string
1407 string_length = strnlen ((char*) this, offset + len);
1409 string_length = this.length;
1413 offset = string_length + offset;
1414 GLib.return_val_if_fail (offset >= 0, null);
1416 GLib.return_val_if_fail (offset <= string_length, null);
1419 len = string_length - offset;
1421 GLib.return_val_if_fail (offset + len <= string_length, null);
1422 return strndup ((char*) this + offset, len);
1425 public string slice (long start, long end) {
1426 long string_length = this.length;
1428 start = string_length + start;
1431 end = string_length + end;
1433 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1434 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1435 GLib.return_val_if_fail (start <= end, null);
1436 return strndup ((char*) this + start, end - start);
1439 public string splice (long start, long end, string? str = null) {
1440 long string_length = this.length;
1442 start = string_length + start;
1445 end = string_length + end;
1447 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1448 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1449 GLib.return_val_if_fail (start <= end, null);
1455 str_size = ((!)(str)).length;
1458 string* result = GLib.malloc0 (this.length - (end - start) + str_size + 1);
1460 char* dest = (char*) result;
1462 GLib.Memory.copy (dest, this, start);
1465 GLib.Memory.copy (dest, str, str_size);
1468 GLib.Memory.copy (dest, (char*) this + end, string_length - end);
1470 return (owned) result;
1473 public bool contains (string needle) {
1474 return strstr ((char*) this, (char*) needle) != null;
1477 public string replace (string old, string replacement) {
1478 if (*((char*) this) == '\0' || *((char*) old) == '\0' || old == replacement)
1482 var regex = new GLib.Regex (GLib.Regex.escape_string (old));
1483 return regex.replace_literal (this, -1, 0, replacement);
1484 } catch (GLib.RegexError e) {
1485 GLib.assert_not_reached ();
1489 [CCode (cname = "g_utf8_strlen")]
1490 public int char_count (ssize_t max = -1);
1493 [CCode (cname = "strlen")]
1497 public uint8[] data {
1499 unowned uint8[] res = (uint8[]) this;
1500 res.length = (int) this.length;
1505 public char[] to_utf8 () {
1506 char[] result = new char[this.length + 1];
1508 GLib.Memory.copy (result, this, this.length);
1512 public unowned string to_string () {
1516 [CCode (cname = "g_utf8_to_utf16")]
1517 public string16 to_utf16 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1518 [CCode (cname = "g_utf8_to_ucs4")]
1519 public string32 to_utf32 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1520 [CCode (cname = "g_utf8_to_ucs4_fast")]
1521 public string32 to_utf32_fast (long len = -1, out long items_written = null);
1527 [GIR (name = "gunichar")]
1528 [CCode (cname = "gunichar", const_cname = "const gunichar", free_function = "g_free", cheader_filename = "glib.h")]
1529 public class string32 {
1530 [CCode (cname = "g_ucs4_to_utf16")]
1531 public string16 to_utf16 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1532 [CCode (cname = "g_ucs4_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) {
1546 [GIR (name = "guint16")]
1547 [CCode (cname = "gunichar2", const_cname = "const gunichar2", free_function = "g_free", cheader_filename = "glib.h")]
1548 public class string16 {
1549 [CCode (cname = "g_utf16_to_ucs4")]
1550 public string32 to_utf32 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1551 [CCode (cname = "g_utf16_to_utf8")]
1552 public string to_utf8 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError;
1554 public string? to_string () {
1556 return this.to_utf8 ();
1557 } catch (GLib.ConvertError e) {
1563 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
1565 [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
1567 [CCode (cname = "G_E")]
1568 public const double E;
1570 [CCode (cname = "G_PI")]
1571 public const double PI;
1573 [CCode (cname = "G_LN2")]
1574 public const double LN2;
1576 [CCode (cname = "G_LN10")]
1577 public const double LN10;
1579 [CCode (cname = "G_PI_2")]
1580 public const double PI_2;
1582 [CCode (cname = "G_PI_4")]
1583 public const double PI_4;
1585 [CCode (cname = "G_SQRT2")]
1586 public const double SQRT2;
1588 [CCode (cname = "G_LOG_2_BASE_10")]
1589 public const double LOG_2_BASE_10;
1591 /* generated from <bits/mathcalls.h> of glibc */
1592 public static double acos (double x);
1593 public static float acosf (float x);
1594 public static double asin (double x);
1595 public static float asinf (float x);
1596 public static double atan (double x);
1597 public static float atanf (float x);
1598 public static double atan2 (double y, double x);
1599 public static float atan2f (float y, float x);
1600 public static double cos (double x);
1601 public static float cosf (float x);
1602 public static double sin (double x);
1603 public static float sinf (float x);
1604 public static double tan (double x);
1605 public static float tanf (float x);
1606 public static double cosh (double x);
1607 public static float coshf (float x);
1608 public static double sinh (double x);
1609 public static float sinhf (float x);
1610 public static double tanh (double x);
1611 public static float tanhf (float x);
1612 public static void sincos (double x, out double sinx, out double cosx);
1613 public static void sincosf (float x, out float sinx, out float cosx);
1614 public static double acosh (double x);
1615 public static float acoshf (float x);
1616 public static double asinh (double x);
1617 public static float asinhf (float x);
1618 public static double atanh (double x);
1619 public static float atanhf (float x);
1620 public static double exp (double x);
1621 public static float expf (float x);
1622 public static double frexp (double x, out int exponent);
1623 public static float frexpf (float x, out int exponent);
1624 public static double ldexp (double x, int exponent);
1625 public static float ldexpf (float x, int exponent);
1626 public static double log (double x);
1627 public static float logf (float x);
1628 public static double log10 (double x);
1629 public static float log10f (float x);
1630 public static double modf (double x, out double iptr);
1631 public static float modff (float x, out float iptr);
1632 [CCode (feature_test_macro = "_GNU_SOURCE")]
1633 public static double exp10 (double x);
1634 [CCode (feature_test_macro = "_GNU_SOURCE")]
1635 public static float exp10f (float x);
1636 [CCode (feature_test_macro = "_GNU_SOURCE")]
1637 public static double pow10 (double x);
1638 [CCode (feature_test_macro = "_GNU_SOURCE")]
1639 public static float pow10f (float x);
1640 public static double expm1 (double x);
1641 public static float expm1f (float x);
1642 public static double log1p (double x);
1643 public static float log1pf (float x);
1644 public static double logb (double x);
1645 public static float logbf (float x);
1646 public static double exp2 (double x);
1647 public static float exp2f (float x);
1648 public static double log2 (double x);
1649 public static float log2f (float x);
1650 public static double pow (double x, double y);
1651 public static float powf (float x, float y);
1652 public static double sqrt (double x);
1653 public static float sqrtf (float x);
1654 public static double hypot (double x, double y);
1655 public static float hypotf (float x, float y);
1656 public static double cbrt (double x);
1657 public static float cbrtf (float x);
1658 public static double ceil (double x);
1659 public static float ceilf (float x);
1660 public static double fabs (double x);
1661 public static float fabsf (float x);
1662 public static double floor (double x);
1663 public static float floorf (float x);
1664 public static double fmod (double x, double y);
1665 public static float fmodf (float x, float y);
1666 public static int isinf (double value);
1667 public static int isinff (float value);
1668 public static int finite (double value);
1669 public static int finitef (float value);
1670 public static double drem (double x, double y);
1671 public static float dremf (float x, float y);
1672 public static double significand (double x);
1673 public static float significandf (float x);
1674 public static double copysign (double x, double y);
1675 public static float copysignf (float x, float y);
1676 public static double nan (string tagb);
1677 public static float nanf (string tagb);
1678 public static int isnan (double value);
1679 public static int isnanf (float value);
1680 public static double j0 (double x0);
1681 public static float j0f (float x0);
1682 public static double j1 (double x0);
1683 public static float j1f (float x0);
1684 public static double jn (int x0, double x1);
1685 public static float jnf (int x0, float x1);
1686 public static double y0 (double x0);
1687 public static float y0f (float x0);
1688 public static double y1 (double x0);
1689 public static float y1f (float x0);
1690 public static double yn (int x0, double x1);
1691 public static float ynf (int x0, float x1);
1692 public static double erf (double x0);
1693 public static float erff (float x0);
1694 public static double erfc (double x0);
1695 public static float erfcf (float x0);
1696 public static double lgamma (double x0);
1697 public static float lgammaf (float x0);
1698 public static double tgamma (double x0);
1699 public static float tgammaf (float x0);
1700 public static double gamma (double x0);
1701 public static float gammaf (float x0);
1702 public static double lgamma_r (double x0, out int signgamp);
1703 public static float lgamma_rf (float x0, out int signgamp);
1704 public static double rint (double x);
1705 public static float rintf (float x);
1706 public static double nextafter (double x, double y);
1707 public static float nextafterf (float x, float y);
1708 public static double nexttoward (double x, double y);
1709 public static float nexttowardf (float x, double y);
1710 public static double remainder (double x, double y);
1711 public static float remainderf (float x, float y);
1712 public static double scalbn (double x, int n);
1713 public static float scalbnf (float x, int n);
1714 public static int ilogb (double x);
1715 public static int ilogbf (float x);
1716 public static double scalbln (double x, long n);
1717 public static float scalblnf (float x, long n);
1718 public static double nearbyint (double x);
1719 public static float nearbyintf (float x);
1720 public static double round (double x);
1721 public static float roundf (float x);
1722 public static double trunc (double x);
1723 public static float truncf (float x);
1724 public static double remquo (double x, double y, out int quo);
1725 public static float remquof (float x, float y, out int quo);
1726 public static long lrint (double x);
1727 public static long lrintf (float x);
1728 public static int64 llrint (double x);
1729 public static int64 llrintf (float x);
1730 public static long lround (double x);
1731 public static long lroundf (float x);
1732 public static int64 llround (double x);
1733 public static int64 llroundf (float x);
1734 public static double fdim (double x, double y);
1735 public static float fdimf (float x, float y);
1736 public static double fmax (double x, double y);
1737 public static float fmaxf (float x, float y);
1738 public static double fmin (double x, double y);
1739 public static float fminf (float x, float y);
1740 public static double fma (double x, double y, double z);
1741 public static float fmaf (float x, float y, float z);
1742 public static double scalb (double x, double n);
1743 public static float scalbf (float x, float n);
1747 [CCode (cprefix = "G_", cname = "int", has_type_id = false)]
1748 public enum ByteOrder {
1749 [CCode (cname = "G_BYTE_ORDER")]
1756 public const ByteOrder BYTE_ORDER;
1758 /* Atomic Operations */
1760 [Version (since = "2.4")]
1761 namespace AtomicInt {
1762 public static int get ([CCode (type = "volatile gint *")] ref int atomic);
1763 public static void set ([CCode (type = "volatile gint *")] ref int atomic, int newval);
1764 [Version (since = "2.30")]
1765 public static int add ([CCode (type = "volatile gint *")] ref int atomic, int val);
1766 [Version (deprecated_since = "2.30", replacement = "add")]
1767 public static int exchange_and_add ([CCode (type = "volatile gint *")] ref int atomic, int val);
1768 public static bool compare_and_exchange ([CCode (type = "volatile gint *")] ref int atomic, int oldval, int newval);
1769 public static void inc ([CCode (type = "volatile gint *")] ref int atomic);
1770 public static bool dec_and_test ([CCode (type = "volatile gint *")] ref int atomic);
1773 [Version (since = "2.4")]
1774 namespace AtomicPointer {
1775 public static void* get ([CCode (type = "volatile gpointer *")] void** atomic);
1776 public static void set ([CCode (type = "volatile gpointer *")] void** atomic, void* newval);
1777 public static bool compare_and_exchange ([CCode (type = "volatile gpointer *")] void** atomic, void* oldval, void* newval);
1780 /* The Main Event Loop */
1783 [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
1784 public class MainLoop {
1785 public MainLoop (MainContext? context = null, bool is_running = false);
1787 public void quit ();
1788 public bool is_running ();
1789 public unowned MainContext get_context ();
1792 namespace Priority {
1793 public const int HIGH;
1794 public const int DEFAULT;
1795 public const int HIGH_IDLE;
1796 public const int DEFAULT_IDLE;
1797 public const int LOW;
1801 [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
1802 public class MainContext {
1803 public MainContext ();
1804 public static unowned MainContext @default ();
1805 public bool iteration (bool may_block);
1806 public bool pending ();
1807 public unowned Source find_source_by_id (uint source_id);
1808 public unowned Source find_source_by_user_data (void* user_data);
1809 public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data);
1810 public void wakeup ();
1811 public bool acquire ();
1812 public void release ();
1813 [Version (since = "2.10")]
1814 public bool is_owner ();
1815 public bool wait (Cond cond, Mutex mutex);
1816 public bool prepare (out int priority);
1817 public int query (int max_priority, out int timeout_, PollFD[] fds);
1818 public bool check (int max_priority, PollFD[] fds);
1819 public void dispatch ();
1820 public void set_poll_func (PollFunc func);
1821 public PollFunc get_poll_func ();
1822 public void add_poll (ref PollFD fd, int priority);
1823 public void remove_poll (ref PollFD fd);
1824 public int depth ();
1825 [Version (since = "2.12")]
1826 [CCode (cname = "g_main_current_source")]
1827 public static unowned Source current_source ();
1828 [Version (since = "2.22")]
1829 public static unowned MainContext? get_thread_default ();
1830 [Version (since = "2.32")]
1831 public static MainContext ref_thread_default ();
1832 [Version (since = "2.22")]
1833 public void push_thread_default ();
1834 [Version (since = "2.22")]
1835 public void pop_thread_default ();
1836 [Version (since = "2.28")]
1837 [CCode (cname = "g_main_context_invoke_full")]
1838 public void invoke (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1839 [Version (since = "2.28")]
1840 public void invoke_full (int priority, owned SourceFunc function);
1843 [CCode (has_target = false)]
1844 public delegate int PollFunc (PollFD[] ufds, int timeout_);
1846 [CCode (cname = "GSource")]
1847 public class TimeoutSource : Source {
1848 public TimeoutSource (uint interval);
1849 [Version (since = "2.14")]
1850 public TimeoutSource.seconds (uint interval);
1854 [CCode (cname = "g_timeout_add_full")]
1855 public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1856 public static uint add_full (int priority, uint interval, owned SourceFunc function);
1857 [Version (since = "2.14")]
1858 [CCode (cname = "g_timeout_add_seconds_full")]
1859 public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1860 [Version (since = "2.14")]
1861 public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function);
1864 [CCode (cname = "GSource")]
1865 public class IdleSource : Source {
1866 public IdleSource ();
1870 [CCode (cname = "g_idle_add_full")]
1871 public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1872 public static uint add_full (int priority, owned SourceFunc function);
1873 public static bool remove_by_data (void* data);
1876 [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")]
1877 [IntegerType (rank = 6)]
1878 public struct Pid : int {
1879 [CCode (cname = "G_PID_FORMAT")]
1880 [Version (since = "2.50")]
1881 public const string FORMAT;
1884 public delegate void ChildWatchFunc (Pid pid, int status);
1886 [CCode (cname = "GSource")]
1887 public class ChildWatchSource : Source {
1888 public ChildWatchSource (Pid pid);
1891 namespace ChildWatch {
1892 [Version (since = "2.4")]
1893 [CCode (cname = "g_child_watch_add_full")]
1894 public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1895 [Version (since = "2.4")]
1896 public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function);
1899 public struct PollFD {
1901 public IOCondition events;
1902 public IOCondition revents;
1906 [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
1907 public abstract class Source {
1908 protected Source ();
1909 [Version (since = "2.12")]
1910 public void set_funcs (SourceFuncs funcs);
1911 public uint attach (MainContext? context = null);
1912 public void destroy ();
1913 [Version (since = "2.12")]
1914 public bool is_destroyed ();
1915 public void set_priority (int priority);
1916 public int get_priority ();
1917 public void set_can_recurse (bool can_recurse);
1918 public bool get_can_recurse ();
1919 public uint get_id ();
1920 [Version (since = "2.26")]
1921 public unowned string? get_name ();
1922 [Version (since = "2.26")]
1923 public void set_name (string? name);
1924 [Version (since = "2.26")]
1925 public static void set_name_by_id (uint tag, string? name);
1926 public unowned MainContext get_context ();
1927 public void set_callback (owned SourceFunc func);
1928 public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs);
1929 [Version (since = "2.36")]
1930 public void* add_unix_fd (int fd, IOCondition events);
1931 [Version (since = "2.36")]
1932 public void remove_unix_fd (void* tag);
1933 [Version (since = "2.36")]
1934 public void modify_unix_fd (void* tag, IOCondition new_events);
1935 [Version (since = "2.36")]
1936 public IOCondition query_unix_fd (void* tag);
1937 public void add_poll (ref PollFD fd);
1938 public void remove_poll (ref PollFD fd);
1939 [Version (since = "2.28")]
1940 public void add_child_source (Source child_source);
1941 [Version (since = "2.28")]
1942 public void remove_child_source (Source child_source);
1943 [Version (since = "2.28")]
1944 public int64 get_time ();
1945 [Version (deprecated_since = "2.28", replacement = "get_time")]
1946 public void get_current_time (out TimeVal timeval);
1947 [Version (since = "2.36")]
1948 public void set_ready_time (int64 ready_time);
1949 public int64 get_ready_time ();
1950 public static bool remove (uint id);
1951 public static bool remove_by_funcs_user_data (void* user_data);
1952 public static bool remove_by_user_data (void* user_data);
1953 [Version (since = "2.32")]
1954 [CCode (cname = "G_SOURCE_CONTINUE")]
1955 public const bool CONTINUE;
1956 [Version (since = "2.32")]
1957 [CCode (cname = "G_SOURCE_REMOVE")]
1958 public const bool REMOVE;
1960 protected abstract bool prepare (out int timeout_);
1961 protected abstract bool check ();
1962 protected abstract bool dispatch (SourceFunc? _callback);
1965 [CCode (has_target = false)]
1966 public delegate void SourceDummyMarshal ();
1968 [CCode (has_target = false)]
1969 public delegate bool SourcePrepareFunc (Source source, out int timeout_);
1970 [CCode (has_target = false)]
1971 public delegate bool SourceCheckFunc (Source source);
1972 [CCode (has_target = false)]
1973 public delegate bool SourceDispatchFunc (Source source, SourceFunc? _callback);
1974 [CCode (has_target = false)]
1975 public delegate void SourceFinalizeFunc (Source source);
1977 public struct SourceFuncs {
1978 public SourcePrepareFunc prepare;
1979 public SourceCheckFunc check;
1980 public SourceDispatchFunc dispatch;
1981 public SourceFinalizeFunc finalize;
1984 [CCode (has_target = false)]
1985 public delegate void SourceCallbackRefFunc (void* cb_data);
1986 [CCode (has_target = false)]
1987 public delegate void SourceCallbackUnrefFunc (void* cb_data);
1988 [CCode (has_target = false)]
1989 public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
1992 public class SourceCallbackFuncs {
1993 public SourceCallbackRefFunc @ref;
1994 public SourceCallbackUnrefFunc unref;
1995 public SourceCallbackGetFunc @get;
1998 public delegate bool SourceFunc ();
2000 public errordomain ThreadError {
2002 public static GLib.Quark quark ();
2005 /* Thread support */
2007 [CCode (scope = "async")]
2008 public delegate G ThreadFunc<G> ();
2009 public delegate void Func<G> (G data);
2011 [Version (since = "2.36")]
2012 public uint get_num_processors ();
2014 [CCode (has_type_id = false)]
2015 public enum ThreadPriority {
2023 [Version (since = "2.32")]
2024 [CCode (ref_function = "g_thread_ref", unref_function = "g_thread_unref")]
2025 public class Thread<T> {
2026 [Version (since = "2.32")]
2027 public Thread (string? name, owned ThreadFunc<T> func);
2028 [Version (since = "2.32")]
2029 [CCode (cname = "g_thread_try_new")]
2030 public Thread.try (string? name, owned ThreadFunc<T> func) throws GLib.Error;
2031 public static bool supported ();
2032 [Version (deprecated_since = "2.32", replacement = "new Thread<T> ()")]
2033 [CCode (simple_generics = true)]
2034 public static unowned Thread<T> create<T> (owned ThreadFunc<T> func, bool joinable) throws ThreadError;
2035 [Version (deprecated_since = "2.32", replacement = "new Thread<T> ()")]
2036 [CCode (simple_generics = true)]
2037 public static unowned Thread<T> create_full<T> (owned ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
2038 [CCode (simple_generics = true)]
2039 public static unowned Thread<T> self<T> ();
2042 [Version (deprecated_since = "2.32")]
2043 public void set_priority (ThreadPriority priority);
2044 public static void yield ();
2045 public static void exit (T retval);
2046 [Version (deprecated_since = "2.32", since = "2.10")]
2047 public static void @foreach (Func<Thread> thread_func);
2049 [CCode (cname = "g_usleep")]
2050 public static void usleep (ulong microseconds);
2053 [Version (since = "2.32")]
2054 [CCode (destroy_function = "g_mutex_clear", lvalue_access = false)]
2055 public struct Mutex {
2057 public void @lock ();
2058 public bool trylock ();
2059 public void unlock ();
2062 [Version (since = "2.44")]
2063 [CCode (destroy_function = "g_mutex_locker_free")]
2064 public struct MutexLocker {
2065 public MutexLocker (Mutex mutex);
2066 public void free ();
2069 [Version (since = "2.32")]
2070 [CCode (destroy_function = "g_rec_mutex_clear")]
2071 public struct RecMutex {
2073 public void lock ();
2074 public bool trylock ();
2075 public void unlock ();
2078 [Version (since = "2.32")]
2079 [CCode (destroy_function = "g_rw_lock_clear")]
2080 public struct RWLock {
2082 public void writer_lock ();
2083 public bool writer_trylock ();
2084 public void writer_unlock ();
2085 public void reader_lock ();
2086 public bool reader_trylock ();
2087 public void reader_unlock ();
2090 [Version (deprecated_since = "2.32", replacement = "Mutex")]
2091 [CCode (destroy_function = "g_static_mutex_free", default_value = "G_STATIC_MUTEX_INIT")]
2092 public struct StaticMutex {
2093 public StaticMutex ();
2094 public void lock ();
2095 public bool trylock ();
2096 public void unlock ();
2097 public void lock_full ();
2100 [Version (deprecated_since = "2.32", replacement = "RecMutex")]
2101 [CCode (destroy_function = "g_static_rec_mutex_free", default_value = "G_STATIC_REC_MUTEX_INIT")]
2102 public struct StaticRecMutex {
2103 public StaticRecMutex ();
2104 public void lock ();
2105 public bool trylock ();
2106 public void unlock ();
2107 public void lock_full ();
2110 [Version (deprecated_since = "2.32", replacement = "RWLock")]
2111 [CCode (destroy_function = "g_static_rw_lock_free", default_value = "G_STATIC_RW_LOCK_INIT")]
2112 public struct StaticRWLock {
2113 public StaticRWLock ();
2114 public void reader_lock ();
2115 public bool reader_trylock ();
2116 public void reader_unlock ();
2117 public void writer_lock ();
2118 public bool writer_trylock ();
2119 public void writer_unlock ();
2123 [CCode (ref_function = "", unref_function = "")]
2124 public class Private {
2125 public Private (DestroyNotify? destroy_func = null);
2126 public void* get ();
2127 public void set (void* data);
2128 public void replace (void* data);
2131 [CCode (destroy_function = "g_static_private_free", default_value = "G_STATIC_PRIVATE_INIT")]
2132 [Version (deprecated_since = "2.32")]
2133 public struct StaticPrivate {
2134 public StaticPrivate ();
2135 public void* get ();
2136 public void set (void* data, DestroyNotify? destroy_func);
2139 [Version (since = "2.32")]
2140 [CCode (destroy_function = "g_cond_clear", lvalue_access = false)]
2141 public struct Cond {
2143 public void @signal ();
2144 public void broadcast ();
2145 public void wait (Mutex mutex);
2146 [Version (deprecated_since = "2.32", replacement = "wait_until")]
2147 public bool timed_wait (Mutex mutex, TimeVal abs_time);
2148 [Version (since = "2.32")]
2149 public bool wait_until (Mutex mutex, int64 end_time);
2152 [CCode (cname = "GThreadFunc")]
2153 public delegate G OnceFunc<G> ();
2155 [Version (since = "2.4")]
2156 [CCode (default_value = "G_ONCE_INIT")]
2157 public struct Once<G> {
2158 [CCode (cname = "g_once")]
2159 public unowned G once (OnceFunc<G> function);
2160 [Version (since = "2.14")]
2161 public static bool init_enter ([CCode (ctype="volatile gsize *")] size_t *value);
2162 [Version (since = "2.14")]
2163 public static void init_leave ([CCode (ctype="volatile gsize *")] size_t *value, size_t set_value);
2164 public OnceStatus status;
2167 [CCode (cprefix = "G_ONCE_STATUS_", has_type_id = false)]
2168 public enum OnceStatus {
2176 [CCode (cname = "GFunc")]
2177 public delegate void ThreadPoolFunc<G> (owned G data);
2180 [CCode (free_function = "g_thread_pool_free")]
2181 public class ThreadPool<T> {
2182 [Version (deprecated_since = "vala-0.18", replacement = "ThreadPool.with_owned_data")]
2183 public ThreadPool (Func<T> func, int max_threads, bool exclusive) throws ThreadError;
2184 [CCode (cname = "g_thread_pool_new")]
2185 public ThreadPool.with_owned_data (ThreadPoolFunc<T> func, int max_threads, bool exclusive) throws ThreadError;
2186 [Version (deprecated_since = "vala-0.18", replacement = "add")]
2187 public void push (T data) throws ThreadError;
2188 [CCode (cname = "g_thread_pool_push")]
2189 public void add (owned T data) throws ThreadError;
2190 public void set_max_threads (int max_threads) throws ThreadError;
2191 public int get_max_threads ();
2192 public uint get_num_threads ();
2193 [Version (since = "2.46")]
2194 public bool move_to_front (T data);
2195 public uint unprocessed ();
2196 [CCode (cname = "g_thread_pool_free")]
2197 void _free (bool immediate, bool wait);
2198 [CCode (cname = "vala__g_thread_pool_free_wrapper")]
2199 public static void free (owned ThreadPool? pool, bool immediate, bool wait) {
2200 ThreadPool* ptr = (owned) pool;
2202 ((ThreadPool)ptr)._free (immediate, wait);
2205 public static void set_max_unused_threads (int max_threads);
2206 public static int get_max_unused_threads ();
2207 public static uint get_num_unused_threads ();
2208 public static void stop_unused_threads ();
2209 [Version (since = "2.10")]
2210 public void set_sort_function (CompareDataFunc<T> func);
2211 [Version (since = "2.10")]
2212 public static void set_max_idle_time (uint interval);
2213 [Version (since = "2.10")]
2214 public static uint get_max_idle_time ();
2217 /* Asynchronous Queues */
2220 [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
2221 public class AsyncQueue<G> {
2222 [Version (since = "2.16")]
2223 [CCode (cname = "g_async_queue_new_full", simple_generics = true)]
2224 public AsyncQueue ();
2225 public void push (owned G data);
2226 [Version (since = "2.10")]
2227 public void push_sorted (owned G data, CompareDataFunc<G> func);
2229 public G? try_pop ();
2230 public G? timed_pop (ref TimeVal end_time);
2231 public int length ();
2232 [Version (since = "2.10")]
2233 public void sort (CompareDataFunc<G> func);
2234 public void @lock ();
2235 public void unlock ();
2236 public void ref_unlocked ();
2237 public void unref_and_unlock ();
2238 [Version (since = "2.46")]
2239 public void push_front (owned G data);
2240 [Version (since = "2.46")]
2241 public void push_front_unlocked (owned G data);
2242 public void push_unlocked (owned G data);
2243 [Version (since = "2.10")]
2244 public void push_sorted_unlocked (owned G data, CompareDataFunc<G> func);
2245 public G pop_unlocked ();
2246 [Version (since = "2.46")]
2247 public bool remove (G data);
2248 [Version (since = "2.46")]
2249 public bool remove_unlocked (G data);
2250 public G? try_pop_unlocked ();
2251 public G? timed_pop_unlocked (ref TimeVal end_time);
2252 public G? timeout_pop (uint64 timeout);
2253 public G? timeout_pop_unlocked (uint64 timeout);
2254 public int length_unlocked ();
2255 public void sort_unlocked (CompareDataFunc<G> func);
2258 /* Memory Allocation */
2260 public static void* malloc (size_t n_bytes);
2261 public static void* malloc0 (size_t n_bytes);
2262 public static void* realloc (void* mem, size_t n_bytes);
2264 public static void* try_malloc (size_t n_bytes);
2265 [Version (since = "2.8")]
2266 public static void* try_malloc0 (size_t n_bytes);
2267 public static void* try_realloc (void* mem, size_t n_bytes);
2269 public static void free (void* mem);
2271 public class MemVTable {
2274 [CCode (cname = "glib_mem_profiler_table")]
2275 public static MemVTable mem_profiler_table;
2277 public static void mem_set_vtable (MemVTable vtable);
2278 public static void mem_profile ();
2280 [CCode (cheader_filename = "string.h")]
2282 [CCode (cname = "memcmp")]
2283 public static int cmp (void* s1, void* s2, size_t n);
2284 [CCode (cname = "memcpy")]
2285 public static void* copy (void* dest, void* src, size_t n);
2286 [CCode (cname = "memset")]
2287 public static void* set (void* dest, int src, size_t n);
2288 [CCode (cname = "g_memmove")]
2289 public static void* move (void* dest, void* src, size_t n);
2290 [CCode (cname = "g_memdup")]
2291 public static void* dup (void* mem, uint n);
2294 [Version (since = "2.10")]
2296 public static void* alloc (size_t block_size);
2297 public static void* alloc0 (size_t block_size);
2298 [Version (since = "2.14")]
2299 public static void* copy (size_t block_size, void* mem_block);
2300 [CCode (cname = "g_slice_free1")]
2301 public static void free (size_t block_size, void* mem_block);
2302 public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset);
2303 public static int64 get_config (SliceConfig ckey);
2304 [CCode (array_length_cname = "n_values", array_length_type = "guint")]
2305 public static int64[] get_config_state (SliceConfig ckey, int64 address);
2306 public static void set_config (SliceConfig ckey, int64 value);
2309 [CCode (cprefix = "G_SLICE_CONFIG_", has_type_id = false)]
2310 public enum SliceConfig {
2322 [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
2323 public class IOChannel {
2324 [CCode (cname = "g_io_channel_unix_new")]
2325 public IOChannel.unix_new (int fd);
2326 public int unix_get_fd ();
2327 [CCode (cname = "g_io_channel_win32_new_fd")]
2328 public IOChannel.win32_new_fd (int fd);
2329 [CCode (cname = "g_io_channel_win32_new_socket")]
2330 public IOChannel.win32_socket (int socket);
2331 [CCode (cname = "g_io_channel_win32_new_messages")]
2332 public IOChannel.win32_messages (size_t hwnd);
2333 public void init ();
2334 public IOChannel.file (string filename, string mode) throws FileError;
2335 public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError;
2336 public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
2337 public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError;
2338 public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError;
2339 public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError;
2340 public IOStatus write_chars (char[] buf, out size_t bytes_written) throws ConvertError, IOChannelError;
2341 public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
2342 public IOStatus flush () throws IOChannelError;
2343 public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
2344 public IOStatus shutdown (bool flush) throws IOChannelError;
2345 [CCode (cname = "g_io_create_watch")]
2346 public IOSource create_watch (IOCondition condition);
2347 [CCode (cname = "g_io_add_watch")]
2348 public uint add_watch (IOCondition condition, IOFunc func);
2349 [CCode (cname = "g_io_add_watch_full")]
2350 public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func);
2351 public size_t get_buffer_size ();
2352 public void set_buffer_size (size_t size);
2353 public IOCondition get_buffer_condition ();
2354 public IOFlags get_flags ();
2355 public IOStatus set_flags (IOFlags flags) throws IOChannelError;
2356 public unowned string get_line_term (out int length);
2357 public void set_line_term (string line_term, int length);
2358 public bool get_buffered ();
2359 public void set_buffered (bool buffered);
2360 public unowned string get_encoding ();
2361 public IOStatus set_encoding (string? encoding) throws IOChannelError;
2362 public bool get_close_on_unref ();
2363 public void set_close_on_unref (bool do_close);
2367 [CCode (cname = "GSource")]
2368 public class IOSource : Source {
2369 [CCode (cname = "g_io_create_watch")]
2370 public IOSource (IOChannel channel, IOCondition condition);
2371 [CCode (cname = "g_source_set_callback")]
2372 public void set_callback ([CCode (type = "GSourceFunc")] owned IOFunc func);
2375 [CCode (cprefix = "G_SEEK_", has_type_id = false)]
2376 public enum SeekType {
2382 [CCode (has_type_id = false)]
2383 public enum IOStatus {
2390 public errordomain IOChannelError {
2400 public static GLib.Quark quark ();
2404 [CCode (cprefix = "G_IO_")]
2405 public enum IOCondition {
2414 public delegate bool IOFunc (IOChannel source, IOCondition condition);
2416 [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)]
2418 public enum IOFlags {
2430 /* Error Reporting */
2434 [CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
2435 public class Error {
2437 public Error (Quark domain, int code, string format, ...);
2438 public Error.literal (Quark domain, int code, string message);
2440 public Error.valist (Quark domain, int code, string format, va_list args);
2441 public Error copy ();
2442 public bool matches (Quark domain, int code);
2443 [CCode (cname = "g_prefix_error")]
2444 public static void prefix (out Error? dest, string format, ...);
2445 [CCode (cname = "g_propagate_error")]
2446 public static void propagate (out Error? dest, owned Error src);
2447 [CCode (cname = "g_propagate_prefixed_error")]
2448 public static void propagate_prefixed (out Error? dest, owned Error src, string format, ...);
2449 [CCode (cname = "g_set_error")]
2450 public static void @set (out Error? dest, Quark domain, int code, string format, ...);
2451 [CCode (cname = "g_set_error_literal")]
2452 public static void set_literal (out Error? dest, Quark domain, int code, string message);
2454 public Quark domain;
2456 public string message;
2459 /* Message Output and Debugging Functions */
2462 public static void print (string format, ...);
2463 public static void set_print_handler (PrintFunc func);
2464 [CCode (has_target = false)]
2465 public delegate void PrintFunc (string text);
2467 public static void printerr (string format, ...);
2468 public static void set_printerr_handler (PrintFunc func);
2470 public static void return_if_fail (bool expr);
2471 [CCode (sentinel = "")]
2472 public static void return_val_if_fail (bool expr, ...);
2474 public static void return_if_reached ();
2476 [CCode (sentinel = "")]
2477 public static void return_val_if_reached (...);
2478 [Version (since = "2.16")]
2479 public static void warn_if_fail (bool expr);
2480 [Version (since = "2.16")]
2481 public static void warn_if_reached ();
2484 public static void assert (bool expr);
2486 [Version (since = "2.46")]
2487 public static void assert_cmpmem (uint8[] m1, uint8[] m2);
2489 public static void assert_error (Error? error, Quark error_domain, int error_code);
2491 [Version (since = "2.38")]
2492 public static void assert_false (bool expr);
2494 [Version (since = "2.38")]
2495 public static void assert_true (bool expr);
2497 [Version (since = "2.38")]
2498 public static void assert_null (void* expr);
2500 public static void assert_no_error (Error? error);
2502 [Version (since = "2.40")]
2503 public static void assert_nonnull (void* expr);
2505 public static void assert_not_reached ();
2507 public static void on_error_query (string? prg_name = null);
2508 public static void on_error_stack_trace (string? prg_name = null);
2509 [CCode (cname = "G_BREAKPOINT")]
2510 public static void breakpoint ();
2512 /* Message Logging */
2514 [CCode (cprefix = "G_LOG_", has_type_id = false)]
2516 public enum LogLevelFlags {
2521 /* GLib log levels */
2532 [CCode (cprefix = "G_LOG_WRITER_", has_type_id = false)]
2533 [Version (since = "2.50")]
2534 public enum LogWriterOutput {
2539 [CCode (has_type_id = false, simple_generics = true)]
2540 [Version (since = "2.50")]
2541 public struct LogField<T> {
2542 public unowned string key;
2543 public unowned T @value;
2544 public ssize_t length;
2547 public void logv (string? log_domain, LogLevelFlags log_level, string format, va_list args);
2550 public void log (string? log_domain, LogLevelFlags log_level, string format, ...);
2552 [Version (since = "2.50")]
2553 public void log_structured (string? log_domain, LogLevelFlags log_levels, ...);
2554 [Version (since = "2.50")]
2555 public void log_structured_array (LogLevelFlags log_levels, LogField[] fields);
2557 [Version (since = "2.50")]
2558 public void log_variant (string? log_domain, LogLevelFlags log_levels, GLib.Variant fields);
2562 public void message (string format, ...);
2565 public void warning (string format, ...);
2568 public void critical (string format, ...);
2572 public void error (string format, ...);
2575 [Version (since = "2.6")]
2576 public void debug (string format, ...);
2579 [Version (since = "2.40")]
2580 public void info (string format, ...);
2581 [CCode (cname = "G_DEBUG_HERE")]
2582 [Version (since = "2.50")]
2583 public void debug_here ();
2585 public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message);
2586 [Version (since = "2.50")]
2587 public delegate LogWriterOutput LogWriterFunc (LogLevelFlags log_level, LogField[] fields);
2590 public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
2591 [Version (since = "2.46")]
2592 public static void set_handler_full (string? log_domain, LogLevelFlags log_levels, owned LogFunc log_func);
2593 [Version (since = "2.6")]
2594 public static void set_default_handler (LogFunc log_func);
2595 [CCode (delegate_target = false)]
2596 public static GLib.LogFunc default_handler;
2597 public static LogLevelFlags set_fatal_mask (string log_domain, LogLevelFlags log_levels);
2598 public static LogLevelFlags set_always_fatal (LogLevelFlags log_levels);
2599 public static void remove_handler (string? log_domain, uint handler_id);
2601 public const string FILE;
2602 public const int LINE;
2603 public const string METHOD;
2605 [Version (since = "2.50")]
2606 public static void set_writer_func (owned LogWriterFunc func);
2607 [Version (since = "2.50")]
2608 public static bool writer_supports_color (int output_fd);
2609 [Version (since = "2.50")]
2610 public static bool writer_is_journald (int output_fd);
2611 [Version (since = "2.50")]
2612 public static string writer_format_fields (LogLevelFlags log_levels, LogField[] fields, bool use_color);
2613 [Version (since = "2.50")]
2614 public static LogWriterOutput writer_journald (LogLevelFlags log_levels, LogField[] fields, void* user_data);
2615 [Version (since = "2.50")]
2616 public static LogWriterOutput writer_standard_streams (LogLevelFlags log_levels, LogField[] fields, void* user_data);
2617 [Version (since = "2.50")]
2618 public static LogWriterOutput writer_default (LogLevelFlags log_levels, LogField[] fields, void* user_data);
2621 [CCode (has_type_id = false)]
2622 public struct DebugKey {
2627 public uint parse_debug_string (string? debug_string, DebugKey[] keys);
2629 /* String Utility Functions */
2631 public string strdup (string str);
2632 [CCode (array_length = false, array_null_terminated = true)]
2633 public string[] strdupv ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2635 public void strfreev (string** str_array);
2636 [Version (since = "2.6")]
2637 public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2638 [Version (since = "2.44")]
2639 public bool strv_contains ([CCode (array_length = false, array_null_terminated = true)] string[] str_array, string str);
2641 [CCode (cname = "errno", cheader_filename = "errno.h")]
2643 public unowned string strerror (int errnum);
2645 /* Character Set Conversions */
2647 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;
2648 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;
2649 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;
2650 public static bool get_charset (out unowned string charset);
2651 public static bool get_filename_charsets ([CCode (array_length = false, array_null_terminated = true)] out unowned string[] charsets);
2654 public struct IConv {
2655 public static IConv open (string to_codeset, string from_codeset);
2656 [CCode (cname = "g_iconv")]
2657 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);
2658 public int close ();
2661 namespace Filename {
2662 public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2663 public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2664 public static string from_uri (string uri, out string hostname = null) throws ConvertError;
2665 public static string to_uri (string filename, string? hostname = null) throws ConvertError;
2666 [Version (since = "2.6")]
2667 public static string display_name (string filename);
2668 [Version (since = "2.6")]
2669 public static string display_basename (string filename);
2672 public errordomain ConvertError {
2679 public static GLib.Quark quark ();
2682 /* Base64 Encoding */
2684 [Version (since = "2.12")]
2686 public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save);
2687 public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
2688 public static string encode (uchar[] data);
2689 public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
2690 [CCode (array_length_type = "size_t")]
2691 public static uchar[] decode (string text);
2694 /* Data Checksums */
2696 [Version (since = "2.16")]
2697 [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)]
2698 public enum ChecksumType {
2702 [Version (since = "2.52")]
2704 [Version (since = "2.36")]
2707 public ssize_t get_length ();
2711 [Version (since = "2.16")]
2712 [CCode (free_function = "g_checksum_free")]
2713 public class Checksum {
2714 public Checksum (ChecksumType checksum_type);
2715 public Checksum copy ();
2716 public void update ([CCode (array_length = false)] uchar[] data, size_t length);
2717 public unowned string get_string ();
2718 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2719 [CCode (cname = "g_compute_checksum_for_data")]
2720 public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
2721 [CCode (cname = "g_compute_checksum_for_string")]
2722 public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1);
2723 [Version (since = "2.34")]
2724 [CCode (cname = "g_compute_checksum_for_bytes")]
2725 public static string compute_for_bytes (ChecksumType checksum_type, Bytes data);
2728 /* Secure HMAC Digests */
2731 [Version (since = "2.30")]
2732 [CCode (ref_function = "g_hmac_ref", unref_function = "g_hmac_unref")]
2734 public Hmac (ChecksumType digest_type, [CCode (array_length_type = "gsize")] uint8[] key);
2735 public Hmac copy ();
2736 public void update ([CCode (array_length_type = "gssize")] uint8[] data);
2737 public unowned string get_string ();
2738 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2739 [Version (since = "2.30")]
2740 [CCode (cname = "g_compute_hmac_for_data")]
2741 public static string compute_for_data (ChecksumType checksum_type, uint8[] key, uint8[] data);
2742 [Version (since = "2.30")]
2743 [CCode (cname = "g_compute_hmac_for_string")]
2744 public static string compute_for_string (ChecksumType checksum_type, uint8[] key, string str, size_t length = -1);
2745 [Version (since = "2.50")]
2746 [CCode (cname = "g_compute_hmac_for_bytes")]
2747 public static string compute_hmac_for_bytes (ChecksumType checksum_type, Bytes key, Bytes data);
2750 /* Date and Time Functions */
2752 [CCode (has_type_id = false)]
2753 public struct TimeVal {
2755 public long tv_usec;
2757 [CCode (cname = "g_get_current_time")]
2759 [CCode (cname = "g_get_current_time")]
2760 public void get_current_time ();
2761 public void add (long microseconds);
2762 [Version (since = "2.12")]
2763 [CCode (instance_pos = -1)]
2764 public bool from_iso8601 (string iso_date);
2765 [Version (since = "2.12")]
2766 public string to_iso8601 ();
2769 [Version (since = "2.28")]
2770 public static int64 get_monotonic_time ();
2771 [Version (since = "2.28")]
2772 public static int64 get_real_time ();
2774 public struct DateDay : uchar {
2775 [CCode (cname = "G_DATE_BAD_DAY")]
2776 public static DateDay BAD_DAY;
2778 [CCode (cname = "g_date_valid_day")]
2779 public bool valid ();
2782 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2783 public enum DateMonth {
2798 [CCode (cname = "g_date_get_days_in_month")]
2799 public uchar get_days_in_month (DateYear year);
2800 [CCode (cname = "g_date_valid_month")]
2801 public bool valid ();
2804 public struct DateYear : ushort {
2805 [CCode (cname = "G_DATE_BAD_YEAR")]
2806 public static DateDay BAD_YEAR;
2808 [CCode (cname = "g_date_is_leap_year")]
2809 public bool is_leap_year ();
2810 [CCode (cname = "g_date_get_monday_weeks_in_year")]
2811 public uchar get_monday_weeks_in_year ();
2812 [CCode (cname = "g_date_get_sunday_weeks_in_year")]
2813 public uchar get_sunday_weeks_in_year ();
2814 [CCode (cname = "g_date_valid_year")]
2815 public bool valid ();
2818 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2819 public enum DateWeekday {
2829 [CCode (cname = "g_date_valid_weekday")]
2830 public bool valid ();
2833 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2834 public enum DateDMY {
2840 [CCode (type_id = "G_TYPE_DATE")]
2841 public struct Date {
2842 public void clear (uint n_dates = 1);
2843 [Version (since = "2.56")]
2844 public Date copy ();
2845 public void set_day (DateDay day);
2846 public void set_month (DateMonth month);
2847 public void set_year (DateYear year);
2848 public void set_dmy (DateDay day, int month, DateYear y);
2849 public void set_julian (uint julian_day);
2850 [Version (since = "2.10")]
2851 public void set_time_t (time_t timet);
2852 [Version (since = "2.10")]
2853 public void set_time_val (TimeVal timeval);
2854 public void set_parse (string str);
2855 public void add_days (uint n_days);
2856 public void subtract_days (uint n_days);
2857 public void add_months (uint n_months);
2858 public void subtract_months (uint n_months);
2859 public void add_years (uint n_years);
2860 public void subtract_years (uint n_years);
2861 public int days_between (Date date2);
2862 public int compare (Date rhs);
2863 public void clamp (Date min_date, Date max_date);
2864 public void order (Date date2);
2865 public DateDay get_day ();
2866 public DateMonth get_month ();
2867 public DateYear get_year ();
2868 public uint get_julian ();
2869 public DateWeekday get_weekday ();
2870 public uint get_day_of_year ();
2871 public bool is_first_of_month ();
2872 public bool is_last_of_month ();
2873 public uint get_monday_week_of_year ();
2874 public uint get_sunday_week_of_year ();
2875 [Version (since = "2.6")]
2876 public uint get_iso8601_week_of_year ();
2877 [CCode (instance_pos = -1)]
2878 public size_t strftime (char[] s, string format);
2879 [CCode (cname = "g_date_to_struct_tm")]
2880 public void to_time (out Time tm);
2881 public bool valid ();
2882 public static uchar get_days_in_month (DateMonth month, DateYear year);
2883 public static bool valid_day (DateDay day);
2884 public static bool valid_dmy (DateDay day, DateMonth month, DateYear year);
2885 public static bool valid_julian (uint julian_date);
2886 public static bool valid_weekday (DateWeekday weekday);
2889 [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)]
2890 public struct Time {
2891 [CCode (cname = "tm_sec")]
2893 [CCode (cname = "tm_min")]
2895 [CCode (cname = "tm_hour")]
2897 [CCode (cname = "tm_mday")]
2899 [CCode (cname = "tm_mon")]
2901 [CCode (cname = "tm_year")]
2903 [CCode (cname = "tm_wday")]
2905 [CCode (cname = "tm_yday")]
2906 public int day_of_year;
2907 [CCode (cname = "tm_isdst")]
2910 [CCode (cname = "gmtime_r")]
2911 static void gmtime_r (ref time_t time, out Time result);
2912 [CCode (cname = "localtime_r")]
2913 static void localtime_r (ref time_t time, out Time result);
2915 public static Time gm (time_t time) {
2917 gmtime_r (ref time, out result);
2920 public static Time local (time_t time) {
2922 localtime_r (ref time, out result);
2926 public string to_string () {
2927 return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
2930 public string format (string format) {
2931 var buffer = new char[64];
2932 this.strftime (buffer, format);
2933 return (string) buffer;
2936 [CCode (cname = "mktime")]
2937 public time_t mktime ();
2939 [CCode (cname = "strftime", instance_pos = -1)]
2940 public size_t strftime (char[] s, string format);
2941 [CCode (cname = "strptime", instance_pos = -1)]
2942 public unowned string? strptime (string buf, string format);
2946 [Version (since = "2.26")]
2947 [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")]
2948 [IntegerType (rank = 10)]
2949 public struct TimeSpan : int64 {
2950 public const TimeSpan DAY;
2951 public const TimeSpan HOUR;
2952 public const TimeSpan MINUTE;
2953 public const TimeSpan SECOND;
2954 public const TimeSpan MILLISECOND;
2958 [Version (since = "2.26")]
2959 [CCode (ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")]
2960 public class DateTime {
2961 public DateTime.now (TimeZone tz);
2962 public DateTime.now_local ();
2963 public DateTime.now_utc ();
2964 [Version (since = "2.56")]
2965 public DateTime.from_iso8601 (string text, TimeZone default_tz);
2966 public DateTime.from_unix_local (int64 t);
2967 public DateTime.from_unix_utc (int64 t);
2968 public DateTime.from_timeval_local (TimeVal tv);
2969 public DateTime.from_timeval_utc (TimeVal tv);
2970 public DateTime (TimeZone tz, int year, int month, int day, int hour, int minute, double seconds);
2971 public DateTime.local (int year, int month, int day, int hour, int minute, double seconds);
2972 public DateTime.utc (int year, int month, int day, int hour, int minute, double seconds);
2973 public DateTime add (TimeSpan timespan);
2974 public DateTime add_years (int years);
2975 public DateTime add_months (int months);
2976 public DateTime add_weeks (int weeks);
2977 public DateTime add_days (int days);
2978 public DateTime add_hours (int hours);
2979 public DateTime add_minutes (int minutes);
2980 public DateTime add_seconds (double seconds);
2981 public DateTime add_full (int years, int months, int days, int hours = 0, int minutes = 0, double seconds = 0);
2982 public int compare (DateTime dt);
2983 public TimeSpan difference (DateTime begin);
2984 public uint hash ();
2985 public bool equal (DateTime dt);
2986 public void get_ymd (out int year, out int month, out int day);
2987 public int get_year ();
2988 public int get_month ();
2989 public int get_day_of_month ();
2990 public int get_week_numbering_year ();
2991 public int get_week_of_year ();
2992 public int get_day_of_week ();
2993 public int get_day_of_year ();
2994 public int get_hour ();
2995 public int get_minute ();
2996 public int get_second ();
2997 public int get_microsecond ();
2998 public double get_seconds ();
2999 [Version (since = "2.58")]
3000 public unowned TimeZone get_timezone ();
3001 public int64 to_unix ();
3002 public bool to_timeval (out TimeVal tv);
3003 public TimeSpan get_utc_offset ();
3004 public unowned string get_timezone_abbreviation ();
3005 public bool is_daylight_savings ();
3006 public DateTime to_timezone (TimeZone tz);
3007 public DateTime to_local ();
3008 public DateTime to_utc ();
3009 public string format (string format);
3010 public string to_string () {
3011 return this.format ("%FT%H:%M:%S%z");
3015 public enum TimeType {
3022 [Version (since = "2.26")]
3023 [CCode (ref_function = "g_time_zone_ref", unref_function = "g_time_zone_unref")]
3024 public class TimeZone {
3025 public TimeZone (string identifier);
3026 public TimeZone.utc ();
3027 public TimeZone.local ();
3028 [Version (since = "2.58")]
3029 public TimeZone.offset (int32 seconds);
3030 public int find_interval (TimeType type, int64 time);
3031 public int adjust_time (TimeType type, ref int64 time);
3032 public unowned string get_abbreviation (int interval);
3033 [Version (since = "2.58")]
3034 public unowned string get_identifier ();
3035 public int32 get_offset (int interval);
3036 public bool is_dst (int interval);
3039 /* Random Numbers */
3042 [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
3044 public Rand.with_seed (uint32 seed);
3045 [Version (since = "2.4")]
3046 public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
3048 public void set_seed (uint32 seed);
3049 [Version (since = "2.4")]
3050 public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
3051 public bool boolean ();
3052 [CCode (cname = "g_rand_int")]
3053 public uint32 next_int ();
3054 public int32 int_range (int32 begin, int32 end);
3055 [CCode (cname = "g_rand_double")]
3056 public double next_double ();
3057 public double double_range (double begin, double end);
3061 public static void set_seed (uint32 seed);
3062 public static bool boolean ();
3063 [CCode (cname = "g_random_int")]
3064 public static uint32 next_int ();
3065 public static int32 int_range (int32 begin, int32 end);
3066 [CCode (cname = "g_random_double")]
3067 public static double next_double ();
3068 public static double double_range (double begin, double end);
3072 [Version (since = "2.52")]
3073 public static bool string_is_valid (string str);
3074 [Version (since = "2.52")]
3075 public static string string_random ();
3078 /* Miscellaneous Utility Functions */
3080 namespace Environment {
3081 [Version (since = "2.2")]
3082 [CCode (cname = "g_get_application_name")]
3083 public static unowned string? get_application_name ();
3084 [Version (since = "2.2")]
3085 [CCode (cname = "g_set_application_name")]
3086 public static void set_application_name (string application_name);
3087 [CCode (cname = "g_get_prgname")]
3088 public static unowned string get_prgname ();
3089 [CCode (cname = "g_set_prgname")]
3090 public static void set_prgname (string application_name);
3091 [CCode (cname = "g_getenv")]
3092 public static unowned string? get_variable (string variable);
3093 [Version (since = "2.4")]
3094 [CCode (cname = "g_setenv")]
3095 public static bool set_variable (string variable, string value, bool overwrite);
3096 [Version (since = "2.4")]
3097 [CCode (cname = "g_unsetenv")]
3098 public static void unset_variable (string variable);
3099 [Version (since = "2.8")]
3100 [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)]
3101 public static string[] list_variables ();
3102 [CCode (cname = "g_get_user_name")]
3103 public static unowned string get_user_name ();
3104 [CCode (cname = "g_get_real_name")]
3105 public static unowned string get_real_name ();
3106 [Version (since = "2.6")]
3107 [CCode (cname = "g_get_user_cache_dir")]
3108 public static unowned string get_user_cache_dir ();
3109 [Version (since = "2.6")]
3110 [CCode (cname = "g_get_user_data_dir")]
3111 public static unowned string get_user_data_dir ();
3112 [Version (since = "2.6")]
3113 [CCode (cname = "g_get_user_config_dir")]
3114 public static unowned string get_user_config_dir ();
3115 [CCode (cname = "g_get_user_runtime_dir")]
3116 public static unowned string get_user_runtime_dir ();
3117 [Version (since = "2.14")]
3118 [CCode (cname = "g_get_user_special_dir")]
3119 public static unowned string get_user_special_dir (UserDirectory directory);
3120 [Version (since = "2.6")]
3121 [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)]
3122 public static unowned string[] get_system_data_dirs ();
3123 [Version (since = "2.6")]
3124 [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)]
3125 public static unowned string[] get_system_config_dirs ();
3126 [Version (since = "2.8")]
3127 [CCode (cname = "g_get_host_name")]
3128 public static unowned string get_host_name ();
3129 [CCode (cname = "g_get_home_dir")]
3130 public static unowned string get_home_dir ();
3131 [CCode (cname = "g_get_tmp_dir")]
3132 public static unowned string get_tmp_dir ();
3133 [CCode (cname = "g_get_current_dir")]
3134 public static string get_current_dir ();
3135 [CCode (cname = "g_find_program_in_path")]
3136 public static string? find_program_in_path (string program);
3137 [Version (deprecated_since = "2.32")]
3138 [CCode (cname = "g_atexit")]
3139 public static void atexit (VoidFunc func);
3140 [Version (since = "2.8")]
3141 [CCode (cname = "g_chdir")]
3142 public static int set_current_dir (string path);
3146 [Version (since = "2.28")]
3147 [CCode (cname = "g_get_environ", array_length = false, array_null_terminated = true)]
3148 public static string[] get ();
3149 [Version (since = "2.32")]
3150 [CCode (cname = "g_environ_getenv")]
3151 public static unowned string? get_variable ([CCode (array_length = false, array_null_terminated = true)] string[]? envp, string variable);
3152 [Version (since = "2.32")]
3153 [CCode (cname = "g_environ_setenv", array_length = false, array_null_terminated = true)]
3154 public static string[] set_variable ([CCode (array_length = false, array_null_terminated = true)] owned string[]? envp, string variable, string value, bool overwrite = true);
3155 [Version (since = "2.32")]
3156 [CCode (cname = "g_environ_unsetenv", array_length = false, array_null_terminated = true)]
3157 public static string[] unset_variable ([CCode (array_length = false, array_null_terminated = true)] owned string[]? envp, string variable);
3160 [Version (since = "2.14")]
3161 [CCode (has_type_id = false)]
3162 public enum UserDirectory {
3171 [CCode (cname = "G_USER_N_DIRECTORIES")]
3175 namespace Hostname {
3176 public static bool is_non_ascii (string hostname);
3177 public static bool is_ascii_encoded (string hostname);
3178 public static bool is_ip_address (string hostname);
3179 public static string to_ascii (string hostname);
3180 public static string to_unicode (string hostname);
3184 public static bool is_absolute (string file_name);
3185 public static unowned string skip_root (string file_name);
3186 public static string get_basename (string file_name);
3187 public static string get_dirname (string file_name);
3188 [CCode (cname = "g_build_filename")]
3189 public static string build_filename (string first_element, ...);
3190 [Version (since = "2.56")]
3191 [CCode (cname = "g_build_filename_valist")]
3192 public static string build_filename_valist (string first_element, va_list args);
3193 [CCode (cname = "g_build_path")]
3194 public static string build_path (string separator, string first_element, ...);
3196 [CCode (cname = "G_DIR_SEPARATOR")]
3197 public const char DIR_SEPARATOR;
3198 [CCode (cname = "G_DIR_SEPARATOR_S")]
3199 public const string DIR_SEPARATOR_S;
3200 [Version (since = "2.6")]
3201 [CCode (cname = "G_IS_DIR_SEPARATOR")]
3202 public static bool is_dir_separator (unichar c);
3203 [CCode (cname = "G_SEARCHPATH_SEPARATOR")]
3204 public const char SEARCHPATH_SEPARATOR;
3205 [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")]
3206 public const string SEARCHPATH_SEPARATOR_S;
3210 public static int nth_lsf (ulong mask, int nth_bit);
3211 public static int nth_msf (ulong mask, int nth_bit);
3212 public static uint storage (ulong number);
3215 namespace SpacedPrimes {
3216 public static uint closest (uint num);
3219 [CCode (has_target = false)]
3220 public delegate void FreeFunc (void* data);
3221 [CCode (has_target = false)]
3222 public delegate void VoidFunc ();
3224 [Version (deprecated_since = "2.30", replacement = "format_size", since = "2.16")]
3225 public string format_size_for_display (int64 size);
3227 [Version (since = "2.30")]
3228 [CCode (cname = "g_format_size_full")]
3229 public string format_size (uint64 size, FormatSizeFlags flags = FormatSizeFlags.DEFAULT);
3231 [Version (since = "2.30")]
3232 [CCode (cprefix = "G_FORMAT_SIZE_", has_type_id = false)]
3234 public enum FormatSizeFlags {
3240 /* Lexical Scanner */
3241 [CCode (has_target = false)]
3242 public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error);
3245 [CCode (free_function = "g_scanner_destroy")]
3246 public class Scanner {
3247 public unowned string input_name;
3248 public TokenType token;
3249 public TokenValue value;
3251 public uint position;
3252 public TokenType next_token;
3253 public TokenValue next_value;
3254 public uint next_line;
3255 public uint next_position;
3256 public ScannerMsgFunc msg_handler;
3257 public ScannerConfig? config;
3258 public Scanner (ScannerConfig? config_templ);
3259 public void input_file (int input_fd);
3260 public void sync_file_offset ();
3261 public void input_text (string text, uint text_len);
3262 public TokenType peek_next_token ();
3263 public TokenType get_next_token ();
3265 public int cur_line ();
3266 public int cur_position ();
3267 public TokenType cur_token ();
3268 public TokenValue cur_value ();
3269 public uint set_scope (uint scope_id);
3270 public void scope_add_symbol (uint scope_id, string symbol, void* value);
3271 public void scope_foreach_symbol (uint scope_id, HFunc<string, void*> func);
3272 public void* scope_lookup_symbol (uint scope_id, string symbol);
3273 public void scope_remove_symbol (uint scope_id, string symbol);
3274 public void* lookup_symbol (string symbol);
3276 public void warn (string format, ...);
3278 public void error (string format, ...);
3279 public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error);
3282 public struct ScannerConfig {
3283 public string* cset_skip_characters;
3284 public string* cset_identifier_first;
3285 public string* cset_identifier_nth;
3286 public string* cpair_comment_single;
3287 public bool case_sensitive;
3288 public bool skip_comment_multi;
3289 public bool skip_comment_single;
3290 public bool scan_comment_multi;
3291 public bool scan_identifier;
3292 public bool scan_identifier_1char;
3293 public bool scan_identifier_NULL;
3294 public bool scan_symbols;
3295 public bool scan_binary;
3296 public bool scan_octal;
3297 public bool scan_float;
3298 public bool scan_hex;
3299 public bool scan_hex_dollar;
3300 public bool scan_string_sq;
3301 public bool scan_string_dq;
3302 public bool numbers_2_int;
3303 public bool int_2_float;
3304 public bool identifier_2_string;
3305 public bool char_2_token;
3306 public bool symbol_2_token;
3307 public bool scope_0_fallback;
3308 public bool store_int64;
3311 [CCode (lower_case_cprefix="G_CSET_")]
3312 namespace CharacterSet {
3313 public const string A_2_Z;
3314 public const string a_2_z;
3315 public const string DIGITS;
3316 public const string LATINC;
3317 public const string LATINS;
3320 [CCode (cprefix = "G_TOKEN_", has_type_id = false)]
3321 public enum TokenType {
3349 public struct TokenValue {
3350 [CCode (cname="v_symbol")]
3351 public void* symbol;
3352 [CCode (cname="v_identifier")]
3353 public unowned string identifier;
3354 [CCode (cname="v_binary")]
3355 public ulong binary;
3356 [CCode (cname="v_octal")]
3358 [CCode (cname="v_int")]
3360 [CCode (cname="v_int64")]
3362 [CCode (cname="v_float")]
3363 public double float;
3364 [CCode (cname="v_hex")]
3366 [CCode (cname="v_string")]
3367 public unowned string string;
3368 [CCode (cname="v_comment")]
3369 public unowned string comment;
3370 [CCode (cname="v_char")]
3372 [CCode (cname="v_error")]
3376 [CCode (cprefix = "G_ERR_", has_type_id = false)]
3377 public enum ErrorType {
3380 UNEXP_EOF_IN_STRING,
3381 UNEXP_EOF_IN_COMMENT,
3388 /* Automatic String Completion */
3390 [Version (deprecated_since = "2.26")]
3392 [CCode (free_function = "g_completion_free")]
3393 public class Completion {
3394 public Completion (CompletionFunc? func = null);
3395 public List<void*> items;
3396 public CompletionFunc func;
3397 public string prefix;
3398 public List<void*> cache;
3399 public CompletionStrncmpFunc strncmp_func;
3400 public void add_items (List<void*> items);
3401 public void remove_items (List<void*> items);
3402 public void clear_items ();
3403 public unowned List<void*> complete (string prefix, out string? new_prefix = null);
3404 [Version (since = "2.4")]
3405 public unowned List<void*> complete_utf8 (string prefix, out string? new_prefix = null);
3408 [CCode (has_target = false)]
3409 public delegate string CompletionFunc (void* item);
3410 [CCode (has_target = false)]
3411 public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n);
3416 [CCode (free_function = "g_timer_destroy")]
3417 public class Timer {
3419 public void start ();
3420 public void stop ();
3421 [Version (since = "2.4")]
3422 public void @continue ();
3423 public double elapsed (out ulong microseconds = null);
3424 public void reset ();
3427 /* Spawning Processes */
3429 public errordomain SpawnError {
3450 public static GLib.Quark quark ();
3453 [CCode (cprefix = "G_SPAWN_", has_type_id = false)]
3455 public enum SpawnFlags {
3456 LEAVE_DESCRIPTORS_OPEN,
3461 CHILD_INHERITS_STDIN,
3463 SEARCH_PATH_FROM_ENVP
3466 public delegate void SpawnChildSetupFunc ();
3467 [CCode (has_target = false, cheader_filename = "signal.h")]
3468 public delegate void SignalHandlerFunc (int signum);
3470 public unowned string strsignal (int signum);
3472 [CCode (lower_case_cprefix = "g_")]
3474 [Version (since = "2.58")]
3475 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;
3476 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;
3477 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;
3478 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;
3479 public static bool spawn_command_line_async (string command_line) throws SpawnError;
3480 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;
3481 [CCode (cname = "g_spawn_close_pid")]
3482 public static void close_pid (Pid pid);
3483 [Version (since = "2.34")]
3484 [CCode (cname = "g_spawn_check_exit_status")]
3485 public static bool check_exit_status (int exit_status) throws GLib.Error;
3487 /* these macros are required to examine the exit status of a process */
3488 [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")]
3489 public static bool if_exited (int status);
3490 [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")]
3491 public static int exit_status (int status);
3492 [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")]
3493 public static bool if_signaled (int status);
3494 [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")]
3495 public static ProcessSignal term_sig (int status);
3496 [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")]
3497 public static bool core_dump (int status);
3498 [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")]
3499 public static bool if_stopped (int status);
3500 [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")]
3501 public static ProcessSignal stop_sig (int status);
3502 [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")]
3503 public static bool if_continued (int status);
3506 [CCode (cname = "abort", cheader_filename = "stdlib.h")]
3507 public void abort ();
3509 [CCode (cname = "exit", cheader_filename = "stdlib.h")]
3510 public void exit (int status);
3511 [CCode (cname = "raise", cheader_filename = "signal.h")]
3512 public int raise (ProcessSignal sig);
3513 [CCode (cname = "signal", cheader_filename = "signal.h")]
3514 public SignalHandlerFunc @signal (ProcessSignal signum, SignalHandlerFunc handler);
3517 [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")]
3518 public enum ProcessSignal {
3543 /* File Utilities */
3545 public errordomain FileError {
3571 public static GLib.Quark quark ();
3574 [CCode (has_type_id = false)]
3576 public enum FileTest {
3584 [CCode (cname = "int", cprefix = "SEEK_", has_type_id = false)]
3585 public enum FileSeek {
3592 [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
3593 public class FileStream {
3594 [CCode (cname = "EOF", cheader_filename = "stdio.h")]
3595 public const int EOF;
3597 [Version (since = "2.6")]
3598 [CCode (cname = "g_fopen", cheader_filename = "glib/gstdio.h")]
3599 public static FileStream? open (string path, string mode);
3600 [CCode (cname = "fdopen")]
3601 public static FileStream? fdopen (int fildes, string mode);
3602 [CCode (cname = "fprintf")]
3604 public void printf (string format, ...);
3605 [CCode (cname = "vfprintf")]
3606 public void vprintf (string format, va_list args);
3607 [CCode (cname = "fputc", instance_pos = -1)]
3608 public void putc (char c);
3609 [CCode (cname = "fputs", instance_pos = -1)]
3610 public void puts (string s);
3611 [CCode (cname = "fgetc")]
3613 [CCode (cname = "ungetc", instance_pos = -1)]
3614 public int ungetc (int c);
3615 [CCode (cname = "fgets", instance_pos = -1)]
3616 public unowned string? gets (char[] s);
3617 [CCode (cname = "feof")]
3619 [CCode (cname = "fscanf"), ScanfFormat]
3620 public int scanf (string format, ...);
3621 [CCode (cname = "fflush")]
3622 public int flush ();
3623 [CCode (cname = "fseek")]
3624 public int seek (long offset, FileSeek whence);
3625 [CCode (cname = "ftell")]
3626 public long tell ();
3627 [CCode (cname = "rewind")]
3628 public void rewind ();
3629 [CCode (cname = "fileno")]
3630 public int fileno ();
3631 [CCode (cname = "ferror")]
3632 public int error ();
3633 [CCode (cname = "clearerr")]
3634 public void clearerr ();
3635 [CCode (cname = "fread", instance_pos = -1)]
3636 public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3637 [CCode (cname = "fwrite", instance_pos = -1)]
3638 public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3640 public string? read_line () {
3642 StringBuilder? ret = null;
3643 while ((c = getc ()) != EOF) {
3645 ret = new StringBuilder ();
3650 ((!)(ret)).append_c ((char) c);
3655 return ((!)(ret)).str;
3660 [CCode (cname = "struct utimbuf", cheader_filename = "sys/types.h,utime.h")]
3661 public struct UTimBuf {
3662 time_t actime; /* access time */
3663 time_t modtime; /* modification time */
3666 [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
3667 namespace FileUtils {
3668 public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError;
3669 [Version (since = "2.8")]
3670 public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError;
3671 [CCode (cname = "g_file_get_contents")]
3672 public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "size_t")] out uint8[] contents) throws FileError;
3673 [CCode (cname = "g_file_set_contents")]
3674 public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "size_t")] uint8[] contents) throws FileError;
3675 public static bool test (string filename, FileTest test);
3676 public static int open_tmp (string tmpl, out string name_used) throws FileError;
3677 [Version (since = "2.4")]
3678 public static string read_link (string filename) throws FileError;
3679 public static int error_from_errno (int err_no);
3681 [CCode (cname = "g_mkstemp")]
3682 public static int mkstemp (string tmpl);
3683 [Version (since = "2.6")]
3684 [CCode (cname = "g_rename")]
3685 public static int rename (string oldfilename, string newfilename);
3686 [Version (since = "2.6")]
3687 [CCode (cname = "g_remove")]
3688 public static int remove (string filename);
3689 [CCode (cname = "g_unlink")]
3690 public static int unlink (string filename);
3691 [Version (since = "2.8")]
3692 [CCode (cname = "g_chmod")]
3693 public static int chmod (string filename, int mode);
3694 [Version (since = "2.18")]
3695 [CCode (cname = "g_utime")]
3696 public static int utime (string filename, UTimBuf? times = null);
3698 [CCode (cname = "symlink", cheader_filename = "unistd.h")]
3699 public static int symlink (string oldpath, string newpath);
3701 [CCode (cname = "close", cheader_filename = "unistd.h")]
3702 public static int close (int fd);
3704 [Version (since = "2.36")]
3705 [CCode (cname = "g_close")]
3706 public static bool close_checked (int fd) throws FileError;
3709 [CCode (cname = "struct stat", cheader_filename = "sys/stat.h,glib/gstdio.h")]
3710 public struct Stat {
3711 public time_t st_atime;
3712 public time_t st_mtime;
3713 public time_t st_ctime;
3714 [CCode (cname = "g_stat", instance_pos = -1)]
3715 public Stat (string filename);
3716 [Version (since = "2.6")]
3717 [CCode (cname = "g_lstat", instance_pos = -1)]
3718 public Stat.l (string filename);
3722 [CCode (free_function = "g_dir_close")]
3724 public static Dir open (string filename, uint _flags = 0) throws FileError;
3725 public unowned string? read_name ();
3726 public void rewind ();
3729 [CCode (cheader_filename = "glib/gstdio.h")]
3730 namespace DirUtils {
3731 [Version (since = "2.6")]
3732 [CCode (cname = "g_mkdir")]
3733 public static int create (string pathname, int mode);
3734 [Version (since = "2.8")]
3735 [CCode (cname = "g_mkdir_with_parents")]
3736 public static int create_with_parents (string pathname, int mode);
3737 [Version (since = "2.30")]
3738 [CCode (cname = "mkdtemp")]
3739 public static string mkdtemp (owned string template);
3740 [Version (since = "2.30")]
3741 [CCode (cname = "g_dir_make_tmp")]
3742 public static string make_tmp (string tmpl) throws FileError;
3743 [Version (since = "2.6")]
3744 [CCode (cname = "g_rmdir")]
3745 public static int remove (string filename);
3749 [Version (since = "2.22")]
3750 [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref")]
3751 public class MappedFile {
3752 public MappedFile (string filename, bool writable) throws FileError;
3753 public size_t get_length ();
3754 public unowned char* get_contents ();
3755 [Version (since = "2.34")]
3756 public Bytes get_bytes ();
3759 [CCode (cname = "stdin", cheader_filename = "stdio.h")]
3760 public static FileStream stdin;
3762 [CCode (cname = "stdout", cheader_filename = "stdio.h")]
3763 public static FileStream stdout;
3765 [CCode (cname = "stderr", cheader_filename = "stdio.h")]
3766 public static FileStream stderr;
3771 public const string RESERVED_CHARS_ALLOWED_IN_PATH;
3772 public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
3773 public const string RESERVED_CHARS_ALLOWED_IN_USERINFO;
3774 public const string RESERVED_CHARS_GENERIC_DELIMITERS;
3775 public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS;
3777 [Version (since = "2.16")]
3778 public static string? parse_scheme (string uri);
3779 [Version (since = "2.16")]
3780 public static string escape_string (string unescaped, string? reserved_chars_allowed = null, bool allow_utf8 = true);
3781 [Version (since = "2.16")]
3782 public static string? unescape_string (string escaped_string, string? illegal_characters = null);
3783 [Version (since = "2.16")]
3784 public static string? unescape_segment (string? escaped_string, string? escaped_string_end, string? illegal_characters = null);
3785 [Version (since = "2.6")]
3786 [CCode (array_length = false, array_null_terminated = true)]
3787 public static string[] list_extract_uris (string uri_list);
3790 /* Shell-related Utilities */
3792 public errordomain ShellError {
3796 public static GLib.Quark quark ();
3800 public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError;
3801 public static string quote (string unquoted_string);
3802 public static string unquote (string quoted_string) throws ShellError;
3805 /* Commandline option parser */
3807 public errordomain OptionError {
3811 public static GLib.Quark quark ();
3815 [Version (since = "2.6")]
3816 [CCode (free_function = "g_option_context_free")]
3817 public class OptionContext {
3818 public OptionContext (string? parameter_string = null);
3819 [Version (since = "2.12")]
3820 public void set_summary (string summary);
3821 [Version (since = "2.12")]
3822 public unowned string get_summary ();
3823 [Version (since = "2.12")]
3824 public void set_description (string description);
3825 [Version (since = "2.12")]
3826 public unowned string get_description ();
3827 [Version (since = "2.12")]
3828 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3829 [Version (since = "2.12")]
3830 public void set_translation_domain (string domain);
3831 public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError;
3832 [Version (since = "2.40")]
3833 public bool parse_strv ([CCode (array_length = false, array_null_terminated = true)] ref string[] argv) throws OptionError;
3834 public void set_help_enabled (bool help_enabled);
3835 public bool get_help_enabled ();
3836 public void set_ignore_unknown_options (bool ignore_unknown);
3837 public bool get_ignore_unknown_options ();
3838 [Version (since = "2.14")]
3839 public string get_help (bool main_help, OptionGroup? group);
3840 public void add_main_entries ([CCode (array_length = false, array_null_terminated = true)] OptionEntry[] entries, string? translation_domain);
3841 public void add_group (owned OptionGroup group);
3842 public void set_main_group (owned OptionGroup group);
3843 public unowned OptionGroup get_main_group ();
3844 [Version (since = "2.44")]
3845 public void set_strict_posix (bool strict_posix);
3846 [Version (since = "2.44")]
3847 public bool get_strict_posix ();
3850 public delegate unowned string TranslateFunc (string str);
3852 public const string OPTION_REMAINING;
3854 [CCode (has_type_id = false)]
3855 public enum OptionArg {
3868 [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)]
3869 public enum OptionFlags {
3870 [Version (since = "2.42")]
3881 public struct OptionEntry {
3882 public unowned string long_name;
3883 public char short_name;
3886 public OptionArg arg;
3887 public void* arg_data;
3889 public unowned string description;
3890 public unowned string? arg_description;
3895 [Version (since = "2.44")]
3896 [CCode (ref_function = "g_option_group_ref", unref_function = "g_option_group_unref", type_id = "G_TYPE_OPTION_GROUP")]
3898 [Version (since = "2.6")]
3899 [CCode (free_function = "g_option_group_free")]
3901 public class OptionGroup {
3902 public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null);
3903 public void add_entries ([CCode (array_length = false, array_null_terminated = true)] OptionEntry[] entries);
3904 public void set_parse_hooks (OptionParseFunc? pre_parse_func, OptionParseFunc? post_parse_hook);
3905 public void set_error_hook (OptionErrorFunc? error_func);
3906 public void set_translate_func (owned TranslateFunc? func);
3907 public void set_translation_domain (string domain);
3910 [CCode (has_target = false)]
3911 public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError;
3912 [CCode (has_target = false)]
3913 public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error);
3914 [CCode (has_target = false)]
3915 public delegate bool OptionArgFunc (string option_name, string val, void* data) throws OptionError;
3917 /* Perl-compatible regular expressions */
3919 [Version (since = "2.14")]
3920 public errordomain RegexError {
3927 MISSING_CONTROL_CHAR,
3928 UNRECOGNIZED_ESCAPE,
3929 QUANTIFIERS_OUT_OF_ORDER,
3931 UNTERMINATED_CHARACTER_CLASS,
3932 INVALID_ESCAPE_IN_CHARACTER_CLASS,
3935 UNRECOGNIZED_CHARACTER,
3936 POSIX_NAMED_CLASS_OUTSIDE_CLASS,
3937 UNMATCHED_PARENTHESIS,
3938 INEXISTENT_SUBPATTERN_REFERENCE,
3939 UNTERMINATED_COMMENT,
3940 EXPRESSION_TOO_LARGE,
3942 VARIABLE_LENGTH_LOOKBEHIND,
3943 MALFORMED_CONDITION,
3944 TOO_MANY_CONDITIONAL_BRANCHES,
3946 UNKNOWN_POSIX_CLASS_NAME,
3947 POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED,
3950 SINGLE_BYTE_MATCH_IN_LOOKBEHIND,
3952 MISSING_SUBPATTERN_NAME_TERMINATOR,
3953 DUPLICATE_SUBPATTERN_NAME,
3956 SUBPATTERN_NAME_TOO_LONG,
3957 TOO_MANY_SUBPATTERNS,
3958 INVALID_OCTAL_VALUE,
3959 TOO_MANY_BRANCHES_IN_DEFINE,
3961 INCONSISTENT_NEWLINE_OPTIONS,
3962 MISSING_BACK_REFERENCE,
3963 INVALID_RELATIVE_REFERENCE,
3964 BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN,
3965 UNKNOWN_BACKTRACKING_CONTROL_VERB,
3967 MISSING_SUBPATTERN_NAME,
3969 INVALID_DATA_CHARACTER,
3970 EXTRA_SUBPATTERN_NAME,
3971 BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED,
3972 INVALID_CONTROL_CHAR,
3974 NOT_SUPPORTED_IN_CLASS,
3975 TOO_MANY_FORWARD_REFERENCES,
3977 CHARACTER_VALUE_TOO_LARGE;
3978 public static GLib.Quark quark ();
3981 [Version (since = "2.14")]
3982 [CCode (cprefix = "G_REGEX_", has_type_id = false)]
3984 public enum RegexCompileFlags {
4004 [Version (since = "2.14")]
4005 [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)]
4007 public enum RegexMatchFlags {
4026 [Version (since = "2.14")]
4027 [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
4028 public class Regex {
4029 public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
4030 public unowned string get_pattern ();
4031 [Version (since = "2.26")]
4032 public RegexCompileFlags get_compile_flags ();
4033 [Version (since = "2.34")]
4034 public bool get_has_cr_or_lf ();
4035 [Version (since = "2.26")]
4036 public RegexMatchFlags get_match_flags ();
4037 public int get_max_backref ();
4038 [Version (since = "2.38")]
4039 public int get_max_lookbehind ();
4040 public int get_capture_count ();
4041 public int get_string_number (string name);
4042 public static string escape_string (string str, int length = -1);
4043 public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
4044 public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
4045 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;
4046 public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
4047 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;
4048 [CCode (array_length = false, array_null_terminated = true)]
4049 public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
4050 [CCode (array_length = false, array_null_terminated = true)]
4051 public string[] split (string str, RegexMatchFlags match_options = 0);
4052 [CCode (array_length = false, array_null_terminated = true)]
4053 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;
4054 public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
4055 public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
4056 public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options, RegexEvalCallback eval) throws RegexError;
4057 public static bool check_replacement (string replacement, out bool has_references = null) throws RegexError;
4060 [Version (since = "2.14")]
4061 public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
4064 [Version (since = "2.30")]
4065 [CCode (ref_function = "g_match_info_ref", unref_function = "g_match_info_unref", type_id = "G_TYPE_MATCH_INFO")]
4066 public class MatchInfo {
4067 public unowned Regex get_regex ();
4068 public unowned string get_string ();
4069 public bool matches ();
4070 public bool next () throws RegexError;
4071 public int get_match_count ();
4072 public bool is_partial_match ();
4073 public string expand_references (string string_to_expand) throws RegexError;
4074 public string? fetch (int match_num);
4075 public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
4076 public string? fetch_named (string name);
4077 public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
4078 [CCode (array_length = false, array_null_terminated = true)]
4079 public string[] fetch_all ();
4082 /* Simple XML Subset Parser
4083 See http://live.gnome.org/Vala/MarkupSample for an example */
4085 public errordomain MarkupError {
4093 public static GLib.Quark quark ();
4096 [CCode (cprefix = "G_MARKUP_", has_type_id = false)]
4098 public enum MarkupParseFlags {
4099 TREAT_CDATA_AS_TEXT,
4100 PREFIX_ERROR_POSITION
4104 [Version (since = "2.36")]
4105 [CCode (ref_function = "g_markup_parse_context_ref", unref_function = "g_markup_parse_context_unref", type_id = "G_TYPE_MARKUP_PARSE_CONTEXT")]
4106 public class MarkupParseContext {
4107 public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
4108 public bool parse (string text, ssize_t text_len) throws MarkupError;
4109 public bool end_parse () throws MarkupError;
4110 [Version (since = "2.2")]
4111 public unowned string get_element ();
4112 [Version (since = "2.16")]
4113 public unowned SList<string> get_element_stack ();
4114 public void get_position (out int line_number, out int char_number);
4115 [Version (since = "2.18")]
4116 public void push (MarkupParser parser, void* user_data);
4117 [Version (since = "2.18")]
4118 public void* pop ();
4119 [Version (since = "2.18")]
4120 public void* get_user_data ();
4123 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;
4125 public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
4127 public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
4129 public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
4131 public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
4133 public struct MarkupParser {
4134 [CCode (delegate_target = false)]
4135 public unowned MarkupParserStartElementFunc start_element;
4136 [CCode (delegate_target = false)]
4137 public unowned MarkupParserEndElementFunc end_element;
4138 [CCode (delegate_target = false)]
4139 public unowned MarkupParserTextFunc text;
4140 [CCode (delegate_target = false)]
4141 public unowned MarkupParserPassthroughFunc passthrough;
4142 [CCode (delegate_target = false)]
4143 public unowned MarkupParserErrorFunc error;
4147 [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)]
4148 public enum CollectType {
4157 public static string escape_text (string text, ssize_t length = -1);
4158 [Version (since = "2.4")]
4160 public static string printf_escaped (string format, ...);
4161 [Version (since = "2.4")]
4162 public static string vprintf_escaped (string format, va_list args);
4163 [Version (since = "2.16")]
4164 [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")]
4165 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;
4168 /* Key-value file parser */
4170 public errordomain KeyFileError {
4177 public static GLib.Quark quark ();
4181 [Version (since = "2.32")]
4182 [CCode (ref_function = "g_key_file_ref", unref_function = "g_key_file_unref", type_id = "G_TYPE_KEY_FILE")]
4183 public class KeyFile {
4185 public void set_list_separator (char separator);
4186 [Version (since = "2.50")]
4187 public bool load_from_bytes (Bytes bytes, KeyFileFlags @flags) throws KeyFileError;
4188 public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError;
4189 [Version (since = "2.14")]
4190 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;
4191 public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError;
4192 public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
4193 // g_key_file_to_data never throws an error according to the documentation
4194 public string to_data (out size_t length = null, out GLib.Error error = null);
4195 public string get_start_group ();
4196 [CCode (array_length_type = "gsize")]
4197 public string[] get_groups ();
4198 [CCode (array_length_type = "gsize")]
4199 public string[] get_keys (string group_name) throws KeyFileError;
4200 public bool has_group (string group_name);
4201 public bool has_key (string group_name, string key) throws KeyFileError;
4202 public string get_value (string group_name, string key) throws KeyFileError;
4203 public string get_string (string group_name, string key) throws KeyFileError;
4204 public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError;
4205 [Version (since = "2.56")]
4206 public string? get_locale_for_key (string group_name, string key, string? locale = null);
4207 public bool get_boolean (string group_name, string key) throws KeyFileError;
4208 public int get_integer (string group_name, string key) throws KeyFileError;
4209 [Version (since = "2.26")]
4210 public int64 get_int64 (string group_name, string key) throws KeyFileError;
4211 [Version (since = "2.26")]
4212 public uint64 get_uint64 (string group_name, string key) throws KeyFileError;
4213 [Version (since = "2.12")]
4214 public double get_double (string group_name, string key) throws KeyFileError;
4215 [CCode (array_length = true, array_length_type = "gsize", array_null_terminated = true)]
4216 public string[] get_string_list (string group_name, string key) throws KeyFileError;
4217 [CCode (array_length_type = "gsize")]
4218 public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError;
4219 [CCode (array_length_type = "gsize")]
4220 public bool[] get_boolean_list (string group_name, string key) throws KeyFileError;
4221 [CCode (array_length_type = "gsize")]
4222 public int[] get_integer_list (string group_name, string key) throws KeyFileError;
4223 [Version (since = "2.12")]
4224 [CCode (array_length_type = "gsize")]
4225 public double[] get_double_list (string group_name, string key) throws KeyFileError;
4226 public string get_comment (string? group_name, string? key) throws KeyFileError;
4227 [Version (since = "2.40")]
4228 public bool save_to_file (string filename) throws GLib.FileError;
4229 public void set_value (string group_name, string key, string value);
4230 public void set_string (string group_name, string key, string str);
4231 public void set_locale_string (string group_name, string key, string locale, string str);
4232 public void set_boolean (string group_name, string key, bool value);
4233 public void set_integer (string group_name, string key, int value);
4234 [Version (since = "2.26")]
4235 public void set_int64 (string group_name, string key, int64 value);
4236 [Version (since = "2.26")]
4237 public void set_uint64 (string group_name, string key, uint64 value);
4238 [Version (since = "2.12")]
4239 public void set_double (string group_name, string key, double value);
4240 public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list);
4241 public void set_locale_string_list (string group_name, string key, string locale, string[] list);
4242 public void set_boolean_list (string group_name, string key, bool[] list);
4243 public void set_integer_list (string group_name, string key, int[] list);
4244 [Version (since = "2.12")]
4245 public void set_double_list (string group_name, string key, double[] list);
4246 public void set_comment (string? group_name, string? key, string comment) throws KeyFileError;
4247 public void remove_group (string group_name) throws KeyFileError;
4248 public void remove_key (string group_name, string key) throws KeyFileError;
4249 public void remove_comment (string group_name, string key) throws KeyFileError;
4252 [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)]
4254 public enum KeyFileFlags {
4260 [Version (since = "2.14")]
4261 [CCode (cprefix = "G_KEY_FILE_DESKTOP_")]
4262 namespace KeyFileDesktop {
4263 public const string GROUP;
4264 public const string KEY_ACTIONS;
4265 public const string KEY_CATEGORIES;
4266 public const string KEY_COMMENT;
4267 public const string KEY_DBUS_ACTIVATABLE;
4268 public const string KEY_EXEC;
4269 public const string KEY_FULLNAME;
4270 public const string KEY_GENERIC_NAME;
4271 public const string KEY_GETTEXT_DOMAIN;
4272 public const string KEY_HIDDEN;
4273 public const string KEY_ICON;
4274 public const string KEY_KEYWORDS;
4275 public const string KEY_MIME_TYPE;
4276 public const string KEY_NAME;
4277 public const string KEY_NOT_SHOW_IN;
4278 public const string KEY_NO_DISPLAY;
4279 public const string KEY_ONLY_SHOW_IN;
4280 public const string KEY_PATH;
4281 public const string KEY_STARTUP_NOTIFY;
4282 public const string KEY_STARTUP_WM_CLASS;
4283 public const string KEY_TERMINAL;
4284 public const string KEY_TRY_EXEC;
4285 public const string KEY_TYPE;
4286 public const string KEY_URL;
4287 public const string KEY_VERSION;
4288 public const string TYPE_APPLICATION;
4289 public const string TYPE_DIRECTORY;
4290 public const string TYPE_LINK;
4293 /* Bookmark file parser */
4296 [Version (since = "2.12")]
4297 [CCode (free_function = "g_bookmark_file_free")]
4298 public class BookmarkFile {
4299 public BookmarkFile ();
4300 public bool load_from_file (string file) throws BookmarkFileError, FileError;
4301 public bool load_from_data (string data, size_t length) throws BookmarkFileError;
4302 public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError, FileError;
4303 public string to_data (out size_t length) throws BookmarkFileError;
4304 public bool to_file (string filename) throws BookmarkFileError, FileError;
4305 public bool has_item (string uri);
4306 public bool has_group (string uri, string group) throws BookmarkFileError;
4307 public bool has_application (string uri, string name) throws BookmarkFileError;
4308 public int get_size ();
4309 public string[] get_uris ();
4310 public string get_title (string uri) throws BookmarkFileError;
4311 public string get_description (string uri) throws BookmarkFileError;
4312 public string get_mime_type (string uri) throws BookmarkFileError;
4313 public bool get_is_private (string uri) throws BookmarkFileError;
4314 public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError;
4315 public time_t get_added (string uri) throws BookmarkFileError;
4316 public time_t get_modified (string uri) throws BookmarkFileError;
4317 public time_t get_visited (string uri) throws BookmarkFileError;
4318 public string[] get_groups (string uri) throws BookmarkFileError;
4319 public string[] get_applications (string uri) throws BookmarkFileError;
4320 public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError;
4321 public void set_title (string uri, string title);
4322 public void set_description (string uri, string description);
4323 public void set_mime_type (string uri, string mime_type);
4324 public void set_is_private (string uri, bool is_private);
4325 public void set_icon (string uri, string href, string mime_type);
4326 public void set_added (string uri, time_t added);
4327 public void set_groups (string uri, string[] groups);
4328 public void set_modified (string uri, time_t modified);
4329 public void set_visited (string uri, time_t visited);
4330 public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError;
4331 public void add_group (string uri, string group);
4332 public void add_application (string uri, string name, string exec);
4333 public bool remove_group (string uri, string group) throws BookmarkFileError;
4334 public bool remove_application (string uri, string name) throws BookmarkFileError;
4335 public bool remove_item (string uri) throws BookmarkFileError;
4336 public bool move_item (string old_uri, string new_uri) throws BookmarkFileError;
4339 public errordomain BookmarkFileError {
4348 public static GLib.Quark quark ();
4354 [CCode (cprefix = "G_TEST_", has_type_id = false)]
4355 public enum FileType {
4361 [Version (since = "2.16")]
4362 public static void minimized_result (double minimized_quantity, string format, ...);
4364 [Version (since = "2.16")]
4365 public static void maximized_result (double maximized_quantity, string format, ...);
4366 [Version (since = "2.16")]
4367 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...);
4368 public static bool quick ();
4369 public static bool slow ();
4370 public static bool thorough ();
4371 public static bool perf ();
4372 public static bool verbose ();
4373 public static bool quiet ();
4374 [Version (since = "2.16")]
4375 public static int run ();
4376 [Version (since = "2.16")]
4377 public static void add_func (string testpath, [CCode (scope = "async")] owned TestFunc test_funcvoid);
4378 [Version (since = "2.16")]
4379 public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9, scope = "async")] owned TestDataFunc test_funcvoid);
4380 [Version (since = "2.34")]
4381 public static void add_data_func_full (string testpath, [CCode (delegate_target_pos = 1.9)] owned TestDataFunc test_func);
4382 [Version (since = "2.34")]
4383 public static void assert_expected_messages ();
4384 [Version (since = "2.38")]
4385 public static string build_filename (GLib.Test.FileType file_type, params string[] path_segments);
4386 [Version (since = "2.34")]
4387 public static void expect_message (string? log_domain, LogLevelFlags log_level, string pattern);
4388 [Version (since = "2.30")]
4389 public static void fail ();
4390 [Version (since = "2.38")]
4391 public static bool failed ();
4392 [Version (since = "2.38")]
4393 public static unowned string get_dir (GLib.Test.FileType file_type);
4394 [Version (since = "2.38")]
4395 public static unowned string get_filename (GLib.Test.FileType file_type, params string[] path_segments);
4396 [Version (since = "2.38")]
4397 public static void incomplete (string? msg = null);
4398 [Version (since = "2.36")]
4399 public static bool initialized ();
4401 [Version (since = "2.16")]
4402 public static void message (string format, ...);
4403 [Version (since = "2.38")]
4404 public static void set_nonfatal_assertions ();
4405 [Version (since = "2.38")]
4406 public static void skip (string? msg = null);
4407 [Version (since = "2.38")]
4408 public static bool subprocess ();
4409 [Version (since = "2.16")]
4410 public static void bug_base (string uri_pattern);
4411 [Version (since = "2.16")]
4412 public static void bug (string bug_uri_snippet);
4413 [Version (since = "2.16")]
4414 public static void timer_start ();
4415 [Version (since = "2.16")]
4416 public static double timer_elapsed ();
4417 [Version (since = "2.16")]
4418 public static double timer_last ();
4419 [Version (since = "2.16", deprecated_since = "2.38", replacement = "trap_subprocess")]
4420 public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags);
4421 [Version (since = "2.16")]
4422 public static bool trap_has_passed ();
4423 [Version (since = "2.16")]
4424 public static bool trap_reached_timeout ();
4425 [Version (since = "2.38")]
4426 public static void trap_subprocess (string? test_path, uint64 usec_timeout, TestSubprocessFlags test_flags);
4427 [Version (since = "2.16")]
4428 public static void trap_assert_passed ();
4429 [Version (since = "2.16")]
4430 public static void trap_assert_failed ();
4431 [Version (since = "2.16")]
4432 public static void trap_assert_stdout (string soutpattern);
4433 [Version (since = "2.16")]
4434 public static void trap_assert_stdout_unmatched (string soutpattern);
4435 [Version (since = "2.16")]
4436 public static void trap_assert_stderr (string serrpattern);
4437 [Version (since = "2.16")]
4438 public static void trap_assert_stderr_unmatched (string serrpattern);
4439 [Version (since = "2.16")]
4440 public static bool rand_bit ();
4441 [Version (since = "2.16")]
4442 public static int32 rand_int ();
4443 [Version (since = "2.16")]
4444 public static int32 rand_int_range (int32 begin, int32 end);
4445 [Version (since = "2.16")]
4446 public static double rand_double ();
4447 [Version (since = "2.16")]
4448 public static double rand_double_range (double begin, double end);
4449 [Version (since = "2.22")]
4450 public static void log_set_fatal_handler (LogFatalFunc log_func);
4453 public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message);
4456 [CCode (cname = "GTestCase", ref_function = "", unref_function = "")]
4457 public class TestCase {
4458 [Version (since = "2.16")]
4459 [CCode (cname = "g_test_create_case")]
4460 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);
4464 [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")]
4465 public class TestSuite {
4466 [Version (since = "2.16")]
4467 [CCode (cname = "g_test_create_suite")]
4468 public TestSuite (string name);
4469 [Version (since = "2.16")]
4470 [CCode (cname = "g_test_get_root")]
4471 public static TestSuite get_root ();
4472 [Version (since = "2.16")]
4473 [CCode (cname = "g_test_suite_add")]
4474 public void add (TestCase test_case);
4475 [Version (since = "2.16")]
4476 [CCode (cname = "g_test_suite_add_suite")]
4477 public void add_suite (TestSuite test_suite);
4480 [Version (since = "2.26")]
4481 [CCode (has_target = false)]
4482 public delegate void TestFunc ();
4483 [Version (since = "2.26")]
4484 public delegate void TestDataFunc ();
4485 [Version (since = "2.26")]
4486 public delegate void TestFixtureFunc (void* fixture);
4488 [CCode (cprefix = "G_TEST_SUBPROCESS_INHERIT_", has_type_id = false)]
4490 public enum TestSubprocessFlags {
4497 [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)]
4498 public enum TestTrapFlags {
4504 /* Doubly-Linked Lists */
4507 [CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
4508 public class List<G> {
4511 [ReturnsModifiedPointer ()]
4512 public void append (owned G data);
4513 [ReturnsModifiedPointer ()]
4514 public void prepend (owned G data);
4515 [ReturnsModifiedPointer ()]
4516 public void insert (owned G data, int position);
4517 [ReturnsModifiedPointer ()]
4518 public void insert_before (List<G> sibling, owned G data);
4519 [ReturnsModifiedPointer ()]
4520 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
4521 [ReturnsModifiedPointer ()]
4522 public void remove (G data);
4523 [ReturnsModifiedPointer ()]
4524 public void remove_link (List<G> llink);
4525 [ReturnsModifiedPointer ()]
4526 public void delete_link (List<G> link_);
4527 [ReturnsModifiedPointer ()]
4528 public void remove_all (G data);
4530 public uint length ();
4531 public List<unowned G> copy ();
4532 [Version (since = "2.34")]
4533 public List<G> copy_deep (CopyFunc<G> func);
4534 [ReturnsModifiedPointer ()]
4535 public void reverse ();
4536 [ReturnsModifiedPointer ()]
4537 public void sort (CompareFunc<G> compare_func);
4538 [Version (since = "2.10")]
4539 [ReturnsModifiedPointer ()]
4540 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
4541 [ReturnsModifiedPointer ()]
4542 public void sort_with_data (CompareDataFunc<G> compare_func);
4543 [ReturnsModifiedPointer ()]
4544 public void concat (owned List<G> list2);
4545 public void @foreach (Func<G> func);
4547 public unowned List<G> first ();
4548 public unowned List<G> last ();
4549 public unowned List<G> nth (uint n);
4550 public unowned G nth_data (uint n);
4551 public unowned List<G> nth_prev (uint n);
4553 public unowned List<G> find (G data);
4554 public unowned List<G> find_custom (G data, CompareFunc<G> func);
4555 [CCode (cname = "g_list_find_custom", simple_generics = true)]
4556 public unowned List<G> search<T> (T data, SearchFunc<G,T> func);
4558 public int position (List<G> llink);
4559 public int index (G data);
4562 public List<G> next;
4563 public unowned List<G> prev;
4566 /* Singly-Linked Lists */
4569 [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
4570 public class SList<G> {
4573 [ReturnsModifiedPointer ()]
4574 public void append (owned G data);
4575 [ReturnsModifiedPointer ()]
4576 public void prepend (owned G data);
4577 [ReturnsModifiedPointer ()]
4578 public void insert (owned G data, int position);
4579 [ReturnsModifiedPointer ()]
4580 public void insert_before (SList<G> sibling, owned G data);
4581 [ReturnsModifiedPointer ()]
4582 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
4583 [ReturnsModifiedPointer ()]
4584 public void remove (G data);
4585 [ReturnsModifiedPointer ()]
4586 public void remove_link (SList<G> llink);
4587 [ReturnsModifiedPointer ()]
4588 public void delete_link (SList<G> link_);
4589 [ReturnsModifiedPointer ()]
4590 public void remove_all (G data);
4592 public uint length ();
4593 public SList<unowned G> copy ();
4594 [Version (since = "2.34")]
4595 public SList<G> copy_deep (CopyFunc<G> func);
4596 [ReturnsModifiedPointer ()]
4597 public void reverse ();
4598 [Version (since = "2.10")]
4599 [ReturnsModifiedPointer ()]
4600 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
4601 [ReturnsModifiedPointer ()]
4602 public void sort (CompareFunc<G> compare_func);
4603 [ReturnsModifiedPointer ()]
4604 public void sort_with_data (CompareDataFunc<G> compare_func);
4605 [ReturnsModifiedPointer ()]
4606 public void concat (owned SList<G> list2);
4607 public void @foreach (Func<G> func);
4609 public unowned SList<G> last ();
4610 public unowned SList<G> nth (uint n);
4611 public unowned G nth_data (uint n);
4613 public unowned SList<G> find (G data);
4614 public unowned SList<G> find_custom (G data, CompareFunc<G> func);
4615 [CCode (cname = "g_slist_find_custom", simple_generics = true)]
4616 public unowned SList<G> search<T> (T data, SearchFunc<G,T> func);
4618 public int position (SList<G> llink);
4619 public int index (G data);
4622 public SList<G> next;
4625 [CCode (has_target = false)]
4626 public delegate int CompareFunc<G> (G a, G b);
4628 public delegate int CompareDataFunc<G> (G a, G b);
4630 [Version (since = "2.16")]
4631 [CCode (cname = "g_strcmp0")]
4632 public static GLib.CompareFunc<string> strcmp;
4634 public delegate G CopyFunc<G> (G src);
4636 [CCode (cname = "GCompareFunc", has_target = false)]
4637 public delegate int SearchFunc<G,T> (G a, T b);
4639 /* Double-ended Queues */
4642 [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
4643 public class Queue<G> {
4644 public unowned List<G> head;
4645 public unowned List<G> tail;
4650 [Version (since = "2.14")]
4651 public void clear ();
4652 public bool is_empty ();
4653 [Version (since = "2.4")]
4654 public uint get_length ();
4655 [Version (since = "2.4")]
4656 public void reverse ();
4657 public Queue copy ();
4658 [Version (since = "2.4")]
4659 public unowned List<G> find (G data);
4660 [Version (since = "2.4")]
4661 public unowned List<G> find_custom (G data, CompareFunc<G> func);
4662 [CCode (cname = "g_queue_find_custom", simple_generics = true)]
4663 public unowned List<G> search<T> (T data, SearchFunc<G,T> func);
4664 [Version (since = "2.4")]
4665 public void sort (CompareDataFunc<G> compare_func);
4666 public void push_head (owned G data);
4667 public void push_tail (owned G data);
4668 [Version (since = "2.4")]
4669 public void push_nth (owned G data, int n);
4670 public G pop_head ();
4671 public G pop_tail ();
4672 [Version (since = "2.4")]
4673 public G pop_nth (uint n);
4674 public unowned G peek_head ();
4675 public unowned G peek_tail ();
4676 [Version (since = "2.4")]
4677 public unowned G peek_nth (uint n);
4678 [Version (since = "2.4")]
4679 public int index (G data);
4680 [Version (since = "2.4")]
4681 public bool remove (G data);
4682 [Version (since = "2.4")]
4683 public uint remove_all (G data);
4684 [Version (since = "2.4")]
4685 public void delete_link (List<G> link);
4686 [Version (since = "2.4")]
4687 public void unlink (List<G> link);
4688 [Version (since = "2.4")]
4689 public void insert_before (List<G> sibling, owned G data);
4690 [Version (since = "2.4")]
4691 public void insert_after (List<G> sibling, owned G data);
4692 [Version (since = "2.4")]
4693 public void insert_sorted (owned G data, CompareDataFunc<G> func);
4699 [Version (since = "2.14")]
4700 [CCode (free_function = "g_sequence_free")]
4701 public class Sequence<G> {
4702 [CCode (simple_generics = true)]
4704 public int get_length ();
4705 public void @foreach (Func<G> func);
4706 public void sort (CompareDataFunc<G> cmp_func);
4707 public void sort_iter (SequenceIterCompareFunc<G> func);
4708 public SequenceIter<G> get_begin_iter ();
4709 public SequenceIter<G> get_end_iter ();
4710 public SequenceIter<G> get_iter_at_pos (int pos);
4711 public SequenceIter<G> append (owned G data);
4712 public SequenceIter<G> prepend (owned G data);
4713 public SequenceIter<G> insert_sorted (owned G data, CompareDataFunc<G> cmp_func);
4714 [Version (since = "2.48")]
4715 public bool is_empty ();
4716 public SequenceIter<G> insert_sorted_iter (owned G data, SequenceIterCompareFunc<G> iter_cmp);
4717 public SequenceIter<G> search (G data, CompareDataFunc<G> cmp_func);
4718 public SequenceIter<G> search_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
4719 [Version (since = "2.28")]
4720 public SequenceIter<G> lookup (G data, CompareDataFunc<G> cmp_func);
4721 [Version (since = "2.28")]
4722 public SequenceIter<G> lookup_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
4724 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.foreach_range")]
4725 public static void foreach_range (SequenceIter<G> begin, SequenceIter<G> end, Func<G> func);
4726 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.insert_before")]
4727 public static SequenceIter<G> insert_before (SequenceIter<G> iter, owned G data);
4728 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.move_to")]
4729 public static void move (SequenceIter<G> src, SequenceIter<G> dest);
4730 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.swap")]
4731 public static void swap (SequenceIter<G> src, SequenceIter<G> dest);
4732 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.sort_changed")]
4733 public static void sort_changed (SequenceIter<G> iter, CompareDataFunc<G> cmp_func);
4734 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.sort_changed_iter")]
4735 public static void sort_changed_iter (SequenceIter<G> iter, SequenceIterCompareFunc<G> iter_cmp);
4736 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.remove")]
4737 public static void remove (SequenceIter<G> iter);
4738 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.remove_range")]
4739 public static void remove_range (SequenceIter<G> begin, SequenceIter<G> end);
4740 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.move_range")]
4741 public static void move_range (SequenceIter<G> dest, SequenceIter<G> begin, SequenceIter<G> end);
4742 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.get")]
4743 public static unowned G get (SequenceIter<G> iter);
4744 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.set")]
4745 public static void set (SequenceIter<G> iter, owned G data);
4746 [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.range_get_midpoint")]
4747 public static SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
4751 [Version (since = "2.14")]
4752 [CCode (ref_function = "", unref_function = "")]
4753 public class SequenceIter<G> {
4754 public bool is_begin ();
4755 public bool is_end ();
4756 public SequenceIter<G> next ();
4757 public SequenceIter<G> prev ();
4758 public int get_position ();
4759 public SequenceIter<G> move (int delta);
4760 public unowned Sequence<G> get_sequence ();
4761 public int compare (SequenceIter<G> other);
4763 [CCode (cname = "g_sequence_foreach_range")]
4764 public void foreach_range (SequenceIter<G> end, Func<G> func);
4765 [CCode (cname = "g_sequence_insert_before")]
4766 public SequenceIter<G> insert_before (owned G data);
4767 [CCode (cname = "g_sequence_move")]
4768 public void move_to (SequenceIter<G> dest);
4769 [CCode (cname = "g_sequence_swap")]
4770 public void swap (SequenceIter<G> dest);
4771 [CCode (cname = "g_sequence_sort_changed")]
4772 public void sort_changed (CompareDataFunc<G> cmp_func);
4773 [CCode (cname = "g_sequence_sort_changed_iter")]
4774 public void sort_changed_iter (SequenceIterCompareFunc<G> iter_cmp);
4775 [CCode (cname = "g_sequence_remove")]
4776 public void remove ();
4777 [CCode (cname = "g_sequence_remove_range")]
4778 public void remove_range (SequenceIter<G> end);
4779 [CCode (cname = "g_sequence_move_range")]
4780 public void move_range (SequenceIter<G> begin, SequenceIter<G> end);
4781 [CCode (cname = "g_sequence_get")]
4782 public unowned G get ();
4783 [CCode (cname = "g_sequence_set")]
4784 public void set (owned G data);
4785 [CCode (cname = "g_sequence_range_get_midpoint")]
4786 public SequenceIter<G> range_get_midpoint (SequenceIter<G> end);
4789 public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
4794 [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
4795 public class HashTable<K,V> {
4796 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
4797 public HashTable (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func);
4798 public HashTable.full (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
4799 public void insert (owned K key, owned V value);
4800 public void replace (owned K key, owned V value);
4801 [Version (since = "2.32", deprecated_since = "vala-0.26", replacement = "GenericSet.add")]
4802 public void add (owned K key);
4803 public unowned V? lookup (K key);
4804 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
4805 [Version (since = "2.32")]
4806 public bool contains (K key);
4807 public bool remove (K key);
4808 [Version (since = "2.12")]
4809 public void remove_all ();
4810 public uint foreach_remove (HRFunc<K,V> predicate);
4811 public uint foreach_steal (HRFunc<K,V> predicate);
4812 [CCode (cname = "g_hash_table_lookup")]
4813 public unowned V? @get (K key);
4814 [CCode (cname = "g_hash_table_insert")]
4815 public void @set (owned K key, owned V value);
4816 [Version (since = "2.14")]
4817 public List<unowned K> get_keys ();
4819 [Version (since = "2.40")]
4820 public (unowned K)[] get_keys_as_array ();
4822 [Version (since = "2.14")]
4823 public List<unowned V> get_values ();
4824 public void @foreach (HFunc<K,V> func);
4825 [CCode (cname = "g_hash_table_foreach")]
4826 public void for_each (HFunc<K,V> func);
4827 [Version (since = "2.4")]
4828 public unowned V? find (HRFunc<K,V> predicate);
4829 public uint size ();
4830 public bool steal (K key);
4831 [Version (since = "2.12")]
4832 public void steal_all ();
4833 [Version (since = "2.58")]
4834 public bool steal_extended (K lookup_key, out K stolen_key, out V stolen_value);
4835 [CCode (cname = "_vala_g_hash_table_take")]
4836 public V? take (K key, out bool exists = null) {
4837 GLib.HashTable<K,V>? ht = null;
4839 *htp = this.lookup (key);
4840 exists = this.steal (key);
4843 public uint length {
4844 [CCode (cname = "g_hash_table_size")]
4849 [Version (since = "2.16")]
4850 public struct HashTableIter<K,V> {
4851 public HashTableIter (GLib.HashTable<K,V> table);
4852 public bool next ([CCode (type = "gpointer*")] out unowned K key, [CCode (type = "gpointer*")] out unowned V value);
4853 public void remove ();
4854 public void steal ();
4855 public unowned GLib.HashTable<K,V> get_hash_table ();
4858 [Version (since = "2.32")]
4859 [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}")]
4860 public class GenericSet<T> {
4861 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
4862 public GenericSet (HashFunc<T>? hash_func, EqualFunc<T>? equal_func, GLib.DestroyNotify? always_pass_null_here = null);
4863 public void add (owned T value);
4864 public bool contains (T valule);
4865 public bool remove (T value);
4866 public void remove_all ();
4867 public GLib.List<unowned T> get_values ();
4868 [CCode (cname = "g_hash_table_iter_init", instance_pos = -1)]
4869 public GLib.GenericSetIter<T> iterator ();
4870 [CCode (cname = "_vala_g_hash_set_foreach")]
4871 public void @foreach (GLib.Func<T> func) {
4872 ((GLib.HashTable<unowned T,T>) this).foreach ((k, v) => func (v));
4874 public uint length {
4875 [CCode (cname = "g_hash_table_size")]
4880 [Version (since = "2.32")]
4881 [CCode (cname = "GHashTableIter", lower_case_cprefix = "g_hash_table_iter_")]
4882 public struct GenericSetIter<T> {
4883 [CCode (cname = "_vala_hash_set_next_value")]
4884 public unowned T? next_value () {
4886 GLib.HashTableIter<unowned T,T>* htp = vi;
4888 return htp->next (out value, null) ? value : null;
4890 public void remove ();
4893 [CCode (has_target = false)]
4894 public delegate uint HashFunc<K> (K key);
4895 [CCode (has_target = false)]
4896 public delegate bool EqualFunc<G> (G a, G b);
4897 public delegate void HFunc<K,V> (K key, V value);
4898 public delegate bool HRFunc<K,V> (K key, V value);
4900 [CCode (has_target = false)]
4901 public delegate void DestroyNotify (void* data);
4903 [CCode (cname = "g_direct_hash")]
4904 public static GLib.HashFunc<void*> direct_hash;
4905 [CCode (cname = "g_direct_equal")]
4906 public static GLib.EqualFunc<void*> direct_equal;
4907 [CCode (cname = "g_int64_hash")]
4908 public static GLib.HashFunc<int64?> int64_hash;
4909 [Version (since = "2.22")]
4910 [CCode (cname = "g_int64_equal")]
4911 public static GLib.EqualFunc<int64?> int64_equal;
4912 [Version (since = "2.22")]
4913 [CCode (cname = "g_int_hash")]
4914 public static GLib.HashFunc<int?> int_hash;
4915 [CCode (cname = "g_int_equal")]
4916 public static GLib.EqualFunc<int?> int_equal;
4917 [CCode (cname = "g_str_hash")]
4918 public static GLib.HashFunc<string> str_hash;
4919 [CCode (cname = "g_str_equal")]
4920 public static GLib.EqualFunc<string> str_equal;
4921 [CCode (cname = "g_free")]
4922 public static GLib.DestroyNotify g_free;
4923 [CCode (cname = "g_object_unref")]
4924 public static GLib.DestroyNotify g_object_unref;
4925 [CCode (cname = "g_list_free")]
4926 public static GLib.DestroyNotify g_list_free;
4927 [CCode (cname = "((GDestroyNotify) g_variant_unref)")]
4928 public static GLib.DestroyNotify g_variant_unref;
4933 [GIR (name = "String")]
4934 [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
4935 public class StringBuilder {
4936 public StringBuilder (string init = "");
4937 [CCode (cname = "g_string_sized_new")]
4938 public StringBuilder.sized (size_t dfl_size);
4939 public unowned StringBuilder assign (string rval);
4940 public unowned StringBuilder append (string val);
4941 public unowned StringBuilder append_c (char c);
4942 public unowned StringBuilder append_unichar (unichar wc);
4943 public unowned StringBuilder append_len (string val, ssize_t len);
4944 public unowned StringBuilder prepend (string val);
4945 public unowned StringBuilder prepend_c (char c);
4946 public unowned StringBuilder prepend_unichar (unichar wc);
4947 public unowned StringBuilder prepend_len (string val, ssize_t len);
4948 public unowned StringBuilder insert (ssize_t pos, string val);
4949 public unowned StringBuilder insert_len (ssize_t pos, string val, ssize_t len);
4950 public unowned StringBuilder insert_unichar (ssize_t pos, unichar wc);
4951 [Version (since = "2.14")]
4952 public unowned StringBuilder overwrite (size_t pos, string val);
4953 [Version (since = "2.14")]
4954 public unowned StringBuilder overwrite_len (size_t pos, string val, ssize_t len);
4955 public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
4956 public unowned StringBuilder truncate (size_t len = 0);
4959 public void printf (string format, ...);
4961 public void append_printf (string format, ...);
4962 [Version (since = "2.14")]
4963 public void vprintf (string format, va_list args);
4964 [Version (since = "2.14")]
4965 public void append_vprintf (string format, va_list args);
4969 public ssize_t allocated_len;
4971 public uint8[] data {
4973 unowned uint8[] res = (uint8[]) this.str;
4974 res.length = (int) this.len;
4979 [Version (since = "2.34")]
4980 public static Bytes free_to_bytes (owned StringBuilder str);
4986 [CCode (free_function = "g_string_chunk_free")]
4987 public class StringChunk {
4988 public StringChunk (size_t size);
4989 public unowned string insert (string str);
4990 public unowned string insert_const (string str);
4991 [Version (since = "2.4")]
4992 public unowned string insert_len (string str, ssize_t len);
4993 [Version (since = "2.14")]
4994 public void clear ();
4997 /* Pointer Arrays */
5000 [Version (since = "2.22", deprecated_since = "vala-0.26", replacement="GenericArray")]
5001 [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
5002 public class PtrArray {
5004 [Version (since = "2.22")]
5005 public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func);
5006 [CCode (cname = "g_ptr_array_sized_new")]
5007 public PtrArray.sized (uint reserved_size);
5008 public void add (void* data);
5009 [Version (since = "2.4")]
5010 public void foreach (GLib.Func<void*> func);
5011 [CCode (cname = "g_ptr_array_index")]
5012 public void* index(uint index);
5013 public bool remove (void* data);
5014 public void* remove_index (uint index);
5015 public bool remove_fast (void *data);
5016 public void remove_index_fast (uint index);
5017 [Version (since = "2.4")]
5018 public void remove_range (uint index, uint length);
5019 public void sort (CompareFunc<void**> compare_func);
5020 public void sort_with_data (CompareDataFunc<void**> compare_func);
5021 [Version (since = "2.22")]
5022 public void set_free_func (GLib.DestroyNotify? element_free_function);
5023 public void set_size (int length);
5026 public void** pdata;
5030 [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")]
5031 [GIR (name = "PtrArray")]
5032 public class GenericArray<G> {
5033 [Version (since = "2.30")]
5034 [CCode (cname = "g_ptr_array_new_full", simple_generics = true)]
5035 public GenericArray (uint reserved_size = 0);
5036 public void add (owned G data);
5037 [Version (since = "2.54")]
5038 public bool find (G needle, out uint index = null);
5039 [Version (since = "2.54")]
5040 public bool find_with_equal_func (G needle, GLib.EqualFunc<G>? equal_func, out uint index = null);
5041 public void foreach (GLib.Func<G> func);
5042 [CCode (cname = "g_ptr_array_index")]
5043 public unowned G get (uint index);
5044 [Version (since = "2.40")]
5045 public void insert (int index, owned G data);
5046 public bool remove (G data);
5047 public void remove_index (uint index);
5048 public bool remove_fast (G data);
5049 public void remove_index_fast (uint index);
5050 public void remove_range (uint index, uint length);
5051 public void set (uint index, owned G data) {
5052 this.add ((owned) data);
5053 this.remove_index_fast (index);
5055 [CCode (cname = "vala_g_ptr_array_sort")]
5056 public void sort (GLib.CompareFunc<G> compare_func) {
5057 this._sort_with_data ((a, b) => {
5058 return compare_func ((G**) (*a), (G**) (*b));
5061 [CCode (cname = "g_ptr_array_sort_with_data")]
5062 public void _sort_with_data (GLib.CompareDataFunc<G**> compare_func);
5063 [CCode (cname = "vala_g_ptr_array_sort_with_data")]
5064 public void sort_with_data (GLib.CompareDataFunc<G> compare_func) {
5065 this._sort_with_data ((a, b) => {
5066 return compare_func ((G**) (*a), (G**) (*b));
5069 [Version (since = "2.58")]
5070 public G steal_index (uint index);
5071 [Version (since = "2.58")]
5072 public G steal_index_fast (uint index);
5074 private void set_size (int length);
5077 get { return (int) this.len; }
5078 set { this.set_size (value); }
5081 [CCode (cname = "pdata", array_length_cname = "len", array_length_type = "guint")]
5088 [Version (since = "2.32")]
5089 [CCode (cprefix = "g_bytes_", ref_function = "g_bytes_ref", unref_function = "g_bytes_unref", type_id = "G_TYPE_BYTES")]
5090 public class Bytes {
5091 public Bytes ([CCode (array_length_type = "gsize")] uint8[] data);
5092 public Bytes.take ([CCode (array_length_type = "gsize")] owned uint8[] data);
5093 public Bytes.static ([CCode (array_length_type = "gsize")] uint8[] data);
5094 public Bytes.with_free_func ([CCode (array_length_type = "gsize")] owned uint8[] data, GLib.DestroyNotify? free_func, void* user_data);
5095 public Bytes.from_bytes (GLib.Bytes bytes, size_t offset, size_t length);
5097 [CCode (cname = "g_bytes_new_with_free_func", simple_generics = true)]
5098 public static Bytes new_with_owner<T> ([CCode (array_length_type = "gsize")] uint8[] data, [CCode (destroy_notify_pos = 1.9)] owned T? owner = null);
5100 [CCode (array_length_type = "gsize")]
5101 public unowned uint8[] get_data ();
5102 public size_t get_size ();
5103 public uint hash ();
5104 public int compare (GLib.Bytes bytes2);
5105 public static uint8[] unref_to_data (owned GLib.Bytes bytes);
5106 public static GLib.ByteArray unref_to_array (owned GLib.Bytes bytes);
5108 [CCode (cname = "_vala_g_bytes_get")]
5109 public uint8 get (int index) {
5110 unowned uint8[] data = this.get_data ();
5114 [CCode (cname = "_vala_g_bytes_slice")]
5115 public GLib.Bytes slice (size_t start, size_t end) {
5116 return new GLib.Bytes.from_bytes (this, start, end - start);
5120 [CCode (cname = "_vala_g_bytes_get_length")]
5122 return (int) this.get_size ();
5130 [Version (since = "2.22")]
5131 [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")]
5132 public class ByteArray {
5133 public ByteArray ();
5134 [CCode (cname = "g_byte_array_sized_new")]
5135 public ByteArray.sized (uint reserved_size);
5136 [Version (since = "2.32")]
5137 public ByteArray.take (owned uint8[] data);
5138 public void append (uint8[] data);
5139 [Version (since = "2.32")]
5140 public static GLib.Bytes free_to_bytes (owned GLib.ByteArray array);
5141 public void prepend (uint8[] data);
5142 public void remove_index (uint index);
5143 public void remove_index_fast (uint index);
5144 [Version (since = "2.4")]
5145 public void remove_range (uint index, uint length);
5146 public void sort (CompareFunc<int8> compare_func);
5147 public void sort_with_data (CompareDataFunc<int8> compare_func);
5148 public void set_size (uint length);
5151 [CCode (array_length_cname = "len", array_length_type = "guint")]
5152 public uint8[] data;
5157 public delegate bool NodeTraverseFunc (Node node);
5158 public delegate void NodeForeachFunc (Node node);
5160 [CCode (cprefix = "G_TRAVERSE_")]
5161 public enum TraverseFlags {
5171 [CCode (dup_function = "g_node_copy", free_function = "g_node_destroy")]
5172 public class Node<G> {
5173 public Node(owned G? data = null);
5174 public Node<unowned G> copy ();
5175 public Node<G> copy_deep (CopyFunc<G> copy_func);
5176 public unowned Node<G> insert (int position, owned Node<G> node);
5177 public unowned Node<G> insert_before (Node<G> sibling, owned Node<G> node);
5178 public unowned Node<G> insert_after (Node<G> sibling, owned Node<G> node);
5179 public unowned Node<G> append (owned Node<G> node);
5180 public unowned Node<G> prepend (owned Node<G> node);
5181 public unowned Node<G> insert_data (int position, owned G data);
5182 public unowned Node<G> insert_data_before (Node<G> sibling, owned G data);
5183 public unowned Node<G> append_data (owned G data);
5184 public unowned Node<G> prepend_data (owned G data);
5185 public void reverse_children ();
5186 public void traverse (TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func);
5187 public void children_foreach (TraverseFlags flags, NodeForeachFunc func);
5188 public unowned Node<G> get_root ();
5189 public unowned Node<G> find (TraverseType order, TraverseFlags flags, G data);
5190 public unowned Node<G> find_child (TraverseFlags flags, G data);
5191 public int child_index (G data);
5192 public int child_position (Node<G> child);
5193 public unowned Node<G> first_child ();
5194 public unowned Node<G> last_child ();
5195 public unowned Node<G> nth_child (uint n);
5196 public unowned Node<G> first_sibling ();
5197 public unowned Node<G> next_sibling ();
5198 public unowned Node<G> prev_sibling ();
5199 public unowned Node<G> last_sibling ();
5201 [CCode (cname = "G_NODE_IS_LEAF")]
5202 public bool is_leaf ();
5203 [CCode (cname = "G_NODE_IS_ROOT")]
5204 public bool is_root ();
5205 public bool is_ancestor (Node<G> descendant);
5207 public uint depth ();
5208 public uint n_nodes (TraverseFlags flags);
5209 public uint n_children ();
5210 public uint max_height ();
5212 [CCode (cname = "g_node_unlink")]
5213 public void _unlink ();
5214 [CCode (cname = "g_node_unlink_vala")]
5215 public Node<G> unlink ()
5219 return (Node<G>) (owned) ptr;
5226 public Node children;
5231 [CCode (type_id = "G_TYPE_UINT")]
5232 public struct Quark : uint32 {
5233 public static Quark from_string (string str);
5234 public static Quark try_string (string str);
5235 public unowned string to_string ();
5238 /* Keyed Data Lists */
5240 [CCode (cname = "GData*")]
5241 public struct Datalist<G> {
5243 public void clear ();
5244 [Version (since = "2.34")]
5245 public G id_dup_data (Quark key_id, DuplicateFunc<G> dup_func);
5246 public unowned G id_get_data (Quark key_id);
5247 public void id_set_data (Quark key_id, owned G data);
5248 public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
5249 public void id_remove_data (Quark key_id);
5250 public G id_remove_no_notify (Quark key_id);
5251 [Version (since = "2.34")]
5252 public bool id_replace_data (Quark key_id, G oldval, owned G newval, GLib.DestroyNotify? destroy, out GLib.DestroyNotify? old_destroy);
5253 public void @foreach (DataForeachFunc<G> func);
5254 public unowned G get_data (string key);
5255 public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
5256 public G remove_no_notify (string key);
5257 public void set_data (string key, owned G data);
5258 public void remove_data (string key);
5261 public delegate void DataForeachFunc<G> (Quark key_id, G data);
5262 public delegate G DuplicateFunc<G> (G data);
5267 [Version (since = "2.22")]
5268 [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")]
5269 public class Array<G> {
5270 [CCode (cname = "len")]
5272 [CCode (cname = "data", array_length_cname = "len", array_length_type = "uint")]
5275 public Array (bool zero_terminated = true, bool clear = true, ulong element_size = 0);
5276 [CCode (cname = "g_array_sized_new")]
5277 public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
5278 public void append_val (owned G value);
5279 public void append_vals (void* data, uint len);
5280 public void prepend_val (owned G value);
5281 public void prepend_vals (void* data, uint len);
5282 public void insert_val (uint index, owned G value);
5283 public void insert_vals (uint index, void* data, uint len);
5284 [CCode (cname = "g_array_remove_index")]
5285 public void _remove_index (uint index);
5286 [CCode (cname = "g_array_remove_index_fast")]
5287 public void _remove_index_fast (uint index);
5288 [CCode (cname = "g_array_remove_range")]
5289 public void _remove_range (uint index, uint length);
5290 [CCode (cname = "vala_g_array_remove_index")]
5291 public G remove_index (uint index) {
5292 assert (length > index);
5294 _remove_index (index);
5297 [CCode (cname = "vala_g_array_remove_index_fast")]
5298 public G remove_index_fast (uint index) {
5299 assert (length > index);
5301 _remove_index_fast (index);
5304 [CCode (cname = "vala_g_array_remove_range")]
5305 public G[] remove_range (uint index, uint length) {
5306 assert (this.length >= index + length);
5307 G[] ga = new G[length];
5308 for (uint i = 0; i < length; i++) {
5309 ga[i] = data[i + index];
5311 _remove_range (index, length);
5314 public void sort (CompareFunc<G> compare_func);
5315 public void sort_with_data (CompareDataFunc<G> compare_func);
5316 [CCode (generic_type_pos = 0.1)]
5317 public unowned G index (uint index);
5318 public void set_size (uint length);
5323 public delegate bool TraverseFunc<K,V> (K key, V value);
5325 [CCode (cprefix = "G_", has_type_id = false)]
5326 public enum TraverseType {
5333 public delegate int TreeSearchFunc<K> (K key);
5336 [Version (since = "2.22")]
5337 [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")]
5338 public class Tree<K,V> {
5339 [CCode (cname = "g_tree_new_full", simple_generics = true)]
5340 public Tree (CompareDataFunc<K> key_compare_func);
5341 [Version (deprecated_since = "vala-0.20", replacement = "Tree ()")]
5342 public Tree.with_data (CompareDataFunc<K> key_compare_func);
5343 public Tree.full (CompareDataFunc<K> key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
5344 public void insert (owned K key, owned V value);
5345 public void replace (owned K key, owned V value);
5346 public int nnodes ();
5347 public int height ();
5348 public unowned V lookup (K key);
5349 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
5350 public void foreach (TraverseFunc<K,V> traverse_func);
5351 public unowned V search (TreeSearchFunc<K> search_func);
5352 [CCode (cname = "g_tree_search")]
5353 public unowned V search_key (CompareFunc<K> search_func, K key);
5354 public bool remove (K key);
5355 public bool steal (K key);
5358 /* Internationalization */
5360 [Version (since = "2.4")]
5361 [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5362 public static unowned string _ ([FormatArg] string str);
5363 [Version (since = "2.4")]
5364 [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5365 public static unowned string Q_ ([FormatArg] string str);
5366 [Version (since = "2.4")]
5367 [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5368 public static unowned string N_ ([FormatArg] string str);
5369 [Version (since = "2.16")]
5370 [CCode (cname = "C_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5371 public static unowned string C_ (string context, [FormatArg] string str);
5372 [Version (since = "2.18")]
5373 [CCode (cname = "NC_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5374 public static unowned string NC_ (string context, [FormatArg] string str);
5375 [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")]
5376 public static unowned string ngettext (string msgid, [FormatArg] string msgid_plural, ulong n);
5377 [Version (since = "2.18")]
5378 [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")]
5379 public static unowned string dgettext (string? domain, [FormatArg] string msgid);
5380 [Version (since = "2.26")]
5381 [CCode (cname = "g_dcgettext", cheader_filename = "glib/gi18n-lib.h")]
5382 public static unowned string dcgettext (string? domain, [FormatArg] string msgid, int category);
5383 [Version (since = "2.18")]
5384 [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")]
5385 public static unowned string dngettext (string? domain, string msgid, [FormatArg] string msgid_plural, ulong n);
5386 [Version (since = "2.16")]
5387 [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")]
5388 public static unowned string dpgettext (string? domain, [FormatArg] string msgctxid, size_t msgidoffset);
5389 [Version (since = "2.18")]
5390 [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")]
5391 public static unowned string dpgettext2 (string? domain, string context, [FormatArg] string msgid);
5393 [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
5394 public enum LocaleCategory {
5405 [CCode (cname = "setlocale", cheader_filename = "locale.h")]
5406 public static unowned string? setlocale (LocaleCategory category = GLib.LocaleCategory.ALL, string? locale = "");
5407 [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")]
5408 public static unowned string? bindtextdomain (string domainname, string? dirname);
5409 [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")]
5410 public static unowned string? textdomain (string? domainname);
5411 [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")]
5412 public static unowned string? bind_textdomain_codeset (string domainname, string? codeset);
5413 [Version (since = "2.6")]
5414 [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)]
5415 public static unowned string[] get_language_names ();
5416 [Version (since = "2.58")]
5417 [CCode (cname = "g_get_language_names_with_category", array_length = false, array_null_terminated = true)]
5418 public static unowned string[] get_language_names_with_category (string category_name);
5419 [Version (since = "2.4")]
5420 [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")]
5421 public static unowned string strip_context (string msgid, string msgval);
5425 public class PatternSpec {
5426 public PatternSpec (string pattern);
5427 public bool equal (PatternSpec pspec);
5428 [CCode (cname = "g_pattern_match")]
5429 public bool match (uint string_length, string str, string? str_reversed);
5430 [CCode (cname = "g_pattern_match_string")]
5431 public bool match_string (string str);
5432 [CCode (cname = "g_pattern_match_simple")]
5433 public static bool match_simple (string pattern, string str);
5436 [CCode (lower_case_cprefix = "glib_version_")]
5438 [CCode (cname = "glib_major_version")]
5439 public const uint major;
5440 [CCode (cname = "glib_minor_version")]
5441 public const uint minor;
5442 [CCode (cname = "glib_micro_version")]
5443 public const uint micro;
5444 [CCode (cname = "glib_check_version")]
5445 public static unowned string? check (uint required_major, uint required_minor = 0, uint required_micro = 0);
5447 [CCode (cname = "GLIB_MAJOR_VERSION")]
5448 public const uint MAJOR;
5449 [CCode (cname = "GLIB_MINOR_VERSION")]
5450 public const uint MINOR;
5451 [CCode (cname = "GLIB_MICRO_VERSION")]
5452 public const uint MICRO;
5453 [CCode (cname = "GLIB_CHECK_VERSION")]
5454 public static bool CHECK (uint required_major, uint required_minor = 0, uint required_micro = 0);
5456 [CCode (cname = "G_ENCODE_VERSION")]
5457 public static uint encode (uint major, uint minor);
5459 public const uint CUR_STABLE;
5460 public const uint PREV_STABLE;
5461 public const uint MIN_REQUIRED;
5462 public const uint MAX_ALLOWED;
5464 public const uint @2_26;
5465 public const uint @2_28;
5466 public const uint @2_30;
5467 public const uint @2_32;
5468 public const uint @2_34;
5469 public const uint @2_36;
5470 public const uint @2_38;
5471 public const uint @2_40;
5472 public const uint @2_42;
5473 public const uint @2_44;
5474 public const uint @2_46;
5475 public const uint @2_48;
5476 public const uint @2_50;
5477 public const uint @2_52;
5478 public const uint @2_54;
5479 public const uint @2_56;
5481 [CCode (cname = "glib_binary_age")]
5482 public const uint binary_age;
5483 [CCode (cname = "glib_interface_age")]
5484 public const uint interface_age;
5488 public enum OSType {
5489 [CCode (cname = "G_WIN32_OS_ANY")]
5491 [CCode (cname = "G_WIN32_OS_WORKSTATION")]
5493 [CCode (cname = "G_WIN32_OS_SERVER")]
5496 [Version (since = "2.44")]
5497 public bool check_windows_version (int major, int minor, int spver, GLib.Win32.OSType os_type);
5499 public string error_message (int error);
5500 public string getlocale ();
5501 [Version (since = "2.16")]
5502 public string get_package_installation_directory_of_module (void* hmodule);
5503 public uint get_windows_version ();
5504 [Version (since = "2.8")]
5505 public string locale_filename_from_utf8 (string utf8filename);
5506 [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")]
5507 public bool have_widechar_api ();
5508 [CCode (cname = "G_WIN32_IS_NT_BASED")]
5509 public bool is_nt_based ();
5510 [Version (since = "2.40")]
5511 [CCode (array_length = false, array_null_terminated = true)]
5512 public string[] get_command_line ();
5517 [Version (since = "2.24")]
5518 [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
5519 public class VariantType {
5520 [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
5521 public static VariantType BOOLEAN;
5522 [CCode (cname = "G_VARIANT_TYPE_BYTE")]
5523 public static VariantType BYTE;
5524 [CCode (cname = "G_VARIANT_TYPE_INT16")]
5525 public static VariantType INT16;
5526 [CCode (cname = "G_VARIANT_TYPE_UINT16")]
5527 public static VariantType UINT16;
5528 [CCode (cname = "G_VARIANT_TYPE_INT32")]
5529 public static VariantType INT32;
5530 [CCode (cname = "G_VARIANT_TYPE_UINT32")]
5531 public static VariantType UINT32;
5532 [CCode (cname = "G_VARIANT_TYPE_INT64")]
5533 public static VariantType INT64;
5534 [CCode (cname = "G_VARIANT_TYPE_UINT64")]
5535 public static VariantType UINT64;
5536 [CCode (cname = "G_VARIANT_TYPE_HANDLE")]
5537 public static VariantType HANDLE;
5538 [CCode (cname = "G_VARIANT_TYPE_DOUBLE")]
5539 public static VariantType DOUBLE;
5540 [CCode (cname = "G_VARIANT_TYPE_STRING")]
5541 public static VariantType STRING;
5542 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")]
5543 public static VariantType OBJECT_PATH;
5544 [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")]
5545 public static VariantType SIGNATURE;
5546 [CCode (cname = "G_VARIANT_TYPE_VARIANT")]
5547 public static VariantType VARIANT;
5548 [CCode (cname = "G_VARIANT_TYPE_UNIT")]
5549 public static VariantType UNIT;
5550 [CCode (cname = "G_VARIANT_TYPE_ANY")]
5551 public static VariantType ANY;
5552 [CCode (cname = "G_VARIANT_TYPE_BASIC")]
5553 public static VariantType BASIC;
5554 [CCode (cname = "G_VARIANT_TYPE_MAYBE")]
5555 public static VariantType MAYBE;
5556 [CCode (cname = "G_VARIANT_TYPE_ARRAY")]
5557 public static VariantType ARRAY;
5558 [CCode (cname = "G_VARIANT_TYPE_TUPLE")]
5559 public static VariantType TUPLE;
5560 [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")]
5561 public static VariantType DICT_ENTRY;
5562 [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")]
5563 public static VariantType DICTIONARY;
5564 [CCode (cname = "G_VARIANT_TYPE_STRING_ARRAY")]
5565 public static VariantType STRING_ARRAY;
5566 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH_ARRAY")]
5567 public static VariantType OBJECT_PATH_ARRAY;
5568 [CCode (cname = "G_VARIANT_TYPE_BYTESTRING")]
5569 public static VariantType BYTESTRING;
5570 [CCode (cname = "G_VARIANT_TYPE_BYTESTRING_ARRAY")]
5571 public static VariantType BYTESTRING_ARRAY;
5572 [Version (since = "2.30")]
5573 [CCode (cname = "G_VARIANT_TYPE_VARDICT")]
5574 public static VariantType VARDICT;
5576 public static bool string_is_valid (string type_string);
5577 public static bool string_scan (string type_string, char *limit, out char* endptr);
5579 public VariantType (string type_string);
5580 public size_t get_string_length ();
5581 public char* peek_string ();
5582 public string dup_string ();
5584 public bool is_definite ();
5585 public bool is_container ();
5586 public bool is_basic ();
5587 public bool is_maybe ();
5588 public bool is_array ();
5589 public bool is_tuple ();
5590 public bool is_dict_entry ();
5591 public bool is_variant ();
5593 public uint hash ();
5594 public bool equal (VariantType other);
5595 public bool is_subtype_of (VariantType supertype);
5597 public unowned VariantType element ();
5598 public unowned VariantType first ();
5599 public unowned VariantType next ();
5600 public unowned VariantType n_items ();
5601 public unowned VariantType key ();
5602 public unowned VariantType value ();
5604 public VariantType.array (VariantType element);
5605 public VariantType.maybe (VariantType element);
5606 public VariantType.tuple (VariantType[] items);
5607 public VariantType.dict_entry (VariantType key, VariantType value);
5611 [Version (since = "2.24")]
5612 [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")]
5613 public class Variant {
5614 [CCode (has_type_id = false)]
5616 BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64,
5617 UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH,
5618 SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY
5621 public unowned VariantType get_type ();
5622 public unowned string get_type_string ();
5623 public bool is_of_type (VariantType type);
5624 public bool is_container ();
5625 [Version (since = "2.26")]
5626 public bool is_floating ();
5627 public Class classify ();
5628 [Version (since = "2.26")]
5629 public int compare (Variant other);
5631 public Variant.boolean (bool value);
5632 public Variant.byte (uint8 value);
5633 public Variant.int16 (int16 value);
5634 public Variant.uint16 (uint16 value);
5635 public Variant.int32 (int32 value);
5636 public Variant.uint32 (uint32 value);
5637 public Variant.int64 (int64 value);
5638 public Variant.uint64 (uint64 value);
5639 public Variant.handle (int32 value);
5640 public Variant.double (double value);
5641 public Variant.string (string value);
5642 [Version (since = "2.26")]
5643 public Variant.bytestring (string value);
5644 public Variant.object_path (string object_path);
5645 public static bool is_object_path (string object_path);
5646 public Variant.signature (string signature);
5647 public static bool is_signature (string signature);
5649 public bool get_boolean ();
5650 public uint8 get_byte ();
5651 public int16 get_int16 ();
5652 public uint16 get_uint16 ();
5653 public int32 get_int32 ();
5654 public uint32 get_uint32 ();
5655 public int64 get_int64 ();
5656 public uint64 get_uint64 ();
5657 public int32 get_handle ();
5658 public double get_double ();
5659 public unowned string get_string (out size_t length = null);
5660 public string dup_string (out size_t length = null);
5661 [Version (since = "2.26")]
5662 public unowned string get_bytestring ();
5663 [Version (since = "2.26")]
5664 public string dup_bytestring (out size_t length);
5666 public Variant.strv (string[] value);
5667 [CCode (array_length_type = "size_t")]
5669 public (unowned string)[] get_strv ();
5671 public string*[] get_strv ();
5673 [CCode (array_length_type = "size_t")]
5674 public string[] dup_strv ();
5676 [Version (since = "2.26")]
5677 public Variant.bytestring_array (string[] value);
5678 [Version (since = "2.26")]
5679 [CCode (array_length_type = "size_t")]
5681 public (unowned string)[] get_bytestring_array ();
5683 public string*[] get_bytestring_array ();
5685 [Version (since = "2.26")]
5686 [CCode (array_length_type = "size_t")]
5687 public string[] dup_bytestring_array ();
5689 [Version (since = "2.30")]
5690 public Variant.objv (string[] value);
5691 [Version (since = "2.30")]
5692 [CCode (array_length_type = "size_t")]
5694 public (unowned string)[] get_objv ();
5696 public string*[] get_objv ();
5698 [Version (since = "2.30")]
5699 [CCode (array_length_type = "size_t")]
5700 public string[] dup_objv ();
5702 public Variant (string format, ...);
5703 // note: the function changes its behaviour when end_ptr is null, so 'out char *' is wrong
5704 public Variant.va (string format, char **end_ptr, va_list *app);
5705 public void get (string format, ...);
5706 public void get_va (string format, char **end_ptr, va_list *app);
5708 public Variant.variant (Variant value);
5709 public Variant.maybe (VariantType? child_type, Variant? child);
5710 public Variant.array (VariantType? child_type, Variant[] children);
5711 [Version (since = "2.32")]
5712 [CCode (simple_generics = true)]
5713 public static Variant new_fixed_array<T> (VariantType? element_type, [CCode (array_length_type = "gsize")] T[] elements, size_t element_size);
5714 public Variant.tuple (Variant[] children);
5715 public Variant.dict_entry (Variant key, Variant value);
5716 public Variant get_variant ();
5717 public Variant? get_maybe ();
5719 public size_t n_children ();
5720 public Variant get_child_value (size_t index);
5721 public void get_child (size_t index, string format_string, ...);
5723 [Version (since = "2.28")]
5724 public Variant? lookup_value (string key, VariantType? expected_type);
5725 [Version (since = "2.28")]
5726 public bool lookup (string key, string format_string, ...);
5728 public size_t get_size ();
5729 public void *get_data ();
5730 public void store (void *data);
5732 public string print (bool type_annotate);
5733 public StringBuilder print_string (StringBuilder? builder, bool type_annotate);
5735 public uint hash ();
5736 public bool equal (Variant other);
5738 public Variant byteswap ();
5739 public Variant get_normal_form ();
5740 public bool is_normal_form ();
5741 [CCode (returns_floating_reference = true, simple_generics = true)]
5742 public static Variant new_from_data<T> (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null);
5744 [CCode (cname = "g_variant_iter_new")]
5745 public VariantIter iterator ();
5747 public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError;
5748 public Variant.parsed (string format_string, ...);
5750 [Version (since = "2.34")]
5751 public bool check_format_string (string format_string, bool copy_only);
5753 [Version (since = "2.36")]
5754 public Variant.from_bytes (VariantType type, Bytes bytes, bool trusted);
5755 [Version (since = "2.36")]
5756 public Bytes get_data_as_bytes ();
5758 [Version (since = "2.38")]
5759 public Variant.printf (string format_string, ...);
5760 [Version (since = "2.38")]
5761 public Variant.take_string (owned string str);
5763 [Version (since = "2.40")]
5764 public static void parse_error_print_context (GLib.VariantParseError error, string source_str);
5767 [Version (since = "2.24")]
5768 public errordomain VariantParseError {
5770 BASIC_TYPE_EXPECTED,
5772 DEFINITE_TYPE_EXPECTED,
5775 INVALID_FORMAT_STRING,
5776 INVALID_OBJECT_PATH,
5778 INVALID_TYPE_STRING,
5780 NUMBER_OUT_OF_RANGE,
5785 UNTERMINATED_STRING_CONSTANT,
5787 public static GLib.Quark quark ();
5791 [Version (since = "2.24")]
5792 public class VariantIter {
5793 public VariantIter (Variant value);
5794 public size_t n_children ();
5795 public Variant? next_value ();
5796 public bool next (string format_string, ...);
5800 [Version (since = "2.24")]
5801 [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref")]
5802 public class VariantBuilder {
5803 public VariantBuilder (VariantType type);
5804 public void open (VariantType type);
5805 public void close ();
5806 public void add_value (Variant value);
5807 public void add (string format_string, ...);
5808 [CCode (returns_floating_reference = true)]
5809 public Variant end ();
5812 [Version (since = "2.40")]
5813 [Compact, CCode (ref_function = "g_variant_dict_ref", unref_function = "g_variant_dict_unref")]
5814 public class VariantDict {
5815 public VariantDict (GLib.Variant? from_asv = null);
5816 public bool lookup (string key, string format_string, ...);
5817 public GLib.Variant lookup_value (string key, GLib.VariantType expected_type);
5818 public bool contains (string key);
5819 public void insert (string key, string format_string, ...);
5820 public void insert_value (string key, GLib.Variant value);
5821 public bool remove (string key);
5822 public void clear ();
5823 [CCode (returns_floating_reference = true)]
5824 public GLib.Variant end ();
5827 [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")]
5828 public class ObjectPath : string {
5829 [CCode (cname = "g_strdup")]
5830 public ObjectPath (string path);
5833 [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")]
5834 public class BusName : string {
5835 [CCode (cname = "g_strdup")]
5836 public BusName (string bus_name);
5839 [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]
5840 public static bool likely (bool expression);
5841 [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")]
5842 public static bool unlikely (bool expression);
5843 [Version (since = "2.20")]
5844 [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")]
5845 public static void static_assert (bool expression);
5847 [CCode (simple_generics = true, cname = "g_qsort_with_data")]
5848 private static void _qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func);
5850 [CCode (cname = "_vala_g_qsort_with_data")]
5851 public static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func) {
5852 _qsort_with_data<T*> (elems, size, (a, b) => {
5853 return compare_func (*a, *b);
5857 [Version (since = "2.54")]
5858 public errordomain NumberParserError {
5861 public static GLib.Quark quark ();
5864 /* Unix-specific functions. All of these have to include glib-unix.h. */
5866 [Version (since = "2.30")]
5867 [CCode (cheader_filename = "glib-unix.h", cname = "g_unix_signal_add_full")]
5868 public static uint signal_add (int signum, owned GLib.SourceFunc handler, [CCode (pos = 0.9)] int priority = Priority.DEFAULT);
5870 [CCode (cheader_filename = "glib-unix.h", cname = "GSource")]
5871 public class SignalSource : GLib.Source {
5872 public SignalSource (int signum);
5875 [Version (since = "2.30")]
5876 [CCode (cheader_filename = "glib-unix.h")]
5877 public static bool open_pipe ([CCode (array_length = false, array_null_terminated = false)] int[] fds, int flags) throws GLib.Error;
5878 [Version (since = "2.30")]
5879 [CCode (cheader_filename = "glib-unix.h")]
5880 public static bool set_fd_nonblocking (int fd, bool nonblock) throws GLib.Error;
5883 [CCode (cname = "GUnicodeScript", cprefix = "G_UNICODE_SCRIPT_", has_type_id = false)]
5884 public enum UnicodeScript {
5926 CANADIAN_ABORIGINAL,
5969 /* Unicode-5.2 additions */
5972 EGYPTIAN_HIEROGLYPHS, /* Egyp */
5973 IMPERIAL_ARAMAIC, /* Armi */
5974 INSCRIPTIONAL_PAHLAVI, /* Phli */
5975 INSCRIPTIONAL_PARTHIAN, /* Prti */
5976 JAVANESE, /* Java */
5979 MEETEI_MAYEK, /* Mtei */
5980 OLD_SOUTH_ARABIAN, /* Sarb */
5981 OLD_TURKIC, /* Orkh */
5982 SAMARITAN, /* Samr */
5983 TAI_THAM, /* Lana */
5984 TAI_VIET, /* Tavt */
5986 /* Unicode-6.0 additions */
5991 /* Unicode-6.1 additions */
5993 MEROITIC_CURSIVE, /* Merc */
5994 MEROITIC_HIEROGLYPHS, /* Mero */
5997 SORA_SOMPENG, /* Sora */
6000 /* Unicode 7.0 additions */
6001 BASSA_VAH, /* Bass */
6002 CAUCASIAN_ALBANIAN, /* Aghb */
6003 DUPLOYAN, /* Dupl */
6007 KHUDAWADI, /* Sind */
6008 LINEAR_A, /* Lina */
6009 MAHAJANI, /* Mahj */
6010 MANICHAEAN, /* Manu */
6011 MENDE_KIKAKUI, /* Mend */
6014 NABATAEAN, /* Nbat */
6015 OLD_NORTH_ARABIAN, /* Narb */
6016 OLD_PERMIC, /* Perm */
6017 PAHAWH_HMONG, /* Hmng */
6018 PALMYRENE, /* Palm */
6019 PAU_CIN_HAU, /* Pauc */
6020 PSALTER_PAHLAVI, /* Phlp */
6023 WARANG_CITI, /* Wara */
6025 /* Unicode 8.0 additions */
6027 ANATOLIAN_HIEROGLYPHS, /* Hluw */
6030 OLD_HUNGARIAN, /* Hung */
6031 SIGNWRITING, /* Sgnw */
6033 /* Unicode 9.0 additions */
6035 BHAIKSUKI, /* Bhks */
6041 /* Unicode 10.0 additions */
6042 MASARAM_GONDI, /* Gonm */
6045 ZANABAZAR_SQUARE, /* Zanb */
6047 /* Unicode 11.0 additions */
6049 GUNJALA_GONDI, /* Gong */
6050 HANIFI_ROHINGYA, /* Rohg */
6052 MEDEFAIDRIN, /* Medf */
6053 OLD_SOGDIAN, /* Sogo */
6056 [CCode (cname = "g_unicode_script_to_iso15924")]
6057 public uint32 to_iso15924 ();
6058 [CCode (cname = "g_unicode_script_from_iso15924")]
6059 public static GLib.UnicodeScript from_iso15924 (uint32 iso15924);
6062 [CCode (cname = "GUnicodeType", cprefix = "G_UNICODE_", has_type_id = false)]
6063 public enum UnicodeType {
6080 CONNECT_PUNCTUATION,
6084 INITIAL_PUNCTUATION,
6092 PARAGRAPH_SEPARATOR,
6096 [CCode (cname = "GUnicodeBreakType", cprefix = "G_UNICODE_BREAK_", has_type_id = false)]
6097 public enum UnicodeBreakType {
6133 HANGUL_LVT_SYLLABLE,
6135 CONDITIONAL_JAPANESE_STARTER,
6143 [CCode (cname = "GNormalizeMode", cprefix = "G_NORMALIZE_", has_type_id = false)]
6144 public enum NormalizeMode {