3 * Copyright (C) 2006-2011 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 () {
46 [GIR (name = "gint8")]
47 [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_char", set_value_function = "g_value_set_char", default_value = "\'\\0\'", type_signature = "y")]
48 [IntegerType (rank = 2, min = 0, max = 127)]
50 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
51 public string to_string (string format = "%c");
52 public bool isalnum ();
53 public bool isalpha ();
54 public bool iscntrl ();
55 public bool isdigit ();
56 public bool isgraph ();
57 public bool islower ();
58 public bool isprint ();
59 public bool ispunct ();
60 public bool isspace ();
61 public bool isupper ();
62 public bool isxdigit ();
63 public int digit_value ();
64 public int xdigit_value ();
65 public char tolower ();
66 public char toupper ();
68 [CCode (cname = "MIN")]
69 public static char min (char a, char b);
70 [CCode (cname = "MAX")]
71 public static char max (char a, char b);
72 [CCode (cname = "CLAMP")]
73 public char clamp (char low, char high);
77 [GIR (name = "guint8")]
78 [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")]
79 [IntegerType (rank = 3, min = 0, max = 255)]
81 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
82 public string to_string (string format = "%hhu");
84 [CCode (cname = "MIN")]
85 public static uchar min (uchar a, uchar b);
86 [CCode (cname = "MAX")]
87 public static uchar max (uchar a, uchar b);
88 [CCode (cname = "CLAMP")]
89 public uchar clamp (uchar low, uchar high);
94 [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", type_signature = "i")]
95 [IntegerType (rank = 6)]
97 [CCode (cname = "G_MININT")]
98 public static int MIN;
99 [CCode (cname = "G_MAXINT")]
100 public static int MAX;
102 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
103 public string to_string (string format = "%i");
105 [CCode (cname = "MIN")]
106 public static int min (int a, int b);
107 [CCode (cname = "MAX")]
108 public static int max (int a, int b);
109 [CCode (cname = "CLAMP")]
110 public int clamp (int low, int high);
112 [CCode (cname = "GINT_TO_POINTER")]
113 public void* to_pointer ();
115 [CCode (cname = "abs", cheader_filename = "stdlib.h")]
118 [CCode (cname = "GINT_TO_BE")]
119 public int to_big_endian ();
120 [CCode (cname = "GINT_TO_LE")]
121 public int to_little_endian ();
123 [CCode (cname = "GINT_FROM_BE")]
124 public static int from_big_endian (int val);
125 [CCode (cname = "GINT_FROM_LE")]
126 public static int from_little_endian (int val);
130 [GIR (name = "guint")]
131 [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")]
132 [IntegerType (rank = 7)]
134 [CCode (cname = "0")]
135 public static uint MIN;
136 [CCode (cname = "G_MAXUINT")]
137 public static uint MAX;
139 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
140 public string to_string (string format = "%u");
142 [CCode (cname = "MIN")]
143 public static uint min (uint a, uint b);
144 [CCode (cname = "MAX")]
145 public static uint max (uint a, uint b);
146 [CCode (cname = "CLAMP")]
147 public uint clamp (uint low, uint high);
149 [CCode (cname = "GUINT_TO_POINTER")]
150 public void* to_pointer ();
152 [CCode (cname = "GUINT_TO_BE")]
153 public uint to_big_endian ();
154 [CCode (cname = "GUINT_TO_LE")]
155 public uint to_little_endian ();
157 [CCode (cname = "GUINT_FROM_BE")]
158 public static uint from_big_endian (uint val);
159 [CCode (cname = "GUINT_FROM_LE")]
160 public static uint from_little_endian (uint val);
164 [GIR (name = "gshort")]
165 [CCode (cname = "gshort", cheader_filename = "glib.h", has_type_id = false, default_value = "0", type_signature = "n")]
166 [IntegerType (rank = 4, min = -32768, max = 32767)]
167 public struct short {
168 [CCode (cname = "G_MINSHORT")]
169 public static short MIN;
170 [CCode (cname = "G_MAXSHORT")]
171 public static short MAX;
173 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
174 public string to_string (string format = "%hi");
176 [CCode (cname = "MIN")]
177 public static short min (short a, short b);
178 [CCode (cname = "MAX")]
179 public static short max (short a, short b);
180 [CCode (cname = "CLAMP")]
181 public short clamp (short low, short high);
185 [GIR (name = "gushort")]
186 [CCode (cname = "gushort", cheader_filename = "glib.h", has_type_id = false, default_value = "0U", type_signature = "q")]
187 [IntegerType (rank = 5, min = 0, max = 65535)]
188 public struct ushort {
189 [CCode (cname = "0U")]
190 public static ushort MIN;
191 [CCode (cname = "G_MAXUSHORT")]
192 public static ushort MAX;
194 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
195 public string to_string (string format = "%hu");
197 [CCode (cname = "MIN")]
198 public static ushort min (ushort a, ushort b);
199 [CCode (cname = "MAX")]
200 public static ushort max (ushort a, ushort b);
201 [CCode (cname = "CLAMP")]
202 public ushort clamp (ushort low, ushort high);
206 [GIR (name = "glong")]
207 [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")]
208 [IntegerType (rank = 8)]
210 [CCode (cname = "G_MINLONG")]
211 public static long MIN;
212 [CCode (cname = "G_MAXLONG")]
213 public static long MAX;
215 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
216 public string to_string (string format = "%li");
218 [CCode (cname = "MIN")]
219 public static long min (long a, long b);
220 [CCode (cname = "MAX")]
221 public static long max (long a, long b);
222 [CCode (cname = "CLAMP")]
223 public long clamp (long low, long high);
224 [CCode (cname = "labs", cheader_filename = "stdlib.h")]
227 [CCode (cname = "GLONG_TO_BE")]
228 public long to_big_endian ();
229 [CCode (cname = "GLONG_TO_LE")]
230 public long to_little_endian ();
232 [CCode (cname = "GLONG_FROM_BE")]
233 public static long from_big_endian (long val);
234 [CCode (cname = "GLONG_FROM_LE")]
235 public static long from_little_endian (long val);
239 [GIR (name = "gulong")]
240 [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")]
241 [IntegerType (rank = 9)]
242 public struct ulong {
243 [CCode (cname = "0UL")]
244 public static ulong MIN;
245 [CCode (cname = "G_MAXULONG")]
246 public static ulong MAX;
248 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
249 public string to_string (string format = "%lu");
251 [CCode (cname = "MIN")]
252 public static ulong min (ulong a, ulong b);
253 [CCode (cname = "MAX")]
254 public static ulong max (ulong a, ulong b);
255 [CCode (cname = "CLAMP")]
256 public ulong clamp (ulong low, ulong high);
258 [CCode (cname = "GULONG_TO_BE")]
259 public ulong to_big_endian ();
260 [CCode (cname = "GULONG_TO_LE")]
261 public ulong to_little_endian ();
263 [CCode (cname = "GULONG_FROM_BE")]
264 public static ulong from_big_endian (ulong val);
265 [CCode (cname = "GULONG_FROM_LE")]
266 public static ulong from_little_endian (ulong val);
270 [GIR (name = "gulong")]
271 [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")]
272 [IntegerType (rank = 9)]
273 public struct size_t {
274 [CCode (cname = "0UL")]
275 public static ulong MIN;
276 [CCode (cname = "G_MAXSIZE")]
277 public static ulong MAX;
279 [CCode (cname = "G_GSIZE_FORMAT")]
280 public const string FORMAT;
281 [CCode (cname = "G_GSIZE_MODIFIER")]
282 public const string FORMAT_MODIFIER;
284 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
285 public string to_string (string format = "%" + FORMAT);
287 [CCode (cname = "GSIZE_TO_POINTER")]
288 public void* to_pointer ();
290 [CCode (cname = "MIN")]
291 public static size_t min (size_t a, size_t b);
292 [CCode (cname = "MAX")]
293 public static size_t max (size_t a, size_t b);
294 [CCode (cname = "CLAMP")]
295 public size_t clamp (size_t low, size_t high);
299 [GIR (name = "glong")]
300 [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")]
301 [IntegerType (rank = 8)]
302 public struct ssize_t {
303 [CCode (cname = "G_MINSSIZE")]
304 public static long MIN;
305 [CCode (cname = "G_MAXSSIZE")]
306 public static long MAX;
308 [CCode (cname = "G_GSSIZE_FORMAT")]
309 public const string FORMAT;
310 [CCode (cname = "G_GSIZE_MODIFIER")]
311 public const string FORMAT_MODIFIER;
313 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
314 public string to_string (string format = "%" + FORMAT);
316 [CCode (cname = "MIN")]
317 public static ssize_t min (ssize_t a, ssize_t b);
318 [CCode (cname = "MAX")]
319 public static ssize_t max (ssize_t a, ssize_t b);
320 [CCode (cname = "CLAMP")]
321 public ssize_t clamp (ssize_t low, ssize_t high);
325 [GIR (name = "gint8")]
326 [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", type_signature = "y")]
327 [IntegerType (rank = 1, min = -128, max = 127)]
329 [CCode (cname = "G_MININT8")]
330 public static int8 MIN;
331 [CCode (cname = "G_MAXINT8")]
332 public static int8 MAX;
334 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
335 public string to_string (string format = "%hhi");
337 [CCode (cname = "MIN")]
338 public static int8 min (int8 a, int8 b);
339 [CCode (cname = "MAX")]
340 public static int8 max (int8 a, int8 b);
341 [CCode (cname = "CLAMP")]
342 public int8 clamp (int8 low, int8 high);
346 [GIR (name = "guint8")]
347 [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")]
348 [IntegerType (rank = 3, min = 0, max = 255)]
349 public struct uint8 {
350 [CCode (cname = "0U")]
351 public static uint8 MIN;
352 [CCode (cname = "G_MAXUINT8")]
353 public static uint8 MAX;
355 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
356 public string to_string (string format = "%hhu");
358 [CCode (cname = "MIN")]
359 public static uint8 min (uint8 a, uint8 b);
360 [CCode (cname = "MAX")]
361 public static uint8 max (uint8 a, uint8 b);
362 [CCode (cname = "CLAMP")]
363 public uint8 clamp (uint8 low, uint8 high);
367 [GIR (name = "gint16")]
368 [CCode (cname = "gint16", cheader_filename = "glib.h", default_value = "0", type_signature = "n", has_type_id = false)]
369 [IntegerType (rank = 4, min = -32768, max = 32767)]
370 public struct int16 {
371 [CCode (cname = "G_MININT16")]
372 public static int16 MIN;
373 [CCode (cname = "G_MAXINT16")]
374 public static int16 MAX;
376 [CCode (cname = "G_GINT16_FORMAT")]
377 public const string FORMAT;
378 [CCode (cname = "G_GINT16_MODIFIER")]
379 public const string FORMAT_MODIFIER;
381 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
382 public string to_string (string format = "%" + FORMAT);
384 [CCode (cname = "MIN")]
385 public static int16 min (int16 a, int16 b);
386 [CCode (cname = "MAX")]
387 public static int16 max (int16 a, int16 b);
388 [CCode (cname = "CLAMP")]
389 public int16 clamp (int16 low, int16 high);
391 [CCode (cname = "GINT16_TO_BE")]
392 public int16 to_big_endian ();
393 [CCode (cname = "GINT16_TO_LE")]
394 public int16 to_little_endian ();
396 [CCode (cname = "GINT16_FROM_BE")]
397 public static int16 from_big_endian (int16 val);
398 [CCode (cname = "GINT16_FROM_LE")]
399 public static int16 from_little_endian (int16 val);
403 [GIR (name = "guint16")]
404 [CCode (cname = "guint16", cheader_filename = "glib.h", default_value = "0U", type_signature = "q", has_type_id = false)]
405 [IntegerType (rank = 5, min = 0, max = 65535)]
406 public struct uint16 {
407 [CCode (cname = "0U")]
408 public static uint16 MIN;
409 [CCode (cname = "G_MAXUINT16")]
410 public static uint16 MAX;
412 [CCode (cname = "G_GUINT16_FORMAT")]
413 public const string FORMAT;
414 [CCode (cname = "G_GINT16_MODIFIER")]
415 public const string FORMAT_MODIFIER;
417 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
418 public string to_string (string format = "%hu");
420 [CCode (cname = "MIN")]
421 public static uint16 min (uint16 a, uint16 b);
422 [CCode (cname = "MAX")]
423 public static uint16 max (uint16 a, uint16 b);
424 [CCode (cname = "CLAMP")]
425 public uint16 clamp (uint16 low, uint16 high);
427 [CCode (cname = "GUINT16_TO_BE")]
428 public uint16 to_big_endian ();
429 [CCode (cname = "GUINT16_TO_LE")]
430 public uint16 to_little_endian ();
432 [CCode (cname = "GUINT16_FROM_BE")]
433 public static uint16 from_big_endian (uint16 val);
434 [CCode (cname = "GUINT16_FROM_LE")]
435 public static uint16 from_little_endian (uint16 val);
437 [CCode (cname = "GUINT16_SWAP_BE_PDP")]
438 public uint16 swap_big_endian_pdp ();
439 [CCode (cname = "GUINT16_SWAP_LE_BE")]
440 public uint16 swap_little_endian_big_endian ();
441 [CCode (cname = "GUINT16_SWAP_LE_PDP")]
442 public uint16 swap_little_endian_pdp ();
446 [GIR (name = "gint32")]
447 [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", type_signature = "i")]
448 [IntegerType (rank = 6)]
449 public struct int32 {
450 [CCode (cname = "G_MININT32")]
451 public static int32 MIN;
452 [CCode (cname = "G_MAXINT32")]
453 public static int32 MAX;
455 [CCode (cname = "G_GINT32_FORMAT")]
456 public const string FORMAT;
457 [CCode (cname = "G_GINT32_MODIFIER")]
458 public const string FORMAT_MODIFIER;
460 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
461 public string to_string (string format = "%i");
463 [CCode (cname = "MIN")]
464 public static int32 min (int32 a, int32 b);
465 [CCode (cname = "MAX")]
466 public static int32 max (int32 a, int32 b);
467 [CCode (cname = "CLAMP")]
468 public int32 clamp (int32 low, int32 high);
470 [CCode (cname = "GINT32_TO_BE")]
471 public int32 to_big_endian ();
472 [CCode (cname = "GINT32_TO_LE")]
473 public int32 to_little_endian ();
475 [CCode (cname = "GINT32_FROM_BE")]
476 public static int32 from_big_endian (int32 val);
477 [CCode (cname = "GINT32_FROM_LE")]
478 public static int32 from_little_endian (int32 val);
482 [GIR (name = "guint32")]
483 [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")]
484 [IntegerType (rank = 7)]
485 public struct uint32 {
486 [CCode (cname = "0U")]
487 public static uint32 MIN;
488 [CCode (cname = "G_MAXUINT32")]
489 public static uint32 MAX;
491 [CCode (cname = "G_GUINT32_FORMAT")]
492 public const string FORMAT;
493 [CCode (cname = "G_GINT32_MODIFIER")]
494 public const string FORMAT_MODIFIER;
496 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
497 public string to_string (string format = "%u");
499 [CCode (cname = "MIN")]
500 public static uint32 min (uint32 a, uint32 b);
501 [CCode (cname = "MAX")]
502 public static uint32 max (uint32 a, uint32 b);
503 [CCode (cname = "CLAMP")]
504 public uint32 clamp (uint32 low, uint32 high);
506 [CCode (cname = "GUINT32_TO_BE")]
507 public uint32 to_big_endian ();
508 [CCode (cname = "GUINT32_TO_LE")]
509 public uint32 to_little_endian ();
511 [CCode (cname = "GUINT32_FROM_BE")]
512 public static uint32 from_big_endian (uint32 val);
513 [CCode (cname = "GUINT32_FROM_LE")]
514 public static uint32 from_little_endian (uint32 val);
516 [CCode (cname = "GUINT32_SWAP_BE_PDP")]
517 public uint32 swap_big_endian_pdp ();
518 [CCode (cname = "GUINT32_SWAP_LE_BE")]
519 public uint32 swap_little_endian_big_endian ();
520 [CCode (cname = "GUINT32_SWAP_LE_PDP")]
521 public uint32 swap_little_endian_pdp ();
525 [GIR (name = "gint64")]
526 [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", type_signature = "x")]
527 [IntegerType (rank = 10)]
528 public struct int64 {
529 [CCode (cname = "G_MININT64")]
530 public static int64 MIN;
531 [CCode (cname = "G_MAXINT64")]
532 public static int64 MAX;
534 [CCode (cname = "G_GINT64_FORMAT")]
535 public const string FORMAT;
536 [CCode (cname = "G_GINT64_MODIFIER")]
537 public const string FORMAT_MODIFIER;
539 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
540 public string to_string (string format = "%" + FORMAT);
542 [CCode (cname = "MIN")]
543 public static int64 min (int64 a, int64 b);
544 [CCode (cname = "MAX")]
545 public static int64 max (int64 a, int64 b);
546 [CCode (cname = "CLAMP")]
547 public int64 clamp (int64 low, int64 high);
548 [CCode (cname = "llabs", cheader_filename = "stdlib.h")]
551 [CCode (cname = "GINT64_TO_BE")]
552 public int64 to_big_endian ();
553 [CCode (cname = "GINT64_TO_LE")]
554 public int64 to_little_endian ();
556 [CCode (cname = "GINT64_FROM_BE")]
557 public static int64 from_big_endian (int64 val);
558 [CCode (cname = "GINT64_FROM_LE")]
559 public static int64 from_little_endian (int64 val);
561 [CCode (cname = "GUINT64_SWAP_LE_BE")]
562 public uint64 swap_little_endian_big_endian ();
566 [GIR (name = "guint64")]
567 [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")]
568 [IntegerType (rank = 11)]
569 public struct uint64 {
570 [CCode (cname = "0ULL")]
571 public static uint64 MIN;
572 [CCode (cname = "G_MAXUINT64")]
573 public static uint64 MAX;
575 [CCode (cname = "G_GUINT64_FORMAT")]
576 public const string FORMAT;
577 [CCode (cname = "G_GINT64_MODIFIER")]
578 public const string FORMAT_MODIFIER;
580 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
581 public string to_string (string format = "%" + FORMAT);
583 [CCode (cname = "MIN")]
584 public static uint64 min (uint64 a, uint64 b);
585 [CCode (cname = "MAX")]
586 public static uint64 max (uint64 a, uint64 b);
587 [CCode (cname = "CLAMP")]
588 public uint64 clamp (uint64 low, uint64 high);
590 [CCode (cname = "GUINT64_TO_BE")]
591 public uint64 to_big_endian ();
592 [CCode (cname = "GUINT64_TO_LE")]
593 public uint64 to_little_endian ();
595 [CCode (cname = "GUINT64_FROM_BE")]
596 public static uint64 from_big_endian (uint64 val);
597 [CCode (cname = "GUINT64_FROM_LE")]
598 public static uint64 from_little_endian (uint64 val);
602 [GIR (name = "gfloat")]
603 [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")]
604 [FloatingType (rank = 1)]
605 public struct float {
606 [CCode (cname = "FLT_MANT_DIG")]
607 public static int MANT_DIG;
608 [CCode (cname = "FLT_DIG")]
609 public static int DIG;
611 [CCode (cname = "FLT_MIN_EXP")]
612 public static int MIN_EXP;
613 [CCode (cname = "FLT_MAX_EXP")]
614 public static int MAX_EXP;
616 [CCode (cname = "FLT_MIN_10_EXP")]
617 public static int MIN_10_EXP;
618 [CCode (cname = "FLT_MAX_10_EXP")]
619 public static int MAX_10_EXP;
621 [CCode (cname = "FLT_EPSILON")]
622 public static float EPSILON;
623 [CCode (cname = "FLT_MIN")]
624 public static float MIN;
625 [CCode (cname = "FLT_MAX")]
626 public static float MAX;
628 [CCode (cname = "NAN")]
629 public static float NAN;
630 [CCode (cname = "INFINITY")]
631 public static float INFINITY;
633 [CCode (cname = "isnan")]
634 public bool is_nan ();
635 [CCode (cname = "isfinite")]
636 public bool is_finite ();
637 [CCode (cname = "isnormal")]
638 public bool is_normal ();
639 [CCode (cname = "isinf")]
640 public int is_infinity ();
642 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
643 public string to_string (string format = "%g");
645 [CCode (cname = "MIN")]
646 public static float min (float a, float b);
647 [CCode (cname = "MAX")]
648 public static float max (float a, float b);
649 [CCode (cname = "CLAMP")]
650 public float clamp (float low, float high);
654 [GIR (name = "gdouble")]
655 [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", type_signature = "d")]
656 [FloatingType (rank = 2)]
657 public struct double {
658 [CCode (cname = "DBL_MANT_DIG")]
659 public static int MANT_DIG;
660 [CCode (cname = "DBL_DIG")]
661 public static int DIG;
663 [CCode (cname = "DBL_MIN_EXP")]
664 public static int MIN_EXP;
665 [CCode (cname = "DBL_MAX_EXP")]
666 public static int MAX_EXP;
668 [CCode (cname = "DBL_MIN_10_EXP")]
669 public static int MIN_10_EXP;
670 [CCode (cname = "DBL_MAX_10_EXP")]
671 public static int MAX_10_EXP;
673 [CCode (cname = "DBL_EPSILON")]
674 public static double EPSILON;
675 [CCode (cname = "DBL_MIN")]
676 public static double MIN;
677 [CCode (cname = "DBL_MAX")]
678 public static double MAX;
680 [CCode (cname = "((double) NAN)")]
681 public static double NAN;
682 [CCode (cname = "((double) INFINITY)")]
683 public static double INFINITY;
685 [CCode (cname = "isnan")]
686 public bool is_nan ();
687 [CCode (cname = "isfinite")]
688 public bool is_finite ();
689 [CCode (cname = "isnormal")]
690 public bool is_normal ();
691 [CCode (cname = "isinf")]
692 public int is_infinity ();
694 [CCode (cname = "MIN")]
695 public static double min (double a, double b);
696 [CCode (cname = "MAX")]
697 public static double max (double a, double b);
698 [CCode (cname = "CLAMP")]
699 public double clamp (double low, double high);
701 [CCode (cname = "G_ASCII_DTOSTR_BUF_SIZE")]
702 public const int DTOSTR_BUF_SIZE;
703 [CCode (cname = "g_ascii_dtostr", instance_pos = -1)]
704 public unowned string to_str (char[] buffer);
705 [CCode (cname = "g_ascii_formatd", instance_pos = -1)]
706 public unowned string format (char[] buffer, string format = "%g");
708 public string to_string () {
709 return this.to_str(new char[DTOSTR_BUF_SIZE]);
713 [GIR (name = "glong")]
714 [CCode (cheader_filename = "time.h", has_type_id = false, default_value = "0")]
715 [IntegerType (rank = 8)]
716 public struct time_t {
717 [CCode (cname = "time")]
718 public time_t (out time_t result = null);
722 [CCode (cheader_filename="stdarg.h", cprefix="va_", has_type_id = false, destroy_function = "va_end")]
723 public struct va_list {
724 [CCode (cname = "va_start")]
726 [CCode (cname = "va_copy")]
727 public va_list.copy (va_list src);
728 [CCode (generic_type_pos = 1.1)]
729 public unowned G arg<G> ();
733 [GIR (name = "gunichar")]
734 [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")]
735 [IntegerType (rank = 7)]
736 public struct unichar {
737 public bool validate ();
738 public bool isalnum ();
739 public bool isalpha ();
740 public bool iscntrl ();
741 public bool isdigit ();
742 public bool isgraph ();
743 public bool islower ();
744 public bool isprint ();
745 public bool ispunct ();
746 public bool isspace ();
747 public bool isupper ();
748 public bool isxdigit ();
749 public bool istitle ();
750 public bool isdefined ();
751 public bool iswide ();
752 public bool iswide_cjk ();
753 public bool iszerowidth ();
754 public unichar toupper ();
755 public unichar tolower ();
756 public unichar totitle ();
757 public int digit_value ();
758 public int xdigit_value ();
759 public UnicodeType type ();
760 public UnicodeBreakType break_type ();
761 public UnicodeScript get_script();
763 public int to_utf8 (string? outbuf);
765 public string? to_string () {
766 string str = (string) new char[7];
771 [CCode (cname = "MIN")]
772 public static unichar min (unichar a, unichar b);
773 [CCode (cname = "MAX")]
774 public static unichar max (unichar a, unichar b);
775 [CCode (cname = "CLAMP")]
776 public unichar clamp (unichar low, unichar high);
779 [CCode (cname = "GUnicodeScript", cprefix = "G_UNICODE_SCRIPT_", has_type_id = false)]
780 public enum UnicodeScript {
866 [CCode (cname = "GUnicodeType", cprefix = "G_UNICODE_", has_type_id = false)]
867 public enum UnicodeType {
900 [CCode (cname = "GUnicodeBreakType", cprefix = "G_UNICODE_BREAK_", has_type_id = false)]
901 public enum UnicodeBreakType {
940 [CCode (cname = "GNormalizeMode", cprefix = "G_NORMALIZE_", has_type_id = false)]
941 public enum NormalizeMode {
955 [GIR (name = "utf8")]
956 [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")]
957 public class string {
958 [Deprecated (replacement = "string.index_of")]
959 [CCode (cname = "strstr")]
960 public unowned string? str (string needle);
961 [CCode (cname = "g_strrstr")]
962 public unowned string? rstr (string needle);
963 [CCode (cname = "g_strrstr_len")]
964 public unowned string? rstr_len (ssize_t haystack_len, string needle);
966 [CCode (cname = "strstr")]
967 static char* strstr (char* haystack, char* needle);
968 [CCode (cname = "g_utf8_strchr")]
969 static char* utf8_strchr (char* str, ssize_t len, unichar c);
971 public int index_of (string needle, int start_index = 0) {
972 char* result = strstr ((char*) this + start_index, (char*) needle);
974 if (result != null) {
975 return (int) (result - (char*) this);
981 public int index_of_char (unichar c, int start_index = 0) {
982 char* result = utf8_strchr ((char*) this + start_index, -1, c);
984 if (result != null) {
985 return (int) (result - (char*) this);
991 [CCode (cname = "g_str_has_prefix")]
992 public bool has_prefix (string prefix);
993 [CCode (cname = "g_str_has_suffix")]
994 public bool has_suffix (string suffix);
995 [CCode (cname = "g_strdup_printf"), PrintfFormat]
996 public string printf (...);
997 [CCode (cname = "g_strdup_vprintf")]
998 public string vprintf (va_list args);
999 [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat]
1000 public int scanf (...);
1001 [CCode (cname = "g_strconcat")]
1002 public string concat (string string2, ...);
1003 [CCode (cname = "g_strescape")]
1004 public string escape (string exceptions);
1005 [CCode (cname = "g_strcompress")]
1006 public string compress ();
1007 [CCode (cname = "g_strsplit", array_length = false, array_null_terminated = true)]
1008 public string[] split (string delimiter, int max_tokens = 0);
1009 [CCode (cname = "g_strsplit_set", array_length = false, array_null_terminated = true)]
1010 public string[] split_set (string delimiters, int max_tokens = 0);
1011 [CCode (cname = "g_strjoinv")]
1012 public static string joinv (string separator, [CCode (array_length = false, array_null_terminated = true)] string[] str_array);
1013 [CCode (cname = "g_strjoin")]
1014 public static string join (string separator, ...);
1015 [CCode (cname = "g_strnfill")]
1016 public static string nfill (size_t length, char fill_char);
1018 public char get (long index) {
1019 return ((char*) this)[index];
1022 // checks whether valid string character starts at specified index
1023 // embedded NULs are not supported by the string class
1024 public bool valid_char (int index) {
1025 uint8 c = ((uint8*) this)[index];
1026 if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) {
1033 [CCode (cname = "g_utf8_next_char")]
1034 public unowned string next_char ();
1035 [CCode (cname = "g_utf8_get_char")]
1036 static unichar utf8_get_char (char* str);
1037 public unichar get_char (long index = 0) {
1038 return utf8_get_char ((char*) this + index);
1040 [CCode (cname = "g_utf8_get_char_validated")]
1041 public unichar get_char_validated (ssize_t max_len = -1);
1043 [Deprecated (replacement = "string.index_of_nth_char")]
1044 [CCode (cname = "g_utf8_offset_to_pointer")]
1045 public unowned string utf8_offset (long offset);
1046 [Deprecated (replacement = "string.substring")]
1047 public unowned string offset (long offset) {
1048 return (string) ((char*) this + offset);
1050 [Deprecated (replacement = "string.char_count")]
1051 public long pointer_to_offset (string pos) {
1052 return (long) ((char*) pos - (char*) this);
1055 [CCode (cname = "g_utf8_offset_to_pointer")]
1056 char* utf8_offset_to_pointer (long offset);
1058 public int index_of_nth_char (long c) {
1059 return (int) (this.utf8_offset_to_pointer (c) - (char*) this);
1062 [CCode (cname = "g_utf8_prev_char")]
1063 public unowned string prev_char ();
1064 [Deprecated (replacement = "string.length")]
1065 [CCode (cname = "strlen")]
1067 [Deprecated (replacement = "string.index_of_char")]
1068 [CCode (cname = "g_utf8_strchr")]
1069 public unowned string chr (ssize_t len, unichar c);
1070 [CCode (cname = "g_utf8_strrchr")]
1071 public unowned string rchr (ssize_t len, unichar c);
1072 [CCode (cname = "g_utf8_strreverse")]
1073 public string reverse (ssize_t len = -1);
1074 [CCode (cname = "g_utf8_validate")]
1075 public bool validate (ssize_t max_len = -1, out char* end = null);
1076 [CCode (cname = "g_utf8_normalize")]
1077 public string normalize (ssize_t len = -1, NormalizeMode mode = NormalizeMode.DEFAULT);
1079 [CCode (cname = "g_utf8_strup")]
1080 public string up (ssize_t len = -1);
1081 [CCode (cname = "g_utf8_strdown")]
1082 public string down (ssize_t len = -1);
1083 [CCode (cname = "g_utf8_casefold")]
1084 public string casefold (ssize_t len = -1);
1085 [CCode (cname = "g_utf8_collate")]
1086 public int collate (string str2);
1087 [CCode (cname = "g_utf8_collate_key")]
1088 public string collate_key (ssize_t len = -1);
1089 [CCode (cname = "g_utf8_collate_key_for_filename")]
1090 public string collate_key_for_filename (ssize_t len = -1);
1092 [CCode (cname = "g_locale_to_utf8")]
1093 public string locale_to_utf8 (ssize_t len, out size_t bytes_read, out size_t bytes_written, out GLib.Error error = null);
1095 [CCode (cname = "g_strchomp")]
1096 public unowned string _chomp();
1097 public string chomp () {
1098 string result = this.dup ();
1103 [CCode (cname = "g_strchug")]
1104 public unowned string _chug();
1105 public string chug () {
1106 string result = this.dup ();
1111 [CCode (cname = "g_strstrip")]
1112 public unowned string _strip ();
1113 public string strip () {
1114 string result = this.dup ();
1119 [CCode (cname = "g_strdelimit")]
1120 public unowned string _delimit (string delimiters, char new_delimiter);
1121 public string delimit (string delimiters, char new_delimiter) {
1122 string result = this.dup ();
1123 result._delimit (delimiters, new_delimiter);
1127 [CCode (cname = "g_str_hash")]
1128 public uint hash ();
1130 [CCode (cname = "atoi")]
1131 public int to_int ();
1132 [CCode (cname = "strtol")]
1133 public long to_long (out unowned string endptr = null, int _base = 0);
1134 [CCode (cname = "g_ascii_strtod")]
1135 public double to_double (out unowned string endptr = null);
1136 [CCode (cname = "strtoul")]
1137 public ulong to_ulong (out unowned string endptr = null, int _base = 0);
1138 [CCode (cname = "g_ascii_strtoll")]
1139 public int64 to_int64 (out unowned string endptr = null, int _base = 0);
1140 [CCode (cname = "g_ascii_strtoull")]
1141 public uint64 to_uint64 (out unowned string endptr = null, int _base = 0);
1143 public bool to_bool () {
1144 if (this == "true") {
1151 [Deprecated (replacement = "string.length")]
1152 [CCode (cname = "strlen")]
1153 public size_t size ();
1155 [CCode (cname = "g_ascii_strcasecmp")]
1156 public int ascii_casecmp (string s2);
1157 [CCode (cname = "g_ascii_strncasecmp")]
1158 public int ascii_ncasecmp (string s2, size_t n);
1160 [CCode (cname = "g_utf8_skip")]
1161 public static char[] skip;
1163 /* modifies string in place */
1164 [CCode (cname = "g_strcanon")]
1165 public void canon (string valid_chars, char substitutor);
1167 [CCode (cname = "g_strdup")]
1168 public string dup ();
1169 [Deprecated (replacement = "string.substring")]
1170 [CCode (cname = "g_strndup")]
1171 public string ndup (size_t n);
1173 [CCode (cname = "g_strndup")]
1174 static string strndup (char* str, size_t n);
1176 public string substring (long offset, long len = -1) {
1177 long string_length = this.length;
1179 offset = string_length + offset;
1180 GLib.return_val_if_fail (offset >= 0, null);
1182 GLib.return_val_if_fail (offset <= string_length, null);
1185 len = string_length - offset;
1187 GLib.return_val_if_fail (offset + len <= string_length, null);
1188 return strndup ((char*) this + offset, len);
1191 public string slice (long start, long end) {
1192 long string_length = this.length;
1194 start = string_length + start;
1197 end = string_length + end;
1199 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1200 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1201 GLib.return_val_if_fail (start <= end, null);
1202 return strndup ((char*) this + start, end - start);
1205 public string splice (long start, long end, string? str = null) {
1206 long string_length = this.length;
1208 start = string_length + start;
1211 end = string_length + end;
1213 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1214 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1215 GLib.return_val_if_fail (start <= end, null);
1221 str_size = str.length;
1224 string* result = GLib.malloc0 (this.length - (end - start) + str_size + 1);
1226 char* dest = (char*) result;
1228 GLib.Memory.copy (dest, this, start);
1231 GLib.Memory.copy (dest, str, str_size);
1234 GLib.Memory.copy (dest, (char*) this + end, string_length - end);
1236 return (owned) result;
1239 public bool contains (string needle) {
1240 return strstr ((char*) this, (char*) needle) != null;
1243 public string replace (string old, string replacement) {
1245 var regex = new GLib.Regex (GLib.Regex.escape_string (old));
1246 return regex.replace_literal (this, -1, 0, replacement);
1247 } catch (GLib.RegexError e) {
1248 GLib.assert_not_reached ();
1252 [CCode (cname = "g_utf8_strlen")]
1253 public int char_count (ssize_t max = -1);
1256 [CCode (cname = "strlen")]
1260 public uint8[] data {
1262 unowned uint8[] res = (uint8[]) this;
1263 res.length = (int) this.length;
1268 public char[] to_utf8 () {
1269 char[] result = new char[this.length + 1];
1271 GLib.Memory.copy (result, this, this.length);
1275 public unowned string to_string () {
1280 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
1282 [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
1284 [CCode (cname = "G_E")]
1285 public const double E;
1287 [CCode (cname = "G_PI")]
1288 public const double PI;
1290 [CCode (cname = "G_LN2")]
1291 public const double LN2;
1293 [CCode (cname = "G_LN10")]
1294 public const double LN10;
1296 [CCode (cname = "G_PI_2")]
1297 public const double PI_2;
1299 [CCode (cname = "G_PI_4")]
1300 public const double PI_4;
1302 [CCode (cname = "G_SQRT2")]
1303 public const double SQRT2;
1305 /* generated from <bits/mathcalls.h> of glibc */
1306 public static double acos (double x);
1307 public static float acosf (float x);
1308 public static double asin (double x);
1309 public static float asinf (float x);
1310 public static double atan (double x);
1311 public static float atanf (float x);
1312 public static double atan2 (double y, double x);
1313 public static float atan2f (float y, float x);
1314 public static double cos (double x);
1315 public static float cosf (float x);
1316 public static double sin (double x);
1317 public static float sinf (float x);
1318 public static double tan (double x);
1319 public static float tanf (float x);
1320 public static double cosh (double x);
1321 public static float coshf (float x);
1322 public static double sinh (double x);
1323 public static float sinhf (float x);
1324 public static double tanh (double x);
1325 public static float tanhf (float x);
1326 public static void sincos (double x, out double sinx, out double cosx);
1327 public static void sincosf (float x, out float sinx, out float cosx);
1328 public static double acosh (double x);
1329 public static float acoshf (float x);
1330 public static double asinh (double x);
1331 public static float asinhf (float x);
1332 public static double atanh (double x);
1333 public static float atanhf (float x);
1334 public static double exp (double x);
1335 public static float expf (float x);
1336 public static double frexp (double x, out int exponent);
1337 public static float frexpf (float x, out int exponent);
1338 public static double ldexp (double x, int exponent);
1339 public static float ldexpf (float x, int exponent);
1340 public static double log (double x);
1341 public static float logf (float x);
1342 public static double log10 (double x);
1343 public static float log10f (float x);
1344 public static double modf (double x, out double iptr);
1345 public static float modff (float x, out float iptr);
1346 public static double exp10 (double x);
1347 public static float exp10f (float x);
1348 public static double pow10 (double x);
1349 public static float pow10f (float x);
1350 public static double expm1 (double x);
1351 public static float expm1f (float x);
1352 public static double log1p (double x);
1353 public static float log1pf (float x);
1354 public static double logb (double x);
1355 public static float logbf (float x);
1356 public static double exp2 (double x);
1357 public static float exp2f (float x);
1358 public static double log2 (double x);
1359 public static float log2f (float x);
1360 public static double pow (double x, double y);
1361 public static float powf (float x, float y);
1362 public static double sqrt (double x);
1363 public static float sqrtf (float x);
1364 public static double hypot (double x, double y);
1365 public static float hypotf (float x, float y);
1366 public static double cbrt (double x);
1367 public static float cbrtf (float x);
1368 public static double ceil (double x);
1369 public static float ceilf (float x);
1370 public static double fabs (double x);
1371 public static float fabsf (float x);
1372 public static double floor (double x);
1373 public static float floorf (float x);
1374 public static double fmod (double x, double y);
1375 public static float fmodf (float x, float y);
1376 public static int isinf (double value);
1377 public static int isinff (float value);
1378 public static int finite (double value);
1379 public static int finitef (float value);
1380 public static double drem (double x, double y);
1381 public static float dremf (float x, float y);
1382 public static double significand (double x);
1383 public static float significandf (float x);
1384 public static double copysign (double x, double y);
1385 public static float copysignf (float x, float y);
1386 public static double nan (string tagb);
1387 public static float nanf (string tagb);
1388 public static int isnan (double value);
1389 public static int isnanf (float value);
1390 public static double j0 (double x0);
1391 public static float j0f (float x0);
1392 public static double j1 (double x0);
1393 public static float j1f (float x0);
1394 public static double jn (int x0, double x1);
1395 public static float jnf (int x0, float x1);
1396 public static double y0 (double x0);
1397 public static float y0f (float x0);
1398 public static double y1 (double x0);
1399 public static float y1f (float x0);
1400 public static double yn (int x0, double x1);
1401 public static float ynf (int x0, float x1);
1402 public static double erf (double x0);
1403 public static float erff (float x0);
1404 public static double erfc (double x0);
1405 public static float erfcf (float x0);
1406 public static double lgamma (double x0);
1407 public static float lgammaf (float x0);
1408 public static double tgamma (double x0);
1409 public static float tgammaf (float x0);
1410 public static double gamma (double x0);
1411 public static float gammaf (float x0);
1412 public static double lgamma_r (double x0, out int signgamp);
1413 public static float lgamma_rf (float x0, out int signgamp);
1414 public static double rint (double x);
1415 public static float rintf (float x);
1416 public static double nextafter (double x, double y);
1417 public static float nextafterf (float x, float y);
1418 public static double nexttoward (double x, double y);
1419 public static float nexttowardf (float x, double y);
1420 public static double remainder (double x, double y);
1421 public static float remainderf (float x, float y);
1422 public static double scalbn (double x, int n);
1423 public static float scalbnf (float x, int n);
1424 public static int ilogb (double x);
1425 public static int ilogbf (float x);
1426 public static double scalbln (double x, long n);
1427 public static float scalblnf (float x, long n);
1428 public static double nearbyint (double x);
1429 public static float nearbyintf (float x);
1430 public static double round (double x);
1431 public static float roundf (float x);
1432 public static double trunc (double x);
1433 public static float truncf (float x);
1434 public static double remquo (double x, double y, out int quo);
1435 public static float remquof (float x, float y, out int quo);
1436 public static long lrint (double x);
1437 public static long lrintf (float x);
1438 public static int64 llrint (double x);
1439 public static int64 llrintf (float x);
1440 public static long lround (double x);
1441 public static long lroundf (float x);
1442 public static int64 llround (double x);
1443 public static int64 llroundf (float x);
1444 public static double fdim (double x, double y);
1445 public static float fdimf (float x, float y);
1446 public static double fmax (double x, double y);
1447 public static float fmaxf (float x, float y);
1448 public static double fmin (double x, double y);
1449 public static float fminf (float x, float y);
1450 public static double fma (double x, double y, double z);
1451 public static float fmaf (float x, float y, float z);
1452 public static double scalb (double x, double n);
1453 public static float scalbf (float x, float n);
1457 [CCode (cprefix = "G_", cname = "int", has_type_id = false)]
1458 public enum ByteOrder {
1459 [CCode (cname = "G_BYTE_ORDER")]
1466 public const ByteOrder BYTE_ORDER;
1468 /* Atomic Operations */
1470 namespace AtomicInt {
1471 public static int get (ref int atomic);
1472 public static void set (ref int atomic, int newval);
1473 public static void add (ref int atomic, int val);
1474 public static int exchange_and_add (ref int atomic, int val);
1475 public static bool compare_and_exchange (ref int atomic, int oldval, int newval);
1476 public static void inc (ref int atomic);
1477 public static bool dec_and_test (ref int atomic);
1480 namespace AtomicPointer {
1481 public static void* get (void** atomic);
1482 public static void set (void** atomic, void* newval);
1483 public static bool compare_and_exchange (void** atomic, void* oldval, void* newval);
1486 /* The Main Event Loop */
1489 [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
1490 public class MainLoop {
1491 public MainLoop (MainContext? context = null, bool is_running = false);
1493 public void quit ();
1494 public bool is_running ();
1495 public unowned MainContext get_context ();
1498 namespace Priority {
1499 public const int HIGH;
1500 public const int DEFAULT;
1501 public const int HIGH_IDLE;
1502 public const int DEFAULT_IDLE;
1503 public const int LOW;
1507 [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
1508 public class MainContext {
1509 public MainContext ();
1510 public static unowned MainContext @default ();
1511 public bool iteration (bool may_block);
1512 public bool pending ();
1513 public unowned Source find_source_by_id (uint source_id);
1514 public unowned Source find_source_by_user_data (void* user_data);
1515 public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data);
1516 public void wakeup ();
1517 public bool acquire ();
1518 public void release ();
1519 public bool is_owner ();
1520 public bool wait (Cond cond, Mutex mutex);
1521 public bool prepare (out int priority);
1522 public int query (int max_priority, out int timeout_, PollFD[] fds);
1523 [CCode (array_length = false)]
1524 public int check (int max_priority, PollFD[] fds, int n_fds);
1525 public void dispatch ();
1526 public void set_poll_func (PollFunc func);
1527 public PollFunc get_poll_func ();
1528 public void add_poll (ref PollFD fd, int priority);
1529 public void remove_poll (ref PollFD fd);
1530 public int depth ();
1531 [CCode (cname = "g_main_current_source")]
1532 public static unowned Source current_source ();
1533 public static unowned MainContext get_thread_default ();
1534 public void push_thread_default ();
1535 public void pop_thread_default ();
1536 public unowned string? get_name ();
1537 public void set_name (string? name);
1538 public static void set_name_by_id (uint tag, string? name);
1539 [CCode (cname = "g_main_context_invoke_full")]
1540 public void invoke (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1541 public void invoke_full (int priority, owned SourceFunc function);
1544 [CCode (has_target = false)]
1545 public delegate int PollFunc (PollFD[] ufds, uint nfsd, int timeout_);
1547 [CCode (cname = "GSource")]
1548 public class TimeoutSource : Source {
1549 public TimeoutSource (uint interval);
1550 public TimeoutSource.seconds (uint interval);
1554 [CCode (cname = "g_timeout_add_full")]
1555 public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1556 public static uint add_full (int priority, uint interval, owned SourceFunc function);
1557 [CCode (cname = "g_timeout_add_seconds_full")]
1558 public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1559 public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function);
1562 [CCode (cname = "GSource")]
1563 public class IdleSource : Source {
1564 public IdleSource ();
1568 [CCode (cname = "g_idle_add_full")]
1569 public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1570 public static uint add_full (int priority, owned SourceFunc function);
1571 public static bool remove_by_data (void* data);
1574 [CCode (default_value = "0")]
1575 [IntegerType (rank = 6)]
1579 public delegate void ChildWatchFunc (Pid pid, int status);
1581 public class ChildWatchSource : Source {
1582 public ChildWatchSource (Pid pid, int status, void* data);
1585 namespace ChildWatch {
1586 [CCode (cname = "g_child_watch_add_full")]
1587 public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1588 public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function);
1591 public struct PollFD {
1593 public IOCondition events;
1594 public IOCondition revents;
1598 [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
1599 public class Source {
1600 public Source (SourceFuncs source_funcs, uint struct_size /* = sizeof (Source) */);
1601 public void set_funcs (SourceFuncs funcs);
1602 public uint attach (MainContext? context);
1603 public void destroy ();
1604 public bool is_destroyed ();
1605 public void set_priority (int priority);
1606 public int get_priority ();
1607 public void set_can_recurse (bool can_recurse);
1608 public bool get_can_recurse ();
1609 public uint get_id ();
1610 public unowned MainContext get_context ();
1611 public void set_callback (owned SourceFunc func);
1612 public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs);
1613 public void add_poll (ref PollFD fd);
1614 public void remove_poll (ref PollFD fd);
1615 public void get_current_time (out TimeVal timeval);
1616 public static bool remove (uint id);
1617 public static bool remove_by_funcs_user_data (void* user_data);
1618 public static bool remove_by_user_data (void* user_data);
1621 [CCode (has_target = false)]
1622 public delegate void SourceDummyMarshal ();
1624 [CCode (has_target = false)]
1625 public delegate bool SourcePrepareFunc (Source source, out int timeout_);
1626 [CCode (has_target = false)]
1627 public delegate bool SourceCheckFunc (Source source);
1628 [CCode (has_target = false)]
1629 public delegate bool SourceDispatchFunc (Source source, SourceFunc _callback);
1630 [CCode (has_target = false)]
1631 public delegate void SourceFinalizeFunc (Source source);
1634 public class SourceFuncs {
1635 public SourcePrepareFunc prepare;
1636 public SourceCheckFunc check;
1637 public SourceDispatchFunc dispatch;
1638 public SourceFinalizeFunc finalize;
1641 [CCode (has_target = false)]
1642 public delegate void SourceCallbackRefFunc (void* cb_data);
1643 [CCode (has_target = false)]
1644 public delegate void SourceCallbackUnrefFunc (void* cb_data);
1645 [CCode (has_target = false)]
1646 public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
1649 public class SourceCallbackFuncs {
1650 public SourceCallbackRefFunc @ref;
1651 public SourceCallbackUnrefFunc unref;
1652 public SourceCallbackGetFunc @get;
1655 public delegate bool SourceFunc ();
1657 public errordomain ThreadError {
1661 /* Thread support */
1663 public delegate G ThreadFunc<G> ();
1664 public delegate void Func<G> (G data);
1666 [CCode (has_type_id = false)]
1667 public enum ThreadPriority {
1675 public class Thread<T> {
1676 public static bool supported ();
1677 [CCode (simple_generics = true)]
1678 public static unowned Thread<T> create<T> (ThreadFunc<T> func, bool joinable) throws ThreadError;
1679 [CCode (simple_generics = true)]
1680 public static unowned Thread<T> create_full<T> (ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
1681 [CCode (simple_generics = true)]
1682 public static unowned Thread<T> self<T> ();
1684 public void set_priority (ThreadPriority priority);
1685 public static void yield ();
1686 public static void exit (T retval);
1687 public static void @foreach<T> (Func<T> thread_func);
1689 [CCode (cname = "g_usleep")]
1690 public static void usleep (ulong microseconds);
1694 [CCode (free_function = "g_mutex_free")]
1695 public class Mutex {
1697 public void @lock ();
1698 public bool trylock ();
1699 public void unlock ();
1702 [CCode (destroy_function = "g_static_mutex_free")]
1703 public struct StaticMutex {
1704 public StaticMutex ();
1705 public void lock ();
1706 public bool trylock ();
1707 public void unlock ();
1708 public void lock_full ();
1711 [CCode (destroy_function = "g_static_rec_mutex_free")]
1712 public struct StaticRecMutex {
1713 public StaticRecMutex ();
1714 public void lock ();
1715 public bool trylock ();
1716 public void unlock ();
1717 public void lock_full ();
1720 [CCode (destroy_function = "g_static_rw_lock_free")]
1721 public struct StaticRWLock {
1722 public StaticRWLock ();
1723 public void reader_lock ();
1724 public bool reader_trylock ();
1725 public void reader_unlock ();
1726 public void writer_lock ();
1727 public bool writer_trylock ();
1728 public void writer_unlock ();
1732 [CCode (ref_function = "", unref_function = "")]
1733 public class Private {
1734 public Private (DestroyNotify destroy_func);
1735 public void* get ();
1736 public void set (void* data);
1739 [CCode (destroy_function = "g_static_private_free")]
1740 public struct StaticPrivate {
1741 public StaticPrivate ();
1742 public void* get ();
1743 public void set (void* data, DestroyNotify? destroy_func);
1747 [CCode (free_function = "g_cond_free")]
1750 public void @signal ();
1751 public void broadcast ();
1752 public void wait (Mutex mutex);
1753 public bool timed_wait (Mutex mutex, TimeVal abs_time);
1759 [CCode (free_function = "g_thread_pool_free")]
1760 public class ThreadPool<T> {
1761 public ThreadPool (Func<T> func, int max_threads, bool exclusive) throws ThreadError;
1762 public void push (T data) throws ThreadError;
1763 public void set_max_threads (int max_threads) throws ThreadError;
1764 public int get_max_threads ();
1765 public uint get_num_threads ();
1766 public uint unprocessed ();
1767 public static void set_max_unused_threads (int max_threads);
1768 public static int get_max_unused_threads ();
1769 public static uint get_num_unused_threads ();
1770 public static void stop_unused_threads ();
1771 public void set_sort_function (CompareDataFunc func);
1772 public static void set_max_idle_time (uint interval);
1773 public static uint get_max_idle_time ();
1776 /* Asynchronous Queues */
1779 [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
1780 public class AsyncQueue<G> {
1781 public AsyncQueue ();
1782 public void push (owned G data);
1783 public void push_sorted (owned G data, CompareDataFunc<G> func);
1785 public G try_pop ();
1786 public G timed_pop (ref TimeVal end_time);
1787 public int length ();
1788 public void sort (CompareDataFunc<G> func);
1789 public void @lock ();
1790 public void unlock ();
1791 public void ref_unlocked ();
1792 public void unref_and_unlock ();
1793 public void push_unlocked (owned G data);
1794 public void push_sorted_unlocked (owned G data, CompareDataFunc<G> func);
1795 public G pop_unlocked ();
1796 public G try_pop_unlocked ();
1797 public G timed_pop_unlocked (ref TimeVal end_time);
1798 public int length_unlocked ();
1799 public void sort_unlocked (CompareDataFunc<G> func);
1802 /* Memory Allocation */
1804 public static void* malloc (size_t n_bytes);
1805 public static void* malloc0 (size_t n_bytes);
1806 public static void* realloc (void* mem, size_t n_bytes);
1808 public static void* try_malloc (size_t n_bytes);
1809 public static void* try_malloc0 (size_t n_bytes);
1810 public static void* try_realloc (void* mem, size_t n_bytes);
1812 public static void free (void* mem);
1814 public class MemVTable {
1817 [CCode (cname = "glib_mem_profiler_table")]
1818 public static MemVTable mem_profiler_table;
1820 public static void mem_set_vtable (MemVTable vtable);
1821 public static void mem_profile ();
1823 [CCode (cheader_filename = "string.h")]
1825 [CCode (cname = "memcmp")]
1826 public static int cmp (void* s1, void* s2, size_t n);
1827 [CCode (cname = "memcpy")]
1828 public static void* copy (void* dest, void* src, size_t n);
1829 [CCode (cname = "memset")]
1830 public static void* set (void* dest, int src, size_t n);
1831 [CCode (cname = "g_memmove")]
1832 public static void* move (void* dest, void* src, size_t n);
1833 [CCode (cname = "g_memdup")]
1834 public static void* dup (void* mem, uint n);
1838 public static void* alloc (size_t block_size);
1839 public static void* alloc0 (size_t block_size);
1840 public static void* copy (size_t block_size, void* mem_block);
1841 [CCode (cname = "g_slice_free1")]
1842 public static void free (size_t block_size, void* mem_block);
1843 public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset);
1849 [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
1850 public class IOChannel {
1851 [CCode (cname = "g_io_channel_unix_new")]
1852 public IOChannel.unix_new (int fd);
1853 public int unix_get_fd ();
1854 [CCode (cname = "g_io_channel_win32_new_fd")]
1855 public IOChannel.win32_new_fd (int fd);
1856 [CCode (cname = "g_io_channel_win32_new_socket")]
1857 public IOChannel.win32_socket (int socket);
1858 [CCode (cname = "g_io_channel_win32_new_messages")]
1859 public IOChannel.win32_messages (size_t hwnd);
1860 public void init ();
1861 public IOChannel.file (string filename, string mode) throws FileError;
1862 public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError;
1863 public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
1864 public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError;
1865 public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError;
1866 public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError;
1867 public IOStatus write_chars (char[] buf, out size_t bytes_written) throws ConvertError, IOChannelError;
1868 public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
1869 public IOStatus flush () throws IOChannelError;
1870 public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
1871 public IOStatus shutdown (bool flush) throws IOChannelError;
1872 [CCode (cname = "g_io_create_watch")]
1873 public GLib.Source create_watch (IOCondition condition);
1874 [CCode (cname = "g_io_add_watch")]
1875 public uint add_watch (IOCondition condition, IOFunc func);
1876 [CCode (cname = "g_io_add_watch_full")]
1877 public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func);
1878 public size_t get_buffer_size ();
1879 public void set_buffer_size (size_t size);
1880 public IOCondition get_buffer_condition ();
1881 public IOFlags get_flags ();
1882 public IOStatus set_flags (IOFlags flags) throws IOChannelError;
1883 public unowned string get_line_term (out int length);
1884 public void set_line_term (string line_term, int length);
1885 public bool get_buffered ();
1886 public void set_buffered (bool buffered);
1887 public unowned string get_encoding ();
1888 public IOStatus set_encoding (string? encoding) throws IOChannelError;
1889 public bool get_close_on_unref ();
1890 public void set_close_on_unref (bool do_close);
1893 [CCode (cprefix = "G_SEEK_", has_type_id = false)]
1894 public enum SeekType {
1900 [CCode (has_type_id = false)]
1901 public enum IOStatus {
1908 public errordomain IOChannelError {
1921 [CCode (cprefix = "G_IO_")]
1922 public enum IOCondition {
1931 public delegate bool IOFunc (IOChannel source, IOCondition condition);
1933 [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)]
1934 public enum IOFlags {
1945 /* Error Reporting */
1949 [CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
1950 public class Error {
1952 public Error (Quark domain, int code, string format, ...);
1953 public Error copy ();
1954 public bool matches (Quark domain, int code);
1956 public Quark domain;
1958 public string message;
1961 /* Message Output and Debugging Functions */
1964 public static void print (string format, ...);
1965 public static void set_print_handler (PrintFunc func);
1966 [CCode (has_target = false)]
1967 public delegate void PrintFunc (string text);
1969 public static void printerr (string format, ...);
1970 public static void set_printerr_handler (PrintFunc func);
1972 public static void return_if_fail (bool expr);
1973 [CCode (sentinel = "")]
1974 public static void return_val_if_fail (bool expr, ...);
1976 public static void return_if_reached ();
1978 [CCode (sentinel = "")]
1979 public static void return_val_if_reached (...);
1980 public static void warn_if_fail (bool expr);
1981 public static void warn_if_reached ();
1984 public static void assert (bool expr);
1986 public static void assert_not_reached ();
1988 public static void on_error_query (string? prg_name = null);
1989 public static void on_error_stack_trace (string? prg_name = null);
1990 [CCode (cname = "G_BREAKPOINT")]
1991 public static void breakpoint ();
1993 /* Message Logging */
1995 [CCode (cprefix = "G_LOG_", has_type_id = false)]
1996 public enum LogLevelFlags {
2001 /* GLib log levels */
2012 public void logv (string? log_domain, LogLevelFlags log_level, string format, va_list args);
2015 public void log (string? log_domain, LogLevelFlags log_level, string format, ...);
2019 public void message (string format, ...);
2022 public void warning (string format, ...);
2025 public void critical (string format, ...);
2029 public void error (string format, ...);
2032 public void debug (string format, ...);
2034 public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message);
2037 public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
2038 public static void set_default_handler (LogFunc log_func);
2039 [CCode (delegate_target = "NULL")]
2040 public static GLib.LogFunc default_handler;
2041 public static void set_fatal_mask (string log_domain, LogLevelFlags log_levels);
2042 public static void set_always_fatal (LogLevelFlags log_levels);
2044 public const string FILE;
2045 public const int LINE;
2046 public const string METHOD;
2049 [CCode (has_type_id = false)]
2050 public struct DebugKey {
2055 public uint parse_debug_string (string? debug_string, DebugKey[] keys);
2057 /* String Utility Functions */
2059 public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2061 [CCode (cname = "errno", cheader_filename = "errno.h")]
2063 public unowned string strerror (int errnum);
2065 /* Character Set Conversions */
2067 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;
2068 public static bool get_charset (out unowned string charset);
2071 public struct IConv {
2072 public static IConv open (string to_codeset, string from_codeset);
2073 [CCode (cname = "g_iconv")]
2074 public uint iconv (out string inbuf, out uint inbytes_left, out string outbuf, out uint outbytes_left);
2075 public int close ();
2078 namespace Filename {
2079 public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2080 public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2081 public static string from_uri (string uri, out string hostname = null) throws ConvertError;
2082 public static string to_uri (string filename, string? hostname = null) throws ConvertError;
2083 public static string display_name (string filename);
2084 public static string display_basename (string filename);
2087 public errordomain ConvertError {
2096 /* Base64 Encoding */
2099 public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save);
2100 public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
2101 public static string encode (uchar[] data);
2102 public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
2103 [CCode (array_length_type = "size_t")]
2104 public static uchar[] decode (string text);
2107 /* Data Checksums */
2109 [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)]
2110 public enum ChecksumType {
2115 public ssize_t get_length ();
2119 [CCode (free_function = "g_checksum_free")]
2120 public class Checksum {
2121 public Checksum (ChecksumType checksum_type);
2122 public Checksum copy ();
2123 public void update ([CCode (array_length = false)] uchar[] data, size_t length);
2124 public unowned string get_string ();
2125 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2126 [CCode (cname = "g_compute_checksum_for_data")]
2127 public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
2128 [CCode (cname = "g_compute_checksum_for_string")]
2129 public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1);
2132 /* Date and Time Functions */
2134 [CCode (has_type_id = false)]
2135 public struct TimeVal {
2137 public long tv_usec;
2139 [CCode (cname = "g_get_current_time")]
2141 [CCode (cname = "g_get_current_time")]
2142 public void get_current_time ();
2143 public void add (long microseconds);
2144 [CCode (instance_pos = -1)]
2145 public bool from_iso8601 (string iso_date);
2146 [InstanceByReference]
2147 public string to_iso8601 ();
2150 public struct DateDay : uchar {
2151 [CCode (cname = "G_DATE_BAD_DAY")]
2152 public static DateDay BAD_DAY;
2154 [CCode (cname = "g_date_valid_day")]
2155 public bool valid ();
2158 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2159 public enum DateMonth {
2174 [CCode (cname = "g_date_get_days_in_month")]
2175 public uchar get_days_in_month (DateYear year);
2176 [CCode (cname = "g_date_valid_month")]
2177 public bool valid ();
2180 public struct DateYear : ushort {
2181 [CCode (cname = "G_DATE_BAD_YEAR")]
2182 public static DateDay BAD_YEAR;
2184 [CCode (cname = "g_date_is_leap_year")]
2185 public bool is_leap_year ();
2186 [CCode (cname = "g_date_get_monday_weeks_in_year")]
2187 public uchar get_monday_weeks_in_year ();
2188 [CCode (cname = "g_date_get_sunday_weeks_in_year")]
2189 public uchar get_sunday_weeks_in_year ();
2190 [CCode (cname = "g_date_valid_year")]
2191 public bool valid ();
2194 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2195 public enum DateWeekday {
2205 [CCode (cname = "g_date_valid_weekday")]
2206 public bool valid ();
2209 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2210 public enum DateDMY {
2216 [CCode (type_id = "G_TYPE_DATE")]
2217 public struct Date {
2218 public void clear (uint n_dates = 1);
2219 public void set_day (DateDay day);
2220 public void set_month (DateMonth month);
2221 public void set_year (DateYear year);
2222 public void set_dmy (DateDay day, int month, DateYear y);
2223 public void set_julian (uint julian_day);
2224 public void set_time_t (time_t timet);
2225 public void set_time_val (TimeVal timeval);
2226 public void set_parse (string str);
2227 public void add_days (uint n_days);
2228 public void subtract_days (uint n_days);
2229 public void add_months (uint n_months);
2230 public void subtract_months (uint n_months);
2231 public void add_years (uint n_years);
2232 public void subtract_years (uint n_years);
2233 public int days_between (Date date2);
2234 public int compare (Date rhs);
2235 public void clamp (Date min_date, Date max_date);
2236 public void order (Date date2);
2237 public DateDay get_day ();
2238 public DateMonth get_month ();
2239 public DateYear get_year ();
2240 public uint get_julian ();
2241 public DateWeekday get_weekday ();
2242 public uint get_day_of_year ();
2243 public bool is_first_of_month ();
2244 public bool is_last_of_month ();
2245 public uint get_monday_week_of_year ();
2246 public uint get_sunday_week_of_year ();
2247 public uint get_iso8601_week_of_year ();
2248 [CCode (instance_pos = -1)]
2249 public size_t strftime (char[] s, string format);
2250 [CCode (cname = "g_date_to_struct_tm")]
2251 public void to_time (out Time tm);
2252 public bool valid ();
2253 public static uchar get_days_in_month (DateMonth month, DateYear year);
2254 public static bool valid_day (DateDay day);
2255 public static bool valid_dmy (DateDay day, DateMonth month, DateYear year);
2256 public static bool valid_julian (uint julian_date);
2257 public static bool valid_weekday (DateWeekday weekday);
2260 [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)]
2261 public struct Time {
2262 [CCode (cname = "tm_sec")]
2264 [CCode (cname = "tm_min")]
2266 [CCode (cname = "tm_hour")]
2268 [CCode (cname = "tm_mday")]
2270 [CCode (cname = "tm_mon")]
2272 [CCode (cname = "tm_year")]
2274 [CCode (cname = "tm_wday")]
2276 [CCode (cname = "tm_yday")]
2277 public int day_of_year;
2278 [CCode (cname = "tm_isdst")]
2281 [CCode (cname = "gmtime_r")]
2282 static void gmtime_r (ref time_t time, out Time result);
2283 [CCode (cname = "localtime_r")]
2284 static void localtime_r (ref time_t time, out Time result);
2286 public static Time gm (time_t time) {
2288 gmtime_r (ref time, out result);
2291 public static Time local (time_t time) {
2293 localtime_r (ref time, out result);
2297 public string to_string () {
2298 return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
2301 public string format (string format) {
2302 var buffer = new char[64];
2303 this.strftime (buffer, format);
2304 return (string) buffer;
2307 [CCode (cname = "mktime")]
2308 public time_t mktime ();
2310 [CCode (cname = "strftime", instance_pos = -1)]
2311 public size_t strftime (char[] s, string format);
2312 [CCode (cname = "strptime", instance_pos = -1)]
2313 public unowned string? strptime (string buf, string format);
2316 public struct TimeSpan : int64 {
2317 public const TimeSpan DAY;
2318 public const TimeSpan HOUR;
2319 public const TimeSpan MINUTE;
2320 public const TimeSpan SECOND;
2321 public const TimeSpan MILLISECOND;
2325 [CCode (ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")]
2326 public class DateTime {
2327 public DateTime.now (TimeZone tz);
2328 public DateTime.now_local ();
2329 public DateTime.now_utc ();
2330 public DateTime.from_unix_local (int64 t);
2331 public DateTime.from_unix_utc (int64 t);
2332 public DateTime.from_timeval_local (TimeVal tv);
2333 public DateTime.from_timeval_utc (TimeVal tv);
2334 public DateTime (TimeZone tz, int year, int month, int day, int hour, int minute, double seconds);
2335 public DateTime.local (int year, int month, int day, int hour, int minute, double seconds);
2336 public DateTime.utc (int year, int month, int day, int hour, int minute, double seconds);
2337 public DateTime add (TimeSpan timespan);
2338 public DateTime add_years (int years);
2339 public DateTime add_months (int months);
2340 public DateTime add_weeks (int weeks);
2341 public DateTime add_days (int days);
2342 public DateTime add_hours (int hours);
2343 public DateTime add_milliseconds (int milliseconds);
2344 public DateTime add_minutes (int minutes);
2345 public DateTime add_seconds (double seconds);
2346 public DateTime add_full (int years, int months, int days, int hours = 0, int minutes = 0, double seconds = 0);
2347 public int compare (DateTime dt);
2348 public TimeSpan difference (DateTime begin);
2349 public uint hash ();
2350 public bool equal (DateTime dt);
2351 public void get_ymd (out int year, out int month, out int day);
2352 public int get_year ();
2353 public int get_month ();
2354 public int get_day_of_month ();
2355 public int get_week_numbering_year ();
2356 public int get_week_of_year ();
2357 public int get_day_of_week ();
2358 public int get_day_of_year ();
2359 public int get_hour ();
2360 public int get_minute ();
2361 public int get_second ();
2362 public int get_microsecond ();
2363 public double get_seconds ();
2364 public int64 to_unix ();
2365 public bool to_timeval (out TimeVal tv);
2366 public TimeSpan get_utc_offset ();
2367 public unowned string get_timezone_abbreviation ();
2368 public bool is_daylight_savings ();
2369 public DateTime to_timezone (TimeZone tz);
2370 public DateTime to_local ();
2371 public DateTime to_utc ();
2372 public string format (string format);
2373 public string to_string () {
2374 return this.format ("%FT%H:%M:%S%z");
2378 public enum TimeType {
2385 [CCode (ref_function = "g_time_zone_ref", unref_function = "g_time_zone_unref")]
2386 public class TimeZone {
2387 public TimeZone (string identifier);
2388 public TimeZone.utc ();
2389 public TimeZone.local ();
2390 public int find_interval (TimeType type, int64 time);
2391 public int adjust_time (TimeType type, ref int64 time);
2392 public unowned string get_abbreviation (int interval);
2393 public int32 get_offset (int interval);
2394 public bool is_dst (int interval);
2397 /* Random Numbers */
2400 [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
2402 public Rand.with_seed (uint32 seed);
2403 public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2405 public void set_seed (uint32 seed);
2406 public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2407 public bool boolean ();
2408 [CCode (cname = "g_rand_int")]
2409 public uint32 next_int ();
2410 public int32 int_range (int32 begin, int32 end);
2411 [CCode (cname = "g_rand_double")]
2412 public double next_double ();
2413 public double double_range (double begin, double end);
2417 public static void set_seed (uint32 seed);
2418 public static bool boolean ();
2419 [CCode (cname = "g_random_int")]
2420 public static uint32 next_int ();
2421 public static int32 int_range (int32 begin, int32 end);
2422 [CCode (cname = "g_random_double")]
2423 public static double next_double ();
2424 public static double double_range (double begin, double end);
2427 /* Miscellaneous Utility Functions */
2429 namespace Environment {
2430 [CCode (cname = "g_get_application_name")]
2431 public static unowned string? get_application_name ();
2432 [CCode (cname = "g_set_application_name")]
2433 public static void set_application_name (string application_name);
2434 [CCode (cname = "g_get_prgname")]
2435 public static unowned string get_prgname ();
2436 [CCode (cname = "g_set_prgname")]
2437 public static void set_prgname (string application_name);
2438 [CCode (cname = "g_getenv")]
2439 public static unowned string? get_variable (string variable);
2440 [CCode (cname = "g_setenv")]
2441 public static bool set_variable (string variable, string value, bool overwrite);
2442 [CCode (cname = "g_unsetenv")]
2443 public static void unset_variable (string variable);
2444 [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)]
2445 public static string[] list_variables ();
2446 [CCode (cname = "g_get_user_name")]
2447 public static unowned string get_user_name ();
2448 [CCode (cname = "g_get_real_name")]
2449 public static unowned string get_real_name ();
2450 [CCode (cname = "g_get_user_cache_dir")]
2451 public static unowned string get_user_cache_dir ();
2452 [CCode (cname = "g_get_user_data_dir")]
2453 public static unowned string get_user_data_dir ();
2454 [CCode (cname = "g_get_user_config_dir")]
2455 public static unowned string get_user_config_dir ();
2456 [CCode (cname = "g_get_user_special_dir")]
2457 public static unowned string get_user_special_dir (UserDirectory directory);
2458 [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)]
2459 public static unowned string[] get_system_data_dirs ();
2460 [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)]
2461 public static unowned string[] get_system_config_dirs ();
2462 [CCode (cname = "g_get_host_name")]
2463 public static unowned string get_host_name ();
2464 [CCode (cname = "g_get_home_dir")]
2465 public static unowned string get_home_dir ();
2466 [CCode (cname = "g_get_tmp_dir")]
2467 public static unowned string get_tmp_dir ();
2468 [CCode (cname = "g_get_current_dir")]
2469 public static string get_current_dir ();
2470 [CCode (cname = "g_find_program_in_path")]
2471 public static string? find_program_in_path (string program);
2472 [CCode (cname = "g_atexit")]
2473 public static void atexit (VoidFunc func);
2474 [CCode (cname = "g_chdir")]
2475 public static int set_current_dir (string path);
2478 [CCode (has_type_id = false)]
2479 public enum UserDirectory {
2488 [CCode (cname = "G_USER_N_DIRECTORIES")]
2493 public static bool is_absolute (string file_name);
2494 public static unowned string skip_root (string file_name);
2495 public static string get_basename (string file_name);
2496 public static string get_dirname (string file_name);
2497 [CCode (cname = "g_build_filename")]
2498 public static string build_filename (string first_element, ...);
2499 [CCode (cname = "g_build_path")]
2500 public static string build_path (string separator, string first_element, ...);
2502 [CCode (cname = "G_DIR_SEPARATOR")]
2503 public const char DIR_SEPARATOR;
2504 [CCode (cname = "G_DIR_SEPARATOR_S")]
2505 public const string DIR_SEPARATOR_S;
2506 [CCode (cname = "G_IS_DIR_SEPARATOR")]
2507 public static bool is_dir_separator (unichar c);
2508 [CCode (cname = "G_SEARCHPATH_SEPARATOR")]
2509 public const char SEARCHPATH_SEPARATOR;
2510 [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")]
2511 public const string SEARCHPATH_SEPARATOR_S;
2515 public static int nth_lsf (ulong mask, int nth_bit);
2516 public static int nth_msf (ulong mask, int nth_bit);
2517 public static uint storage (ulong number);
2520 namespace SpacedPrimes {
2521 public static uint closest (uint num);
2524 [CCode (has_target = false)]
2525 public delegate void FreeFunc (void* data);
2526 [CCode (has_target = false)]
2527 public delegate void VoidFunc ();
2529 public string format_size_for_display (int64 size);
2531 /* Lexical Scanner */
2532 [CCode (has_target = false)]
2533 public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error);
2536 [CCode (free_function = "g_scanner_destroy")]
2537 public class Scanner {
2538 public unowned string input_name;
2539 public TokenType token;
2540 public TokenValue value;
2542 public uint position;
2543 public TokenType next_token;
2544 public TokenValue next_value;
2545 public uint next_line;
2546 public uint next_position;
2547 public ScannerMsgFunc msg_handler;
2548 public ScannerConfig? config;
2549 public Scanner (ScannerConfig? config_templ);
2550 public void input_file (int input_fd);
2551 public void sync_file_offset ();
2552 public void input_text (string text, uint text_len);
2553 public TokenType peek_next_token ();
2554 public TokenType get_next_token ();
2556 public int cur_line ();
2557 public int cur_position ();
2558 public TokenType cur_token ();
2559 public TokenValue cur_value ();
2560 public uint set_scope (uint scope_id);
2561 public void scope_add_symbol (uint scope_id, string symbol, void* value);
2562 public void scope_foreach_symbol (uint scope_id, HFunc func);
2563 public void* scope_lookup_symbol (uint scope_id, string symbol);
2564 public void scope_remove_symbol (uint scope_id, string symbol);
2565 public void* lookup_symbol (string symbol);
2567 public void warn (string format, ...);
2569 public void error (string format, ...);
2570 public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error);
2573 public struct ScannerConfig {
2574 public string* cset_skip_characters;
2575 public string* cset_identifier_first;
2576 public string* cset_identifier_nth;
2577 public string* cpair_comment_single;
2578 public bool case_sensitive;
2579 public bool skip_comment_multi;
2580 public bool skip_comment_single;
2581 public bool scan_comment_multi;
2582 public bool scan_identifier;
2583 public bool scan_identifier_1char;
2584 public bool scan_identifier_NULL;
2585 public bool scan_symbols;
2586 public bool scan_binary;
2587 public bool scan_octal;
2588 public bool scan_float;
2589 public bool scan_hex;
2590 public bool scan_hex_dollar;
2591 public bool scan_string_sq;
2592 public bool scan_string_dq;
2593 public bool numbers_2_int;
2594 public bool int_2_float;
2595 public bool identifier_2_string;
2596 public bool char_2_token;
2597 public bool symbol_2_token;
2598 public bool scope_0_fallback;
2599 public bool store_int64;
2602 [CCode (lower_case_cprefix="G_CSET_")]
2603 namespace CharacterSet {
2604 public const string A_2_Z;
2605 public const string a_2_z;
2606 public const string DIGITS;
2607 public const string LATINC;
2608 public const string LATINS;
2611 [CCode (cprefix = "G_TOKEN_", has_type_id = false)]
2612 public enum TokenType
2641 public struct TokenValue {
2642 [CCode (cname="v_symbol")]
2643 public void* symbol;
2644 [CCode (cname="v_identifier")]
2645 public unowned string identifier;
2646 [CCode (cname="v_binary")]
2647 public ulong binary;
2648 [CCode (cname="v_octal")]
2650 [CCode (cname="v_int")]
2652 [CCode (cname="v_int64")]
2654 [CCode (cname="v_float")]
2655 public double float;
2656 [CCode (cname="v_hex")]
2658 [CCode (cname="v_string")]
2659 public unowned string string;
2660 [CCode (cname="v_comment")]
2661 public unowned string comment;
2662 [CCode (cname="v_char")]
2664 [CCode (cname="v_error")]
2668 [CCode (cprefix = "G_ERR_", has_type_id = false)]
2669 public enum ErrorType
2673 UNEXP_EOF_IN_STRING,
2674 UNEXP_EOF_IN_COMMENT,
2681 /* Automatic String Completion */
2684 [CCode (free_function = "g_completion_free")]
2685 public class Completion {
2686 public Completion (CompletionFunc? func = null);
2687 public List<void*> items;
2688 public CompletionFunc func;
2689 public string prefix;
2690 public List<void*> cache;
2691 public CompletionStrncmpFunc strncmp_func;
2692 public void add_items (List<void*> items);
2693 public void remove_items (List<void*> items);
2694 public void clear_items ();
2695 public unowned List<void*> complete (string prefix, out string? new_prefix = null);
2696 public unowned List<void*> complete_utf8 (string prefix, out string? new_prefix = null);
2699 [CCode (has_target = false)]
2700 public delegate string CompletionFunc (void* item);
2701 [CCode (has_target = false)]
2702 public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n);
2707 [CCode (free_function = "g_timer_destroy")]
2708 public class Timer {
2710 public void start ();
2711 public void stop ();
2712 public void @continue ();
2713 public double elapsed (out ulong microseconds = null);
2714 public void reset ();
2717 /* Spawning Processes */
2719 public errordomain SpawnError {
2742 [CCode (cprefix = "G_SPAWN_", has_type_id = false)]
2743 public enum SpawnFlags {
2744 LEAVE_DESCRIPTORS_OPEN,
2749 CHILD_INHERITS_STDIN,
2753 public delegate void SpawnChildSetupFunc ();
2754 [CCode (has_target = false, cheader_filename = "signal.h")]
2755 public delegate void SignalHandlerFunc (int signum);
2757 public unowned string strsignal (int signum);
2759 [CCode (lower_case_cprefix = "g_")]
2761 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;
2762 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;
2763 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;
2764 public static bool spawn_command_line_async (string command_line) throws SpawnError;
2765 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;
2766 [CCode (cname = "g_spawn_close_pid")]
2767 public static void close_pid (Pid pid);
2769 /* these macros are required to examine the exit status of a process */
2770 [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")]
2771 public static bool if_exited (int status);
2772 [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")]
2773 public static int exit_status (int status);
2774 [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")]
2775 public static bool if_signaled (int status);
2776 [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")]
2777 public static ProcessSignal term_sig (int status);
2778 [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")]
2779 public static bool core_dump (int status);
2780 [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")]
2781 public static bool if_stopped (int status);
2782 [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")]
2783 public static ProcessSignal stop_sig (int status);
2784 [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")]
2785 public static bool if_continued (int status);
2788 [CCode (cname = "abort", cheader_filename = "stdlib.h")]
2789 public void abort ();
2791 [CCode (cname = "exit", cheader_filename = "stdlib.h")]
2792 public void exit (int status);
2793 [CCode (cname = "raise", cheader_filename = "signal.h")]
2794 public int raise (ProcessSignal sig);
2795 [CCode (cname = "signal", cheader_filename = "signal.h")]
2796 public SignalHandlerFunc @signal (ProcessSignal signum, SignalHandlerFunc handler);
2799 [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")]
2800 public enum ProcessSignal {
2825 /* File Utilities */
2827 public errordomain FileError {
2855 [CCode (has_type_id = false)]
2856 public enum FileTest {
2864 [CCode (cprefix = "SEEK_", has_type_id = false)]
2865 public enum FileSeek {
2872 [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
2873 public class FileStream {
2874 [CCode (cname = "EOF", cheader_filename = "stdio.h")]
2875 public const int EOF;
2877 [CCode (cname = "fopen")]
2878 public static FileStream? open (string path, string mode);
2879 [CCode (cname = "fdopen")]
2880 public static FileStream? fdopen (int fildes, string mode);
2881 [CCode (cname = "fprintf")]
2883 public void printf (string format, ...);
2884 [CCode (cname = "vfprintf")]
2885 public void vprintf (string format, va_list args);
2886 [CCode (cname = "fputc", instance_pos = -1)]
2887 public void putc (char c);
2888 [CCode (cname = "fputs", instance_pos = -1)]
2889 public void puts (string s);
2890 [CCode (cname = "fgetc")]
2892 [CCode (cname = "ungetc", instance_pos = -1)]
2893 public int ungetc (int c);
2894 [CCode (cname = "fgets", instance_pos = -1)]
2895 public unowned string gets (char[] s);
2896 [CCode (cname = "feof")]
2898 [CCode (cname = "fscanf"), ScanfFormat]
2899 public int scanf (string format, ...);
2900 [CCode (cname = "fflush")]
2901 public int flush ();
2902 [CCode (cname = "fseek")]
2903 public int seek (long offset, FileSeek whence);
2904 [CCode (cname = "ftell")]
2905 public long tell ();
2906 [CCode (cname = "rewind")]
2907 public void rewind ();
2908 [CCode (cname = "fileno")]
2909 public int fileno ();
2910 [CCode (cname = "ferror")]
2911 public int error ();
2912 [CCode (cname = "clearerr")]
2913 public void clearerr ();
2914 [CCode (cname = "fread", instance_pos = -1)]
2915 public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
2916 [CCode (cname = "fwrite", instance_pos = -1)]
2917 public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
2919 public string? read_line () {
2921 StringBuilder? ret = null;
2922 while ((c = getc ()) != EOF) {
2924 ret = new StringBuilder ();
2929 ret.append_c ((char) c);
2939 [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
2940 namespace FileUtils {
2941 public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError;
2942 public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError;
2943 [CCode (cname = "g_file_get_contents")]
2944 public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "size_t")] out uint8[] contents) throws FileError;
2945 [CCode (cname = "g_file_set_contents")]
2946 public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "size_t")] uint8[] contents) throws FileError;
2947 public static bool test (string filename, FileTest test);
2948 public static int open_tmp (string tmpl, out string name_used) throws FileError;
2949 public static string read_link (string filename) throws FileError;
2950 public static int error_from_errno (int err_no);
2952 [CCode (cname = "g_mkstemp")]
2953 public static int mkstemp (string tmpl);
2954 [CCode (cname = "g_rename")]
2955 public static int rename (string oldfilename, string newfilename);
2956 [CCode (cname = "g_remove")]
2957 public static int remove (string filename);
2958 [CCode (cname = "g_unlink")]
2959 public static int unlink (string filename);
2960 [CCode (cname = "g_chmod")]
2961 public static int chmod (string filename, int mode);
2963 [CCode (cname = "symlink")]
2964 public static int symlink (string oldpath, string newpath);
2966 [CCode (cname = "close", cheader_filename = "unistd.h")]
2967 public static int close (int fd);
2970 [CCode (cname = "struct stat", cheader_filename = "sys/stat.h")]
2971 public struct Stat {
2972 [CCode (cname = "g_stat", instance_pos = -1)]
2973 public Stat (string filename);
2974 [CCode (cname = "g_lstat", instance_pos = -1)]
2975 public Stat.l (string filename);
2979 [CCode (free_function = "g_dir_close")]
2981 public static Dir open (string filename, uint _flags = 0) throws FileError;
2982 public unowned string? read_name ();
2983 public void rewind ();
2986 namespace DirUtils {
2987 [CCode (cname = "g_mkdir")]
2988 public static int create (string pathname, int mode);
2989 [CCode (cname = "g_mkdir_with_parents")]
2990 public static int create_with_parents (string pathname, int mode);
2991 [CCode (cname = "mkdtemp")]
2992 public static unowned string mkdtemp (string template);
2993 [CCode (cname = "g_rmdir")]
2994 public static int remove (string filename);
2999 [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref")]
3001 [CCode (free_function = "g_mapped_file_free")]
3003 public class MappedFile {
3004 public MappedFile (string filename, bool writable) throws FileError;
3005 public size_t get_length ();
3006 public unowned char* get_contents ();
3009 [CCode (cname = "stdin", cheader_filename = "stdio.h")]
3010 public static FileStream stdin;
3012 [CCode (cname = "stdout", cheader_filename = "stdio.h")]
3013 public static FileStream stdout;
3015 [CCode (cname = "stderr", cheader_filename = "stdio.h")]
3016 public static FileStream stderr;
3021 public const string RESERVED_CHARS_ALLOWED_IN_PATH;
3022 public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
3023 public const string RESERVED_CHARS_ALLOWED_IN_USERINFO;
3024 public const string RESERVED_CHARS_GENERIC_DELIMITERS;
3025 public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS;
3027 public static string parse_scheme (string uri);
3028 public static string escape_string (string unescaped, string reserved_chars_allowed, bool allow_utf8);
3029 public static string unescape_string (string escaped_string, string? illegal_characters = null);
3030 public static string unescape_segment (string escaped_string, string escaped_string_end, string? illegal_characters = null);
3031 [CCode (array_length = false, array_null_terminated = true)]
3032 public static string[] list_extract_uris (string uri_list);
3035 /* Shell-related Utilities */
3037 public errordomain ShellError {
3044 public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError;
3045 public static string quote (string unquoted_string);
3046 public static string unquote (string quoted_string) throws ShellError;
3049 /* Commandline option parser */
3051 public errordomain OptionError {
3058 [CCode (free_function = "g_option_context_free")]
3059 public class OptionContext {
3060 public OptionContext (string parameter_string);
3061 public void set_summary (string summary);
3062 public unowned string get_summary ();
3063 public void set_description (string description);
3064 public void get_description ();
3065 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3066 public void set_translation_domain (string domain);
3067 public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError;
3068 public void set_help_enabled (bool help_enabled);
3069 public bool get_help_enabled ();
3070 public void set_ignore_unknown_options (bool ignore_unknown);
3071 public bool get_ignore_unknown_options ();
3072 public string get_help (bool main_help, OptionGroup? group);
3073 public void add_main_entries ([CCode (array_length = false)] OptionEntry[] entries, string? translation_domain);
3074 public void add_group (owned OptionGroup group);
3075 public void set_main_group (owned OptionGroup group);
3076 public unowned OptionGroup get_main_group ();
3079 public delegate unowned string TranslateFunc (string str);
3081 [CCode (has_type_id = false)]
3082 public enum OptionArg {
3095 [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)]
3096 public enum OptionFlags {
3106 public struct OptionEntry {
3107 public unowned string long_name;
3108 public char short_name;
3111 public OptionArg arg;
3112 public void* arg_data;
3114 public unowned string description;
3115 public unowned string arg_description;
3119 [CCode (free_function = "g_option_group_free")]
3120 public class OptionGroup {
3121 public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null);
3122 public void add_entries ([CCode (array_length = false)] OptionEntry[] entries);
3123 public void set_parse_hooks (OptionParseFunc pre_parse_func, OptionParseFunc post_parse_hook);
3124 public void set_error_hook (OptionErrorFunc error_func);
3125 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3126 public void set_translation_domain (string domain);
3129 [CCode (has_target = false)]
3130 public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError;
3131 [CCode (has_target = false)]
3132 public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error);
3134 /* Perl-compatible regular expressions */
3136 public errordomain RegexError {
3143 [CCode (cprefix = "G_REGEX_", has_type_id = false)]
3144 public enum RegexCompileFlags {
3161 [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)]
3162 public enum RegexMatchFlags {
3175 [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
3176 public class Regex {
3177 public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
3178 public unowned string get_pattern ();
3179 public RegexCompileFlags get_compile_flags ();
3180 public RegexMatchFlags get_match_flags ();
3181 public int get_max_backref ();
3182 public int get_capture_count ();
3183 public int get_string_number (string name);
3184 public static string escape_string (string str, int length = -1);
3185 public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
3186 public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
3187 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;
3188 public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
3189 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;
3190 [CCode (array_length = false, array_null_terminated = true)]
3191 public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
3192 [CCode (array_length = false, array_null_terminated = true)]
3193 public string[] split (string str, RegexMatchFlags match_options = 0);
3194 [CCode (array_length = false, array_null_terminated = true)]
3195 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;
3196 public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
3197 public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
3198 public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval) throws RegexError;
3199 public static bool check_replacement (out bool has_references = null) throws RegexError;
3202 public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
3205 [CCode (free_function = "g_match_info_free")]
3206 public class MatchInfo {
3207 public unowned Regex get_regex ();
3208 public unowned string get_string ();
3209 public bool matches ();
3210 public bool next () throws RegexError;
3211 public int get_match_count ();
3212 public bool is_partial_match ();
3213 public string expand_references (string string_to_expand) throws RegexError;
3214 public string? fetch (int match_num);
3215 public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
3216 public string? fetch_named (string name);
3217 public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
3218 [CCode (array_length = false, array_null_terminated = true)]
3219 public string[] fetch_all ();
3222 /* Simple XML Subset Parser
3223 See http://live.gnome.org/Vala/MarkupSample for an example */
3225 public errordomain MarkupError {
3235 [CCode (cprefix = "G_MARKUP_", has_type_id = false)]
3236 public enum MarkupParseFlags {
3241 [CCode (free_function = "g_markup_parse_context_free")]
3242 public class MarkupParseContext {
3243 public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
3244 public bool parse (string text, ssize_t text_len) throws MarkupError;
3245 public bool end_parse () throws MarkupError;
3246 public unowned string get_element ();
3247 public unowned SList<string> get_element_stack ();
3248 public void get_position (out int line_number, out int char_number);
3249 public void push (MarkupParser parser, void* user_data);
3250 public void* pop ();
3253 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;
3255 public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
3257 public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
3259 public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
3261 public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
3263 public struct MarkupParser {
3264 public unowned MarkupParserStartElementFunc start_element;
3265 public unowned MarkupParserEndElementFunc end_element;
3266 public unowned MarkupParserTextFunc text;
3267 public unowned MarkupParserPassthroughFunc passthrough;
3268 public unowned MarkupParserErrorFunc error;
3272 [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)]
3273 public enum CollectType {
3282 public static string escape_text (string text, ssize_t length = -1);
3284 public static string printf_escaped (string format, ...);
3285 public static string vprintf_escaped (string format, va_list args);
3286 [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")]
3287 public static bool collect_attributes (string element_name, string[] attribute_names, string[] attribute_values, ...) throws MarkupError;
3290 /* Key-value file parser */
3292 public errordomain KeyFileError {
3302 [CCode (free_function = "g_key_file_free")]
3303 public class KeyFile {
3305 public void set_list_separator (char separator);
3306 public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError;
3307 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;
3308 public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError;
3309 public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
3310 // g_key_file_to_data never throws an error according to the documentation
3311 public string to_data (out size_t length = null, out GLib.Error error = null);
3312 public string get_start_group ();
3313 [CCode (array_length_type = "gsize")]
3314 public string[] get_groups ();
3315 [CCode (array_length_type = "gsize")]
3316 public string[] get_keys (string group_name) throws KeyFileError;
3317 public bool has_group (string group_name);
3318 public bool has_key (string group_name, string key) throws KeyFileError;
3319 public string get_value (string group_name, string key) throws KeyFileError;
3320 public string get_string (string group_name, string key) throws KeyFileError;
3321 public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError;
3322 public bool get_boolean (string group_name, string key) throws KeyFileError;
3323 public int get_integer (string group_name, string key) throws KeyFileError;
3324 public int64 get_int64 (string group_name, string key) throws KeyFileError;
3325 public uint64 get_uint64 (string group_name, string key) throws KeyFileError;
3326 public double get_double (string group_name, string key) throws KeyFileError;
3327 [CCode (array_length_type = "gsize")]
3328 public string[] get_string_list (string group_name, string key) throws KeyFileError;
3329 [CCode (array_length_type = "gsize")]
3330 public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError;
3331 [CCode (array_length_type = "gsize")]
3332 public bool[] get_boolean_list (string group_name, string key) throws KeyFileError;
3333 [CCode (array_length_type = "gsize")]
3334 public int[] get_integer_list (string group_name, string key) throws KeyFileError;
3335 [CCode (array_length_type = "gsize")]
3336 public double[] get_double_list (string group_name, string key) throws KeyFileError;
3337 public string get_comment (string group_name, string key) throws KeyFileError;
3338 public void set_value (string group_name, string key, string value);
3339 public void set_string (string group_name, string key, string str);
3340 public void set_locale_string (string group_name, string key, string locale, string str);
3341 public void set_boolean (string group_name, string key, bool value);
3342 public void set_integer (string group_name, string key, int value);
3343 public void set_int64 (string group_name, string key, int64 value);
3344 public void set_uint64 (string group_name, string key, uint64 value);
3345 public void set_double (string group_name, string key, double value);
3346 public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list);
3347 public void set_locale_string_list (string group_name, string key, string locale, string[] list);
3348 public void set_boolean_list (string group_name, string key, bool[] list);
3349 public void set_integer_list (string group_name, string key, int[] list);
3350 public void set_double_list (string group_name, string key, double[] list);
3351 public void set_comment (string group_name, string key, string comment) throws KeyFileError;
3352 public void remove_group (string group_name) throws KeyFileError;
3353 public void remove_key (string group_name, string key) throws KeyFileError;
3354 public void remove_comment (string group_name, string key) throws KeyFileError;
3357 [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)]
3358 public enum KeyFileFlags {
3364 [CCode (cprefix = "G_KEY_FILE_DESKTOP_")]
3365 namespace KeyFileDesktop {
3366 public static const string GROUP;
3367 public static const string KEY_TYPE;
3368 public static const string KEY_VERSION;
3369 public static const string KEY_NAME;
3370 public static const string KEY_GENERIC_NAME;
3371 public static const string KEY_NO_DISPLAY;
3372 public static const string KEY_COMMENT;
3373 public static const string KEY_ICON;
3374 public static const string KEY_HIDDEN;
3375 public static const string KEY_ONLY_SHOW_IN;
3376 public static const string KEY_NOT_SHOW_IN;
3377 public static const string KEY_TRY_EXEC;
3378 public static const string KEY_EXEC;
3379 public static const string KEY_PATH;
3380 public static const string KEY_TERMINAL;
3381 public static const string KEY_MIME_TYPE;
3382 public static const string KEY_CATEGORIES;
3383 public static const string KEY_STARTUP_NOTIFY;
3384 public static const string KEY_STARTUP_WM_CLASS;
3385 public static const string KEY_URL;
3386 public static const string TYPE_APPLICATION;
3387 public static const string TYPE_LINK;
3388 public static const string TYPE_DIRECTORY;
3391 /* Bookmark file parser */
3394 [CCode (free_function = "g_bookmark_file_free")]
3395 public class BookmarkFile {
3396 public BookmarkFile ();
3397 public bool load_from_file (string file) throws BookmarkFileError;
3398 public bool load_from_data (string data, size_t length) throws BookmarkFileError;
3399 public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError;
3400 public string to_data (out size_t length) throws BookmarkFileError;
3401 public bool to_file (string filename) throws BookmarkFileError;
3402 public bool has_item (string uri);
3403 public bool has_group (string uri, string group) throws BookmarkFileError;
3404 public bool has_application (string uri, string name) throws BookmarkFileError;
3405 public int get_size ();
3406 public string[] get_uris ();
3407 public string get_title (string uri) throws BookmarkFileError;
3408 public string get_description (string uri) throws BookmarkFileError;
3409 public string get_mime_type (string uri) throws BookmarkFileError;
3410 public bool get_is_private (string uri) throws BookmarkFileError;
3411 public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError;
3412 public time_t get_added (string uri) throws BookmarkFileError;
3413 public time_t get_modified (string uri) throws BookmarkFileError;
3414 public time_t get_visited (string uri) throws BookmarkFileError;
3415 public string[] get_groups (string uri) throws BookmarkFileError;
3416 public string[] get_applications (string uri) throws BookmarkFileError;
3417 public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError;
3418 public void set_title (string uri, string title);
3419 public void set_description (string uri, string description);
3420 public void set_mime_type (string uri, string mime_type);
3421 public void set_is_private (string uri, bool is_private);
3422 public void set_icon (string uri, string href, string mime_type);
3423 public void set_added (string uri, time_t added);
3424 public void set_groups (string uri, string[] groups);
3425 public void set_modified (string uri, time_t modified);
3426 public void set_visited (string uri, time_t visited);
3427 public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError;
3428 public void add_group (string uri, string group);
3429 public void add_application (string uri, string name, string exec);
3430 public bool remove_group (string uri, string group) throws BookmarkFileError;
3431 public bool remove_application (string uri, string name) throws BookmarkFileError;
3432 public bool remove_item (string uri) throws BookmarkFileError;
3433 public bool move_item (string old_uri, string new_uri) throws BookmarkFileError;
3436 public errordomain BookmarkFileError {
3451 public static void minimized_result (double minimized_quantity, string format, ...);
3453 public static void maximized_result (double maximized_quantity, string format, ...);
3454 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...);
3455 public static bool quick ();
3456 public static bool slow ();
3457 public static bool thorough ();
3458 public static bool perf ();
3459 public static bool verbose ();
3460 public static bool quiet ();
3461 public static int run ();
3462 public static void add_func (string testpath, Callback test_funcvoid);
3463 public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9)] DataTestFunc test_funcvoid);
3465 public static void message (string format, ...);
3466 public static void bug_base (string uri_pattern);
3467 public static void bug (string bug_uri_snippet);
3468 public static void timer_start ();
3469 public static double timer_elapsed ();
3470 public static double timer_last ();
3471 public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags);
3472 public static bool trap_has_passed ();
3473 public static bool trap_reached_timeout ();
3474 public static void trap_assert_passed ();
3475 public static void trap_assert_failed ();
3476 public static void trap_assert_stdout (string soutpattern);
3477 public static void trap_assert_stdout_unmatched (string soutpattern);
3478 public static void trap_assert_stderr (string serrpattern);
3479 public static void trap_assert_stderr_unmatched (string serrpattern);
3480 public static bool rand_bit ();
3481 public static int32 rand_int ();
3482 public static int32 rand_int_range (int32 begin, int32 end);
3483 public static double rand_double ();
3484 public static double rand_double_range ();
3485 public static void log_set_fatal_handler (LogFatalFunc log_func);
3488 public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message);
3491 [CCode (cname = "GTestCase", ref_function = "", unref_function = "")]
3492 public class TestCase {
3493 [CCode (cname = "g_test_create_case")]
3494 public TestCase (string test_name, [CCode (delegate_target_pos = 1.9, type = "void (*) (void)")] TestFunc data_setup, [CCode (delegate_target_pos = 1.9, type = "void (*) (void)")] TestFunc data_func, [CCode (delegate_target_pos = 1.9, type = "void (*) (void)")] TestFunc data_teardown, [CCode (pos = 1.8)] size_t data_size = 0);
3498 [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")]
3499 public class TestSuite {
3500 [CCode (cname = "g_test_create_suite")]
3501 public TestSuite (string name);
3502 [CCode (cname = "g_test_get_root")]
3503 public static TestSuite get_root ();
3504 [CCode (cname = "g_test_suite_add")]
3505 public void add (TestCase test_case);
3506 [CCode (cname = "g_test_suite_add_suite")]
3507 public void add_suite (TestSuite test_suite);
3510 public delegate void TestFunc (void* fixture);
3511 public delegate void DataTestFunc ();
3514 [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)]
3515 public enum TestTrapFlags {
3521 /* Doubly-Linked Lists */
3524 [CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
3525 public class List<G> {
3528 [ReturnsModifiedPointer ()]
3529 public void append (owned G data);
3530 [ReturnsModifiedPointer ()]
3531 public void prepend (owned G data);
3532 [ReturnsModifiedPointer ()]
3533 public void insert (owned G data, int position);
3534 [ReturnsModifiedPointer ()]
3535 public void insert_before (List<G> sibling, owned G data);
3536 [ReturnsModifiedPointer ()]
3537 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
3538 [ReturnsModifiedPointer ()]
3539 public void remove (G data);
3540 [ReturnsModifiedPointer ()]
3541 public void remove_link (List<G> llink);
3542 [ReturnsModifiedPointer ()]
3543 public void delete_link (List<G> link_);
3544 [ReturnsModifiedPointer ()]
3545 public void remove_all (G data);
3547 public uint length ();
3548 public List<unowned G> copy ();
3549 [ReturnsModifiedPointer ()]
3550 public void reverse ();
3551 [ReturnsModifiedPointer ()]
3552 public void sort (CompareFunc<G> compare_func);
3553 [ReturnsModifiedPointer ()]
3554 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
3555 [ReturnsModifiedPointer ()]
3556 public void sort_with_data (CompareDataFunc<G> compare_func);
3557 [ReturnsModifiedPointer ()]
3558 public void concat (owned List<G> list2);
3559 public void @foreach (Func<G> func);
3561 public unowned List<G> first ();
3562 public unowned List<G> last ();
3563 public unowned List<G> nth (uint n);
3564 public unowned G nth_data (uint n);
3565 public unowned List<G> nth_prev (uint n);
3567 public unowned List<G> find (G data);
3568 public unowned List<G> find_custom (G data, CompareFunc<G> func);
3569 public int position (List<G> llink);
3570 public int index (G data);
3573 public List<G> next;
3574 public unowned List<G> prev;
3577 /* Singly-Linked Lists */
3580 [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
3581 public class SList<G> {
3584 [ReturnsModifiedPointer ()]
3585 public void append (owned G data);
3586 [ReturnsModifiedPointer ()]
3587 public void prepend (owned G data);
3588 [ReturnsModifiedPointer ()]
3589 public void insert (owned G data, int position);
3590 [ReturnsModifiedPointer ()]
3591 public void insert_before (SList<G> sibling, owned G data);
3592 [ReturnsModifiedPointer ()]
3593 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
3594 [ReturnsModifiedPointer ()]
3595 public void remove (G data);
3596 [ReturnsModifiedPointer ()]
3597 public void remove_link (SList<G> llink);
3598 [ReturnsModifiedPointer ()]
3599 public void delete_link (SList<G> link_);
3600 [ReturnsModifiedPointer ()]
3601 public void remove_all (G data);
3603 public uint length ();
3604 public SList<unowned G> copy ();
3605 [ReturnsModifiedPointer ()]
3606 public void reverse ();
3607 [ReturnsModifiedPointer ()]
3608 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
3609 [ReturnsModifiedPointer ()]
3610 public void sort (CompareFunc<G> compare_func);
3611 [ReturnsModifiedPointer ()]
3612 public void sort_with_data (CompareDataFunc<G> compare_func);
3613 [ReturnsModifiedPointer ()]
3614 public void concat (owned SList<G> list2);
3615 public void @foreach (Func<G> func);
3617 public unowned SList<G> last ();
3618 public unowned SList<G> nth (uint n);
3619 public unowned G nth_data (uint n);
3621 public unowned SList<G> find (G data);
3622 public unowned SList<G> find_custom (G data, CompareFunc<G> func);
3623 public int position (SList<G> llink);
3624 public int index (G data);
3627 public SList<G> next;
3630 [CCode (has_target = false)]
3631 public delegate int CompareFunc<G> (G a, G b);
3633 public delegate int CompareDataFunc<G> (G a, G b);
3635 [CCode (cname = "g_strcmp0")]
3636 public static GLib.CompareFunc<string> strcmp;
3638 /* Double-ended Queues */
3641 [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
3642 public class Queue<G> {
3643 public unowned List<G> head;
3644 public unowned List<G> tail;
3649 public void clear ();
3650 public bool is_empty ();
3651 public uint get_length ();
3652 public void reverse ();
3653 public Queue copy ();
3654 public unowned List<G> find (G data);
3655 public unowned List<G> find_custom (G data, CompareFunc<G> func);
3656 public void sort (CompareDataFunc<G> compare_func);
3657 public void push_head (owned G data);
3658 public void push_tail (owned G data);
3659 public void push_nth (owned G data, int n);
3660 public G pop_head ();
3661 public G pop_tail ();
3662 public G pop_nth (uint n);
3663 public unowned G peek_head ();
3664 public unowned G peek_tail ();
3665 public unowned G peek_nth (uint n);
3666 public int index (G data);
3667 public void remove (G data);
3668 public void remove_all (G data);
3669 public void delete_link (List<G> link);
3670 public void unlink (List<G> link);
3671 public void insert_before (List<G> sibling, owned G data);
3672 public void insert_after (List<G> sibling, owned G data);
3673 public void insert_sorted (owned G data, CompareDataFunc<G> func);
3679 [CCode (free_function = "g_sequence_free")]
3680 public class Sequence<G> {
3681 public Sequence (DestroyNotify? data_destroy);
3682 public int get_length ();
3683 public void @foreach (Func<G> func);
3684 public static void foreach_range (SequenceIter<G> begin, SequenceIter<G> end, Func<G> func);
3685 public void sort (CompareDataFunc<G> cmp_func);
3686 public void sort_iter (SequenceIterCompareFunc<G> func);
3687 public SequenceIter<G> get_begin_iter ();
3688 public SequenceIter<G> get_end_iter ();
3689 public SequenceIter<G> get_iter_at_pos (int pos);
3690 public SequenceIter<G> append (owned G data);
3691 public SequenceIter<G> prepend (owned G data);
3692 public static SequenceIter<G> insert_before (SequenceIter<G> iter, owned G data);
3693 public static void move (SequenceIter<G> src, SequenceIter<G> dest);
3694 public static void swap (SequenceIter<G> src, SequenceIter<G> dest);
3695 public SequenceIter<G> insert_sorted (owned G data, CompareDataFunc<G> cmp_func);
3696 public SequenceIter<G> insert_sorted_iter (owned G data, SequenceIterCompareFunc<G> iter_cmp);
3697 public static void sort_changed (SequenceIter<G> iter, CompareDataFunc<G> cmp_func);
3698 public static void sort_changed_iter (SequenceIter<G> iter, SequenceIterCompareFunc<G> iter_cmp);
3699 public static void remove (SequenceIter<G> iter);
3700 public static void remove_range (SequenceIter<G> begin, SequenceIter<G> end);
3701 public static void move_range (SequenceIter<G> dest, SequenceIter<G> begin, SequenceIter<G> end);
3702 public SequenceIter<G> search (G data, CompareDataFunc<G> cmp_func);
3703 public SequenceIter<G> search_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
3704 public static unowned G get (SequenceIter<G> iter);
3705 public static void set (SequenceIter<G> iter, owned G data);
3706 public static SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
3710 [CCode (ref_function = "", unref_function = "")]
3711 public class SequenceIter<G> {
3712 public bool is_begin ();
3713 public bool is_end ();
3714 public SequenceIter<G> next ();
3715 public SequenceIter<G> prev ();
3716 public int get_position ();
3717 public SequenceIter<G> move (int delta);
3718 public Sequence<G> get_sequence ();
3719 public int compare (SequenceIter<G> other);
3721 [CCode (cname = "g_sequence_get")]
3722 public unowned G get ();
3725 public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
3730 [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
3731 public class HashTable<K,V> {
3732 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
3733 public HashTable (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func);
3734 public HashTable.full (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
3735 public void insert (owned K key, owned V value);
3736 public void replace (owned K key, owned V value);
3737 public unowned V lookup (K key);
3738 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
3739 public bool remove (K key);
3740 public void remove_all ();
3741 public List<unowned K> get_keys ();
3742 public List<unowned V> get_values ();
3743 public void @foreach (HFunc<K,V> func);
3744 [CCode (cname = "g_hash_table_foreach")]
3745 public void for_each (HFunc<K,V> func);
3746 public unowned V find (HRFunc<K,V> predicate);
3747 public uint size ();
3748 public bool steal (K key);
3749 public void steal_all ();
3752 public struct HashTableIter<K,V> {
3753 public HashTableIter (GLib.HashTable<K,V> table);
3754 public bool next (out unowned K key, out unowned V value);
3755 public void remove ();
3756 public void steal ();
3757 public unowned GLib.HashTable<K,V> get_hash_table ();
3760 [CCode (has_target = false)]
3761 public delegate uint HashFunc<K> (K key);
3762 [CCode (has_target = false)]
3763 public delegate bool EqualFunc<G> (G a, G b);
3764 public delegate void HFunc<K,V> (K key, V value);
3765 public delegate bool HRFunc<K,V> (K key, V value);
3767 [CCode (has_target = false)]
3768 public delegate void DestroyNotify (void* data);
3770 [CCode (cname = "g_direct_hash")]
3771 public static GLib.HashFunc<void*> direct_hash;
3772 [CCode (cname = "g_direct_equal")]
3773 public static GLib.EqualFunc<void*> direct_equal;
3774 [CCode (cname = "g_int64_hash")]
3775 public static GLib.HashFunc<int64?> int64_hash;
3776 [CCode (cname = "g_int64_equal")]
3777 public static GLib.EqualFunc<int64?> int64_equal;
3778 [CCode (cname = "g_int_hash")]
3779 public static GLib.HashFunc<int?> int_hash;
3780 [CCode (cname = "g_int_equal")]
3781 public static GLib.EqualFunc<int?> int_equal;
3782 [CCode (cname = "g_str_hash")]
3783 public static GLib.HashFunc<string> str_hash;
3784 [CCode (cname = "g_str_equal")]
3785 public static GLib.EqualFunc<string> str_equal;
3786 [CCode (cname = "g_free")]
3787 public static GLib.DestroyNotify g_free;
3788 [CCode (cname = "g_object_unref")]
3789 public static GLib.DestroyNotify g_object_unref;
3790 [CCode (cname = "g_list_free")]
3791 public static GLib.DestroyNotify g_list_free;
3792 [CCode (cname = "((GDestroyNotify) g_variant_unref)")]
3793 public static GLib.DestroyNotify g_variant_unref;
3798 [GIR (name = "String")]
3799 [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
3800 public class StringBuilder {
3801 public StringBuilder (string init = "");
3802 [CCode (cname = "g_string_sized_new")]
3803 public StringBuilder.sized (size_t dfl_size);
3804 public unowned StringBuilder assign (string rval);
3805 public unowned StringBuilder append (string val);
3806 public unowned StringBuilder append_c (char c);
3807 public unowned StringBuilder append_unichar (unichar wc);
3808 public unowned StringBuilder append_len (string val, ssize_t len);
3809 public unowned StringBuilder prepend (string val);
3810 public unowned StringBuilder prepend_c (char c);
3811 public unowned StringBuilder prepend_unichar (unichar wc);
3812 public unowned StringBuilder prepend_len (string val, ssize_t len);
3813 public unowned StringBuilder insert (ssize_t pos, string val);
3814 public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
3815 public unowned StringBuilder truncate (size_t len = 0);
3818 public void printf (string format, ...);
3820 public void append_printf (string format, ...);
3821 public void vprintf (string format, va_list args);
3822 public void append_vprintf (string format, va_list args);
3826 public ssize_t allocated_len;
3832 [CCode (free_function = "g_string_chunk_free")]
3833 public class StringChunk {
3834 public StringChunk (size_t size);
3835 public unowned string insert (string str);
3836 public unowned string insert_const (string str);
3837 public unowned string insert_len (string str, ssize_t len);
3838 public void clear ();
3841 /* Pointer Arrays */
3845 [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
3847 [CCode (free_function = "g_ptr_array_free")]
3849 public class PtrArray {
3851 public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func);
3852 [CCode (cname = "g_ptr_array_sized_new")]
3853 public PtrArray.sized (uint reserved_size);
3854 public void add (void* data);
3855 public void foreach (GLib.Func<void*> func);
3856 [CCode (cname = "g_ptr_array_index")]
3857 public void* index(uint index);
3858 public bool remove (void* data);
3859 public void* remove_index (uint index);
3860 public bool remove_fast (void *data);
3861 public void remove_index_fast (uint index);
3862 public void remove_range (uint index, uint length);
3863 public void sort (CompareFunc compare_func);
3864 public void sort_with_data (CompareDataFunc compare_func);
3865 public void set_free_func (GLib.DestroyNotify? element_free_function);
3866 public void set_size (int length);
3869 public void** pdata;
3873 [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")]
3874 public class GenericArray<G> {
3875 [CCode (cname = "g_ptr_array_new_with_free_func", simple_generics = true)]
3876 public GenericArray ();
3877 public void add (owned G data);
3878 public void foreach (GLib.Func<G> func);
3879 [CCode (cname = "g_ptr_array_index")]
3880 public unowned G get (uint index);
3881 public bool remove (G data);
3882 public void remove_index (uint index);
3883 public bool remove_fast (G data);
3884 public void remove_index_fast (uint index);
3885 public void remove_range (uint index, uint length);
3886 public void set (uint index, owned G data) {
3887 this.add ((owned) data);
3888 this.remove_index_fast (index);
3890 public void sort (GLib.CompareFunc<G> compare_func);
3891 public void sort_with_data (GLib.CompareDataFunc<G> compare_func);
3892 private void set_size (int length);
3895 get { return (int) this.len; }
3896 set { this.set_size (value); }
3906 [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")]
3908 [CCode (cprefix = "g_byte_array_", free_function = "g_byte_array_free")]
3910 public class ByteArray {
3911 public ByteArray ();
3912 [CCode (cname = "g_byte_array_sized_new")]
3913 public ByteArray.sized (uint reserved_size);
3914 public void append (uint8[] data);
3915 public void prepend (uint8[] data);
3916 public void remove_index (uint index);
3917 public void remove_index_fast (uint index);
3918 public void remove_range (uint index, uint length);
3919 public void sort (CompareFunc<int8> compare_func);
3920 public void sort_with_data (CompareDataFunc<int8> compare_func);
3921 public void set_size (uint length);
3924 [CCode (array_length_cname = "len", array_length_type = "guint")]
3925 public uint8[] data;
3930 public delegate bool NodeTraverseFunc (Node node);
3931 public delegate void NodeForeachFunc (Node node);
3933 [CCode (cprefix = "G_TRAVERSE_")]
3934 public enum TraverseFlags {
3941 [CCode (dup_function = "g_node_copy", free_function = "g_node_destroy")]
3942 public class Node<G> {
3943 public Node(owned G? data = null);
3944 public Node<unowned G> copy ();
3945 public unowned Node<G> insert (int position, owned Node<G> node);
3946 public unowned Node<G> insert_before (Node<G> sibling, owned Node<G> node);
3947 public unowned Node<G> insert_after (Node<G> sibling, owned Node<G> node);
3948 public unowned Node<G> append (owned Node<G> node);
3949 public unowned Node<G> prepend (owned Node<G> node);
3950 public unowned Node<G> insert_data (int position, owned G data);
3951 public unowned Node<G> insert_data_before (Node<G> sibling, owned G data);
3952 public unowned Node<G> append_data (owned G data);
3953 public unowned Node<G> prepend_data (owned G data);
3954 public void reverse_children ();
3955 public void traverse (TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func);
3956 public void children_foreach (TraverseFlags flags, NodeForeachFunc func);
3957 public unowned Node<G> get_root ();
3958 public unowned Node<G> find (TraverseType order, TraverseFlags flags, G data);
3959 public unowned Node<G> find_child (TraverseFlags flags, G data);
3960 public int child_index (G data);
3961 public int child_position (Node<G> child);
3962 public unowned Node<G> first_child ();
3963 public unowned Node<G> last_child ();
3964 public unowned Node<G> nth_child ();
3965 public unowned Node<G> first_sibling ();
3966 public unowned Node<G> next_sibling ();
3967 public unowned Node<G> prev_sibling ();
3968 public unowned Node<G> last_sibling ();
3970 [CCode (cname = "G_NODE_IS_LEAF")]
3971 public bool is_leaf ();
3972 [CCode (cname = "G_NODE_IS_ROOT")]
3973 public bool is_root ();
3974 public bool is_ancestor (Node<G> descendant);
3976 public uint depth ();
3977 public uint n_nodes (TraverseFlags flags);
3978 public uint max_height ();
3980 [CCode (cname = "g_node_unlink")]
3981 public void _unlink ();
3982 [CCode (cname = "g_node_unlink_vala")]
3983 public Node<G> unlink ()
3987 return (Node<G>) (owned) ptr;
3994 public Node children;
3999 [CCode (type_id = "G_TYPE_UINT")]
4000 public struct Quark : uint32 {
4001 public static Quark from_string (string str);
4002 public static Quark try_string (string str);
4003 public unowned string to_string ();
4006 /* Keyed Data Lists */
4008 [CCode (cname = "GData*")]
4009 public struct Datalist<G> {
4011 public void clear ();
4012 public unowned G id_get_data (Quark key_id);
4013 public void id_set_data (Quark key_id, owned G data);
4014 public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
4015 public void id_remove_data (Quark key_id);
4016 public G id_remove_no_notify (Quark key_id);
4017 public void @foreach (DataForeachFunc func);
4018 public unowned G get_data (string key);
4019 public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
4020 public G remove_no_notify (string key);
4021 public void set_data (string key, owned G data);
4022 public void remove_data (string key);
4025 public delegate void DataForeachFunc<G> (Quark key_id, G data);
4031 [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")]
4033 [CCode (free_function = "g_array_free")]
4035 public class Array<G> {
4036 [CCode (cname = "len")]
4039 public Array (bool zero_terminated, bool clear, ulong element_size);
4040 [CCode (cname = "g_array_sized_new")]
4041 public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
4042 public void append_val (owned G value);
4043 public void append_vals (void* data, uint len);
4044 public void prepend_val (owned G value);
4045 public void prepend_vals (void* data, uint len);
4046 public void insert_val (uint index, owned G value);
4047 public void insert_vals (uint index, void* data, uint len);
4048 public void remove_index (uint index);
4049 public void remove_index_fast (uint index);
4050 public void remove_range (uint index, uint length);
4051 public void sort (CompareFunc<G> compare_func);
4052 public void sort_with_data (CompareDataFunc<G> compare_func);
4053 [CCode (generic_type_pos = 0.1)]
4054 public unowned G index (uint index);
4055 public void set_size (uint length);
4060 public delegate int TraverseFunc (void* key, void* value);
4062 [CCode (cprefix = "G_", has_type_id = false)]
4063 public enum TraverseType {
4070 public delegate int TreeSearchFunc<K> (K key);
4074 [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")]
4076 [CCode (free_function = "g_tree_destroy")]
4078 public class Tree<K,V> {
4079 public Tree (CompareFunc<K> key_compare_func);
4080 public Tree.with_data (CompareDataFunc<K> key_compare_func);
4081 public Tree.full (CompareDataFunc<K> key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
4082 public void insert (owned K key, owned V value);
4083 public void replace (owned K key, owned V value);
4084 public int nnodes ();
4085 public int height ();
4086 public unowned V lookup (K key);
4087 public bool lookup_extended (K lookup_key, K orig_key, V value);
4088 public void foreach (TraverseFunc traverse_func);
4089 public unowned V search (TreeSearchFunc<K> search_func);
4090 [CCode (cname = "g_tree_search")]
4091 public unowned V search_key (CompareFunc<K> search_func, K key);
4092 public bool remove (K key);
4093 public bool steal (K key);
4096 /* Internationalization */
4098 [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4099 public static unowned string _ (string str);
4100 [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4101 public static unowned string Q_ (string str);
4102 [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4103 public static unowned string N_ (string str);
4104 [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4105 public static unowned string ngettext (string msgid, string msgid_plural, ulong n);
4106 [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")]
4107 public static unowned string dgettext (string? domain, string msgid);
4108 [CCode (cname = "g_dcgettext", cheader_filename = "glib/gi18n-lib.h")]
4109 public static unowned string dcgettext (string? domain, string msgid, int category);
4110 [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")]
4111 public static unowned string dngettext (string? domain, string msgid, string msgid_plural, ulong n);
4112 [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")]
4113 public static unowned string dpgettext (string? domain, string msgctxid, size_t msgidoffset);
4114 [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")]
4115 public static unowned string dpgettext2 (string? domain, string context, string msgid);
4117 [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
4118 public enum LocaleCategory {
4129 [CCode (cname = "setlocale", cheader_filename = "locale.h")]
4130 public static unowned string? setlocale (LocaleCategory category, string? locale);
4131 [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")]
4132 public static unowned string? bindtextdomain (string domainname, string? dirname);
4133 [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")]
4134 public static unowned string? textdomain (string? domainname);
4135 [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")]
4136 public static unowned string? bind_textdomain_codeset (string domainname, string? codeset);
4137 [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)]
4138 public static unowned string[] get_language_names ();
4139 [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")]
4140 public static unowned string strip_context (string msgid, string msgval);
4144 public class PatternSpec {
4145 public PatternSpec (string pattern);
4146 public bool equal (PatternSpec pspec);
4147 [CCode (cname = "g_pattern_match")]
4148 public bool match (uint string_length, string str, string? str_reversed);
4149 [CCode (cname = "g_pattern_match_string")]
4150 public bool match_string (string str);
4151 [CCode (cname = "g_pattern_match_simple")]
4152 public static bool match_simple (string pattern, string str);
4156 public string error_message (int error);
4157 public string getlocale ();
4158 public string get_package_installation_directory_of_module (void* hmodule);
4159 public uint get_windows_version ();
4160 public string locale_filename_from_utf8 (string utf8filename);
4161 [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")]
4162 public bool have_widechar_api ();
4163 [CCode (cname = "G_WIN32_IS_NT_BASED")]
4164 public bool is_nt_based ();
4168 [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
4169 public class VariantType {
4170 [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
4171 public static VariantType BOOLEAN;
4172 [CCode (cname = "G_VARIANT_TYPE_BYTE")]
4173 public static VariantType BYTE;
4174 [CCode (cname = "G_VARIANT_TYPE_INT16")]
4175 public static VariantType INT16;
4176 [CCode (cname = "G_VARIANT_TYPE_UINT16")]
4177 public static VariantType UINT16;
4178 [CCode (cname = "G_VARIANT_TYPE_INT32")]
4179 public static VariantType INT32;
4180 [CCode (cname = "G_VARIANT_TYPE_UINT32")]
4181 public static VariantType UINT32;
4182 [CCode (cname = "G_VARIANT_TYPE_INT64")]
4183 public static VariantType INT64;
4184 [CCode (cname = "G_VARIANT_TYPE_UINT64")]
4185 public static VariantType UINT64;
4186 [CCode (cname = "G_VARIANT_TYPE_DOUBLE")]
4187 public static VariantType DOUBLE;
4188 [CCode (cname = "G_VARIANT_TYPE_STRING")]
4189 public static VariantType STRING;
4190 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")]
4191 public static VariantType OBJECT_PATH;
4192 [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")]
4193 public static VariantType SIGNATURE;
4194 [CCode (cname = "G_VARIANT_TYPE_VARIANT")]
4195 public static VariantType VARIANT;
4196 [CCode (cname = "G_VARIANT_TYPE_UNIT")]
4197 public static VariantType UNIT;
4198 [CCode (cname = "G_VARIANT_TYPE_ANY")]
4199 public static VariantType ANY;
4200 [CCode (cname = "G_VARIANT_TYPE_BASIC")]
4201 public static VariantType BASIC;
4202 [CCode (cname = "G_VARIANT_TYPE_MAYBE")]
4203 public static VariantType MAYBE;
4204 [CCode (cname = "G_VARIANT_TYPE_ARRAY")]
4205 public static VariantType ARRAY;
4206 [CCode (cname = "G_VARIANT_TYPE_TUPLE")]
4207 public static VariantType TUPLE;
4208 [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")]
4209 public static VariantType DICT_ENTRY;
4210 [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")]
4211 public static VariantType DICTIONARY;
4213 public static bool string_is_valid (string type_string);
4214 public static bool string_scan (string type_string, char *limit, out char* endptr);
4216 public VariantType (string type_string);
4217 public size_t get_string_length ();
4218 public char* peek_string ();
4219 public string dup_string ();
4221 public bool is_definite ();
4222 public bool is_container ();
4223 public bool is_basic ();
4224 public bool is_maybe ();
4225 public bool is_array ();
4226 public bool is_tuple ();
4227 public bool is_dict_entry ();
4228 public bool is_variant ();
4230 public uint hash ();
4231 public bool equal (VariantType other);
4232 public bool is_subtype_of (VariantType supertype);
4234 public unowned VariantType element ();
4235 public unowned VariantType first ();
4236 public unowned VariantType next ();
4237 public unowned VariantType n_items ();
4238 public unowned VariantType key ();
4239 public unowned VariantType value ();
4241 public VariantType.array (VariantType element);
4242 public VariantType.maybe (VariantType element);
4243 public VariantType.tuple (VariantType[] items);
4244 public VariantType.dict_entry (VariantType key, VariantType value);
4248 [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")]
4249 public class Variant {
4250 [CCode (has_type_id = false)]
4252 BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64,
4253 UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH,
4254 SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY
4257 public unowned VariantType get_type ();
4258 public unowned string get_type_string ();
4259 public bool is_of_type (VariantType type);
4260 public bool is_container ();
4261 public bool is_floating ();
4262 public Class classify ();
4263 public int compare (Variant other);
4265 public Variant.boolean (bool value);
4266 public Variant.byte (uchar value);
4267 public Variant.int16 (int16 value);
4268 public Variant.uint16 (uint16 value);
4269 public Variant.int32 (int32 value);
4270 public Variant.uint32 (uint32 value);
4271 public Variant.int64 (int64 value);
4272 public Variant.uint64 (uint64 value);
4273 public Variant.handle (int32 value);
4274 public Variant.double (double value);
4275 public Variant.string (string value);
4276 public Variant.bytestring (string value);
4277 public Variant.object_path (string object_path);
4278 public static bool is_object_path (string object_path);
4279 public Variant.signature (string signature);
4280 public static bool is_signature (string signature);
4282 public bool get_boolean ();
4283 public uint8 get_byte ();
4284 public int16 get_int16 ();
4285 public uint16 get_uint16 ();
4286 public int32 get_int32 ();
4287 public uint32 get_uint32 ();
4288 public int64 get_int64 ();
4289 public uint64 get_uint64 ();
4290 public int32 get_handle ();
4291 public double get_double ();
4292 public unowned string get_string (out size_t length = null);
4293 public string dup_string (out size_t length = null);
4294 public unowned string get_bytestring ();
4295 public string dup_bytestring ();
4297 public Variant.strv (string[] value);
4298 [CCode (array_length_type = "size_t")]
4299 public string*[] get_strv ();
4300 [CCode (array_length_type = "size_t")]
4301 public string[] dup_strv ();
4303 public Variant.bytestring_array (string[] value);
4304 [CCode (array_length_type = "size_t")]
4305 public string*[] get_bytestring_array ();
4306 [CCode (array_length_type = "size_t")]
4307 public string[] dup_bytestring_array ();
4309 public Variant (string format, ...);
4310 public void get (string format, ...);
4312 public Variant.variant (Variant value);
4313 public Variant.maybe (VariantType? child_type, Variant? child);
4314 public Variant.array (VariantType? child_type, Variant[] children);
4315 public Variant.tuple (Variant[] children);
4316 public Variant.dict_entry (Variant key, Variant value);
4317 public Variant get_variant ();
4318 public Variant? get_maybe ();
4320 public size_t n_children ();
4321 public Variant get_child_value (size_t index);
4323 public size_t get_size ();
4324 public void *get_data ();
4325 public void store (void *data);
4327 public string print (bool type_annotate);
4328 public StringBuilder print_string (StringBuilder? builder, bool type_annotate);
4330 public uint hash ();
4331 public bool equal (Variant other);
4333 public Variant byteswap ();
4334 public Variant get_normal_form ();
4335 public bool is_normal_form ();
4336 [CCode (returns_floating_reference = true, simple_generics = true)]
4337 public static Variant new_from_data<T> (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null);
4339 [CCode (cname = "g_variant_iter_new")]
4340 public VariantIter iterator ();
4342 public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError;
4343 public Variant.parsed (string format_string, ...);
4346 public errordomain VariantParseError {
4351 [CCode (copy_func = "g_variant_iter_copy", free_func = "g_variant_iter_free")]
4352 public class VariantIter {
4353 public VariantIter (Variant value);
4354 public size_t n_children ();
4355 public Variant? next_value ();
4356 public bool next (string format_string, ...);
4360 [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref")]
4361 public class VariantBuilder {
4362 public VariantBuilder (VariantType type);
4363 public void open (VariantType type);
4364 public void close ();
4365 public void add_value (Variant value);
4366 public void add (string format_string, ...);
4367 [CCode (returns_floating_reference = true)]
4368 public Variant end ();
4372 [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")]
4373 public class ObjectPath : string {
4374 [CCode (cname = "g_strdup")]
4375 public ObjectPath (string path);
4378 [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")]
4379 public class BusName : string {
4380 [CCode (cname = "g_strdup")]
4381 public BusName (string bus_name);
4385 [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]
4386 public static bool likely (bool expression);
4387 [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")]
4388 public static bool unlikely (bool expression);
4389 [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")]
4390 public static void static_assert (bool expression);
4392 [CCode (simple_generics = true)]
4393 private static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func);