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 () {
44 public static bool parse (string str) {
51 public static bool try_parse (string str, out bool result = null) {
55 } else if (str == "false") {
66 [GIR (name = "gint8")]
67 [CCode (cname = "gchar", cprefix = "g_ascii_", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "\'\\0\'", type_signature = "y")]
68 [IntegerType (rank = 2, min = 0, max = 127)]
70 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
71 public string to_string (string format = "%c");
72 public bool isalnum ();
73 public bool isalpha ();
74 public bool iscntrl ();
75 public bool isdigit ();
76 public bool isgraph ();
77 public bool islower ();
78 public bool isprint ();
79 public bool ispunct ();
80 public bool isspace ();
81 public bool isupper ();
82 public bool isxdigit ();
83 public int digit_value ();
84 public int xdigit_value ();
85 public char tolower ();
86 public char toupper ();
88 [CCode (cname = "MIN")]
89 public static char min (char a, char b);
90 [CCode (cname = "MAX")]
91 public static char max (char a, char b);
92 [CCode (cname = "CLAMP")]
93 public char clamp (char low, char high);
97 [GIR (name = "guint8")]
98 [CCode (cname = "guchar", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "\'\\0\'", type_signature = "y")]
99 [IntegerType (rank = 3, min = 0, max = 255)]
100 public struct uchar {
101 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
102 public string to_string (string format = "%hhu");
104 [CCode (cname = "MIN")]
105 public static uchar min (uchar a, uchar b);
106 [CCode (cname = "MAX")]
107 public static uchar max (uchar a, uchar b);
108 [CCode (cname = "CLAMP")]
109 public uchar clamp (uchar low, uchar high);
113 [GIR (name = "gint")]
114 [CCode (cname = "gint", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", type_signature = "i")]
115 [IntegerType (rank = 6)]
117 [CCode (cname = "G_MININT")]
118 public static int MIN;
119 [CCode (cname = "G_MAXINT")]
120 public static int MAX;
122 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
123 public string to_string (string format = "%i");
125 [CCode (cname = "MIN")]
126 public static int min (int a, int b);
127 [CCode (cname = "MAX")]
128 public static int max (int a, int b);
129 [CCode (cname = "CLAMP")]
130 public int clamp (int low, int high);
132 [CCode (cname = "GINT_TO_POINTER")]
133 public void* to_pointer ();
135 [CCode (cname = "abs", cheader_filename = "stdlib.h")]
138 [CCode (cname = "GINT_TO_BE")]
139 public int to_big_endian ();
140 [CCode (cname = "GINT_TO_LE")]
141 public int to_little_endian ();
143 [CCode (cname = "GINT_FROM_BE")]
144 public static int from_big_endian (int val);
145 [CCode (cname = "GINT_FROM_LE")]
146 public static int from_little_endian (int val);
148 [CCode (cname = "atoi", cheader_filename = "stdlib.h")]
149 public static int parse (string str);
153 [GIR (name = "guint")]
154 [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")]
155 [IntegerType (rank = 7)]
157 [CCode (cname = "0")]
158 public static uint MIN;
159 [CCode (cname = "G_MAXUINT")]
160 public static uint MAX;
162 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
163 public string to_string (string format = "%u");
165 [CCode (cname = "MIN")]
166 public static uint min (uint a, uint b);
167 [CCode (cname = "MAX")]
168 public static uint max (uint a, uint b);
169 [CCode (cname = "CLAMP")]
170 public uint clamp (uint low, uint high);
172 [CCode (cname = "GUINT_TO_POINTER")]
173 public void* to_pointer ();
175 [CCode (cname = "GUINT_TO_BE")]
176 public uint to_big_endian ();
177 [CCode (cname = "GUINT_TO_LE")]
178 public uint to_little_endian ();
180 [CCode (cname = "GUINT_FROM_BE")]
181 public static uint from_big_endian (uint val);
182 [CCode (cname = "GUINT_FROM_LE")]
183 public static uint from_little_endian (uint val);
187 [GIR (name = "gshort")]
188 [CCode (cname = "gshort", cheader_filename = "glib.h", has_type_id = false, default_value = "0", type_signature = "n")]
189 [IntegerType (rank = 4, min = -32768, max = 32767)]
190 public struct short {
191 [CCode (cname = "G_MINSHORT")]
192 public static short MIN;
193 [CCode (cname = "G_MAXSHORT")]
194 public static short MAX;
196 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
197 public string to_string (string format = "%hi");
199 [CCode (cname = "MIN")]
200 public static short min (short a, short b);
201 [CCode (cname = "MAX")]
202 public static short max (short a, short b);
203 [CCode (cname = "CLAMP")]
204 public short clamp (short low, short high);
208 [GIR (name = "gushort")]
209 [CCode (cname = "gushort", cheader_filename = "glib.h", has_type_id = false, default_value = "0U", type_signature = "q")]
210 [IntegerType (rank = 5, min = 0, max = 65535)]
211 public struct ushort {
212 [CCode (cname = "0U")]
213 public static ushort MIN;
214 [CCode (cname = "G_MAXUSHORT")]
215 public static ushort MAX;
217 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
218 public string to_string (string format = "%hu");
220 [CCode (cname = "MIN")]
221 public static ushort min (ushort a, ushort b);
222 [CCode (cname = "MAX")]
223 public static ushort max (ushort a, ushort b);
224 [CCode (cname = "CLAMP")]
225 public ushort clamp (ushort low, ushort high);
229 [GIR (name = "glong")]
230 [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")]
231 [IntegerType (rank = 8)]
233 [CCode (cname = "G_MINLONG")]
234 public static long MIN;
235 [CCode (cname = "G_MAXLONG")]
236 public static long MAX;
238 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
239 public string to_string (string format = "%li");
241 [CCode (cname = "MIN")]
242 public static long min (long a, long b);
243 [CCode (cname = "MAX")]
244 public static long max (long a, long b);
245 [CCode (cname = "CLAMP")]
246 public long clamp (long low, long high);
247 [CCode (cname = "labs", cheader_filename = "stdlib.h")]
250 [CCode (cname = "GLONG_TO_BE")]
251 public long to_big_endian ();
252 [CCode (cname = "GLONG_TO_LE")]
253 public long to_little_endian ();
255 [CCode (cname = "GLONG_FROM_BE")]
256 public static long from_big_endian (long val);
257 [CCode (cname = "GLONG_FROM_LE")]
258 public static long from_little_endian (long val);
260 [CCode (cname = "atol", cheader_filename = "stdlib.h")]
261 public static long parse (string str);
265 [GIR (name = "gulong")]
266 [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")]
267 [IntegerType (rank = 9)]
268 public struct ulong {
269 [CCode (cname = "0UL")]
270 public static ulong MIN;
271 [CCode (cname = "G_MAXULONG")]
272 public static ulong MAX;
274 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
275 public string to_string (string format = "%lu");
277 [CCode (cname = "MIN")]
278 public static ulong min (ulong a, ulong b);
279 [CCode (cname = "MAX")]
280 public static ulong max (ulong a, ulong b);
281 [CCode (cname = "CLAMP")]
282 public ulong clamp (ulong low, ulong high);
284 [CCode (cname = "GULONG_TO_BE")]
285 public ulong to_big_endian ();
286 [CCode (cname = "GULONG_TO_LE")]
287 public ulong to_little_endian ();
289 [CCode (cname = "GULONG_FROM_BE")]
290 public static ulong from_big_endian (ulong val);
291 [CCode (cname = "GULONG_FROM_LE")]
292 public static ulong from_little_endian (ulong val);
296 [GIR (name = "gulong")]
297 [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")]
298 [IntegerType (rank = 9)]
299 public struct size_t {
300 [CCode (cname = "0UL")]
301 public static ulong MIN;
302 [CCode (cname = "G_MAXSIZE")]
303 public static ulong MAX;
305 [CCode (cname = "G_GSIZE_FORMAT")]
306 public const string FORMAT;
307 [CCode (cname = "G_GSIZE_MODIFIER")]
308 public const string FORMAT_MODIFIER;
310 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
311 public string to_string (string format = "%" + FORMAT);
313 [CCode (cname = "GSIZE_TO_POINTER")]
314 public void* to_pointer ();
316 [CCode (cname = "MIN")]
317 public static size_t min (size_t a, size_t b);
318 [CCode (cname = "MAX")]
319 public static size_t max (size_t a, size_t b);
320 [CCode (cname = "CLAMP")]
321 public size_t clamp (size_t low, size_t high);
325 [GIR (name = "glong")]
326 [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")]
327 [IntegerType (rank = 8)]
328 public struct ssize_t {
329 [CCode (cname = "G_MINSSIZE")]
330 public static long MIN;
331 [CCode (cname = "G_MAXSSIZE")]
332 public static long MAX;
334 [CCode (cname = "G_GSSIZE_FORMAT")]
335 public const string FORMAT;
336 [CCode (cname = "G_GSIZE_MODIFIER")]
337 public const string FORMAT_MODIFIER;
339 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
340 public string to_string (string format = "%" + FORMAT);
342 [CCode (cname = "MIN")]
343 public static ssize_t min (ssize_t a, ssize_t b);
344 [CCode (cname = "MAX")]
345 public static ssize_t max (ssize_t a, ssize_t b);
346 [CCode (cname = "CLAMP")]
347 public ssize_t clamp (ssize_t low, ssize_t high);
351 [GIR (name = "gint8")]
352 [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")]
353 [IntegerType (rank = 1, min = -128, max = 127)]
355 [CCode (cname = "G_MININT8")]
356 public static int8 MIN;
357 [CCode (cname = "G_MAXINT8")]
358 public static int8 MAX;
360 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
361 public string to_string (string format = "%hhi");
363 [CCode (cname = "MIN")]
364 public static int8 min (int8 a, int8 b);
365 [CCode (cname = "MAX")]
366 public static int8 max (int8 a, int8 b);
367 [CCode (cname = "CLAMP")]
368 public int8 clamp (int8 low, int8 high);
372 [GIR (name = "guint8")]
373 [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")]
374 [IntegerType (rank = 3, min = 0, max = 255)]
375 public struct uint8 {
376 [CCode (cname = "0U")]
377 public static uint8 MIN;
378 [CCode (cname = "G_MAXUINT8")]
379 public static uint8 MAX;
381 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
382 public string to_string (string format = "%hhu");
384 [CCode (cname = "MIN")]
385 public static uint8 min (uint8 a, uint8 b);
386 [CCode (cname = "MAX")]
387 public static uint8 max (uint8 a, uint8 b);
388 [CCode (cname = "CLAMP")]
389 public uint8 clamp (uint8 low, uint8 high);
393 [GIR (name = "gint16")]
394 [CCode (cname = "gint16", cheader_filename = "glib.h", default_value = "0", type_signature = "n", has_type_id = false)]
395 [IntegerType (rank = 4, min = -32768, max = 32767)]
396 public struct int16 {
397 [CCode (cname = "G_MININT16")]
398 public static int16 MIN;
399 [CCode (cname = "G_MAXINT16")]
400 public static int16 MAX;
402 [CCode (cname = "G_GINT16_FORMAT")]
403 public const string FORMAT;
404 [CCode (cname = "G_GINT16_MODIFIER")]
405 public const string FORMAT_MODIFIER;
407 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
408 public string to_string (string format = "%" + FORMAT);
410 [CCode (cname = "MIN")]
411 public static int16 min (int16 a, int16 b);
412 [CCode (cname = "MAX")]
413 public static int16 max (int16 a, int16 b);
414 [CCode (cname = "CLAMP")]
415 public int16 clamp (int16 low, int16 high);
417 [CCode (cname = "GINT16_TO_BE")]
418 public int16 to_big_endian ();
419 [CCode (cname = "GINT16_TO_LE")]
420 public int16 to_little_endian ();
422 [CCode (cname = "GINT16_FROM_BE")]
423 public static int16 from_big_endian (int16 val);
424 [CCode (cname = "GINT16_FROM_LE")]
425 public static int16 from_little_endian (int16 val);
429 [GIR (name = "guint16")]
430 [CCode (cname = "guint16", cheader_filename = "glib.h", default_value = "0U", type_signature = "q", has_type_id = false)]
431 [IntegerType (rank = 5, min = 0, max = 65535)]
432 public struct uint16 {
433 [CCode (cname = "0U")]
434 public static uint16 MIN;
435 [CCode (cname = "G_MAXUINT16")]
436 public static uint16 MAX;
438 [CCode (cname = "G_GUINT16_FORMAT")]
439 public const string FORMAT;
440 [CCode (cname = "G_GINT16_MODIFIER")]
441 public const string FORMAT_MODIFIER;
443 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
444 public string to_string (string format = "%hu");
446 [CCode (cname = "MIN")]
447 public static uint16 min (uint16 a, uint16 b);
448 [CCode (cname = "MAX")]
449 public static uint16 max (uint16 a, uint16 b);
450 [CCode (cname = "CLAMP")]
451 public uint16 clamp (uint16 low, uint16 high);
453 [CCode (cname = "GUINT16_TO_BE")]
454 public uint16 to_big_endian ();
455 [CCode (cname = "GUINT16_TO_LE")]
456 public uint16 to_little_endian ();
458 [CCode (cname = "GUINT16_FROM_BE")]
459 public static uint16 from_big_endian (uint16 val);
460 [CCode (cname = "GUINT16_FROM_LE")]
461 public static uint16 from_little_endian (uint16 val);
463 [CCode (cname = "GUINT16_SWAP_BE_PDP")]
464 public uint16 swap_big_endian_pdp ();
465 [CCode (cname = "GUINT16_SWAP_LE_BE")]
466 public uint16 swap_little_endian_big_endian ();
467 [CCode (cname = "GUINT16_SWAP_LE_PDP")]
468 public uint16 swap_little_endian_pdp ();
472 [GIR (name = "gint32")]
473 [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")]
474 [IntegerType (rank = 6)]
475 public struct int32 {
476 [CCode (cname = "G_MININT32")]
477 public static int32 MIN;
478 [CCode (cname = "G_MAXINT32")]
479 public static int32 MAX;
481 [CCode (cname = "G_GINT32_FORMAT")]
482 public const string FORMAT;
483 [CCode (cname = "G_GINT32_MODIFIER")]
484 public const string FORMAT_MODIFIER;
486 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
487 public string to_string (string format = "%i");
489 [CCode (cname = "MIN")]
490 public static int32 min (int32 a, int32 b);
491 [CCode (cname = "MAX")]
492 public static int32 max (int32 a, int32 b);
493 [CCode (cname = "CLAMP")]
494 public int32 clamp (int32 low, int32 high);
496 [CCode (cname = "GINT32_TO_BE")]
497 public int32 to_big_endian ();
498 [CCode (cname = "GINT32_TO_LE")]
499 public int32 to_little_endian ();
501 [CCode (cname = "GINT32_FROM_BE")]
502 public static int32 from_big_endian (int32 val);
503 [CCode (cname = "GINT32_FROM_LE")]
504 public static int32 from_little_endian (int32 val);
508 [GIR (name = "guint32")]
509 [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")]
510 [IntegerType (rank = 7)]
511 public struct uint32 {
512 [CCode (cname = "0U")]
513 public static uint32 MIN;
514 [CCode (cname = "G_MAXUINT32")]
515 public static uint32 MAX;
517 [CCode (cname = "G_GUINT32_FORMAT")]
518 public const string FORMAT;
519 [CCode (cname = "G_GINT32_MODIFIER")]
520 public const string FORMAT_MODIFIER;
522 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
523 public string to_string (string format = "%u");
525 [CCode (cname = "MIN")]
526 public static uint32 min (uint32 a, uint32 b);
527 [CCode (cname = "MAX")]
528 public static uint32 max (uint32 a, uint32 b);
529 [CCode (cname = "CLAMP")]
530 public uint32 clamp (uint32 low, uint32 high);
532 [CCode (cname = "GUINT32_TO_BE")]
533 public uint32 to_big_endian ();
534 [CCode (cname = "GUINT32_TO_LE")]
535 public uint32 to_little_endian ();
537 [CCode (cname = "GUINT32_FROM_BE")]
538 public static uint32 from_big_endian (uint32 val);
539 [CCode (cname = "GUINT32_FROM_LE")]
540 public static uint32 from_little_endian (uint32 val);
542 [CCode (cname = "GUINT32_SWAP_BE_PDP")]
543 public uint32 swap_big_endian_pdp ();
544 [CCode (cname = "GUINT32_SWAP_LE_BE")]
545 public uint32 swap_little_endian_big_endian ();
546 [CCode (cname = "GUINT32_SWAP_LE_PDP")]
547 public uint32 swap_little_endian_pdp ();
551 [GIR (name = "gint64")]
552 [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")]
553 [IntegerType (rank = 10)]
554 public struct int64 {
555 [CCode (cname = "G_MININT64")]
556 public static int64 MIN;
557 [CCode (cname = "G_MAXINT64")]
558 public static int64 MAX;
560 [CCode (cname = "G_GINT64_FORMAT")]
561 public const string FORMAT;
562 [CCode (cname = "G_GINT64_MODIFIER")]
563 public const string FORMAT_MODIFIER;
565 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
566 public string to_string (string format = "%" + FORMAT);
568 [CCode (cname = "MIN")]
569 public static int64 min (int64 a, int64 b);
570 [CCode (cname = "MAX")]
571 public static int64 max (int64 a, int64 b);
572 [CCode (cname = "CLAMP")]
573 public int64 clamp (int64 low, int64 high);
574 [CCode (cname = "llabs", cheader_filename = "stdlib.h")]
577 [CCode (cname = "GINT64_TO_BE")]
578 public int64 to_big_endian ();
579 [CCode (cname = "GINT64_TO_LE")]
580 public int64 to_little_endian ();
582 [CCode (cname = "GINT64_FROM_BE")]
583 public static int64 from_big_endian (int64 val);
584 [CCode (cname = "GINT64_FROM_LE")]
585 public static int64 from_little_endian (int64 val);
587 [CCode (cname = "GUINT64_SWAP_LE_BE")]
588 public uint64 swap_little_endian_big_endian ();
590 [CCode (cname = "g_ascii_strtoll")]
591 static int64 ascii_strtoll (string nptr, out char* endptr, uint _base);
593 public static int64 parse (string str) {
594 return ascii_strtoll (str, null, 0);
596 public static bool try_parse (string str, out int64 result = null) {
598 result = ascii_strtoll (str, out endptr, 0);
599 if (endptr == (char*) str + str.length) {
608 [GIR (name = "guint64")]
609 [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")]
610 [IntegerType (rank = 11)]
611 public struct uint64 {
612 [CCode (cname = "0ULL")]
613 public static uint64 MIN;
614 [CCode (cname = "G_MAXUINT64")]
615 public static uint64 MAX;
617 [CCode (cname = "G_GUINT64_FORMAT")]
618 public const string FORMAT;
619 [CCode (cname = "G_GINT64_MODIFIER")]
620 public const string FORMAT_MODIFIER;
622 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
623 public string to_string (string format = "%" + FORMAT);
625 [CCode (cname = "MIN")]
626 public static uint64 min (uint64 a, uint64 b);
627 [CCode (cname = "MAX")]
628 public static uint64 max (uint64 a, uint64 b);
629 [CCode (cname = "CLAMP")]
630 public uint64 clamp (uint64 low, uint64 high);
632 [CCode (cname = "GUINT64_TO_BE")]
633 public uint64 to_big_endian ();
634 [CCode (cname = "GUINT64_TO_LE")]
635 public uint64 to_little_endian ();
637 [CCode (cname = "GUINT64_FROM_BE")]
638 public static uint64 from_big_endian (uint64 val);
639 [CCode (cname = "GUINT64_FROM_LE")]
640 public static uint64 from_little_endian (uint64 val);
642 [CCode (cname = "g_ascii_strtoull")]
643 static uint64 ascii_strtoull (string nptr, out char* endptr, uint _base);
645 public static uint64 parse (string str) {
646 return ascii_strtoull (str, null, 0);
648 public static bool try_parse (string str, out uint64 result = null) {
650 result = ascii_strtoull (str, out endptr, 0);
651 if (endptr == (char*) str + str.length) {
660 [GIR (name = "gfloat")]
661 [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")]
662 [FloatingType (rank = 1)]
663 public struct float {
664 [CCode (cname = "FLT_MANT_DIG")]
665 public static int MANT_DIG;
666 [CCode (cname = "FLT_DIG")]
667 public static int DIG;
669 [CCode (cname = "FLT_MIN_EXP")]
670 public static int MIN_EXP;
671 [CCode (cname = "FLT_MAX_EXP")]
672 public static int MAX_EXP;
674 [CCode (cname = "FLT_MIN_10_EXP")]
675 public static int MIN_10_EXP;
676 [CCode (cname = "FLT_MAX_10_EXP")]
677 public static int MAX_10_EXP;
679 [CCode (cname = "FLT_EPSILON")]
680 public static float EPSILON;
681 [CCode (cname = "FLT_MIN")]
682 public static float MIN;
683 [CCode (cname = "FLT_MAX")]
684 public static float MAX;
686 [CCode (cname = "NAN")]
687 public static float NAN;
688 [CCode (cname = "INFINITY")]
689 public static float INFINITY;
691 [CCode (cname = "isnan")]
692 public bool is_nan ();
693 [CCode (cname = "isfinite")]
694 public bool is_finite ();
695 [CCode (cname = "isnormal")]
696 public bool is_normal ();
697 [CCode (cname = "isinf")]
698 public int is_infinity ();
700 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
701 public string to_string (string format = "%g");
703 [CCode (cname = "MIN")]
704 public static float min (float a, float b);
705 [CCode (cname = "MAX")]
706 public static float max (float a, float b);
707 [CCode (cname = "CLAMP")]
708 public float clamp (float low, float high);
712 [GIR (name = "gdouble")]
713 [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")]
714 [FloatingType (rank = 2)]
715 public struct double {
716 [CCode (cname = "DBL_MANT_DIG")]
717 public static int MANT_DIG;
718 [CCode (cname = "DBL_DIG")]
719 public static int DIG;
721 [CCode (cname = "DBL_MIN_EXP")]
722 public static int MIN_EXP;
723 [CCode (cname = "DBL_MAX_EXP")]
724 public static int MAX_EXP;
726 [CCode (cname = "DBL_MIN_10_EXP")]
727 public static int MIN_10_EXP;
728 [CCode (cname = "DBL_MAX_10_EXP")]
729 public static int MAX_10_EXP;
731 [CCode (cname = "DBL_EPSILON")]
732 public static double EPSILON;
733 [CCode (cname = "DBL_MIN")]
734 public static double MIN;
735 [CCode (cname = "DBL_MAX")]
736 public static double MAX;
738 [CCode (cname = "((double) NAN)")]
739 public static double NAN;
740 [CCode (cname = "((double) INFINITY)")]
741 public static double INFINITY;
743 [CCode (cname = "isnan")]
744 public bool is_nan ();
745 [CCode (cname = "isfinite")]
746 public bool is_finite ();
747 [CCode (cname = "isnormal")]
748 public bool is_normal ();
749 [CCode (cname = "isinf")]
750 public int is_infinity ();
752 [CCode (cname = "MIN")]
753 public static double min (double a, double b);
754 [CCode (cname = "MAX")]
755 public static double max (double a, double b);
756 [CCode (cname = "CLAMP")]
757 public double clamp (double low, double high);
759 [CCode (cname = "G_ASCII_DTOSTR_BUF_SIZE")]
760 public const int DTOSTR_BUF_SIZE;
761 [CCode (cname = "g_ascii_dtostr", instance_pos = -1)]
762 public unowned string to_str (char[] buffer);
763 [CCode (cname = "g_ascii_formatd", instance_pos = -1)]
764 public unowned string format (char[] buffer, string format = "%g");
766 public string to_string () {
767 return this.to_str(new char[DTOSTR_BUF_SIZE]);
770 [CCode (cname = "g_ascii_strtod")]
771 static double ascii_strtod (string nptr, out char* endptr);
773 public static double parse (string str) {
774 return ascii_strtod (str, null);
776 public static bool try_parse (string str, out double result = null) {
778 result = ascii_strtod (str, out endptr);
779 if (endptr == (char*) str + str.length) {
787 [GIR (name = "glong")]
788 [CCode (cheader_filename = "time.h", has_type_id = false, default_value = "0")]
789 [IntegerType (rank = 8)]
790 public struct time_t {
791 [CCode (cname = "time")]
792 public time_t (out time_t result = null);
796 [CCode (cheader_filename="stdarg.h", cprefix="va_", has_type_id = false, destroy_function = "va_end")]
797 public struct va_list {
798 [CCode (cname = "va_start")]
800 [CCode (cname = "va_copy")]
801 public va_list.copy (va_list src);
802 [CCode (generic_type_pos = 1.1)]
803 public unowned G arg<G> ();
807 [GIR (name = "gunichar")]
808 [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")]
809 [IntegerType (rank = 7)]
810 public struct unichar {
811 public bool validate ();
812 public bool isalnum ();
813 public bool isalpha ();
814 public bool iscntrl ();
815 public bool isdigit ();
816 public bool isgraph ();
817 public bool islower ();
818 public bool isprint ();
819 public bool ispunct ();
820 public bool isspace ();
821 public bool isupper ();
822 public bool isxdigit ();
823 public bool istitle ();
824 public bool isdefined ();
825 public bool iswide ();
826 public bool iswide_cjk ();
827 public bool iszerowidth ();
828 public unichar toupper ();
829 public unichar tolower ();
830 public unichar totitle ();
831 public int digit_value ();
832 public int xdigit_value ();
833 public UnicodeType type ();
834 public UnicodeBreakType break_type ();
835 public UnicodeScript get_script();
837 public int to_utf8 (string? outbuf);
839 public string? to_string () {
840 string str = (string) new char[7];
845 [CCode (cname = "MIN")]
846 public static unichar min (unichar a, unichar b);
847 [CCode (cname = "MAX")]
848 public static unichar max (unichar a, unichar b);
849 [CCode (cname = "CLAMP")]
850 public unichar clamp (unichar low, unichar high);
853 [CCode (cname = "GUnicodeScript", cprefix = "G_UNICODE_SCRIPT_", has_type_id = false)]
854 public enum UnicodeScript {
940 [CCode (cname = "GUnicodeType", cprefix = "G_UNICODE_", has_type_id = false)]
941 public enum UnicodeType {
974 [CCode (cname = "GUnicodeBreakType", cprefix = "G_UNICODE_BREAK_", has_type_id = false)]
975 public enum UnicodeBreakType {
1014 [CCode (cname = "GNormalizeMode", cprefix = "G_NORMALIZE_", has_type_id = false)]
1015 public enum NormalizeMode {
1029 [GIR (name = "utf8")]
1030 [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")]
1031 public class string {
1032 [Deprecated (replacement = "string.index_of")]
1033 [CCode (cname = "strstr")]
1034 public unowned string? str (string needle);
1035 [Deprecated (replacement = "string.last_index_of")]
1036 [CCode (cname = "g_strrstr")]
1037 public unowned string? rstr (string needle);
1038 [CCode (cname = "g_strrstr_len")]
1039 public unowned string? rstr_len (ssize_t haystack_len, string needle);
1041 [CCode (cname = "strstr")]
1042 static char* strstr (char* haystack, char* needle);
1043 [CCode (cname = "g_strrstr")]
1044 static char* strrstr (char* haystack, char* needle);
1045 [CCode (cname = "g_utf8_strchr")]
1046 static char* utf8_strchr (char* str, ssize_t len, unichar c);
1047 [CCode (cname = "g_utf8_strrchr")]
1048 static char* utf8_strrchr (char* str, ssize_t len, unichar c);
1050 public int index_of (string needle, int start_index = 0) {
1051 char* result = strstr ((char*) this + start_index, (char*) needle);
1053 if (result != null) {
1054 return (int) (result - (char*) this);
1060 public int last_index_of (string needle, int start_index = 0) {
1061 char* result = strrstr ((char*) this + start_index, (char*) needle);
1063 if (result != null) {
1064 return (int) (result - (char*) this);
1070 public int index_of_char (unichar c, int start_index = 0) {
1071 char* result = utf8_strchr ((char*) this + start_index, -1, c);
1073 if (result != null) {
1074 return (int) (result - (char*) this);
1080 public int last_index_of_char (unichar c, int start_index = 0) {
1081 char* result = utf8_strrchr ((char*) this + start_index, -1, c);
1083 if (result != null) {
1084 return (int) (result - (char*) this);
1090 [CCode (cname = "g_str_has_prefix")]
1091 public bool has_prefix (string prefix);
1092 [CCode (cname = "g_str_has_suffix")]
1093 public bool has_suffix (string suffix);
1094 [CCode (cname = "g_strdup_printf"), PrintfFormat]
1095 public string printf (...);
1096 [CCode (cname = "g_strdup_vprintf")]
1097 public string vprintf (va_list args);
1098 [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat]
1099 public int scanf (...);
1100 [CCode (cname = "g_strconcat")]
1101 public string concat (string string2, ...);
1102 [CCode (cname = "g_strescape")]
1103 public string escape (string exceptions);
1104 [CCode (cname = "g_strcompress")]
1105 public string compress ();
1106 [CCode (cname = "g_strsplit", array_length = false, array_null_terminated = true)]
1107 public string[] split (string delimiter, int max_tokens = 0);
1108 [CCode (cname = "g_strsplit_set", array_length = false, array_null_terminated = true)]
1109 public string[] split_set (string delimiters, int max_tokens = 0);
1110 [CCode (cname = "g_strjoinv")]
1111 public static string joinv (string separator, [CCode (array_length = false, array_null_terminated = true)] string[] str_array);
1112 [CCode (cname = "g_strjoin")]
1113 public static string join (string separator, ...);
1114 [CCode (cname = "g_strnfill")]
1115 public static string nfill (size_t length, char fill_char);
1117 public char get (long index) {
1118 return ((char*) this)[index];
1121 // checks whether valid string character starts at specified index
1122 // embedded NULs are not supported by the string class
1123 public bool valid_char (int index) {
1124 uint8 c = ((uint8*) this)[index];
1125 if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) {
1132 [CCode (cname = "g_utf8_next_char")]
1133 public unowned string next_char ();
1134 [CCode (cname = "g_utf8_get_char")]
1135 static unichar utf8_get_char (char* str);
1136 public unichar get_char (long index = 0) {
1137 return utf8_get_char ((char*) this + index);
1139 [CCode (cname = "g_utf8_get_char_validated")]
1140 public unichar get_char_validated (ssize_t max_len = -1);
1142 [Deprecated (replacement = "string.index_of_nth_char")]
1143 [CCode (cname = "g_utf8_offset_to_pointer")]
1144 public unowned string utf8_offset (long offset);
1145 [Deprecated (replacement = "string.substring")]
1146 public unowned string offset (long offset) {
1147 return (string) ((char*) this + offset);
1149 [Deprecated (replacement = "string.char_count")]
1150 public long pointer_to_offset (string pos) {
1151 return (long) ((char*) pos - (char*) this);
1154 [CCode (cname = "g_utf8_offset_to_pointer")]
1155 char* utf8_offset_to_pointer (long offset);
1157 public int index_of_nth_char (long c) {
1158 return (int) (this.utf8_offset_to_pointer (c) - (char*) this);
1161 [CCode (cname = "g_utf8_prev_char")]
1162 public unowned string prev_char ();
1163 [Deprecated (replacement = "string.length")]
1164 [CCode (cname = "strlen")]
1166 [Deprecated (replacement = "string.index_of_char")]
1167 [CCode (cname = "g_utf8_strchr")]
1168 public unowned string chr (ssize_t len, unichar c);
1169 [Deprecated (replacement = "string.last_index_of_char")]
1170 [CCode (cname = "g_utf8_strrchr")]
1171 public unowned string rchr (ssize_t len, unichar c);
1172 [CCode (cname = "g_utf8_strreverse")]
1173 public string reverse (ssize_t len = -1);
1174 [CCode (cname = "g_utf8_validate")]
1175 public bool validate (ssize_t max_len = -1, out char* end = null);
1176 [CCode (cname = "g_utf8_normalize")]
1177 public string normalize (ssize_t len = -1, NormalizeMode mode = NormalizeMode.DEFAULT);
1179 [CCode (cname = "g_utf8_strup")]
1180 public string up (ssize_t len = -1);
1181 [CCode (cname = "g_utf8_strdown")]
1182 public string down (ssize_t len = -1);
1183 [CCode (cname = "g_utf8_casefold")]
1184 public string casefold (ssize_t len = -1);
1185 [CCode (cname = "g_utf8_collate")]
1186 public int collate (string str2);
1187 [CCode (cname = "g_utf8_collate_key")]
1188 public string collate_key (ssize_t len = -1);
1189 [CCode (cname = "g_utf8_collate_key_for_filename")]
1190 public string collate_key_for_filename (ssize_t len = -1);
1192 [CCode (cname = "g_locale_to_utf8")]
1193 public string locale_to_utf8 (ssize_t len, out size_t bytes_read, out size_t bytes_written, out GLib.Error error = null);
1195 [CCode (cname = "g_strchomp")]
1196 public unowned string _chomp();
1197 public string chomp () {
1198 string result = this.dup ();
1203 [CCode (cname = "g_strchug")]
1204 public unowned string _chug();
1205 public string chug () {
1206 string result = this.dup ();
1211 [CCode (cname = "g_strstrip")]
1212 public unowned string _strip ();
1213 public string strip () {
1214 string result = this.dup ();
1219 [CCode (cname = "g_strdelimit")]
1220 public unowned string _delimit (string delimiters, char new_delimiter);
1221 public string delimit (string delimiters, char new_delimiter) {
1222 string result = this.dup ();
1223 result._delimit (delimiters, new_delimiter);
1227 [CCode (cname = "g_str_hash")]
1228 public uint hash ();
1230 [Deprecated (replacement = "int.parse")]
1231 [CCode (cname = "atoi")]
1232 public int to_int ();
1233 [Deprecated (replacement = "long.parse")]
1234 [CCode (cname = "strtol")]
1235 public long to_long (out unowned string endptr = null, int _base = 0);
1236 [Deprecated (replacement = "double.parse")]
1237 [CCode (cname = "g_ascii_strtod")]
1238 public double to_double (out unowned string endptr = null);
1239 [Deprecated (replacement = "uint64.parse")]
1240 [CCode (cname = "strtoul")]
1241 public ulong to_ulong (out unowned string endptr = null, int _base = 0);
1242 [Deprecated (replacement = "int64.parse")]
1243 [CCode (cname = "g_ascii_strtoll")]
1244 public int64 to_int64 (out unowned string endptr = null, int _base = 0);
1245 [Deprecated (replacement = "uint64.parse")]
1246 [CCode (cname = "g_ascii_strtoull")]
1247 public uint64 to_uint64 (out unowned string endptr = null, int _base = 0);
1249 [Deprecated (replacement = "bool.parse")]
1250 public bool to_bool () {
1251 if (this == "true") {
1258 [Deprecated (replacement = "string.length")]
1259 [CCode (cname = "strlen")]
1260 public size_t size ();
1262 [CCode (cname = "g_ascii_strcasecmp")]
1263 public int ascii_casecmp (string s2);
1264 [CCode (cname = "g_ascii_strncasecmp")]
1265 public int ascii_ncasecmp (string s2, size_t n);
1267 [CCode (cname = "g_utf8_skip")]
1268 public static char[] skip;
1270 /* modifies string in place */
1271 [CCode (cname = "g_strcanon")]
1272 public void canon (string valid_chars, char substitutor);
1274 [CCode (cname = "g_strdup")]
1275 public string dup ();
1276 [Deprecated (replacement = "string.substring")]
1277 [CCode (cname = "g_strndup")]
1278 public string ndup (size_t n);
1280 [CCode (cname = "strnlen")]
1281 static long strnlen (char* str, size_t maxlen);
1282 [CCode (cname = "g_strndup")]
1283 static string strndup (char* str, size_t n);
1285 public string substring (long offset, long len = -1) {
1287 if (offset >= 0 && len >= 0) {
1288 // avoid scanning whole string
1289 string_length = strnlen ((char*) this, offset + len);
1291 string_length = this.length;
1295 offset = string_length + offset;
1296 GLib.return_val_if_fail (offset >= 0, null);
1298 GLib.return_val_if_fail (offset <= string_length, null);
1301 len = string_length - offset;
1303 GLib.return_val_if_fail (offset + len <= string_length, null);
1304 return strndup ((char*) this + offset, len);
1307 public string slice (long start, long end) {
1308 long string_length = this.length;
1310 start = string_length + start;
1313 end = string_length + end;
1315 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1316 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1317 GLib.return_val_if_fail (start <= end, null);
1318 return strndup ((char*) this + start, end - start);
1321 public string splice (long start, long end, string? str = null) {
1322 long string_length = this.length;
1324 start = string_length + start;
1327 end = string_length + end;
1329 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1330 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1331 GLib.return_val_if_fail (start <= end, null);
1337 str_size = str.length;
1340 string* result = GLib.malloc0 (this.length - (end - start) + str_size + 1);
1342 char* dest = (char*) result;
1344 GLib.Memory.copy (dest, this, start);
1347 GLib.Memory.copy (dest, str, str_size);
1350 GLib.Memory.copy (dest, (char*) this + end, string_length - end);
1352 return (owned) result;
1355 public bool contains (string needle) {
1356 return strstr ((char*) this, (char*) needle) != null;
1359 public string replace (string old, string replacement) {
1361 var regex = new GLib.Regex (GLib.Regex.escape_string (old));
1362 return regex.replace_literal (this, -1, 0, replacement);
1363 } catch (GLib.RegexError e) {
1364 GLib.assert_not_reached ();
1368 [CCode (cname = "g_utf8_strlen")]
1369 public int char_count (ssize_t max = -1);
1372 [CCode (cname = "strlen")]
1376 public uint8[] data {
1378 unowned uint8[] res = (uint8[]) this;
1379 res.length = (int) this.length;
1384 public char[] to_utf8 () {
1385 char[] result = new char[this.length + 1];
1387 GLib.Memory.copy (result, this, this.length);
1391 public unowned string to_string () {
1396 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
1398 [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
1400 [CCode (cname = "G_E")]
1401 public const double E;
1403 [CCode (cname = "G_PI")]
1404 public const double PI;
1406 [CCode (cname = "G_LN2")]
1407 public const double LN2;
1409 [CCode (cname = "G_LN10")]
1410 public const double LN10;
1412 [CCode (cname = "G_PI_2")]
1413 public const double PI_2;
1415 [CCode (cname = "G_PI_4")]
1416 public const double PI_4;
1418 [CCode (cname = "G_SQRT2")]
1419 public const double SQRT2;
1421 /* generated from <bits/mathcalls.h> of glibc */
1422 public static double acos (double x);
1423 public static float acosf (float x);
1424 public static double asin (double x);
1425 public static float asinf (float x);
1426 public static double atan (double x);
1427 public static float atanf (float x);
1428 public static double atan2 (double y, double x);
1429 public static float atan2f (float y, float x);
1430 public static double cos (double x);
1431 public static float cosf (float x);
1432 public static double sin (double x);
1433 public static float sinf (float x);
1434 public static double tan (double x);
1435 public static float tanf (float x);
1436 public static double cosh (double x);
1437 public static float coshf (float x);
1438 public static double sinh (double x);
1439 public static float sinhf (float x);
1440 public static double tanh (double x);
1441 public static float tanhf (float x);
1442 public static void sincos (double x, out double sinx, out double cosx);
1443 public static void sincosf (float x, out float sinx, out float cosx);
1444 public static double acosh (double x);
1445 public static float acoshf (float x);
1446 public static double asinh (double x);
1447 public static float asinhf (float x);
1448 public static double atanh (double x);
1449 public static float atanhf (float x);
1450 public static double exp (double x);
1451 public static float expf (float x);
1452 public static double frexp (double x, out int exponent);
1453 public static float frexpf (float x, out int exponent);
1454 public static double ldexp (double x, int exponent);
1455 public static float ldexpf (float x, int exponent);
1456 public static double log (double x);
1457 public static float logf (float x);
1458 public static double log10 (double x);
1459 public static float log10f (float x);
1460 public static double modf (double x, out double iptr);
1461 public static float modff (float x, out float iptr);
1462 public static double exp10 (double x);
1463 public static float exp10f (float x);
1464 public static double pow10 (double x);
1465 public static float pow10f (float x);
1466 public static double expm1 (double x);
1467 public static float expm1f (float x);
1468 public static double log1p (double x);
1469 public static float log1pf (float x);
1470 public static double logb (double x);
1471 public static float logbf (float x);
1472 public static double exp2 (double x);
1473 public static float exp2f (float x);
1474 public static double log2 (double x);
1475 public static float log2f (float x);
1476 public static double pow (double x, double y);
1477 public static float powf (float x, float y);
1478 public static double sqrt (double x);
1479 public static float sqrtf (float x);
1480 public static double hypot (double x, double y);
1481 public static float hypotf (float x, float y);
1482 public static double cbrt (double x);
1483 public static float cbrtf (float x);
1484 public static double ceil (double x);
1485 public static float ceilf (float x);
1486 public static double fabs (double x);
1487 public static float fabsf (float x);
1488 public static double floor (double x);
1489 public static float floorf (float x);
1490 public static double fmod (double x, double y);
1491 public static float fmodf (float x, float y);
1492 public static int isinf (double value);
1493 public static int isinff (float value);
1494 public static int finite (double value);
1495 public static int finitef (float value);
1496 public static double drem (double x, double y);
1497 public static float dremf (float x, float y);
1498 public static double significand (double x);
1499 public static float significandf (float x);
1500 public static double copysign (double x, double y);
1501 public static float copysignf (float x, float y);
1502 public static double nan (string tagb);
1503 public static float nanf (string tagb);
1504 public static int isnan (double value);
1505 public static int isnanf (float value);
1506 public static double j0 (double x0);
1507 public static float j0f (float x0);
1508 public static double j1 (double x0);
1509 public static float j1f (float x0);
1510 public static double jn (int x0, double x1);
1511 public static float jnf (int x0, float x1);
1512 public static double y0 (double x0);
1513 public static float y0f (float x0);
1514 public static double y1 (double x0);
1515 public static float y1f (float x0);
1516 public static double yn (int x0, double x1);
1517 public static float ynf (int x0, float x1);
1518 public static double erf (double x0);
1519 public static float erff (float x0);
1520 public static double erfc (double x0);
1521 public static float erfcf (float x0);
1522 public static double lgamma (double x0);
1523 public static float lgammaf (float x0);
1524 public static double tgamma (double x0);
1525 public static float tgammaf (float x0);
1526 public static double gamma (double x0);
1527 public static float gammaf (float x0);
1528 public static double lgamma_r (double x0, out int signgamp);
1529 public static float lgamma_rf (float x0, out int signgamp);
1530 public static double rint (double x);
1531 public static float rintf (float x);
1532 public static double nextafter (double x, double y);
1533 public static float nextafterf (float x, float y);
1534 public static double nexttoward (double x, double y);
1535 public static float nexttowardf (float x, double y);
1536 public static double remainder (double x, double y);
1537 public static float remainderf (float x, float y);
1538 public static double scalbn (double x, int n);
1539 public static float scalbnf (float x, int n);
1540 public static int ilogb (double x);
1541 public static int ilogbf (float x);
1542 public static double scalbln (double x, long n);
1543 public static float scalblnf (float x, long n);
1544 public static double nearbyint (double x);
1545 public static float nearbyintf (float x);
1546 public static double round (double x);
1547 public static float roundf (float x);
1548 public static double trunc (double x);
1549 public static float truncf (float x);
1550 public static double remquo (double x, double y, out int quo);
1551 public static float remquof (float x, float y, out int quo);
1552 public static long lrint (double x);
1553 public static long lrintf (float x);
1554 public static int64 llrint (double x);
1555 public static int64 llrintf (float x);
1556 public static long lround (double x);
1557 public static long lroundf (float x);
1558 public static int64 llround (double x);
1559 public static int64 llroundf (float x);
1560 public static double fdim (double x, double y);
1561 public static float fdimf (float x, float y);
1562 public static double fmax (double x, double y);
1563 public static float fmaxf (float x, float y);
1564 public static double fmin (double x, double y);
1565 public static float fminf (float x, float y);
1566 public static double fma (double x, double y, double z);
1567 public static float fmaf (float x, float y, float z);
1568 public static double scalb (double x, double n);
1569 public static float scalbf (float x, float n);
1573 [CCode (cprefix = "G_", cname = "int", has_type_id = false)]
1574 public enum ByteOrder {
1575 [CCode (cname = "G_BYTE_ORDER")]
1582 public const ByteOrder BYTE_ORDER;
1584 /* Atomic Operations */
1586 namespace AtomicInt {
1587 public static int get (ref int atomic);
1588 public static void set (ref int atomic, int newval);
1589 public static void add (ref int atomic, int val);
1590 public static int exchange_and_add (ref int atomic, int val);
1591 public static bool compare_and_exchange (ref int atomic, int oldval, int newval);
1592 public static void inc (ref int atomic);
1593 public static bool dec_and_test (ref int atomic);
1596 namespace AtomicPointer {
1597 public static void* get (void** atomic);
1598 public static void set (void** atomic, void* newval);
1599 public static bool compare_and_exchange (void** atomic, void* oldval, void* newval);
1602 /* The Main Event Loop */
1605 [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
1606 public class MainLoop {
1607 public MainLoop (MainContext? context = null, bool is_running = false);
1609 public void quit ();
1610 public bool is_running ();
1611 public unowned MainContext get_context ();
1614 namespace Priority {
1615 public const int HIGH;
1616 public const int DEFAULT;
1617 public const int HIGH_IDLE;
1618 public const int DEFAULT_IDLE;
1619 public const int LOW;
1623 [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
1624 public class MainContext {
1625 public MainContext ();
1626 public static unowned MainContext @default ();
1627 public bool iteration (bool may_block);
1628 public bool pending ();
1629 public unowned Source find_source_by_id (uint source_id);
1630 public unowned Source find_source_by_user_data (void* user_data);
1631 public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data);
1632 public void wakeup ();
1633 public bool acquire ();
1634 public void release ();
1635 public bool is_owner ();
1636 public bool wait (Cond cond, Mutex mutex);
1637 public bool prepare (out int priority);
1638 public int query (int max_priority, out int timeout_, PollFD[] fds);
1639 [CCode (array_length = false)]
1640 public int check (int max_priority, PollFD[] fds, int n_fds);
1641 public void dispatch ();
1642 public void set_poll_func (PollFunc func);
1643 public PollFunc get_poll_func ();
1644 public void add_poll (ref PollFD fd, int priority);
1645 public void remove_poll (ref PollFD fd);
1646 public int depth ();
1647 [CCode (cname = "g_main_current_source")]
1648 public static unowned Source current_source ();
1649 public static unowned MainContext get_thread_default ();
1650 public void push_thread_default ();
1651 public void pop_thread_default ();
1652 public unowned string? get_name ();
1653 public void set_name (string? name);
1654 public static void set_name_by_id (uint tag, string? name);
1655 [CCode (cname = "g_main_context_invoke_full")]
1656 public void invoke (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1657 public void invoke_full (int priority, owned SourceFunc function);
1660 [CCode (has_target = false)]
1661 public delegate int PollFunc (PollFD[] ufds, int timeout_);
1663 [CCode (cname = "GSource")]
1664 public class TimeoutSource : Source {
1665 public TimeoutSource (uint interval);
1666 public TimeoutSource.seconds (uint interval);
1670 [CCode (cname = "g_timeout_add_full")]
1671 public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1672 public static uint add_full (int priority, uint interval, owned SourceFunc function);
1673 [CCode (cname = "g_timeout_add_seconds_full")]
1674 public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1675 public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function);
1678 [CCode (cname = "GSource")]
1679 public class IdleSource : Source {
1680 public IdleSource ();
1684 [CCode (cname = "g_idle_add_full")]
1685 public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1686 public static uint add_full (int priority, owned SourceFunc function);
1687 public static bool remove_by_data (void* data);
1690 [CCode (default_value = "0")]
1691 [IntegerType (rank = 6)]
1695 public delegate void ChildWatchFunc (Pid pid, int status);
1697 public class ChildWatchSource : Source {
1698 public ChildWatchSource (Pid pid, int status, void* data);
1701 namespace ChildWatch {
1702 [CCode (cname = "g_child_watch_add_full")]
1703 public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1704 public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function);
1707 public struct PollFD {
1709 public IOCondition events;
1710 public IOCondition revents;
1714 [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
1715 public class Source {
1716 public Source (SourceFuncs source_funcs, uint struct_size /* = sizeof (Source) */);
1717 public void set_funcs (SourceFuncs funcs);
1718 public uint attach (MainContext? context);
1719 public void destroy ();
1720 public bool is_destroyed ();
1721 public void set_priority (int priority);
1722 public int get_priority ();
1723 public void set_can_recurse (bool can_recurse);
1724 public bool get_can_recurse ();
1725 public uint get_id ();
1726 public unowned MainContext get_context ();
1727 public void set_callback (owned SourceFunc func);
1728 public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs);
1729 public void add_poll (ref PollFD fd);
1730 public void remove_poll (ref PollFD fd);
1731 public void get_current_time (out TimeVal timeval);
1732 public static bool remove (uint id);
1733 public static bool remove_by_funcs_user_data (void* user_data);
1734 public static bool remove_by_user_data (void* user_data);
1737 [CCode (has_target = false)]
1738 public delegate void SourceDummyMarshal ();
1740 [CCode (has_target = false)]
1741 public delegate bool SourcePrepareFunc (Source source, out int timeout_);
1742 [CCode (has_target = false)]
1743 public delegate bool SourceCheckFunc (Source source);
1744 [CCode (has_target = false)]
1745 public delegate bool SourceDispatchFunc (Source source, SourceFunc _callback);
1746 [CCode (has_target = false)]
1747 public delegate void SourceFinalizeFunc (Source source);
1750 public class SourceFuncs {
1751 public SourcePrepareFunc prepare;
1752 public SourceCheckFunc check;
1753 public SourceDispatchFunc dispatch;
1754 public SourceFinalizeFunc finalize;
1757 [CCode (has_target = false)]
1758 public delegate void SourceCallbackRefFunc (void* cb_data);
1759 [CCode (has_target = false)]
1760 public delegate void SourceCallbackUnrefFunc (void* cb_data);
1761 [CCode (has_target = false)]
1762 public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
1765 public class SourceCallbackFuncs {
1766 public SourceCallbackRefFunc @ref;
1767 public SourceCallbackUnrefFunc unref;
1768 public SourceCallbackGetFunc @get;
1771 public delegate bool SourceFunc ();
1773 public errordomain ThreadError {
1777 /* Thread support */
1779 public delegate G ThreadFunc<G> ();
1780 public delegate void Func<G> (G data);
1782 [CCode (has_type_id = false)]
1783 public enum ThreadPriority {
1791 public class Thread<T> {
1792 public static bool supported ();
1793 [CCode (simple_generics = true)]
1794 public static unowned Thread<T> create<T> (ThreadFunc<T> func, bool joinable) throws ThreadError;
1795 [CCode (simple_generics = true)]
1796 public static unowned Thread<T> create_full<T> (ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
1797 [CCode (simple_generics = true)]
1798 public static unowned Thread<T> self<T> ();
1800 public void set_priority (ThreadPriority priority);
1801 public static void yield ();
1802 public static void exit (T retval);
1803 public static void @foreach<T> (Func<T> thread_func);
1805 [CCode (cname = "g_usleep")]
1806 public static void usleep (ulong microseconds);
1810 [CCode (free_function = "g_mutex_free")]
1811 public class Mutex {
1813 public void @lock ();
1814 public bool trylock ();
1815 public void unlock ();
1818 [CCode (destroy_function = "g_static_mutex_free")]
1819 public struct StaticMutex {
1820 public StaticMutex ();
1821 public void lock ();
1822 public bool trylock ();
1823 public void unlock ();
1824 public void lock_full ();
1827 [CCode (destroy_function = "g_static_rec_mutex_free")]
1828 public struct StaticRecMutex {
1829 public StaticRecMutex ();
1830 public void lock ();
1831 public bool trylock ();
1832 public void unlock ();
1833 public void lock_full ();
1836 [CCode (destroy_function = "g_static_rw_lock_free")]
1837 public struct StaticRWLock {
1838 public StaticRWLock ();
1839 public void reader_lock ();
1840 public bool reader_trylock ();
1841 public void reader_unlock ();
1842 public void writer_lock ();
1843 public bool writer_trylock ();
1844 public void writer_unlock ();
1848 [CCode (ref_function = "", unref_function = "")]
1849 public class Private {
1850 public Private (DestroyNotify destroy_func);
1851 public void* get ();
1852 public void set (void* data);
1855 [CCode (destroy_function = "g_static_private_free")]
1856 public struct StaticPrivate {
1857 public StaticPrivate ();
1858 public void* get ();
1859 public void set (void* data, DestroyNotify? destroy_func);
1863 [CCode (free_function = "g_cond_free")]
1866 public void @signal ();
1867 public void broadcast ();
1868 public void wait (Mutex mutex);
1869 public bool timed_wait (Mutex mutex, TimeVal abs_time);
1875 [CCode (free_function = "g_thread_pool_free")]
1876 public class ThreadPool<T> {
1877 public ThreadPool (Func<T> func, int max_threads, bool exclusive) throws ThreadError;
1878 public void push (T data) throws ThreadError;
1879 public void set_max_threads (int max_threads) throws ThreadError;
1880 public int get_max_threads ();
1881 public uint get_num_threads ();
1882 public uint unprocessed ();
1883 public static void set_max_unused_threads (int max_threads);
1884 public static int get_max_unused_threads ();
1885 public static uint get_num_unused_threads ();
1886 public static void stop_unused_threads ();
1887 public void set_sort_function (CompareDataFunc func);
1888 public static void set_max_idle_time (uint interval);
1889 public static uint get_max_idle_time ();
1892 /* Asynchronous Queues */
1895 [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
1896 public class AsyncQueue<G> {
1897 public AsyncQueue ();
1898 public void push (owned G data);
1899 public void push_sorted (owned G data, CompareDataFunc<G> func);
1901 public G try_pop ();
1902 public G timed_pop (ref TimeVal end_time);
1903 public int length ();
1904 public void sort (CompareDataFunc<G> func);
1905 public void @lock ();
1906 public void unlock ();
1907 public void ref_unlocked ();
1908 public void unref_and_unlock ();
1909 public void push_unlocked (owned G data);
1910 public void push_sorted_unlocked (owned G data, CompareDataFunc<G> func);
1911 public G pop_unlocked ();
1912 public G try_pop_unlocked ();
1913 public G timed_pop_unlocked (ref TimeVal end_time);
1914 public int length_unlocked ();
1915 public void sort_unlocked (CompareDataFunc<G> func);
1918 /* Memory Allocation */
1920 public static void* malloc (size_t n_bytes);
1921 public static void* malloc0 (size_t n_bytes);
1922 public static void* realloc (void* mem, size_t n_bytes);
1924 public static void* try_malloc (size_t n_bytes);
1925 public static void* try_malloc0 (size_t n_bytes);
1926 public static void* try_realloc (void* mem, size_t n_bytes);
1928 public static void free (void* mem);
1930 public class MemVTable {
1933 [CCode (cname = "glib_mem_profiler_table")]
1934 public static MemVTable mem_profiler_table;
1936 public static void mem_set_vtable (MemVTable vtable);
1937 public static void mem_profile ();
1939 [CCode (cheader_filename = "string.h")]
1941 [CCode (cname = "memcmp")]
1942 public static int cmp (void* s1, void* s2, size_t n);
1943 [CCode (cname = "memcpy")]
1944 public static void* copy (void* dest, void* src, size_t n);
1945 [CCode (cname = "memset")]
1946 public static void* set (void* dest, int src, size_t n);
1947 [CCode (cname = "g_memmove")]
1948 public static void* move (void* dest, void* src, size_t n);
1949 [CCode (cname = "g_memdup")]
1950 public static void* dup (void* mem, uint n);
1954 public static void* alloc (size_t block_size);
1955 public static void* alloc0 (size_t block_size);
1956 public static void* copy (size_t block_size, void* mem_block);
1957 [CCode (cname = "g_slice_free1")]
1958 public static void free (size_t block_size, void* mem_block);
1959 public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset);
1965 [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
1966 public class IOChannel {
1967 [CCode (cname = "g_io_channel_unix_new")]
1968 public IOChannel.unix_new (int fd);
1969 public int unix_get_fd ();
1970 [CCode (cname = "g_io_channel_win32_new_fd")]
1971 public IOChannel.win32_new_fd (int fd);
1972 [CCode (cname = "g_io_channel_win32_new_socket")]
1973 public IOChannel.win32_socket (int socket);
1974 [CCode (cname = "g_io_channel_win32_new_messages")]
1975 public IOChannel.win32_messages (size_t hwnd);
1976 public void init ();
1977 public IOChannel.file (string filename, string mode) throws FileError;
1978 public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError;
1979 public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
1980 public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError;
1981 public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError;
1982 public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError;
1983 public IOStatus write_chars (char[] buf, out size_t bytes_written) throws ConvertError, IOChannelError;
1984 public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
1985 public IOStatus flush () throws IOChannelError;
1986 public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
1987 public IOStatus shutdown (bool flush) throws IOChannelError;
1988 [CCode (cname = "g_io_create_watch")]
1989 public GLib.Source create_watch (IOCondition condition);
1990 [CCode (cname = "g_io_add_watch")]
1991 public uint add_watch (IOCondition condition, IOFunc func);
1992 [CCode (cname = "g_io_add_watch_full")]
1993 public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func);
1994 public size_t get_buffer_size ();
1995 public void set_buffer_size (size_t size);
1996 public IOCondition get_buffer_condition ();
1997 public IOFlags get_flags ();
1998 public IOStatus set_flags (IOFlags flags) throws IOChannelError;
1999 public unowned string get_line_term (out int length);
2000 public void set_line_term (string line_term, int length);
2001 public bool get_buffered ();
2002 public void set_buffered (bool buffered);
2003 public unowned string get_encoding ();
2004 public IOStatus set_encoding (string? encoding) throws IOChannelError;
2005 public bool get_close_on_unref ();
2006 public void set_close_on_unref (bool do_close);
2009 [CCode (cprefix = "G_SEEK_", has_type_id = false)]
2010 public enum SeekType {
2016 [CCode (has_type_id = false)]
2017 public enum IOStatus {
2024 public errordomain IOChannelError {
2037 [CCode (cprefix = "G_IO_")]
2038 public enum IOCondition {
2047 public delegate bool IOFunc (IOChannel source, IOCondition condition);
2049 [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)]
2050 public enum IOFlags {
2061 /* Error Reporting */
2065 [CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
2066 public class Error {
2068 public Error (Quark domain, int code, string format, ...);
2069 public Error copy ();
2070 public bool matches (Quark domain, int code);
2072 public Quark domain;
2074 public string message;
2077 /* Message Output and Debugging Functions */
2080 public static void print (string format, ...);
2081 public static void set_print_handler (PrintFunc func);
2082 [CCode (has_target = false)]
2083 public delegate void PrintFunc (string text);
2085 public static void printerr (string format, ...);
2086 public static void set_printerr_handler (PrintFunc func);
2088 public static void return_if_fail (bool expr);
2089 [CCode (sentinel = "")]
2090 public static void return_val_if_fail (bool expr, ...);
2092 public static void return_if_reached ();
2094 [CCode (sentinel = "")]
2095 public static void return_val_if_reached (...);
2096 public static void warn_if_fail (bool expr);
2097 public static void warn_if_reached ();
2100 public static void assert (bool expr);
2102 public static void assert_not_reached ();
2104 public static void on_error_query (string? prg_name = null);
2105 public static void on_error_stack_trace (string? prg_name = null);
2106 [CCode (cname = "G_BREAKPOINT")]
2107 public static void breakpoint ();
2109 /* Message Logging */
2111 [CCode (cprefix = "G_LOG_", has_type_id = false)]
2112 public enum LogLevelFlags {
2117 /* GLib log levels */
2128 public void logv (string? log_domain, LogLevelFlags log_level, string format, va_list args);
2131 public void log (string? log_domain, LogLevelFlags log_level, string format, ...);
2135 public void message (string format, ...);
2138 public void warning (string format, ...);
2141 public void critical (string format, ...);
2145 public void error (string format, ...);
2148 public void debug (string format, ...);
2150 public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message);
2153 public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
2154 public static void set_default_handler (LogFunc log_func);
2155 [CCode (delegate_target = "NULL")]
2156 public static GLib.LogFunc default_handler;
2157 public static void set_fatal_mask (string log_domain, LogLevelFlags log_levels);
2158 public static void set_always_fatal (LogLevelFlags log_levels);
2160 public const string FILE;
2161 public const int LINE;
2162 public const string METHOD;
2165 [CCode (has_type_id = false)]
2166 public struct DebugKey {
2171 public uint parse_debug_string (string? debug_string, DebugKey[] keys);
2173 /* String Utility Functions */
2175 public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2177 [CCode (cname = "errno", cheader_filename = "errno.h")]
2179 public unowned string strerror (int errnum);
2181 /* Character Set Conversions */
2183 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;
2184 public static bool get_charset (out unowned string charset);
2187 public struct IConv {
2188 public static IConv open (string to_codeset, string from_codeset);
2189 [CCode (cname = "g_iconv")]
2190 public uint iconv (out string inbuf, out uint inbytes_left, out string outbuf, out uint outbytes_left);
2191 public int close ();
2194 namespace Filename {
2195 public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2196 public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2197 public static string from_uri (string uri, out string hostname = null) throws ConvertError;
2198 public static string to_uri (string filename, string? hostname = null) throws ConvertError;
2199 public static string display_name (string filename);
2200 public static string display_basename (string filename);
2203 public errordomain ConvertError {
2212 /* Base64 Encoding */
2215 public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save);
2216 public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
2217 public static string encode (uchar[] data);
2218 public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
2219 [CCode (array_length_type = "size_t")]
2220 public static uchar[] decode (string text);
2223 /* Data Checksums */
2225 [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)]
2226 public enum ChecksumType {
2231 public ssize_t get_length ();
2235 [CCode (free_function = "g_checksum_free")]
2236 public class Checksum {
2237 public Checksum (ChecksumType checksum_type);
2238 public Checksum copy ();
2239 public void update ([CCode (array_length = false)] uchar[] data, size_t length);
2240 public unowned string get_string ();
2241 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2242 [CCode (cname = "g_compute_checksum_for_data")]
2243 public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
2244 [CCode (cname = "g_compute_checksum_for_string")]
2245 public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1);
2248 /* Date and Time Functions */
2250 [CCode (has_type_id = false)]
2251 public struct TimeVal {
2253 public long tv_usec;
2255 [CCode (cname = "g_get_current_time")]
2257 [CCode (cname = "g_get_current_time")]
2258 public void get_current_time ();
2259 public void add (long microseconds);
2260 [CCode (instance_pos = -1)]
2261 public bool from_iso8601 (string iso_date);
2262 [InstanceByReference]
2263 public string to_iso8601 ();
2266 public struct DateDay : uchar {
2267 [CCode (cname = "G_DATE_BAD_DAY")]
2268 public static DateDay BAD_DAY;
2270 [CCode (cname = "g_date_valid_day")]
2271 public bool valid ();
2274 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2275 public enum DateMonth {
2290 [CCode (cname = "g_date_get_days_in_month")]
2291 public uchar get_days_in_month (DateYear year);
2292 [CCode (cname = "g_date_valid_month")]
2293 public bool valid ();
2296 public struct DateYear : ushort {
2297 [CCode (cname = "G_DATE_BAD_YEAR")]
2298 public static DateDay BAD_YEAR;
2300 [CCode (cname = "g_date_is_leap_year")]
2301 public bool is_leap_year ();
2302 [CCode (cname = "g_date_get_monday_weeks_in_year")]
2303 public uchar get_monday_weeks_in_year ();
2304 [CCode (cname = "g_date_get_sunday_weeks_in_year")]
2305 public uchar get_sunday_weeks_in_year ();
2306 [CCode (cname = "g_date_valid_year")]
2307 public bool valid ();
2310 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2311 public enum DateWeekday {
2321 [CCode (cname = "g_date_valid_weekday")]
2322 public bool valid ();
2325 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2326 public enum DateDMY {
2332 [CCode (type_id = "G_TYPE_DATE")]
2333 public struct Date {
2334 public void clear (uint n_dates = 1);
2335 public void set_day (DateDay day);
2336 public void set_month (DateMonth month);
2337 public void set_year (DateYear year);
2338 public void set_dmy (DateDay day, int month, DateYear y);
2339 public void set_julian (uint julian_day);
2340 public void set_time_t (time_t timet);
2341 public void set_time_val (TimeVal timeval);
2342 public void set_parse (string str);
2343 public void add_days (uint n_days);
2344 public void subtract_days (uint n_days);
2345 public void add_months (uint n_months);
2346 public void subtract_months (uint n_months);
2347 public void add_years (uint n_years);
2348 public void subtract_years (uint n_years);
2349 public int days_between (Date date2);
2350 public int compare (Date rhs);
2351 public void clamp (Date min_date, Date max_date);
2352 public void order (Date date2);
2353 public DateDay get_day ();
2354 public DateMonth get_month ();
2355 public DateYear get_year ();
2356 public uint get_julian ();
2357 public DateWeekday get_weekday ();
2358 public uint get_day_of_year ();
2359 public bool is_first_of_month ();
2360 public bool is_last_of_month ();
2361 public uint get_monday_week_of_year ();
2362 public uint get_sunday_week_of_year ();
2363 public uint get_iso8601_week_of_year ();
2364 [CCode (instance_pos = -1)]
2365 public size_t strftime (char[] s, string format);
2366 [CCode (cname = "g_date_to_struct_tm")]
2367 public void to_time (out Time tm);
2368 public bool valid ();
2369 public static uchar get_days_in_month (DateMonth month, DateYear year);
2370 public static bool valid_day (DateDay day);
2371 public static bool valid_dmy (DateDay day, DateMonth month, DateYear year);
2372 public static bool valid_julian (uint julian_date);
2373 public static bool valid_weekday (DateWeekday weekday);
2376 [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)]
2377 public struct Time {
2378 [CCode (cname = "tm_sec")]
2380 [CCode (cname = "tm_min")]
2382 [CCode (cname = "tm_hour")]
2384 [CCode (cname = "tm_mday")]
2386 [CCode (cname = "tm_mon")]
2388 [CCode (cname = "tm_year")]
2390 [CCode (cname = "tm_wday")]
2392 [CCode (cname = "tm_yday")]
2393 public int day_of_year;
2394 [CCode (cname = "tm_isdst")]
2397 [CCode (cname = "gmtime_r")]
2398 static void gmtime_r (ref time_t time, out Time result);
2399 [CCode (cname = "localtime_r")]
2400 static void localtime_r (ref time_t time, out Time result);
2402 public static Time gm (time_t time) {
2404 gmtime_r (ref time, out result);
2407 public static Time local (time_t time) {
2409 localtime_r (ref time, out result);
2413 public string to_string () {
2414 return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
2417 public string format (string format) {
2418 var buffer = new char[64];
2419 this.strftime (buffer, format);
2420 return (string) buffer;
2423 [CCode (cname = "mktime")]
2424 public time_t mktime ();
2426 [CCode (cname = "strftime", instance_pos = -1)]
2427 public size_t strftime (char[] s, string format);
2428 [CCode (cname = "strptime", instance_pos = -1)]
2429 public unowned string? strptime (string buf, string format);
2432 public struct TimeSpan : int64 {
2433 public const TimeSpan DAY;
2434 public const TimeSpan HOUR;
2435 public const TimeSpan MINUTE;
2436 public const TimeSpan SECOND;
2437 public const TimeSpan MILLISECOND;
2441 [CCode (ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")]
2442 public class DateTime {
2443 public DateTime.now (TimeZone tz);
2444 public DateTime.now_local ();
2445 public DateTime.now_utc ();
2446 public DateTime.from_unix_local (int64 t);
2447 public DateTime.from_unix_utc (int64 t);
2448 public DateTime.from_timeval_local (TimeVal tv);
2449 public DateTime.from_timeval_utc (TimeVal tv);
2450 public DateTime (TimeZone tz, int year, int month, int day, int hour, int minute, double seconds);
2451 public DateTime.local (int year, int month, int day, int hour, int minute, double seconds);
2452 public DateTime.utc (int year, int month, int day, int hour, int minute, double seconds);
2453 public DateTime add (TimeSpan timespan);
2454 public DateTime add_years (int years);
2455 public DateTime add_months (int months);
2456 public DateTime add_weeks (int weeks);
2457 public DateTime add_days (int days);
2458 public DateTime add_hours (int hours);
2459 public DateTime add_milliseconds (int milliseconds);
2460 public DateTime add_minutes (int minutes);
2461 public DateTime add_seconds (double seconds);
2462 public DateTime add_full (int years, int months, int days, int hours = 0, int minutes = 0, double seconds = 0);
2463 public int compare (DateTime dt);
2464 public TimeSpan difference (DateTime begin);
2465 public uint hash ();
2466 public bool equal (DateTime dt);
2467 public void get_ymd (out int year, out int month, out int day);
2468 public int get_year ();
2469 public int get_month ();
2470 public int get_day_of_month ();
2471 public int get_week_numbering_year ();
2472 public int get_week_of_year ();
2473 public int get_day_of_week ();
2474 public int get_day_of_year ();
2475 public int get_hour ();
2476 public int get_minute ();
2477 public int get_second ();
2478 public int get_microsecond ();
2479 public double get_seconds ();
2480 public int64 to_unix ();
2481 public bool to_timeval (out TimeVal tv);
2482 public TimeSpan get_utc_offset ();
2483 public unowned string get_timezone_abbreviation ();
2484 public bool is_daylight_savings ();
2485 public DateTime to_timezone (TimeZone tz);
2486 public DateTime to_local ();
2487 public DateTime to_utc ();
2488 public string format (string format);
2489 public string to_string () {
2490 return this.format ("%FT%H:%M:%S%z");
2494 public enum TimeType {
2501 [CCode (ref_function = "g_time_zone_ref", unref_function = "g_time_zone_unref")]
2502 public class TimeZone {
2503 public TimeZone (string identifier);
2504 public TimeZone.utc ();
2505 public TimeZone.local ();
2506 public int find_interval (TimeType type, int64 time);
2507 public int adjust_time (TimeType type, ref int64 time);
2508 public unowned string get_abbreviation (int interval);
2509 public int32 get_offset (int interval);
2510 public bool is_dst (int interval);
2513 /* Random Numbers */
2516 [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
2518 public Rand.with_seed (uint32 seed);
2519 public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2521 public void set_seed (uint32 seed);
2522 public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2523 public bool boolean ();
2524 [CCode (cname = "g_rand_int")]
2525 public uint32 next_int ();
2526 public int32 int_range (int32 begin, int32 end);
2527 [CCode (cname = "g_rand_double")]
2528 public double next_double ();
2529 public double double_range (double begin, double end);
2533 public static void set_seed (uint32 seed);
2534 public static bool boolean ();
2535 [CCode (cname = "g_random_int")]
2536 public static uint32 next_int ();
2537 public static int32 int_range (int32 begin, int32 end);
2538 [CCode (cname = "g_random_double")]
2539 public static double next_double ();
2540 public static double double_range (double begin, double end);
2543 /* Miscellaneous Utility Functions */
2545 namespace Environment {
2546 [CCode (cname = "g_get_application_name")]
2547 public static unowned string? get_application_name ();
2548 [CCode (cname = "g_set_application_name")]
2549 public static void set_application_name (string application_name);
2550 [CCode (cname = "g_get_prgname")]
2551 public static unowned string get_prgname ();
2552 [CCode (cname = "g_set_prgname")]
2553 public static void set_prgname (string application_name);
2554 [CCode (cname = "g_getenv")]
2555 public static unowned string? get_variable (string variable);
2556 [CCode (cname = "g_setenv")]
2557 public static bool set_variable (string variable, string value, bool overwrite);
2558 [CCode (cname = "g_unsetenv")]
2559 public static void unset_variable (string variable);
2560 [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)]
2561 public static string[] list_variables ();
2562 [CCode (cname = "g_get_user_name")]
2563 public static unowned string get_user_name ();
2564 [CCode (cname = "g_get_real_name")]
2565 public static unowned string get_real_name ();
2566 [CCode (cname = "g_get_user_cache_dir")]
2567 public static unowned string get_user_cache_dir ();
2568 [CCode (cname = "g_get_user_data_dir")]
2569 public static unowned string get_user_data_dir ();
2570 [CCode (cname = "g_get_user_config_dir")]
2571 public static unowned string get_user_config_dir ();
2572 [CCode (cname = "g_get_user_special_dir")]
2573 public static unowned string get_user_special_dir (UserDirectory directory);
2574 [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)]
2575 public static unowned string[] get_system_data_dirs ();
2576 [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)]
2577 public static unowned string[] get_system_config_dirs ();
2578 [CCode (cname = "g_get_host_name")]
2579 public static unowned string get_host_name ();
2580 [CCode (cname = "g_get_home_dir")]
2581 public static unowned string get_home_dir ();
2582 [CCode (cname = "g_get_tmp_dir")]
2583 public static unowned string get_tmp_dir ();
2584 [CCode (cname = "g_get_current_dir")]
2585 public static string get_current_dir ();
2586 [CCode (cname = "g_find_program_in_path")]
2587 public static string? find_program_in_path (string program);
2588 [CCode (cname = "g_atexit")]
2589 public static void atexit (VoidFunc func);
2590 [CCode (cname = "g_chdir")]
2591 public static int set_current_dir (string path);
2594 [CCode (has_type_id = false)]
2595 public enum UserDirectory {
2604 [CCode (cname = "G_USER_N_DIRECTORIES")]
2609 public static bool is_absolute (string file_name);
2610 public static unowned string skip_root (string file_name);
2611 public static string get_basename (string file_name);
2612 public static string get_dirname (string file_name);
2613 [CCode (cname = "g_build_filename")]
2614 public static string build_filename (string first_element, ...);
2615 [CCode (cname = "g_build_path")]
2616 public static string build_path (string separator, string first_element, ...);
2618 [CCode (cname = "G_DIR_SEPARATOR")]
2619 public const char DIR_SEPARATOR;
2620 [CCode (cname = "G_DIR_SEPARATOR_S")]
2621 public const string DIR_SEPARATOR_S;
2622 [CCode (cname = "G_IS_DIR_SEPARATOR")]
2623 public static bool is_dir_separator (unichar c);
2624 [CCode (cname = "G_SEARCHPATH_SEPARATOR")]
2625 public const char SEARCHPATH_SEPARATOR;
2626 [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")]
2627 public const string SEARCHPATH_SEPARATOR_S;
2631 public static int nth_lsf (ulong mask, int nth_bit);
2632 public static int nth_msf (ulong mask, int nth_bit);
2633 public static uint storage (ulong number);
2636 namespace SpacedPrimes {
2637 public static uint closest (uint num);
2640 [CCode (has_target = false)]
2641 public delegate void FreeFunc (void* data);
2642 [CCode (has_target = false)]
2643 public delegate void VoidFunc ();
2645 public string format_size_for_display (int64 size);
2647 /* Lexical Scanner */
2648 [CCode (has_target = false)]
2649 public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error);
2652 [CCode (free_function = "g_scanner_destroy")]
2653 public class Scanner {
2654 public unowned string input_name;
2655 public TokenType token;
2656 public TokenValue value;
2658 public uint position;
2659 public TokenType next_token;
2660 public TokenValue next_value;
2661 public uint next_line;
2662 public uint next_position;
2663 public ScannerMsgFunc msg_handler;
2664 public ScannerConfig? config;
2665 public Scanner (ScannerConfig? config_templ);
2666 public void input_file (int input_fd);
2667 public void sync_file_offset ();
2668 public void input_text (string text, uint text_len);
2669 public TokenType peek_next_token ();
2670 public TokenType get_next_token ();
2672 public int cur_line ();
2673 public int cur_position ();
2674 public TokenType cur_token ();
2675 public TokenValue cur_value ();
2676 public uint set_scope (uint scope_id);
2677 public void scope_add_symbol (uint scope_id, string symbol, void* value);
2678 public void scope_foreach_symbol (uint scope_id, HFunc func);
2679 public void* scope_lookup_symbol (uint scope_id, string symbol);
2680 public void scope_remove_symbol (uint scope_id, string symbol);
2681 public void* lookup_symbol (string symbol);
2683 public void warn (string format, ...);
2685 public void error (string format, ...);
2686 public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error);
2689 public struct ScannerConfig {
2690 public string* cset_skip_characters;
2691 public string* cset_identifier_first;
2692 public string* cset_identifier_nth;
2693 public string* cpair_comment_single;
2694 public bool case_sensitive;
2695 public bool skip_comment_multi;
2696 public bool skip_comment_single;
2697 public bool scan_comment_multi;
2698 public bool scan_identifier;
2699 public bool scan_identifier_1char;
2700 public bool scan_identifier_NULL;
2701 public bool scan_symbols;
2702 public bool scan_binary;
2703 public bool scan_octal;
2704 public bool scan_float;
2705 public bool scan_hex;
2706 public bool scan_hex_dollar;
2707 public bool scan_string_sq;
2708 public bool scan_string_dq;
2709 public bool numbers_2_int;
2710 public bool int_2_float;
2711 public bool identifier_2_string;
2712 public bool char_2_token;
2713 public bool symbol_2_token;
2714 public bool scope_0_fallback;
2715 public bool store_int64;
2718 [CCode (lower_case_cprefix="G_CSET_")]
2719 namespace CharacterSet {
2720 public const string A_2_Z;
2721 public const string a_2_z;
2722 public const string DIGITS;
2723 public const string LATINC;
2724 public const string LATINS;
2727 [CCode (cprefix = "G_TOKEN_", has_type_id = false)]
2728 public enum TokenType
2757 public struct TokenValue {
2758 [CCode (cname="v_symbol")]
2759 public void* symbol;
2760 [CCode (cname="v_identifier")]
2761 public unowned string identifier;
2762 [CCode (cname="v_binary")]
2763 public ulong binary;
2764 [CCode (cname="v_octal")]
2766 [CCode (cname="v_int")]
2768 [CCode (cname="v_int64")]
2770 [CCode (cname="v_float")]
2771 public double float;
2772 [CCode (cname="v_hex")]
2774 [CCode (cname="v_string")]
2775 public unowned string string;
2776 [CCode (cname="v_comment")]
2777 public unowned string comment;
2778 [CCode (cname="v_char")]
2780 [CCode (cname="v_error")]
2784 [CCode (cprefix = "G_ERR_", has_type_id = false)]
2785 public enum ErrorType
2789 UNEXP_EOF_IN_STRING,
2790 UNEXP_EOF_IN_COMMENT,
2797 /* Automatic String Completion */
2800 [CCode (free_function = "g_completion_free")]
2801 public class Completion {
2802 public Completion (CompletionFunc? func = null);
2803 public List<void*> items;
2804 public CompletionFunc func;
2805 public string prefix;
2806 public List<void*> cache;
2807 public CompletionStrncmpFunc strncmp_func;
2808 public void add_items (List<void*> items);
2809 public void remove_items (List<void*> items);
2810 public void clear_items ();
2811 public unowned List<void*> complete (string prefix, out string? new_prefix = null);
2812 public unowned List<void*> complete_utf8 (string prefix, out string? new_prefix = null);
2815 [CCode (has_target = false)]
2816 public delegate string CompletionFunc (void* item);
2817 [CCode (has_target = false)]
2818 public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n);
2823 [CCode (free_function = "g_timer_destroy")]
2824 public class Timer {
2826 public void start ();
2827 public void stop ();
2828 public void @continue ();
2829 public double elapsed (out ulong microseconds = null);
2830 public void reset ();
2833 /* Spawning Processes */
2835 public errordomain SpawnError {
2858 [CCode (cprefix = "G_SPAWN_", has_type_id = false)]
2859 public enum SpawnFlags {
2860 LEAVE_DESCRIPTORS_OPEN,
2865 CHILD_INHERITS_STDIN,
2869 public delegate void SpawnChildSetupFunc ();
2870 [CCode (has_target = false, cheader_filename = "signal.h")]
2871 public delegate void SignalHandlerFunc (int signum);
2873 public unowned string strsignal (int signum);
2875 [CCode (lower_case_cprefix = "g_")]
2877 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;
2878 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;
2879 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;
2880 public static bool spawn_command_line_async (string command_line) throws SpawnError;
2881 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;
2882 [CCode (cname = "g_spawn_close_pid")]
2883 public static void close_pid (Pid pid);
2885 /* these macros are required to examine the exit status of a process */
2886 [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")]
2887 public static bool if_exited (int status);
2888 [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")]
2889 public static int exit_status (int status);
2890 [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")]
2891 public static bool if_signaled (int status);
2892 [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")]
2893 public static ProcessSignal term_sig (int status);
2894 [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")]
2895 public static bool core_dump (int status);
2896 [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")]
2897 public static bool if_stopped (int status);
2898 [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")]
2899 public static ProcessSignal stop_sig (int status);
2900 [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")]
2901 public static bool if_continued (int status);
2904 [CCode (cname = "abort", cheader_filename = "stdlib.h")]
2905 public void abort ();
2907 [CCode (cname = "exit", cheader_filename = "stdlib.h")]
2908 public void exit (int status);
2909 [CCode (cname = "raise", cheader_filename = "signal.h")]
2910 public int raise (ProcessSignal sig);
2911 [CCode (cname = "signal", cheader_filename = "signal.h")]
2912 public SignalHandlerFunc @signal (ProcessSignal signum, SignalHandlerFunc handler);
2915 [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")]
2916 public enum ProcessSignal {
2941 /* File Utilities */
2943 public errordomain FileError {
2971 [CCode (has_type_id = false)]
2972 public enum FileTest {
2980 [CCode (cprefix = "SEEK_", has_type_id = false)]
2981 public enum FileSeek {
2988 [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
2989 public class FileStream {
2990 [CCode (cname = "EOF", cheader_filename = "stdio.h")]
2991 public const int EOF;
2993 [CCode (cname = "fopen")]
2994 public static FileStream? open (string path, string mode);
2995 [CCode (cname = "fdopen")]
2996 public static FileStream? fdopen (int fildes, string mode);
2997 [CCode (cname = "fprintf")]
2999 public void printf (string format, ...);
3000 [CCode (cname = "vfprintf")]
3001 public void vprintf (string format, va_list args);
3002 [CCode (cname = "fputc", instance_pos = -1)]
3003 public void putc (char c);
3004 [CCode (cname = "fputs", instance_pos = -1)]
3005 public void puts (string s);
3006 [CCode (cname = "fgetc")]
3008 [CCode (cname = "ungetc", instance_pos = -1)]
3009 public int ungetc (int c);
3010 [CCode (cname = "fgets", instance_pos = -1)]
3011 public unowned string gets (char[] s);
3012 [CCode (cname = "feof")]
3014 [CCode (cname = "fscanf"), ScanfFormat]
3015 public int scanf (string format, ...);
3016 [CCode (cname = "fflush")]
3017 public int flush ();
3018 [CCode (cname = "fseek")]
3019 public int seek (long offset, FileSeek whence);
3020 [CCode (cname = "ftell")]
3021 public long tell ();
3022 [CCode (cname = "rewind")]
3023 public void rewind ();
3024 [CCode (cname = "fileno")]
3025 public int fileno ();
3026 [CCode (cname = "ferror")]
3027 public int error ();
3028 [CCode (cname = "clearerr")]
3029 public void clearerr ();
3030 [CCode (cname = "fread", instance_pos = -1)]
3031 public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3032 [CCode (cname = "fwrite", instance_pos = -1)]
3033 public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3035 public string? read_line () {
3037 StringBuilder? ret = null;
3038 while ((c = getc ()) != EOF) {
3040 ret = new StringBuilder ();
3045 ret.append_c ((char) c);
3055 [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
3056 namespace FileUtils {
3057 public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError;
3058 public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError;
3059 [CCode (cname = "g_file_get_contents")]
3060 public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "size_t")] out uint8[] contents) throws FileError;
3061 [CCode (cname = "g_file_set_contents")]
3062 public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "size_t")] uint8[] contents) throws FileError;
3063 public static bool test (string filename, FileTest test);
3064 public static int open_tmp (string tmpl, out string name_used) throws FileError;
3065 public static string read_link (string filename) throws FileError;
3066 public static int error_from_errno (int err_no);
3068 [CCode (cname = "g_mkstemp")]
3069 public static int mkstemp (string tmpl);
3070 [CCode (cname = "g_rename")]
3071 public static int rename (string oldfilename, string newfilename);
3072 [CCode (cname = "g_remove")]
3073 public static int remove (string filename);
3074 [CCode (cname = "g_unlink")]
3075 public static int unlink (string filename);
3076 [CCode (cname = "g_chmod")]
3077 public static int chmod (string filename, int mode);
3079 [CCode (cname = "symlink")]
3080 public static int symlink (string oldpath, string newpath);
3082 [CCode (cname = "close", cheader_filename = "unistd.h")]
3083 public static int close (int fd);
3086 [CCode (cname = "struct stat", cheader_filename = "sys/stat.h")]
3087 public struct Stat {
3088 [CCode (cname = "g_stat", instance_pos = -1)]
3089 public Stat (string filename);
3090 [CCode (cname = "g_lstat", instance_pos = -1)]
3091 public Stat.l (string filename);
3095 [CCode (free_function = "g_dir_close")]
3097 public static Dir open (string filename, uint _flags = 0) throws FileError;
3098 public unowned string? read_name ();
3099 public void rewind ();
3102 namespace DirUtils {
3103 [CCode (cname = "g_mkdir")]
3104 public static int create (string pathname, int mode);
3105 [CCode (cname = "g_mkdir_with_parents")]
3106 public static int create_with_parents (string pathname, int mode);
3107 [CCode (cname = "mkdtemp")]
3108 public static unowned string mkdtemp (string template);
3109 [CCode (cname = "g_rmdir")]
3110 public static int remove (string filename);
3115 [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref")]
3117 [CCode (free_function = "g_mapped_file_free")]
3119 public class MappedFile {
3120 public MappedFile (string filename, bool writable) throws FileError;
3121 public size_t get_length ();
3122 public unowned char* get_contents ();
3125 [CCode (cname = "stdin", cheader_filename = "stdio.h")]
3126 public static FileStream stdin;
3128 [CCode (cname = "stdout", cheader_filename = "stdio.h")]
3129 public static FileStream stdout;
3131 [CCode (cname = "stderr", cheader_filename = "stdio.h")]
3132 public static FileStream stderr;
3137 public const string RESERVED_CHARS_ALLOWED_IN_PATH;
3138 public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
3139 public const string RESERVED_CHARS_ALLOWED_IN_USERINFO;
3140 public const string RESERVED_CHARS_GENERIC_DELIMITERS;
3141 public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS;
3143 public static string parse_scheme (string uri);
3144 public static string escape_string (string unescaped, string reserved_chars_allowed, bool allow_utf8);
3145 public static string unescape_string (string escaped_string, string? illegal_characters = null);
3146 public static string unescape_segment (string escaped_string, string escaped_string_end, string? illegal_characters = null);
3147 [CCode (array_length = false, array_null_terminated = true)]
3148 public static string[] list_extract_uris (string uri_list);
3151 /* Shell-related Utilities */
3153 public errordomain ShellError {
3160 public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError;
3161 public static string quote (string unquoted_string);
3162 public static string unquote (string quoted_string) throws ShellError;
3165 /* Commandline option parser */
3167 public errordomain OptionError {
3174 [CCode (free_function = "g_option_context_free")]
3175 public class OptionContext {
3176 public OptionContext (string parameter_string);
3177 public void set_summary (string summary);
3178 public unowned string get_summary ();
3179 public void set_description (string description);
3180 public void get_description ();
3181 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3182 public void set_translation_domain (string domain);
3183 public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError;
3184 public void set_help_enabled (bool help_enabled);
3185 public bool get_help_enabled ();
3186 public void set_ignore_unknown_options (bool ignore_unknown);
3187 public bool get_ignore_unknown_options ();
3188 public string get_help (bool main_help, OptionGroup? group);
3189 public void add_main_entries ([CCode (array_length = false)] OptionEntry[] entries, string? translation_domain);
3190 public void add_group (owned OptionGroup group);
3191 public void set_main_group (owned OptionGroup group);
3192 public unowned OptionGroup get_main_group ();
3195 public delegate unowned string TranslateFunc (string str);
3197 [CCode (has_type_id = false)]
3198 public enum OptionArg {
3211 [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)]
3212 public enum OptionFlags {
3222 public struct OptionEntry {
3223 public unowned string long_name;
3224 public char short_name;
3227 public OptionArg arg;
3228 public void* arg_data;
3230 public unowned string description;
3231 public unowned string arg_description;
3235 [CCode (free_function = "g_option_group_free")]
3236 public class OptionGroup {
3237 public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null);
3238 public void add_entries ([CCode (array_length = false)] OptionEntry[] entries);
3239 public void set_parse_hooks (OptionParseFunc pre_parse_func, OptionParseFunc post_parse_hook);
3240 public void set_error_hook (OptionErrorFunc error_func);
3241 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3242 public void set_translation_domain (string domain);
3245 [CCode (has_target = false)]
3246 public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError;
3247 [CCode (has_target = false)]
3248 public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error);
3250 /* Perl-compatible regular expressions */
3252 public errordomain RegexError {
3259 [CCode (cprefix = "G_REGEX_", has_type_id = false)]
3260 public enum RegexCompileFlags {
3277 [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)]
3278 public enum RegexMatchFlags {
3291 [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
3292 public class Regex {
3293 public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
3294 public unowned string get_pattern ();
3295 public RegexCompileFlags get_compile_flags ();
3296 public RegexMatchFlags get_match_flags ();
3297 public int get_max_backref ();
3298 public int get_capture_count ();
3299 public int get_string_number (string name);
3300 public static string escape_string (string str, int length = -1);
3301 public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
3302 public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
3303 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;
3304 public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
3305 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;
3306 [CCode (array_length = false, array_null_terminated = true)]
3307 public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
3308 [CCode (array_length = false, array_null_terminated = true)]
3309 public string[] split (string str, RegexMatchFlags match_options = 0);
3310 [CCode (array_length = false, array_null_terminated = true)]
3311 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;
3312 public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
3313 public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
3314 public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval) throws RegexError;
3315 public static bool check_replacement (out bool has_references = null) throws RegexError;
3318 public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
3321 [CCode (free_function = "g_match_info_free")]
3322 public class MatchInfo {
3323 public unowned Regex get_regex ();
3324 public unowned string get_string ();
3325 public bool matches ();
3326 public bool next () throws RegexError;
3327 public int get_match_count ();
3328 public bool is_partial_match ();
3329 public string expand_references (string string_to_expand) throws RegexError;
3330 public string? fetch (int match_num);
3331 public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
3332 public string? fetch_named (string name);
3333 public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
3334 [CCode (array_length = false, array_null_terminated = true)]
3335 public string[] fetch_all ();
3338 /* Simple XML Subset Parser
3339 See http://live.gnome.org/Vala/MarkupSample for an example */
3341 public errordomain MarkupError {
3351 [CCode (cprefix = "G_MARKUP_", has_type_id = false)]
3352 public enum MarkupParseFlags {
3357 [CCode (free_function = "g_markup_parse_context_free")]
3358 public class MarkupParseContext {
3359 public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
3360 public bool parse (string text, ssize_t text_len) throws MarkupError;
3361 public bool end_parse () throws MarkupError;
3362 public unowned string get_element ();
3363 public unowned SList<string> get_element_stack ();
3364 public void get_position (out int line_number, out int char_number);
3365 public void push (MarkupParser parser, void* user_data);
3366 public void* pop ();
3369 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;
3371 public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
3373 public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
3375 public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
3377 public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
3379 public struct MarkupParser {
3380 public unowned MarkupParserStartElementFunc start_element;
3381 public unowned MarkupParserEndElementFunc end_element;
3382 public unowned MarkupParserTextFunc text;
3383 public unowned MarkupParserPassthroughFunc passthrough;
3384 public unowned MarkupParserErrorFunc error;
3388 [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)]
3389 public enum CollectType {
3398 public static string escape_text (string text, ssize_t length = -1);
3400 public static string printf_escaped (string format, ...);
3401 public static string vprintf_escaped (string format, va_list args);
3402 [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")]
3403 public static bool collect_attributes (string element_name, string[] attribute_names, string[] attribute_values, ...) throws MarkupError;
3406 /* Key-value file parser */
3408 public errordomain KeyFileError {
3418 [CCode (free_function = "g_key_file_free")]
3419 public class KeyFile {
3421 public void set_list_separator (char separator);
3422 public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError;
3423 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;
3424 public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError;
3425 public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
3426 // g_key_file_to_data never throws an error according to the documentation
3427 public string to_data (out size_t length = null, out GLib.Error error = null);
3428 public string get_start_group ();
3429 [CCode (array_length_type = "gsize")]
3430 public string[] get_groups ();
3431 [CCode (array_length_type = "gsize")]
3432 public string[] get_keys (string group_name) throws KeyFileError;
3433 public bool has_group (string group_name);
3434 public bool has_key (string group_name, string key) throws KeyFileError;
3435 public string get_value (string group_name, string key) throws KeyFileError;
3436 public string get_string (string group_name, string key) throws KeyFileError;
3437 public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError;
3438 public bool get_boolean (string group_name, string key) throws KeyFileError;
3439 public int get_integer (string group_name, string key) throws KeyFileError;
3440 public int64 get_int64 (string group_name, string key) throws KeyFileError;
3441 public uint64 get_uint64 (string group_name, string key) throws KeyFileError;
3442 public double get_double (string group_name, string key) throws KeyFileError;
3443 [CCode (array_length_type = "gsize")]
3444 public string[] get_string_list (string group_name, string key) throws KeyFileError;
3445 [CCode (array_length_type = "gsize")]
3446 public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError;
3447 [CCode (array_length_type = "gsize")]
3448 public bool[] get_boolean_list (string group_name, string key) throws KeyFileError;
3449 [CCode (array_length_type = "gsize")]
3450 public int[] get_integer_list (string group_name, string key) throws KeyFileError;
3451 [CCode (array_length_type = "gsize")]
3452 public double[] get_double_list (string group_name, string key) throws KeyFileError;
3453 public string get_comment (string group_name, string key) throws KeyFileError;
3454 public void set_value (string group_name, string key, string value);
3455 public void set_string (string group_name, string key, string str);
3456 public void set_locale_string (string group_name, string key, string locale, string str);
3457 public void set_boolean (string group_name, string key, bool value);
3458 public void set_integer (string group_name, string key, int value);
3459 public void set_int64 (string group_name, string key, int64 value);
3460 public void set_uint64 (string group_name, string key, uint64 value);
3461 public void set_double (string group_name, string key, double value);
3462 public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list);
3463 public void set_locale_string_list (string group_name, string key, string locale, string[] list);
3464 public void set_boolean_list (string group_name, string key, bool[] list);
3465 public void set_integer_list (string group_name, string key, int[] list);
3466 public void set_double_list (string group_name, string key, double[] list);
3467 public void set_comment (string group_name, string key, string comment) throws KeyFileError;
3468 public void remove_group (string group_name) throws KeyFileError;
3469 public void remove_key (string group_name, string key) throws KeyFileError;
3470 public void remove_comment (string group_name, string key) throws KeyFileError;
3473 [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)]
3474 public enum KeyFileFlags {
3480 [CCode (cprefix = "G_KEY_FILE_DESKTOP_")]
3481 namespace KeyFileDesktop {
3482 public static const string GROUP;
3483 public static const string KEY_TYPE;
3484 public static const string KEY_VERSION;
3485 public static const string KEY_NAME;
3486 public static const string KEY_GENERIC_NAME;
3487 public static const string KEY_NO_DISPLAY;
3488 public static const string KEY_COMMENT;
3489 public static const string KEY_ICON;
3490 public static const string KEY_HIDDEN;
3491 public static const string KEY_ONLY_SHOW_IN;
3492 public static const string KEY_NOT_SHOW_IN;
3493 public static const string KEY_TRY_EXEC;
3494 public static const string KEY_EXEC;
3495 public static const string KEY_PATH;
3496 public static const string KEY_TERMINAL;
3497 public static const string KEY_MIME_TYPE;
3498 public static const string KEY_CATEGORIES;
3499 public static const string KEY_STARTUP_NOTIFY;
3500 public static const string KEY_STARTUP_WM_CLASS;
3501 public static const string KEY_URL;
3502 public static const string TYPE_APPLICATION;
3503 public static const string TYPE_LINK;
3504 public static const string TYPE_DIRECTORY;
3507 /* Bookmark file parser */
3510 [CCode (free_function = "g_bookmark_file_free")]
3511 public class BookmarkFile {
3512 public BookmarkFile ();
3513 public bool load_from_file (string file) throws BookmarkFileError;
3514 public bool load_from_data (string data, size_t length) throws BookmarkFileError;
3515 public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError;
3516 public string to_data (out size_t length) throws BookmarkFileError;
3517 public bool to_file (string filename) throws BookmarkFileError;
3518 public bool has_item (string uri);
3519 public bool has_group (string uri, string group) throws BookmarkFileError;
3520 public bool has_application (string uri, string name) throws BookmarkFileError;
3521 public int get_size ();
3522 public string[] get_uris ();
3523 public string get_title (string uri) throws BookmarkFileError;
3524 public string get_description (string uri) throws BookmarkFileError;
3525 public string get_mime_type (string uri) throws BookmarkFileError;
3526 public bool get_is_private (string uri) throws BookmarkFileError;
3527 public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError;
3528 public time_t get_added (string uri) throws BookmarkFileError;
3529 public time_t get_modified (string uri) throws BookmarkFileError;
3530 public time_t get_visited (string uri) throws BookmarkFileError;
3531 public string[] get_groups (string uri) throws BookmarkFileError;
3532 public string[] get_applications (string uri) throws BookmarkFileError;
3533 public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError;
3534 public void set_title (string uri, string title);
3535 public void set_description (string uri, string description);
3536 public void set_mime_type (string uri, string mime_type);
3537 public void set_is_private (string uri, bool is_private);
3538 public void set_icon (string uri, string href, string mime_type);
3539 public void set_added (string uri, time_t added);
3540 public void set_groups (string uri, string[] groups);
3541 public void set_modified (string uri, time_t modified);
3542 public void set_visited (string uri, time_t visited);
3543 public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError;
3544 public void add_group (string uri, string group);
3545 public void add_application (string uri, string name, string exec);
3546 public bool remove_group (string uri, string group) throws BookmarkFileError;
3547 public bool remove_application (string uri, string name) throws BookmarkFileError;
3548 public bool remove_item (string uri) throws BookmarkFileError;
3549 public bool move_item (string old_uri, string new_uri) throws BookmarkFileError;
3552 public errordomain BookmarkFileError {
3567 public static void minimized_result (double minimized_quantity, string format, ...);
3569 public static void maximized_result (double maximized_quantity, string format, ...);
3570 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...);
3571 public static bool quick ();
3572 public static bool slow ();
3573 public static bool thorough ();
3574 public static bool perf ();
3575 public static bool verbose ();
3576 public static bool quiet ();
3577 public static int run ();
3578 public static void add_func (string testpath, Callback test_funcvoid);
3579 public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9)] DataTestFunc test_funcvoid);
3581 public static void message (string format, ...);
3582 public static void bug_base (string uri_pattern);
3583 public static void bug (string bug_uri_snippet);
3584 public static void timer_start ();
3585 public static double timer_elapsed ();
3586 public static double timer_last ();
3587 public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags);
3588 public static bool trap_has_passed ();
3589 public static bool trap_reached_timeout ();
3590 public static void trap_assert_passed ();
3591 public static void trap_assert_failed ();
3592 public static void trap_assert_stdout (string soutpattern);
3593 public static void trap_assert_stdout_unmatched (string soutpattern);
3594 public static void trap_assert_stderr (string serrpattern);
3595 public static void trap_assert_stderr_unmatched (string serrpattern);
3596 public static bool rand_bit ();
3597 public static int32 rand_int ();
3598 public static int32 rand_int_range (int32 begin, int32 end);
3599 public static double rand_double ();
3600 public static double rand_double_range ();
3601 public static void log_set_fatal_handler (LogFatalFunc log_func);
3604 public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message);
3607 [CCode (cname = "GTestCase", ref_function = "", unref_function = "")]
3608 public class TestCase {
3609 [CCode (cname = "g_test_create_case")]
3610 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);
3614 [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")]
3615 public class TestSuite {
3616 [CCode (cname = "g_test_create_suite")]
3617 public TestSuite (string name);
3618 [CCode (cname = "g_test_get_root")]
3619 public static TestSuite get_root ();
3620 [CCode (cname = "g_test_suite_add")]
3621 public void add (TestCase test_case);
3622 [CCode (cname = "g_test_suite_add_suite")]
3623 public void add_suite (TestSuite test_suite);
3626 public delegate void TestFunc (void* fixture);
3627 public delegate void DataTestFunc ();
3630 [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)]
3631 public enum TestTrapFlags {
3637 /* Doubly-Linked Lists */
3640 [CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
3641 public class List<G> {
3644 [ReturnsModifiedPointer ()]
3645 public void append (owned G data);
3646 [ReturnsModifiedPointer ()]
3647 public void prepend (owned G data);
3648 [ReturnsModifiedPointer ()]
3649 public void insert (owned G data, int position);
3650 [ReturnsModifiedPointer ()]
3651 public void insert_before (List<G> sibling, owned G data);
3652 [ReturnsModifiedPointer ()]
3653 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
3654 [ReturnsModifiedPointer ()]
3655 public void remove (G data);
3656 [ReturnsModifiedPointer ()]
3657 public void remove_link (List<G> llink);
3658 [ReturnsModifiedPointer ()]
3659 public void delete_link (List<G> link_);
3660 [ReturnsModifiedPointer ()]
3661 public void remove_all (G data);
3663 public uint length ();
3664 public List<unowned G> copy ();
3665 [ReturnsModifiedPointer ()]
3666 public void reverse ();
3667 [ReturnsModifiedPointer ()]
3668 public void sort (CompareFunc<G> compare_func);
3669 [ReturnsModifiedPointer ()]
3670 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
3671 [ReturnsModifiedPointer ()]
3672 public void sort_with_data (CompareDataFunc<G> compare_func);
3673 [ReturnsModifiedPointer ()]
3674 public void concat (owned List<G> list2);
3675 public void @foreach (Func<G> func);
3677 public unowned List<G> first ();
3678 public unowned List<G> last ();
3679 public unowned List<G> nth (uint n);
3680 public unowned G nth_data (uint n);
3681 public unowned List<G> nth_prev (uint n);
3683 public unowned List<G> find (G data);
3684 public unowned List<G> find_custom (G data, CompareFunc<G> func);
3685 public int position (List<G> llink);
3686 public int index (G data);
3689 public List<G> next;
3690 public unowned List<G> prev;
3693 /* Singly-Linked Lists */
3696 [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
3697 public class SList<G> {
3700 [ReturnsModifiedPointer ()]
3701 public void append (owned G data);
3702 [ReturnsModifiedPointer ()]
3703 public void prepend (owned G data);
3704 [ReturnsModifiedPointer ()]
3705 public void insert (owned G data, int position);
3706 [ReturnsModifiedPointer ()]
3707 public void insert_before (SList<G> sibling, owned G data);
3708 [ReturnsModifiedPointer ()]
3709 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
3710 [ReturnsModifiedPointer ()]
3711 public void remove (G data);
3712 [ReturnsModifiedPointer ()]
3713 public void remove_link (SList<G> llink);
3714 [ReturnsModifiedPointer ()]
3715 public void delete_link (SList<G> link_);
3716 [ReturnsModifiedPointer ()]
3717 public void remove_all (G data);
3719 public uint length ();
3720 public SList<unowned G> copy ();
3721 [ReturnsModifiedPointer ()]
3722 public void reverse ();
3723 [ReturnsModifiedPointer ()]
3724 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
3725 [ReturnsModifiedPointer ()]
3726 public void sort (CompareFunc<G> compare_func);
3727 [ReturnsModifiedPointer ()]
3728 public void sort_with_data (CompareDataFunc<G> compare_func);
3729 [ReturnsModifiedPointer ()]
3730 public void concat (owned SList<G> list2);
3731 public void @foreach (Func<G> func);
3733 public unowned SList<G> last ();
3734 public unowned SList<G> nth (uint n);
3735 public unowned G nth_data (uint n);
3737 public unowned SList<G> find (G data);
3738 public unowned SList<G> find_custom (G data, CompareFunc<G> func);
3739 public int position (SList<G> llink);
3740 public int index (G data);
3743 public SList<G> next;
3746 [CCode (has_target = false)]
3747 public delegate int CompareFunc<G> (G a, G b);
3749 public delegate int CompareDataFunc<G> (G a, G b);
3751 [CCode (cname = "g_strcmp0")]
3752 public static GLib.CompareFunc<string> strcmp;
3754 /* Double-ended Queues */
3757 [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
3758 public class Queue<G> {
3759 public unowned List<G> head;
3760 public unowned List<G> tail;
3765 public void clear ();
3766 public bool is_empty ();
3767 public uint get_length ();
3768 public void reverse ();
3769 public Queue copy ();
3770 public unowned List<G> find (G data);
3771 public unowned List<G> find_custom (G data, CompareFunc<G> func);
3772 public void sort (CompareDataFunc<G> compare_func);
3773 public void push_head (owned G data);
3774 public void push_tail (owned G data);
3775 public void push_nth (owned G data, int n);
3776 public G pop_head ();
3777 public G pop_tail ();
3778 public G pop_nth (uint n);
3779 public unowned G peek_head ();
3780 public unowned G peek_tail ();
3781 public unowned G peek_nth (uint n);
3782 public int index (G data);
3783 public void remove (G data);
3784 public void remove_all (G data);
3785 public void delete_link (List<G> link);
3786 public void unlink (List<G> link);
3787 public void insert_before (List<G> sibling, owned G data);
3788 public void insert_after (List<G> sibling, owned G data);
3789 public void insert_sorted (owned G data, CompareDataFunc<G> func);
3795 [CCode (free_function = "g_sequence_free")]
3796 public class Sequence<G> {
3797 public Sequence (DestroyNotify? data_destroy);
3798 public int get_length ();
3799 public void @foreach (Func<G> func);
3800 public static void foreach_range (SequenceIter<G> begin, SequenceIter<G> end, Func<G> func);
3801 public void sort (CompareDataFunc<G> cmp_func);
3802 public void sort_iter (SequenceIterCompareFunc<G> func);
3803 public SequenceIter<G> get_begin_iter ();
3804 public SequenceIter<G> get_end_iter ();
3805 public SequenceIter<G> get_iter_at_pos (int pos);
3806 public SequenceIter<G> append (owned G data);
3807 public SequenceIter<G> prepend (owned G data);
3808 public static SequenceIter<G> insert_before (SequenceIter<G> iter, owned G data);
3809 public static void move (SequenceIter<G> src, SequenceIter<G> dest);
3810 public static void swap (SequenceIter<G> src, SequenceIter<G> dest);
3811 public SequenceIter<G> insert_sorted (owned G data, CompareDataFunc<G> cmp_func);
3812 public SequenceIter<G> insert_sorted_iter (owned G data, SequenceIterCompareFunc<G> iter_cmp);
3813 public static void sort_changed (SequenceIter<G> iter, CompareDataFunc<G> cmp_func);
3814 public static void sort_changed_iter (SequenceIter<G> iter, SequenceIterCompareFunc<G> iter_cmp);
3815 public static void remove (SequenceIter<G> iter);
3816 public static void remove_range (SequenceIter<G> begin, SequenceIter<G> end);
3817 public static void move_range (SequenceIter<G> dest, SequenceIter<G> begin, SequenceIter<G> end);
3818 public SequenceIter<G> search (G data, CompareDataFunc<G> cmp_func);
3819 public SequenceIter<G> search_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
3820 public static unowned G get (SequenceIter<G> iter);
3821 public static void set (SequenceIter<G> iter, owned G data);
3822 public static SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
3826 [CCode (ref_function = "", unref_function = "")]
3827 public class SequenceIter<G> {
3828 public bool is_begin ();
3829 public bool is_end ();
3830 public SequenceIter<G> next ();
3831 public SequenceIter<G> prev ();
3832 public int get_position ();
3833 public SequenceIter<G> move (int delta);
3834 public Sequence<G> get_sequence ();
3835 public int compare (SequenceIter<G> other);
3837 [CCode (cname = "g_sequence_get")]
3838 public unowned G get ();
3841 public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
3846 [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
3847 public class HashTable<K,V> {
3848 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
3849 public HashTable (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func);
3850 public HashTable.full (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
3851 public void insert (owned K key, owned V value);
3852 public void replace (owned K key, owned V value);
3853 public unowned V lookup (K key);
3854 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
3855 public bool remove (K key);
3856 public void remove_all ();
3857 public List<unowned K> get_keys ();
3858 public List<unowned V> get_values ();
3859 public void @foreach (HFunc<K,V> func);
3860 [CCode (cname = "g_hash_table_foreach")]
3861 public void for_each (HFunc<K,V> func);
3862 public unowned V find (HRFunc<K,V> predicate);
3863 public uint size ();
3864 public bool steal (K key);
3865 public void steal_all ();
3868 public struct HashTableIter<K,V> {
3869 public HashTableIter (GLib.HashTable<K,V> table);
3870 public bool next (out unowned K key, out unowned V value);
3871 public void remove ();
3872 public void steal ();
3873 public unowned GLib.HashTable<K,V> get_hash_table ();
3876 [CCode (has_target = false)]
3877 public delegate uint HashFunc<K> (K key);
3878 [CCode (has_target = false)]
3879 public delegate bool EqualFunc<G> (G a, G b);
3880 public delegate void HFunc<K,V> (K key, V value);
3881 public delegate bool HRFunc<K,V> (K key, V value);
3883 [CCode (has_target = false)]
3884 public delegate void DestroyNotify (void* data);
3886 [CCode (cname = "g_direct_hash")]
3887 public static GLib.HashFunc<void*> direct_hash;
3888 [CCode (cname = "g_direct_equal")]
3889 public static GLib.EqualFunc<void*> direct_equal;
3890 [CCode (cname = "g_int64_hash")]
3891 public static GLib.HashFunc<int64?> int64_hash;
3892 [CCode (cname = "g_int64_equal")]
3893 public static GLib.EqualFunc<int64?> int64_equal;
3894 [CCode (cname = "g_int_hash")]
3895 public static GLib.HashFunc<int?> int_hash;
3896 [CCode (cname = "g_int_equal")]
3897 public static GLib.EqualFunc<int?> int_equal;
3898 [CCode (cname = "g_str_hash")]
3899 public static GLib.HashFunc<string> str_hash;
3900 [CCode (cname = "g_str_equal")]
3901 public static GLib.EqualFunc<string> str_equal;
3902 [CCode (cname = "g_free")]
3903 public static GLib.DestroyNotify g_free;
3904 [CCode (cname = "g_object_unref")]
3905 public static GLib.DestroyNotify g_object_unref;
3906 [CCode (cname = "g_list_free")]
3907 public static GLib.DestroyNotify g_list_free;
3908 [CCode (cname = "((GDestroyNotify) g_variant_unref)")]
3909 public static GLib.DestroyNotify g_variant_unref;
3914 [GIR (name = "String")]
3915 [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
3916 public class StringBuilder {
3917 public StringBuilder (string init = "");
3918 [CCode (cname = "g_string_sized_new")]
3919 public StringBuilder.sized (size_t dfl_size);
3920 public unowned StringBuilder assign (string rval);
3921 public unowned StringBuilder append (string val);
3922 public unowned StringBuilder append_c (char c);
3923 public unowned StringBuilder append_unichar (unichar wc);
3924 public unowned StringBuilder append_len (string val, ssize_t len);
3925 public unowned StringBuilder prepend (string val);
3926 public unowned StringBuilder prepend_c (char c);
3927 public unowned StringBuilder prepend_unichar (unichar wc);
3928 public unowned StringBuilder prepend_len (string val, ssize_t len);
3929 public unowned StringBuilder insert (ssize_t pos, string val);
3930 public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
3931 public unowned StringBuilder truncate (size_t len = 0);
3934 public void printf (string format, ...);
3936 public void append_printf (string format, ...);
3937 public void vprintf (string format, va_list args);
3938 public void append_vprintf (string format, va_list args);
3942 public ssize_t allocated_len;
3948 [CCode (free_function = "g_string_chunk_free")]
3949 public class StringChunk {
3950 public StringChunk (size_t size);
3951 public unowned string insert (string str);
3952 public unowned string insert_const (string str);
3953 public unowned string insert_len (string str, ssize_t len);
3954 public void clear ();
3957 /* Pointer Arrays */
3961 [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
3963 [CCode (free_function = "g_ptr_array_free")]
3965 public class PtrArray {
3967 public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func);
3968 [CCode (cname = "g_ptr_array_sized_new")]
3969 public PtrArray.sized (uint reserved_size);
3970 public void add (void* data);
3971 public void foreach (GLib.Func<void*> func);
3972 [CCode (cname = "g_ptr_array_index")]
3973 public void* index(uint index);
3974 public bool remove (void* data);
3975 public void* remove_index (uint index);
3976 public bool remove_fast (void *data);
3977 public void remove_index_fast (uint index);
3978 public void remove_range (uint index, uint length);
3979 public void sort (CompareFunc compare_func);
3980 public void sort_with_data (CompareDataFunc compare_func);
3981 public void set_free_func (GLib.DestroyNotify? element_free_function);
3982 public void set_size (int length);
3985 public void** pdata;
3989 [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")]
3990 public class GenericArray<G> {
3991 [CCode (cname = "g_ptr_array_new_with_free_func", simple_generics = true)]
3992 public GenericArray ();
3993 public void add (owned G data);
3994 public void foreach (GLib.Func<G> func);
3995 [CCode (cname = "g_ptr_array_index")]
3996 public unowned G get (uint index);
3997 public bool remove (G data);
3998 public void remove_index (uint index);
3999 public bool remove_fast (G data);
4000 public void remove_index_fast (uint index);
4001 public void remove_range (uint index, uint length);
4002 public void set (uint index, owned G data) {
4003 this.add ((owned) data);
4004 this.remove_index_fast (index);
4006 public void sort (GLib.CompareFunc<G> compare_func);
4007 public void sort_with_data (GLib.CompareDataFunc<G> compare_func);
4008 private void set_size (int length);
4011 get { return (int) this.len; }
4012 set { this.set_size (value); }
4022 [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")]
4024 [CCode (cprefix = "g_byte_array_", free_function = "g_byte_array_free")]
4026 public class ByteArray {
4027 public ByteArray ();
4028 [CCode (cname = "g_byte_array_sized_new")]
4029 public ByteArray.sized (uint reserved_size);
4030 public void append (uint8[] data);
4031 public void prepend (uint8[] data);
4032 public void remove_index (uint index);
4033 public void remove_index_fast (uint index);
4034 public void remove_range (uint index, uint length);
4035 public void sort (CompareFunc<int8> compare_func);
4036 public void sort_with_data (CompareDataFunc<int8> compare_func);
4037 public void set_size (uint length);
4040 [CCode (array_length_cname = "len", array_length_type = "guint")]
4041 public uint8[] data;
4046 public delegate bool NodeTraverseFunc (Node node);
4047 public delegate void NodeForeachFunc (Node node);
4049 [CCode (cprefix = "G_TRAVERSE_")]
4050 public enum TraverseFlags {
4057 [CCode (dup_function = "g_node_copy", free_function = "g_node_destroy")]
4058 public class Node<G> {
4059 public Node(owned G? data = null);
4060 public Node<unowned G> copy ();
4061 public unowned Node<G> insert (int position, owned Node<G> node);
4062 public unowned Node<G> insert_before (Node<G> sibling, owned Node<G> node);
4063 public unowned Node<G> insert_after (Node<G> sibling, owned Node<G> node);
4064 public unowned Node<G> append (owned Node<G> node);
4065 public unowned Node<G> prepend (owned Node<G> node);
4066 public unowned Node<G> insert_data (int position, owned G data);
4067 public unowned Node<G> insert_data_before (Node<G> sibling, owned G data);
4068 public unowned Node<G> append_data (owned G data);
4069 public unowned Node<G> prepend_data (owned G data);
4070 public void reverse_children ();
4071 public void traverse (TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func);
4072 public void children_foreach (TraverseFlags flags, NodeForeachFunc func);
4073 public unowned Node<G> get_root ();
4074 public unowned Node<G> find (TraverseType order, TraverseFlags flags, G data);
4075 public unowned Node<G> find_child (TraverseFlags flags, G data);
4076 public int child_index (G data);
4077 public int child_position (Node<G> child);
4078 public unowned Node<G> first_child ();
4079 public unowned Node<G> last_child ();
4080 public unowned Node<G> nth_child ();
4081 public unowned Node<G> first_sibling ();
4082 public unowned Node<G> next_sibling ();
4083 public unowned Node<G> prev_sibling ();
4084 public unowned Node<G> last_sibling ();
4086 [CCode (cname = "G_NODE_IS_LEAF")]
4087 public bool is_leaf ();
4088 [CCode (cname = "G_NODE_IS_ROOT")]
4089 public bool is_root ();
4090 public bool is_ancestor (Node<G> descendant);
4092 public uint depth ();
4093 public uint n_nodes (TraverseFlags flags);
4094 public uint max_height ();
4096 [CCode (cname = "g_node_unlink")]
4097 public void _unlink ();
4098 [CCode (cname = "g_node_unlink_vala")]
4099 public Node<G> unlink ()
4103 return (Node<G>) (owned) ptr;
4110 public Node children;
4115 [CCode (type_id = "G_TYPE_UINT")]
4116 public struct Quark : uint32 {
4117 public static Quark from_string (string str);
4118 public static Quark try_string (string str);
4119 public unowned string to_string ();
4122 /* Keyed Data Lists */
4124 [CCode (cname = "GData*")]
4125 public struct Datalist<G> {
4127 public void clear ();
4128 public unowned G id_get_data (Quark key_id);
4129 public void id_set_data (Quark key_id, owned G data);
4130 public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
4131 public void id_remove_data (Quark key_id);
4132 public G id_remove_no_notify (Quark key_id);
4133 public void @foreach (DataForeachFunc func);
4134 public unowned G get_data (string key);
4135 public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
4136 public G remove_no_notify (string key);
4137 public void set_data (string key, owned G data);
4138 public void remove_data (string key);
4141 public delegate void DataForeachFunc<G> (Quark key_id, G data);
4147 [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")]
4149 [CCode (free_function = "g_array_free")]
4151 public class Array<G> {
4152 [CCode (cname = "len")]
4155 public Array (bool zero_terminated, bool clear, ulong element_size);
4156 [CCode (cname = "g_array_sized_new")]
4157 public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
4158 public void append_val (owned G value);
4159 public void append_vals (void* data, uint len);
4160 public void prepend_val (owned G value);
4161 public void prepend_vals (void* data, uint len);
4162 public void insert_val (uint index, owned G value);
4163 public void insert_vals (uint index, void* data, uint len);
4164 public void remove_index (uint index);
4165 public void remove_index_fast (uint index);
4166 public void remove_range (uint index, uint length);
4167 public void sort (CompareFunc<G> compare_func);
4168 public void sort_with_data (CompareDataFunc<G> compare_func);
4169 [CCode (generic_type_pos = 0.1)]
4170 public unowned G index (uint index);
4171 public void set_size (uint length);
4176 public delegate int TraverseFunc (void* key, void* value);
4178 [CCode (cprefix = "G_", has_type_id = false)]
4179 public enum TraverseType {
4186 public delegate int TreeSearchFunc<K> (K key);
4190 [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")]
4192 [CCode (free_function = "g_tree_destroy")]
4194 public class Tree<K,V> {
4195 public Tree (CompareFunc<K> key_compare_func);
4196 public Tree.with_data (CompareDataFunc<K> key_compare_func);
4197 public Tree.full (CompareDataFunc<K> key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
4198 public void insert (owned K key, owned V value);
4199 public void replace (owned K key, owned V value);
4200 public int nnodes ();
4201 public int height ();
4202 public unowned V lookup (K key);
4203 public bool lookup_extended (K lookup_key, K orig_key, V value);
4204 public void foreach (TraverseFunc traverse_func);
4205 public unowned V search (TreeSearchFunc<K> search_func);
4206 [CCode (cname = "g_tree_search")]
4207 public unowned V search_key (CompareFunc<K> search_func, K key);
4208 public bool remove (K key);
4209 public bool steal (K key);
4212 /* Internationalization */
4214 [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4215 public static unowned string _ (string str);
4216 [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4217 public static unowned string Q_ (string str);
4218 [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4219 public static unowned string N_ (string str);
4220 [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4221 public static unowned string ngettext (string msgid, string msgid_plural, ulong n);
4222 [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")]
4223 public static unowned string dgettext (string? domain, string msgid);
4224 [CCode (cname = "g_dcgettext", cheader_filename = "glib/gi18n-lib.h")]
4225 public static unowned string dcgettext (string? domain, string msgid, int category);
4226 [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")]
4227 public static unowned string dngettext (string? domain, string msgid, string msgid_plural, ulong n);
4228 [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")]
4229 public static unowned string dpgettext (string? domain, string msgctxid, size_t msgidoffset);
4230 [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")]
4231 public static unowned string dpgettext2 (string? domain, string context, string msgid);
4233 [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
4234 public enum LocaleCategory {
4245 [CCode (cname = "setlocale", cheader_filename = "locale.h")]
4246 public static unowned string? setlocale (LocaleCategory category, string? locale);
4247 [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")]
4248 public static unowned string? bindtextdomain (string domainname, string? dirname);
4249 [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")]
4250 public static unowned string? textdomain (string? domainname);
4251 [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")]
4252 public static unowned string? bind_textdomain_codeset (string domainname, string? codeset);
4253 [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)]
4254 public static unowned string[] get_language_names ();
4255 [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")]
4256 public static unowned string strip_context (string msgid, string msgval);
4260 public class PatternSpec {
4261 public PatternSpec (string pattern);
4262 public bool equal (PatternSpec pspec);
4263 [CCode (cname = "g_pattern_match")]
4264 public bool match (uint string_length, string str, string? str_reversed);
4265 [CCode (cname = "g_pattern_match_string")]
4266 public bool match_string (string str);
4267 [CCode (cname = "g_pattern_match_simple")]
4268 public static bool match_simple (string pattern, string str);
4272 public string error_message (int error);
4273 public string getlocale ();
4274 public string get_package_installation_directory_of_module (void* hmodule);
4275 public uint get_windows_version ();
4276 public string locale_filename_from_utf8 (string utf8filename);
4277 [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")]
4278 public bool have_widechar_api ();
4279 [CCode (cname = "G_WIN32_IS_NT_BASED")]
4280 public bool is_nt_based ();
4284 [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
4285 public class VariantType {
4286 [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
4287 public static VariantType BOOLEAN;
4288 [CCode (cname = "G_VARIANT_TYPE_BYTE")]
4289 public static VariantType BYTE;
4290 [CCode (cname = "G_VARIANT_TYPE_INT16")]
4291 public static VariantType INT16;
4292 [CCode (cname = "G_VARIANT_TYPE_UINT16")]
4293 public static VariantType UINT16;
4294 [CCode (cname = "G_VARIANT_TYPE_INT32")]
4295 public static VariantType INT32;
4296 [CCode (cname = "G_VARIANT_TYPE_UINT32")]
4297 public static VariantType UINT32;
4298 [CCode (cname = "G_VARIANT_TYPE_INT64")]
4299 public static VariantType INT64;
4300 [CCode (cname = "G_VARIANT_TYPE_UINT64")]
4301 public static VariantType UINT64;
4302 [CCode (cname = "G_VARIANT_TYPE_DOUBLE")]
4303 public static VariantType DOUBLE;
4304 [CCode (cname = "G_VARIANT_TYPE_STRING")]
4305 public static VariantType STRING;
4306 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")]
4307 public static VariantType OBJECT_PATH;
4308 [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")]
4309 public static VariantType SIGNATURE;
4310 [CCode (cname = "G_VARIANT_TYPE_VARIANT")]
4311 public static VariantType VARIANT;
4312 [CCode (cname = "G_VARIANT_TYPE_UNIT")]
4313 public static VariantType UNIT;
4314 [CCode (cname = "G_VARIANT_TYPE_ANY")]
4315 public static VariantType ANY;
4316 [CCode (cname = "G_VARIANT_TYPE_BASIC")]
4317 public static VariantType BASIC;
4318 [CCode (cname = "G_VARIANT_TYPE_MAYBE")]
4319 public static VariantType MAYBE;
4320 [CCode (cname = "G_VARIANT_TYPE_ARRAY")]
4321 public static VariantType ARRAY;
4322 [CCode (cname = "G_VARIANT_TYPE_TUPLE")]
4323 public static VariantType TUPLE;
4324 [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")]
4325 public static VariantType DICT_ENTRY;
4326 [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")]
4327 public static VariantType DICTIONARY;
4329 public static bool string_is_valid (string type_string);
4330 public static bool string_scan (string type_string, char *limit, out char* endptr);
4332 public VariantType (string type_string);
4333 public size_t get_string_length ();
4334 public char* peek_string ();
4335 public string dup_string ();
4337 public bool is_definite ();
4338 public bool is_container ();
4339 public bool is_basic ();
4340 public bool is_maybe ();
4341 public bool is_array ();
4342 public bool is_tuple ();
4343 public bool is_dict_entry ();
4344 public bool is_variant ();
4346 public uint hash ();
4347 public bool equal (VariantType other);
4348 public bool is_subtype_of (VariantType supertype);
4350 public unowned VariantType element ();
4351 public unowned VariantType first ();
4352 public unowned VariantType next ();
4353 public unowned VariantType n_items ();
4354 public unowned VariantType key ();
4355 public unowned VariantType value ();
4357 public VariantType.array (VariantType element);
4358 public VariantType.maybe (VariantType element);
4359 public VariantType.tuple (VariantType[] items);
4360 public VariantType.dict_entry (VariantType key, VariantType value);
4364 [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")]
4365 public class Variant {
4366 [CCode (has_type_id = false)]
4368 BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64,
4369 UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH,
4370 SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY
4373 public unowned VariantType get_type ();
4374 public unowned string get_type_string ();
4375 public bool is_of_type (VariantType type);
4376 public bool is_container ();
4377 public bool is_floating ();
4378 public Class classify ();
4379 public int compare (Variant other);
4381 public Variant.boolean (bool value);
4382 public Variant.byte (uchar value);
4383 public Variant.int16 (int16 value);
4384 public Variant.uint16 (uint16 value);
4385 public Variant.int32 (int32 value);
4386 public Variant.uint32 (uint32 value);
4387 public Variant.int64 (int64 value);
4388 public Variant.uint64 (uint64 value);
4389 public Variant.handle (int32 value);
4390 public Variant.double (double value);
4391 public Variant.string (string value);
4392 public Variant.bytestring (string value);
4393 public Variant.object_path (string object_path);
4394 public static bool is_object_path (string object_path);
4395 public Variant.signature (string signature);
4396 public static bool is_signature (string signature);
4398 public bool get_boolean ();
4399 public uint8 get_byte ();
4400 public int16 get_int16 ();
4401 public uint16 get_uint16 ();
4402 public int32 get_int32 ();
4403 public uint32 get_uint32 ();
4404 public int64 get_int64 ();
4405 public uint64 get_uint64 ();
4406 public int32 get_handle ();
4407 public double get_double ();
4408 public unowned string get_string (out size_t length = null);
4409 public string dup_string (out size_t length = null);
4410 public unowned string get_bytestring ();
4411 public string dup_bytestring (out size_t length);
4413 public Variant.strv (string[] value);
4414 [CCode (array_length_type = "size_t")]
4415 public string*[] get_strv ();
4416 [CCode (array_length_type = "size_t")]
4417 public string[] dup_strv ();
4419 public Variant.bytestring_array (string[] value);
4420 [CCode (array_length_type = "size_t")]
4421 public string*[] get_bytestring_array ();
4422 [CCode (array_length_type = "size_t")]
4423 public string[] dup_bytestring_array ();
4425 public Variant (string format, ...);
4426 public void get (string format, ...);
4428 public Variant.variant (Variant value);
4429 public Variant.maybe (VariantType? child_type, Variant? child);
4430 public Variant.array (VariantType? child_type, Variant[] children);
4431 public Variant.tuple (Variant[] children);
4432 public Variant.dict_entry (Variant key, Variant value);
4433 public Variant get_variant ();
4434 public Variant? get_maybe ();
4436 public size_t n_children ();
4437 public Variant get_child_value (size_t index);
4439 public Variant? lookup_value (string key, VariantType? expected_type);
4440 public bool lookup (string key, string format_string, ...);
4442 public size_t get_size ();
4443 public void *get_data ();
4444 public void store (void *data);
4446 public string print (bool type_annotate);
4447 public StringBuilder print_string (StringBuilder? builder, bool type_annotate);
4449 public uint hash ();
4450 public bool equal (Variant other);
4452 public Variant byteswap ();
4453 public Variant get_normal_form ();
4454 public bool is_normal_form ();
4455 [CCode (returns_floating_reference = true, simple_generics = true)]
4456 public static Variant new_from_data<T> (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null);
4458 [CCode (cname = "g_variant_iter_new")]
4459 public VariantIter iterator ();
4461 public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError;
4462 public Variant.parsed (string format_string, ...);
4465 public errordomain VariantParseError {
4470 [CCode (copy_func = "g_variant_iter_copy", free_func = "g_variant_iter_free")]
4471 public class VariantIter {
4472 public VariantIter (Variant value);
4473 public size_t n_children ();
4474 public Variant? next_value ();
4475 public bool next (string format_string, ...);
4479 [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref")]
4480 public class VariantBuilder {
4481 public VariantBuilder (VariantType type);
4482 public void open (VariantType type);
4483 public void close ();
4484 public void add_value (Variant value);
4485 public void add (string format_string, ...);
4486 [CCode (returns_floating_reference = true)]
4487 public Variant end ();
4491 [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")]
4492 public class ObjectPath : string {
4493 [CCode (cname = "g_strdup")]
4494 public ObjectPath (string path);
4497 [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")]
4498 public class BusName : string {
4499 [CCode (cname = "g_strdup")]
4500 public BusName (string bus_name);
4504 [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]
4505 public static bool likely (bool expression);
4506 [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")]
4507 public static bool unlikely (bool expression);
4508 [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")]
4509 public static void static_assert (bool expression);
4511 [CCode (simple_generics = true)]
4512 private static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func);