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 = "memchr")]
1281 static char* memchr (char* s, int c, size_t n);
1283 // strnlen is not available on all systems
1284 static long strnlen (char* str, long maxlen) {
1285 char* end = memchr (str, 0, maxlen);
1289 return (long) (end - str);
1293 [CCode (cname = "g_strndup")]
1294 static string strndup (char* str, size_t n);
1296 public string substring (long offset, long len = -1) {
1298 if (offset >= 0 && len >= 0) {
1299 // avoid scanning whole string
1300 string_length = strnlen ((char*) this, offset + len);
1302 string_length = this.length;
1306 offset = string_length + offset;
1307 GLib.return_val_if_fail (offset >= 0, null);
1309 GLib.return_val_if_fail (offset <= string_length, null);
1312 len = string_length - offset;
1314 GLib.return_val_if_fail (offset + len <= string_length, null);
1315 return strndup ((char*) this + offset, len);
1318 public string slice (long start, long end) {
1319 long string_length = this.length;
1321 start = string_length + start;
1324 end = string_length + end;
1326 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1327 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1328 GLib.return_val_if_fail (start <= end, null);
1329 return strndup ((char*) this + start, end - start);
1332 public string splice (long start, long end, string? str = null) {
1333 long string_length = this.length;
1335 start = string_length + start;
1338 end = string_length + end;
1340 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1341 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1342 GLib.return_val_if_fail (start <= end, null);
1348 str_size = str.length;
1351 string* result = GLib.malloc0 (this.length - (end - start) + str_size + 1);
1353 char* dest = (char*) result;
1355 GLib.Memory.copy (dest, this, start);
1358 GLib.Memory.copy (dest, str, str_size);
1361 GLib.Memory.copy (dest, (char*) this + end, string_length - end);
1363 return (owned) result;
1366 public bool contains (string needle) {
1367 return strstr ((char*) this, (char*) needle) != null;
1370 public string replace (string old, string replacement) {
1372 var regex = new GLib.Regex (GLib.Regex.escape_string (old));
1373 return regex.replace_literal (this, -1, 0, replacement);
1374 } catch (GLib.RegexError e) {
1375 GLib.assert_not_reached ();
1379 [CCode (cname = "g_utf8_strlen")]
1380 public int char_count (ssize_t max = -1);
1383 [CCode (cname = "strlen")]
1387 public uint8[] data {
1389 unowned uint8[] res = (uint8[]) this;
1390 res.length = (int) this.length;
1395 public char[] to_utf8 () {
1396 char[] result = new char[this.length + 1];
1398 GLib.Memory.copy (result, this, this.length);
1402 public unowned string to_string () {
1407 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
1409 [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
1411 [CCode (cname = "G_E")]
1412 public const double E;
1414 [CCode (cname = "G_PI")]
1415 public const double PI;
1417 [CCode (cname = "G_LN2")]
1418 public const double LN2;
1420 [CCode (cname = "G_LN10")]
1421 public const double LN10;
1423 [CCode (cname = "G_PI_2")]
1424 public const double PI_2;
1426 [CCode (cname = "G_PI_4")]
1427 public const double PI_4;
1429 [CCode (cname = "G_SQRT2")]
1430 public const double SQRT2;
1432 /* generated from <bits/mathcalls.h> of glibc */
1433 public static double acos (double x);
1434 public static float acosf (float x);
1435 public static double asin (double x);
1436 public static float asinf (float x);
1437 public static double atan (double x);
1438 public static float atanf (float x);
1439 public static double atan2 (double y, double x);
1440 public static float atan2f (float y, float x);
1441 public static double cos (double x);
1442 public static float cosf (float x);
1443 public static double sin (double x);
1444 public static float sinf (float x);
1445 public static double tan (double x);
1446 public static float tanf (float x);
1447 public static double cosh (double x);
1448 public static float coshf (float x);
1449 public static double sinh (double x);
1450 public static float sinhf (float x);
1451 public static double tanh (double x);
1452 public static float tanhf (float x);
1453 public static void sincos (double x, out double sinx, out double cosx);
1454 public static void sincosf (float x, out float sinx, out float cosx);
1455 public static double acosh (double x);
1456 public static float acoshf (float x);
1457 public static double asinh (double x);
1458 public static float asinhf (float x);
1459 public static double atanh (double x);
1460 public static float atanhf (float x);
1461 public static double exp (double x);
1462 public static float expf (float x);
1463 public static double frexp (double x, out int exponent);
1464 public static float frexpf (float x, out int exponent);
1465 public static double ldexp (double x, int exponent);
1466 public static float ldexpf (float x, int exponent);
1467 public static double log (double x);
1468 public static float logf (float x);
1469 public static double log10 (double x);
1470 public static float log10f (float x);
1471 public static double modf (double x, out double iptr);
1472 public static float modff (float x, out float iptr);
1473 public static double exp10 (double x);
1474 public static float exp10f (float x);
1475 public static double pow10 (double x);
1476 public static float pow10f (float x);
1477 public static double expm1 (double x);
1478 public static float expm1f (float x);
1479 public static double log1p (double x);
1480 public static float log1pf (float x);
1481 public static double logb (double x);
1482 public static float logbf (float x);
1483 public static double exp2 (double x);
1484 public static float exp2f (float x);
1485 public static double log2 (double x);
1486 public static float log2f (float x);
1487 public static double pow (double x, double y);
1488 public static float powf (float x, float y);
1489 public static double sqrt (double x);
1490 public static float sqrtf (float x);
1491 public static double hypot (double x, double y);
1492 public static float hypotf (float x, float y);
1493 public static double cbrt (double x);
1494 public static float cbrtf (float x);
1495 public static double ceil (double x);
1496 public static float ceilf (float x);
1497 public static double fabs (double x);
1498 public static float fabsf (float x);
1499 public static double floor (double x);
1500 public static float floorf (float x);
1501 public static double fmod (double x, double y);
1502 public static float fmodf (float x, float y);
1503 public static int isinf (double value);
1504 public static int isinff (float value);
1505 public static int finite (double value);
1506 public static int finitef (float value);
1507 public static double drem (double x, double y);
1508 public static float dremf (float x, float y);
1509 public static double significand (double x);
1510 public static float significandf (float x);
1511 public static double copysign (double x, double y);
1512 public static float copysignf (float x, float y);
1513 public static double nan (string tagb);
1514 public static float nanf (string tagb);
1515 public static int isnan (double value);
1516 public static int isnanf (float value);
1517 public static double j0 (double x0);
1518 public static float j0f (float x0);
1519 public static double j1 (double x0);
1520 public static float j1f (float x0);
1521 public static double jn (int x0, double x1);
1522 public static float jnf (int x0, float x1);
1523 public static double y0 (double x0);
1524 public static float y0f (float x0);
1525 public static double y1 (double x0);
1526 public static float y1f (float x0);
1527 public static double yn (int x0, double x1);
1528 public static float ynf (int x0, float x1);
1529 public static double erf (double x0);
1530 public static float erff (float x0);
1531 public static double erfc (double x0);
1532 public static float erfcf (float x0);
1533 public static double lgamma (double x0);
1534 public static float lgammaf (float x0);
1535 public static double tgamma (double x0);
1536 public static float tgammaf (float x0);
1537 public static double gamma (double x0);
1538 public static float gammaf (float x0);
1539 public static double lgamma_r (double x0, out int signgamp);
1540 public static float lgamma_rf (float x0, out int signgamp);
1541 public static double rint (double x);
1542 public static float rintf (float x);
1543 public static double nextafter (double x, double y);
1544 public static float nextafterf (float x, float y);
1545 public static double nexttoward (double x, double y);
1546 public static float nexttowardf (float x, double y);
1547 public static double remainder (double x, double y);
1548 public static float remainderf (float x, float y);
1549 public static double scalbn (double x, int n);
1550 public static float scalbnf (float x, int n);
1551 public static int ilogb (double x);
1552 public static int ilogbf (float x);
1553 public static double scalbln (double x, long n);
1554 public static float scalblnf (float x, long n);
1555 public static double nearbyint (double x);
1556 public static float nearbyintf (float x);
1557 public static double round (double x);
1558 public static float roundf (float x);
1559 public static double trunc (double x);
1560 public static float truncf (float x);
1561 public static double remquo (double x, double y, out int quo);
1562 public static float remquof (float x, float y, out int quo);
1563 public static long lrint (double x);
1564 public static long lrintf (float x);
1565 public static int64 llrint (double x);
1566 public static int64 llrintf (float x);
1567 public static long lround (double x);
1568 public static long lroundf (float x);
1569 public static int64 llround (double x);
1570 public static int64 llroundf (float x);
1571 public static double fdim (double x, double y);
1572 public static float fdimf (float x, float y);
1573 public static double fmax (double x, double y);
1574 public static float fmaxf (float x, float y);
1575 public static double fmin (double x, double y);
1576 public static float fminf (float x, float y);
1577 public static double fma (double x, double y, double z);
1578 public static float fmaf (float x, float y, float z);
1579 public static double scalb (double x, double n);
1580 public static float scalbf (float x, float n);
1584 [CCode (cprefix = "G_", cname = "int", has_type_id = false)]
1585 public enum ByteOrder {
1586 [CCode (cname = "G_BYTE_ORDER")]
1593 public const ByteOrder BYTE_ORDER;
1595 /* Atomic Operations */
1597 namespace AtomicInt {
1598 public static int get (ref int atomic);
1599 public static void set (ref int atomic, int newval);
1600 public static void add (ref int atomic, int val);
1601 public static int exchange_and_add (ref int atomic, int val);
1602 public static bool compare_and_exchange (ref int atomic, int oldval, int newval);
1603 public static void inc (ref int atomic);
1604 public static bool dec_and_test (ref int atomic);
1607 namespace AtomicPointer {
1608 public static void* get (void** atomic);
1609 public static void set (void** atomic, void* newval);
1610 public static bool compare_and_exchange (void** atomic, void* oldval, void* newval);
1613 /* The Main Event Loop */
1616 [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
1617 public class MainLoop {
1618 public MainLoop (MainContext? context = null, bool is_running = false);
1620 public void quit ();
1621 public bool is_running ();
1622 public unowned MainContext get_context ();
1625 namespace Priority {
1626 public const int HIGH;
1627 public const int DEFAULT;
1628 public const int HIGH_IDLE;
1629 public const int DEFAULT_IDLE;
1630 public const int LOW;
1634 [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
1635 public class MainContext {
1636 public MainContext ();
1637 public static unowned MainContext @default ();
1638 public bool iteration (bool may_block);
1639 public bool pending ();
1640 public unowned Source find_source_by_id (uint source_id);
1641 public unowned Source find_source_by_user_data (void* user_data);
1642 public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data);
1643 public void wakeup ();
1644 public bool acquire ();
1645 public void release ();
1646 public bool is_owner ();
1647 public bool wait (Cond cond, Mutex mutex);
1648 public bool prepare (out int priority);
1649 public int query (int max_priority, out int timeout_, PollFD[] fds);
1650 [CCode (array_length = false)]
1651 public int check (int max_priority, PollFD[] fds, int n_fds);
1652 public void dispatch ();
1653 public void set_poll_func (PollFunc func);
1654 public PollFunc get_poll_func ();
1655 public void add_poll (ref PollFD fd, int priority);
1656 public void remove_poll (ref PollFD fd);
1657 public int depth ();
1658 [CCode (cname = "g_main_current_source")]
1659 public static unowned Source current_source ();
1660 public static unowned MainContext get_thread_default ();
1661 public void push_thread_default ();
1662 public void pop_thread_default ();
1663 public unowned string? get_name ();
1664 public void set_name (string? name);
1665 public static void set_name_by_id (uint tag, string? name);
1666 [CCode (cname = "g_main_context_invoke_full")]
1667 public void invoke (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1668 public void invoke_full (int priority, owned SourceFunc function);
1671 [CCode (has_target = false)]
1672 public delegate int PollFunc (PollFD[] ufds, int timeout_);
1674 [CCode (cname = "GSource")]
1675 public class TimeoutSource : Source {
1676 public TimeoutSource (uint interval);
1677 public TimeoutSource.seconds (uint interval);
1681 [CCode (cname = "g_timeout_add_full")]
1682 public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1683 public static uint add_full (int priority, uint interval, owned SourceFunc function);
1684 [CCode (cname = "g_timeout_add_seconds_full")]
1685 public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1686 public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function);
1689 [CCode (cname = "GSource")]
1690 public class IdleSource : Source {
1691 public IdleSource ();
1695 [CCode (cname = "g_idle_add_full")]
1696 public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1697 public static uint add_full (int priority, owned SourceFunc function);
1698 public static bool remove_by_data (void* data);
1701 [CCode (default_value = "0")]
1702 [IntegerType (rank = 6)]
1706 public delegate void ChildWatchFunc (Pid pid, int status);
1708 public class ChildWatchSource : Source {
1709 public ChildWatchSource (Pid pid, int status, void* data);
1712 namespace ChildWatch {
1713 [CCode (cname = "g_child_watch_add_full")]
1714 public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1715 public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function);
1718 public struct PollFD {
1720 public IOCondition events;
1721 public IOCondition revents;
1725 [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
1726 public class Source {
1727 public Source (SourceFuncs source_funcs, uint struct_size /* = sizeof (Source) */);
1728 public void set_funcs (SourceFuncs funcs);
1729 public uint attach (MainContext? context);
1730 public void destroy ();
1731 public bool is_destroyed ();
1732 public void set_priority (int priority);
1733 public int get_priority ();
1734 public void set_can_recurse (bool can_recurse);
1735 public bool get_can_recurse ();
1736 public uint get_id ();
1737 public unowned MainContext get_context ();
1738 public void set_callback (owned SourceFunc func);
1739 public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs);
1740 public void add_poll (ref PollFD fd);
1741 public void remove_poll (ref PollFD fd);
1742 public void get_current_time (out TimeVal timeval);
1743 public static bool remove (uint id);
1744 public static bool remove_by_funcs_user_data (void* user_data);
1745 public static bool remove_by_user_data (void* user_data);
1748 [CCode (has_target = false)]
1749 public delegate void SourceDummyMarshal ();
1751 [CCode (has_target = false)]
1752 public delegate bool SourcePrepareFunc (Source source, out int timeout_);
1753 [CCode (has_target = false)]
1754 public delegate bool SourceCheckFunc (Source source);
1755 [CCode (has_target = false)]
1756 public delegate bool SourceDispatchFunc (Source source, SourceFunc _callback);
1757 [CCode (has_target = false)]
1758 public delegate void SourceFinalizeFunc (Source source);
1761 public class SourceFuncs {
1762 public SourcePrepareFunc prepare;
1763 public SourceCheckFunc check;
1764 public SourceDispatchFunc dispatch;
1765 public SourceFinalizeFunc finalize;
1768 [CCode (has_target = false)]
1769 public delegate void SourceCallbackRefFunc (void* cb_data);
1770 [CCode (has_target = false)]
1771 public delegate void SourceCallbackUnrefFunc (void* cb_data);
1772 [CCode (has_target = false)]
1773 public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
1776 public class SourceCallbackFuncs {
1777 public SourceCallbackRefFunc @ref;
1778 public SourceCallbackUnrefFunc unref;
1779 public SourceCallbackGetFunc @get;
1782 public delegate bool SourceFunc ();
1784 public errordomain ThreadError {
1788 /* Thread support */
1790 public delegate G ThreadFunc<G> ();
1791 public delegate void Func<G> (G data);
1793 [CCode (has_type_id = false)]
1794 public enum ThreadPriority {
1802 public class Thread<T> {
1803 public static bool supported ();
1804 [CCode (simple_generics = true)]
1805 public static unowned Thread<T> create<T> (ThreadFunc<T> func, bool joinable) throws ThreadError;
1806 [CCode (simple_generics = true)]
1807 public static unowned Thread<T> create_full<T> (ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
1808 [CCode (simple_generics = true)]
1809 public static unowned Thread<T> self<T> ();
1811 public void set_priority (ThreadPriority priority);
1812 public static void yield ();
1813 public static void exit (T retval);
1814 public static void @foreach<T> (Func<T> thread_func);
1816 [CCode (cname = "g_usleep")]
1817 public static void usleep (ulong microseconds);
1821 [CCode (free_function = "g_mutex_free")]
1822 public class Mutex {
1824 public void @lock ();
1825 public bool trylock ();
1826 public void unlock ();
1829 [CCode (destroy_function = "g_static_mutex_free")]
1830 public struct StaticMutex {
1831 public StaticMutex ();
1832 public void lock ();
1833 public bool trylock ();
1834 public void unlock ();
1835 public void lock_full ();
1838 [CCode (destroy_function = "g_static_rec_mutex_free")]
1839 public struct StaticRecMutex {
1840 public StaticRecMutex ();
1841 public void lock ();
1842 public bool trylock ();
1843 public void unlock ();
1844 public void lock_full ();
1847 [CCode (destroy_function = "g_static_rw_lock_free")]
1848 public struct StaticRWLock {
1849 public StaticRWLock ();
1850 public void reader_lock ();
1851 public bool reader_trylock ();
1852 public void reader_unlock ();
1853 public void writer_lock ();
1854 public bool writer_trylock ();
1855 public void writer_unlock ();
1859 [CCode (ref_function = "", unref_function = "")]
1860 public class Private {
1861 public Private (DestroyNotify destroy_func);
1862 public void* get ();
1863 public void set (void* data);
1866 [CCode (destroy_function = "g_static_private_free")]
1867 public struct StaticPrivate {
1868 public StaticPrivate ();
1869 public void* get ();
1870 public void set (void* data, DestroyNotify? destroy_func);
1874 [CCode (free_function = "g_cond_free")]
1877 public void @signal ();
1878 public void broadcast ();
1879 public void wait (Mutex mutex);
1880 public bool timed_wait (Mutex mutex, TimeVal abs_time);
1886 [CCode (free_function = "g_thread_pool_free")]
1887 public class ThreadPool<T> {
1888 public ThreadPool (Func<T> func, int max_threads, bool exclusive) throws ThreadError;
1889 public void push (T data) throws ThreadError;
1890 public void set_max_threads (int max_threads) throws ThreadError;
1891 public int get_max_threads ();
1892 public uint get_num_threads ();
1893 public uint unprocessed ();
1894 public static void set_max_unused_threads (int max_threads);
1895 public static int get_max_unused_threads ();
1896 public static uint get_num_unused_threads ();
1897 public static void stop_unused_threads ();
1898 public void set_sort_function (CompareDataFunc func);
1899 public static void set_max_idle_time (uint interval);
1900 public static uint get_max_idle_time ();
1903 /* Asynchronous Queues */
1906 [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
1907 public class AsyncQueue<G> {
1908 public AsyncQueue ();
1909 public void push (owned G data);
1910 public void push_sorted (owned G data, CompareDataFunc<G> func);
1912 public G try_pop ();
1913 public G timed_pop (ref TimeVal end_time);
1914 public int length ();
1915 public void sort (CompareDataFunc<G> func);
1916 public void @lock ();
1917 public void unlock ();
1918 public void ref_unlocked ();
1919 public void unref_and_unlock ();
1920 public void push_unlocked (owned G data);
1921 public void push_sorted_unlocked (owned G data, CompareDataFunc<G> func);
1922 public G pop_unlocked ();
1923 public G try_pop_unlocked ();
1924 public G timed_pop_unlocked (ref TimeVal end_time);
1925 public int length_unlocked ();
1926 public void sort_unlocked (CompareDataFunc<G> func);
1929 /* Memory Allocation */
1931 public static void* malloc (size_t n_bytes);
1932 public static void* malloc0 (size_t n_bytes);
1933 public static void* realloc (void* mem, size_t n_bytes);
1935 public static void* try_malloc (size_t n_bytes);
1936 public static void* try_malloc0 (size_t n_bytes);
1937 public static void* try_realloc (void* mem, size_t n_bytes);
1939 public static void free (void* mem);
1941 public class MemVTable {
1944 [CCode (cname = "glib_mem_profiler_table")]
1945 public static MemVTable mem_profiler_table;
1947 public static void mem_set_vtable (MemVTable vtable);
1948 public static void mem_profile ();
1950 [CCode (cheader_filename = "string.h")]
1952 [CCode (cname = "memcmp")]
1953 public static int cmp (void* s1, void* s2, size_t n);
1954 [CCode (cname = "memcpy")]
1955 public static void* copy (void* dest, void* src, size_t n);
1956 [CCode (cname = "memset")]
1957 public static void* set (void* dest, int src, size_t n);
1958 [CCode (cname = "g_memmove")]
1959 public static void* move (void* dest, void* src, size_t n);
1960 [CCode (cname = "g_memdup")]
1961 public static void* dup (void* mem, uint n);
1965 public static void* alloc (size_t block_size);
1966 public static void* alloc0 (size_t block_size);
1967 public static void* copy (size_t block_size, void* mem_block);
1968 [CCode (cname = "g_slice_free1")]
1969 public static void free (size_t block_size, void* mem_block);
1970 public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset);
1976 [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
1977 public class IOChannel {
1978 [CCode (cname = "g_io_channel_unix_new")]
1979 public IOChannel.unix_new (int fd);
1980 public int unix_get_fd ();
1981 [CCode (cname = "g_io_channel_win32_new_fd")]
1982 public IOChannel.win32_new_fd (int fd);
1983 [CCode (cname = "g_io_channel_win32_new_socket")]
1984 public IOChannel.win32_socket (int socket);
1985 [CCode (cname = "g_io_channel_win32_new_messages")]
1986 public IOChannel.win32_messages (size_t hwnd);
1987 public void init ();
1988 public IOChannel.file (string filename, string mode) throws FileError;
1989 public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError;
1990 public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
1991 public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError;
1992 public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError;
1993 public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError;
1994 public IOStatus write_chars (char[] buf, out size_t bytes_written) throws ConvertError, IOChannelError;
1995 public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
1996 public IOStatus flush () throws IOChannelError;
1997 public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
1998 public IOStatus shutdown (bool flush) throws IOChannelError;
1999 [CCode (cname = "g_io_create_watch")]
2000 public GLib.Source create_watch (IOCondition condition);
2001 [CCode (cname = "g_io_add_watch")]
2002 public uint add_watch (IOCondition condition, IOFunc func);
2003 [CCode (cname = "g_io_add_watch_full")]
2004 public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func);
2005 public size_t get_buffer_size ();
2006 public void set_buffer_size (size_t size);
2007 public IOCondition get_buffer_condition ();
2008 public IOFlags get_flags ();
2009 public IOStatus set_flags (IOFlags flags) throws IOChannelError;
2010 public unowned string get_line_term (out int length);
2011 public void set_line_term (string line_term, int length);
2012 public bool get_buffered ();
2013 public void set_buffered (bool buffered);
2014 public unowned string get_encoding ();
2015 public IOStatus set_encoding (string? encoding) throws IOChannelError;
2016 public bool get_close_on_unref ();
2017 public void set_close_on_unref (bool do_close);
2020 [CCode (cprefix = "G_SEEK_", has_type_id = false)]
2021 public enum SeekType {
2027 [CCode (has_type_id = false)]
2028 public enum IOStatus {
2035 public errordomain IOChannelError {
2048 [CCode (cprefix = "G_IO_")]
2049 public enum IOCondition {
2058 public delegate bool IOFunc (IOChannel source, IOCondition condition);
2060 [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)]
2061 public enum IOFlags {
2072 /* Error Reporting */
2076 [CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
2077 public class Error {
2079 public Error (Quark domain, int code, string format, ...);
2080 public Error copy ();
2081 public bool matches (Quark domain, int code);
2083 public Quark domain;
2085 public string message;
2088 /* Message Output and Debugging Functions */
2091 public static void print (string format, ...);
2092 public static void set_print_handler (PrintFunc func);
2093 [CCode (has_target = false)]
2094 public delegate void PrintFunc (string text);
2096 public static void printerr (string format, ...);
2097 public static void set_printerr_handler (PrintFunc func);
2099 public static void return_if_fail (bool expr);
2100 [CCode (sentinel = "")]
2101 public static void return_val_if_fail (bool expr, ...);
2103 public static void return_if_reached ();
2105 [CCode (sentinel = "")]
2106 public static void return_val_if_reached (...);
2107 public static void warn_if_fail (bool expr);
2108 public static void warn_if_reached ();
2111 public static void assert (bool expr);
2113 public static void assert_not_reached ();
2115 public static void on_error_query (string? prg_name = null);
2116 public static void on_error_stack_trace (string? prg_name = null);
2117 [CCode (cname = "G_BREAKPOINT")]
2118 public static void breakpoint ();
2120 /* Message Logging */
2122 [CCode (cprefix = "G_LOG_", has_type_id = false)]
2123 public enum LogLevelFlags {
2128 /* GLib log levels */
2139 public void logv (string? log_domain, LogLevelFlags log_level, string format, va_list args);
2142 public void log (string? log_domain, LogLevelFlags log_level, string format, ...);
2146 public void message (string format, ...);
2149 public void warning (string format, ...);
2152 public void critical (string format, ...);
2156 public void error (string format, ...);
2159 public void debug (string format, ...);
2161 public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message);
2164 public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
2165 public static void set_default_handler (LogFunc log_func);
2166 [CCode (delegate_target = "NULL")]
2167 public static GLib.LogFunc default_handler;
2168 public static void set_fatal_mask (string log_domain, LogLevelFlags log_levels);
2169 public static void set_always_fatal (LogLevelFlags log_levels);
2171 public const string FILE;
2172 public const int LINE;
2173 public const string METHOD;
2176 [CCode (has_type_id = false)]
2177 public struct DebugKey {
2182 public uint parse_debug_string (string? debug_string, DebugKey[] keys);
2184 /* String Utility Functions */
2186 public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
2188 [CCode (cname = "errno", cheader_filename = "errno.h")]
2190 public unowned string strerror (int errnum);
2192 /* Character Set Conversions */
2194 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;
2195 public static bool get_charset (out unowned string charset);
2198 public struct IConv {
2199 public static IConv open (string to_codeset, string from_codeset);
2200 [CCode (cname = "g_iconv")]
2201 public uint iconv (out string inbuf, out uint inbytes_left, out string outbuf, out uint outbytes_left);
2202 public int close ();
2205 namespace Filename {
2206 public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2207 public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
2208 public static string from_uri (string uri, out string hostname = null) throws ConvertError;
2209 public static string to_uri (string filename, string? hostname = null) throws ConvertError;
2210 public static string display_name (string filename);
2211 public static string display_basename (string filename);
2214 public errordomain ConvertError {
2223 /* Base64 Encoding */
2226 public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save);
2227 public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
2228 public static string encode (uchar[] data);
2229 public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
2230 [CCode (array_length_type = "size_t")]
2231 public static uchar[] decode (string text);
2234 /* Data Checksums */
2236 [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)]
2237 public enum ChecksumType {
2242 public ssize_t get_length ();
2246 [CCode (free_function = "g_checksum_free")]
2247 public class Checksum {
2248 public Checksum (ChecksumType checksum_type);
2249 public Checksum copy ();
2250 public void update ([CCode (array_length = false)] uchar[] data, size_t length);
2251 public unowned string get_string ();
2252 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2253 [CCode (cname = "g_compute_checksum_for_data")]
2254 public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
2255 [CCode (cname = "g_compute_checksum_for_string")]
2256 public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1);
2259 /* Date and Time Functions */
2261 [CCode (has_type_id = false)]
2262 public struct TimeVal {
2264 public long tv_usec;
2266 [CCode (cname = "g_get_current_time")]
2268 [CCode (cname = "g_get_current_time")]
2269 public void get_current_time ();
2270 public void add (long microseconds);
2271 [CCode (instance_pos = -1)]
2272 public bool from_iso8601 (string iso_date);
2273 [InstanceByReference]
2274 public string to_iso8601 ();
2277 public struct DateDay : uchar {
2278 [CCode (cname = "G_DATE_BAD_DAY")]
2279 public static DateDay BAD_DAY;
2281 [CCode (cname = "g_date_valid_day")]
2282 public bool valid ();
2285 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2286 public enum DateMonth {
2301 [CCode (cname = "g_date_get_days_in_month")]
2302 public uchar get_days_in_month (DateYear year);
2303 [CCode (cname = "g_date_valid_month")]
2304 public bool valid ();
2307 public struct DateYear : ushort {
2308 [CCode (cname = "G_DATE_BAD_YEAR")]
2309 public static DateDay BAD_YEAR;
2311 [CCode (cname = "g_date_is_leap_year")]
2312 public bool is_leap_year ();
2313 [CCode (cname = "g_date_get_monday_weeks_in_year")]
2314 public uchar get_monday_weeks_in_year ();
2315 [CCode (cname = "g_date_get_sunday_weeks_in_year")]
2316 public uchar get_sunday_weeks_in_year ();
2317 [CCode (cname = "g_date_valid_year")]
2318 public bool valid ();
2321 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2322 public enum DateWeekday {
2332 [CCode (cname = "g_date_valid_weekday")]
2333 public bool valid ();
2336 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2337 public enum DateDMY {
2343 [CCode (type_id = "G_TYPE_DATE")]
2344 public struct Date {
2345 public void clear (uint n_dates = 1);
2346 public void set_day (DateDay day);
2347 public void set_month (DateMonth month);
2348 public void set_year (DateYear year);
2349 public void set_dmy (DateDay day, int month, DateYear y);
2350 public void set_julian (uint julian_day);
2351 public void set_time_t (time_t timet);
2352 public void set_time_val (TimeVal timeval);
2353 public void set_parse (string str);
2354 public void add_days (uint n_days);
2355 public void subtract_days (uint n_days);
2356 public void add_months (uint n_months);
2357 public void subtract_months (uint n_months);
2358 public void add_years (uint n_years);
2359 public void subtract_years (uint n_years);
2360 public int days_between (Date date2);
2361 public int compare (Date rhs);
2362 public void clamp (Date min_date, Date max_date);
2363 public void order (Date date2);
2364 public DateDay get_day ();
2365 public DateMonth get_month ();
2366 public DateYear get_year ();
2367 public uint get_julian ();
2368 public DateWeekday get_weekday ();
2369 public uint get_day_of_year ();
2370 public bool is_first_of_month ();
2371 public bool is_last_of_month ();
2372 public uint get_monday_week_of_year ();
2373 public uint get_sunday_week_of_year ();
2374 public uint get_iso8601_week_of_year ();
2375 [CCode (instance_pos = -1)]
2376 public size_t strftime (char[] s, string format);
2377 [CCode (cname = "g_date_to_struct_tm")]
2378 public void to_time (out Time tm);
2379 public bool valid ();
2380 public static uchar get_days_in_month (DateMonth month, DateYear year);
2381 public static bool valid_day (DateDay day);
2382 public static bool valid_dmy (DateDay day, DateMonth month, DateYear year);
2383 public static bool valid_julian (uint julian_date);
2384 public static bool valid_weekday (DateWeekday weekday);
2387 [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)]
2388 public struct Time {
2389 [CCode (cname = "tm_sec")]
2391 [CCode (cname = "tm_min")]
2393 [CCode (cname = "tm_hour")]
2395 [CCode (cname = "tm_mday")]
2397 [CCode (cname = "tm_mon")]
2399 [CCode (cname = "tm_year")]
2401 [CCode (cname = "tm_wday")]
2403 [CCode (cname = "tm_yday")]
2404 public int day_of_year;
2405 [CCode (cname = "tm_isdst")]
2408 [CCode (cname = "gmtime_r")]
2409 static void gmtime_r (ref time_t time, out Time result);
2410 [CCode (cname = "localtime_r")]
2411 static void localtime_r (ref time_t time, out Time result);
2413 public static Time gm (time_t time) {
2415 gmtime_r (ref time, out result);
2418 public static Time local (time_t time) {
2420 localtime_r (ref time, out result);
2424 public string to_string () {
2425 return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
2428 public string format (string format) {
2429 var buffer = new char[64];
2430 this.strftime (buffer, format);
2431 return (string) buffer;
2434 [CCode (cname = "mktime")]
2435 public time_t mktime ();
2437 [CCode (cname = "strftime", instance_pos = -1)]
2438 public size_t strftime (char[] s, string format);
2439 [CCode (cname = "strptime", instance_pos = -1)]
2440 public unowned string? strptime (string buf, string format);
2443 public struct TimeSpan : int64 {
2444 public const TimeSpan DAY;
2445 public const TimeSpan HOUR;
2446 public const TimeSpan MINUTE;
2447 public const TimeSpan SECOND;
2448 public const TimeSpan MILLISECOND;
2452 [CCode (ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")]
2453 public class DateTime {
2454 public DateTime.now (TimeZone tz);
2455 public DateTime.now_local ();
2456 public DateTime.now_utc ();
2457 public DateTime.from_unix_local (int64 t);
2458 public DateTime.from_unix_utc (int64 t);
2459 public DateTime.from_timeval_local (TimeVal tv);
2460 public DateTime.from_timeval_utc (TimeVal tv);
2461 public DateTime (TimeZone tz, int year, int month, int day, int hour, int minute, double seconds);
2462 public DateTime.local (int year, int month, int day, int hour, int minute, double seconds);
2463 public DateTime.utc (int year, int month, int day, int hour, int minute, double seconds);
2464 public DateTime add (TimeSpan timespan);
2465 public DateTime add_years (int years);
2466 public DateTime add_months (int months);
2467 public DateTime add_weeks (int weeks);
2468 public DateTime add_days (int days);
2469 public DateTime add_hours (int hours);
2470 public DateTime add_milliseconds (int milliseconds);
2471 public DateTime add_minutes (int minutes);
2472 public DateTime add_seconds (double seconds);
2473 public DateTime add_full (int years, int months, int days, int hours = 0, int minutes = 0, double seconds = 0);
2474 public int compare (DateTime dt);
2475 public TimeSpan difference (DateTime begin);
2476 public uint hash ();
2477 public bool equal (DateTime dt);
2478 public void get_ymd (out int year, out int month, out int day);
2479 public int get_year ();
2480 public int get_month ();
2481 public int get_day_of_month ();
2482 public int get_week_numbering_year ();
2483 public int get_week_of_year ();
2484 public int get_day_of_week ();
2485 public int get_day_of_year ();
2486 public int get_hour ();
2487 public int get_minute ();
2488 public int get_second ();
2489 public int get_microsecond ();
2490 public double get_seconds ();
2491 public int64 to_unix ();
2492 public bool to_timeval (out TimeVal tv);
2493 public TimeSpan get_utc_offset ();
2494 public unowned string get_timezone_abbreviation ();
2495 public bool is_daylight_savings ();
2496 public DateTime to_timezone (TimeZone tz);
2497 public DateTime to_local ();
2498 public DateTime to_utc ();
2499 public string format (string format);
2500 public string to_string () {
2501 return this.format ("%FT%H:%M:%S%z");
2505 public enum TimeType {
2512 [CCode (ref_function = "g_time_zone_ref", unref_function = "g_time_zone_unref")]
2513 public class TimeZone {
2514 public TimeZone (string identifier);
2515 public TimeZone.utc ();
2516 public TimeZone.local ();
2517 public int find_interval (TimeType type, int64 time);
2518 public int adjust_time (TimeType type, ref int64 time);
2519 public unowned string get_abbreviation (int interval);
2520 public int32 get_offset (int interval);
2521 public bool is_dst (int interval);
2524 /* Random Numbers */
2527 [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
2529 public Rand.with_seed (uint32 seed);
2530 public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2532 public void set_seed (uint32 seed);
2533 public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2534 public bool boolean ();
2535 [CCode (cname = "g_rand_int")]
2536 public uint32 next_int ();
2537 public int32 int_range (int32 begin, int32 end);
2538 [CCode (cname = "g_rand_double")]
2539 public double next_double ();
2540 public double double_range (double begin, double end);
2544 public static void set_seed (uint32 seed);
2545 public static bool boolean ();
2546 [CCode (cname = "g_random_int")]
2547 public static uint32 next_int ();
2548 public static int32 int_range (int32 begin, int32 end);
2549 [CCode (cname = "g_random_double")]
2550 public static double next_double ();
2551 public static double double_range (double begin, double end);
2554 /* Miscellaneous Utility Functions */
2556 namespace Environment {
2557 [CCode (cname = "g_get_application_name")]
2558 public static unowned string? get_application_name ();
2559 [CCode (cname = "g_set_application_name")]
2560 public static void set_application_name (string application_name);
2561 [CCode (cname = "g_get_prgname")]
2562 public static unowned string get_prgname ();
2563 [CCode (cname = "g_set_prgname")]
2564 public static void set_prgname (string application_name);
2565 [CCode (cname = "g_getenv")]
2566 public static unowned string? get_variable (string variable);
2567 [CCode (cname = "g_setenv")]
2568 public static bool set_variable (string variable, string value, bool overwrite);
2569 [CCode (cname = "g_unsetenv")]
2570 public static void unset_variable (string variable);
2571 [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)]
2572 public static string[] list_variables ();
2573 [CCode (cname = "g_get_user_name")]
2574 public static unowned string get_user_name ();
2575 [CCode (cname = "g_get_real_name")]
2576 public static unowned string get_real_name ();
2577 [CCode (cname = "g_get_user_cache_dir")]
2578 public static unowned string get_user_cache_dir ();
2579 [CCode (cname = "g_get_user_data_dir")]
2580 public static unowned string get_user_data_dir ();
2581 [CCode (cname = "g_get_user_config_dir")]
2582 public static unowned string get_user_config_dir ();
2583 [CCode (cname = "g_get_user_special_dir")]
2584 public static unowned string get_user_special_dir (UserDirectory directory);
2585 [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)]
2586 public static unowned string[] get_system_data_dirs ();
2587 [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)]
2588 public static unowned string[] get_system_config_dirs ();
2589 [CCode (cname = "g_get_host_name")]
2590 public static unowned string get_host_name ();
2591 [CCode (cname = "g_get_home_dir")]
2592 public static unowned string get_home_dir ();
2593 [CCode (cname = "g_get_tmp_dir")]
2594 public static unowned string get_tmp_dir ();
2595 [CCode (cname = "g_get_current_dir")]
2596 public static string get_current_dir ();
2597 [CCode (cname = "g_find_program_in_path")]
2598 public static string? find_program_in_path (string program);
2599 [CCode (cname = "g_atexit")]
2600 public static void atexit (VoidFunc func);
2601 [CCode (cname = "g_chdir")]
2602 public static int set_current_dir (string path);
2605 [CCode (has_type_id = false)]
2606 public enum UserDirectory {
2615 [CCode (cname = "G_USER_N_DIRECTORIES")]
2620 public static bool is_absolute (string file_name);
2621 public static unowned string skip_root (string file_name);
2622 public static string get_basename (string file_name);
2623 public static string get_dirname (string file_name);
2624 [CCode (cname = "g_build_filename")]
2625 public static string build_filename (string first_element, ...);
2626 [CCode (cname = "g_build_path")]
2627 public static string build_path (string separator, string first_element, ...);
2629 [CCode (cname = "G_DIR_SEPARATOR")]
2630 public const char DIR_SEPARATOR;
2631 [CCode (cname = "G_DIR_SEPARATOR_S")]
2632 public const string DIR_SEPARATOR_S;
2633 [CCode (cname = "G_IS_DIR_SEPARATOR")]
2634 public static bool is_dir_separator (unichar c);
2635 [CCode (cname = "G_SEARCHPATH_SEPARATOR")]
2636 public const char SEARCHPATH_SEPARATOR;
2637 [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")]
2638 public const string SEARCHPATH_SEPARATOR_S;
2642 public static int nth_lsf (ulong mask, int nth_bit);
2643 public static int nth_msf (ulong mask, int nth_bit);
2644 public static uint storage (ulong number);
2647 namespace SpacedPrimes {
2648 public static uint closest (uint num);
2651 [CCode (has_target = false)]
2652 public delegate void FreeFunc (void* data);
2653 [CCode (has_target = false)]
2654 public delegate void VoidFunc ();
2656 public string format_size_for_display (int64 size);
2658 /* Lexical Scanner */
2659 [CCode (has_target = false)]
2660 public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error);
2663 [CCode (free_function = "g_scanner_destroy")]
2664 public class Scanner {
2665 public unowned string input_name;
2666 public TokenType token;
2667 public TokenValue value;
2669 public uint position;
2670 public TokenType next_token;
2671 public TokenValue next_value;
2672 public uint next_line;
2673 public uint next_position;
2674 public ScannerMsgFunc msg_handler;
2675 public ScannerConfig? config;
2676 public Scanner (ScannerConfig? config_templ);
2677 public void input_file (int input_fd);
2678 public void sync_file_offset ();
2679 public void input_text (string text, uint text_len);
2680 public TokenType peek_next_token ();
2681 public TokenType get_next_token ();
2683 public int cur_line ();
2684 public int cur_position ();
2685 public TokenType cur_token ();
2686 public TokenValue cur_value ();
2687 public uint set_scope (uint scope_id);
2688 public void scope_add_symbol (uint scope_id, string symbol, void* value);
2689 public void scope_foreach_symbol (uint scope_id, HFunc func);
2690 public void* scope_lookup_symbol (uint scope_id, string symbol);
2691 public void scope_remove_symbol (uint scope_id, string symbol);
2692 public void* lookup_symbol (string symbol);
2694 public void warn (string format, ...);
2696 public void error (string format, ...);
2697 public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error);
2700 public struct ScannerConfig {
2701 public string* cset_skip_characters;
2702 public string* cset_identifier_first;
2703 public string* cset_identifier_nth;
2704 public string* cpair_comment_single;
2705 public bool case_sensitive;
2706 public bool skip_comment_multi;
2707 public bool skip_comment_single;
2708 public bool scan_comment_multi;
2709 public bool scan_identifier;
2710 public bool scan_identifier_1char;
2711 public bool scan_identifier_NULL;
2712 public bool scan_symbols;
2713 public bool scan_binary;
2714 public bool scan_octal;
2715 public bool scan_float;
2716 public bool scan_hex;
2717 public bool scan_hex_dollar;
2718 public bool scan_string_sq;
2719 public bool scan_string_dq;
2720 public bool numbers_2_int;
2721 public bool int_2_float;
2722 public bool identifier_2_string;
2723 public bool char_2_token;
2724 public bool symbol_2_token;
2725 public bool scope_0_fallback;
2726 public bool store_int64;
2729 [CCode (lower_case_cprefix="G_CSET_")]
2730 namespace CharacterSet {
2731 public const string A_2_Z;
2732 public const string a_2_z;
2733 public const string DIGITS;
2734 public const string LATINC;
2735 public const string LATINS;
2738 [CCode (cprefix = "G_TOKEN_", has_type_id = false)]
2739 public enum TokenType
2768 public struct TokenValue {
2769 [CCode (cname="v_symbol")]
2770 public void* symbol;
2771 [CCode (cname="v_identifier")]
2772 public unowned string identifier;
2773 [CCode (cname="v_binary")]
2774 public ulong binary;
2775 [CCode (cname="v_octal")]
2777 [CCode (cname="v_int")]
2779 [CCode (cname="v_int64")]
2781 [CCode (cname="v_float")]
2782 public double float;
2783 [CCode (cname="v_hex")]
2785 [CCode (cname="v_string")]
2786 public unowned string string;
2787 [CCode (cname="v_comment")]
2788 public unowned string comment;
2789 [CCode (cname="v_char")]
2791 [CCode (cname="v_error")]
2795 [CCode (cprefix = "G_ERR_", has_type_id = false)]
2796 public enum ErrorType
2800 UNEXP_EOF_IN_STRING,
2801 UNEXP_EOF_IN_COMMENT,
2808 /* Automatic String Completion */
2811 [CCode (free_function = "g_completion_free")]
2812 public class Completion {
2813 public Completion (CompletionFunc? func = null);
2814 public List<void*> items;
2815 public CompletionFunc func;
2816 public string prefix;
2817 public List<void*> cache;
2818 public CompletionStrncmpFunc strncmp_func;
2819 public void add_items (List<void*> items);
2820 public void remove_items (List<void*> items);
2821 public void clear_items ();
2822 public unowned List<void*> complete (string prefix, out string? new_prefix = null);
2823 public unowned List<void*> complete_utf8 (string prefix, out string? new_prefix = null);
2826 [CCode (has_target = false)]
2827 public delegate string CompletionFunc (void* item);
2828 [CCode (has_target = false)]
2829 public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n);
2834 [CCode (free_function = "g_timer_destroy")]
2835 public class Timer {
2837 public void start ();
2838 public void stop ();
2839 public void @continue ();
2840 public double elapsed (out ulong microseconds = null);
2841 public void reset ();
2844 /* Spawning Processes */
2846 public errordomain SpawnError {
2869 [CCode (cprefix = "G_SPAWN_", has_type_id = false)]
2870 public enum SpawnFlags {
2871 LEAVE_DESCRIPTORS_OPEN,
2876 CHILD_INHERITS_STDIN,
2880 public delegate void SpawnChildSetupFunc ();
2881 [CCode (has_target = false, cheader_filename = "signal.h")]
2882 public delegate void SignalHandlerFunc (int signum);
2884 public unowned string strsignal (int signum);
2886 [CCode (lower_case_cprefix = "g_")]
2888 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;
2889 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;
2890 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;
2891 public static bool spawn_command_line_async (string command_line) throws SpawnError;
2892 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;
2893 [CCode (cname = "g_spawn_close_pid")]
2894 public static void close_pid (Pid pid);
2896 /* these macros are required to examine the exit status of a process */
2897 [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")]
2898 public static bool if_exited (int status);
2899 [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")]
2900 public static int exit_status (int status);
2901 [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")]
2902 public static bool if_signaled (int status);
2903 [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")]
2904 public static ProcessSignal term_sig (int status);
2905 [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")]
2906 public static bool core_dump (int status);
2907 [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")]
2908 public static bool if_stopped (int status);
2909 [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")]
2910 public static ProcessSignal stop_sig (int status);
2911 [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")]
2912 public static bool if_continued (int status);
2915 [CCode (cname = "abort", cheader_filename = "stdlib.h")]
2916 public void abort ();
2918 [CCode (cname = "exit", cheader_filename = "stdlib.h")]
2919 public void exit (int status);
2920 [CCode (cname = "raise", cheader_filename = "signal.h")]
2921 public int raise (ProcessSignal sig);
2922 [CCode (cname = "signal", cheader_filename = "signal.h")]
2923 public SignalHandlerFunc @signal (ProcessSignal signum, SignalHandlerFunc handler);
2926 [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")]
2927 public enum ProcessSignal {
2952 /* File Utilities */
2954 public errordomain FileError {
2982 [CCode (has_type_id = false)]
2983 public enum FileTest {
2991 [CCode (cprefix = "SEEK_", has_type_id = false)]
2992 public enum FileSeek {
2999 [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
3000 public class FileStream {
3001 [CCode (cname = "EOF", cheader_filename = "stdio.h")]
3002 public const int EOF;
3004 [CCode (cname = "fopen")]
3005 public static FileStream? open (string path, string mode);
3006 [CCode (cname = "fdopen")]
3007 public static FileStream? fdopen (int fildes, string mode);
3008 [CCode (cname = "fprintf")]
3010 public void printf (string format, ...);
3011 [CCode (cname = "vfprintf")]
3012 public void vprintf (string format, va_list args);
3013 [CCode (cname = "fputc", instance_pos = -1)]
3014 public void putc (char c);
3015 [CCode (cname = "fputs", instance_pos = -1)]
3016 public void puts (string s);
3017 [CCode (cname = "fgetc")]
3019 [CCode (cname = "ungetc", instance_pos = -1)]
3020 public int ungetc (int c);
3021 [CCode (cname = "fgets", instance_pos = -1)]
3022 public unowned string gets (char[] s);
3023 [CCode (cname = "feof")]
3025 [CCode (cname = "fscanf"), ScanfFormat]
3026 public int scanf (string format, ...);
3027 [CCode (cname = "fflush")]
3028 public int flush ();
3029 [CCode (cname = "fseek")]
3030 public int seek (long offset, FileSeek whence);
3031 [CCode (cname = "ftell")]
3032 public long tell ();
3033 [CCode (cname = "rewind")]
3034 public void rewind ();
3035 [CCode (cname = "fileno")]
3036 public int fileno ();
3037 [CCode (cname = "ferror")]
3038 public int error ();
3039 [CCode (cname = "clearerr")]
3040 public void clearerr ();
3041 [CCode (cname = "fread", instance_pos = -1)]
3042 public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3043 [CCode (cname = "fwrite", instance_pos = -1)]
3044 public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
3046 public string? read_line () {
3048 StringBuilder? ret = null;
3049 while ((c = getc ()) != EOF) {
3051 ret = new StringBuilder ();
3056 ret.append_c ((char) c);
3066 [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
3067 namespace FileUtils {
3068 public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError;
3069 public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError;
3070 [CCode (cname = "g_file_get_contents")]
3071 public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "size_t")] out uint8[] contents) throws FileError;
3072 [CCode (cname = "g_file_set_contents")]
3073 public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "size_t")] uint8[] contents) throws FileError;
3074 public static bool test (string filename, FileTest test);
3075 public static int open_tmp (string tmpl, out string name_used) throws FileError;
3076 public static string read_link (string filename) throws FileError;
3077 public static int error_from_errno (int err_no);
3079 [CCode (cname = "g_mkstemp")]
3080 public static int mkstemp (string tmpl);
3081 [CCode (cname = "g_rename")]
3082 public static int rename (string oldfilename, string newfilename);
3083 [CCode (cname = "g_remove")]
3084 public static int remove (string filename);
3085 [CCode (cname = "g_unlink")]
3086 public static int unlink (string filename);
3087 [CCode (cname = "g_chmod")]
3088 public static int chmod (string filename, int mode);
3090 [CCode (cname = "symlink")]
3091 public static int symlink (string oldpath, string newpath);
3093 [CCode (cname = "close", cheader_filename = "unistd.h")]
3094 public static int close (int fd);
3097 [CCode (cname = "struct stat", cheader_filename = "sys/stat.h")]
3098 public struct Stat {
3099 [CCode (cname = "g_stat", instance_pos = -1)]
3100 public Stat (string filename);
3101 [CCode (cname = "g_lstat", instance_pos = -1)]
3102 public Stat.l (string filename);
3106 [CCode (free_function = "g_dir_close")]
3108 public static Dir open (string filename, uint _flags = 0) throws FileError;
3109 public unowned string? read_name ();
3110 public void rewind ();
3113 namespace DirUtils {
3114 [CCode (cname = "g_mkdir")]
3115 public static int create (string pathname, int mode);
3116 [CCode (cname = "g_mkdir_with_parents")]
3117 public static int create_with_parents (string pathname, int mode);
3118 [CCode (cname = "mkdtemp")]
3119 public static unowned string mkdtemp (string template);
3120 [CCode (cname = "g_rmdir")]
3121 public static int remove (string filename);
3126 [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref")]
3128 [CCode (free_function = "g_mapped_file_free")]
3130 public class MappedFile {
3131 public MappedFile (string filename, bool writable) throws FileError;
3132 public size_t get_length ();
3133 public unowned char* get_contents ();
3136 [CCode (cname = "stdin", cheader_filename = "stdio.h")]
3137 public static FileStream stdin;
3139 [CCode (cname = "stdout", cheader_filename = "stdio.h")]
3140 public static FileStream stdout;
3142 [CCode (cname = "stderr", cheader_filename = "stdio.h")]
3143 public static FileStream stderr;
3148 public const string RESERVED_CHARS_ALLOWED_IN_PATH;
3149 public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
3150 public const string RESERVED_CHARS_ALLOWED_IN_USERINFO;
3151 public const string RESERVED_CHARS_GENERIC_DELIMITERS;
3152 public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS;
3154 public static string parse_scheme (string uri);
3155 public static string escape_string (string unescaped, string reserved_chars_allowed, bool allow_utf8);
3156 public static string unescape_string (string escaped_string, string? illegal_characters = null);
3157 public static string unescape_segment (string escaped_string, string escaped_string_end, string? illegal_characters = null);
3158 [CCode (array_length = false, array_null_terminated = true)]
3159 public static string[] list_extract_uris (string uri_list);
3162 /* Shell-related Utilities */
3164 public errordomain ShellError {
3171 public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError;
3172 public static string quote (string unquoted_string);
3173 public static string unquote (string quoted_string) throws ShellError;
3176 /* Commandline option parser */
3178 public errordomain OptionError {
3185 [CCode (free_function = "g_option_context_free")]
3186 public class OptionContext {
3187 public OptionContext (string parameter_string);
3188 public void set_summary (string summary);
3189 public unowned string get_summary ();
3190 public void set_description (string description);
3191 public void get_description ();
3192 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3193 public void set_translation_domain (string domain);
3194 public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError;
3195 public void set_help_enabled (bool help_enabled);
3196 public bool get_help_enabled ();
3197 public void set_ignore_unknown_options (bool ignore_unknown);
3198 public bool get_ignore_unknown_options ();
3199 public string get_help (bool main_help, OptionGroup? group);
3200 public void add_main_entries ([CCode (array_length = false)] OptionEntry[] entries, string? translation_domain);
3201 public void add_group (owned OptionGroup group);
3202 public void set_main_group (owned OptionGroup group);
3203 public unowned OptionGroup get_main_group ();
3206 public delegate unowned string TranslateFunc (string str);
3208 [CCode (has_type_id = false)]
3209 public enum OptionArg {
3222 [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)]
3223 public enum OptionFlags {
3233 public struct OptionEntry {
3234 public unowned string long_name;
3235 public char short_name;
3238 public OptionArg arg;
3239 public void* arg_data;
3241 public unowned string description;
3242 public unowned string arg_description;
3246 [CCode (free_function = "g_option_group_free")]
3247 public class OptionGroup {
3248 public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null);
3249 public void add_entries ([CCode (array_length = false)] OptionEntry[] entries);
3250 public void set_parse_hooks (OptionParseFunc pre_parse_func, OptionParseFunc post_parse_hook);
3251 public void set_error_hook (OptionErrorFunc error_func);
3252 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
3253 public void set_translation_domain (string domain);
3256 [CCode (has_target = false)]
3257 public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError;
3258 [CCode (has_target = false)]
3259 public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error);
3261 /* Perl-compatible regular expressions */
3263 public errordomain RegexError {
3270 [CCode (cprefix = "G_REGEX_", has_type_id = false)]
3271 public enum RegexCompileFlags {
3288 [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)]
3289 public enum RegexMatchFlags {
3302 [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
3303 public class Regex {
3304 public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
3305 public unowned string get_pattern ();
3306 public RegexCompileFlags get_compile_flags ();
3307 public RegexMatchFlags get_match_flags ();
3308 public int get_max_backref ();
3309 public int get_capture_count ();
3310 public int get_string_number (string name);
3311 public static string escape_string (string str, int length = -1);
3312 public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
3313 public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
3314 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;
3315 public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
3316 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;
3317 [CCode (array_length = false, array_null_terminated = true)]
3318 public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
3319 [CCode (array_length = false, array_null_terminated = true)]
3320 public string[] split (string str, RegexMatchFlags match_options = 0);
3321 [CCode (array_length = false, array_null_terminated = true)]
3322 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;
3323 public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
3324 public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
3325 public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval) throws RegexError;
3326 public static bool check_replacement (out bool has_references = null) throws RegexError;
3329 public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
3332 [CCode (free_function = "g_match_info_free")]
3333 public class MatchInfo {
3334 public unowned Regex get_regex ();
3335 public unowned string get_string ();
3336 public bool matches ();
3337 public bool next () throws RegexError;
3338 public int get_match_count ();
3339 public bool is_partial_match ();
3340 public string expand_references (string string_to_expand) throws RegexError;
3341 public string? fetch (int match_num);
3342 public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
3343 public string? fetch_named (string name);
3344 public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
3345 [CCode (array_length = false, array_null_terminated = true)]
3346 public string[] fetch_all ();
3349 /* Simple XML Subset Parser
3350 See http://live.gnome.org/Vala/MarkupSample for an example */
3352 public errordomain MarkupError {
3362 [CCode (cprefix = "G_MARKUP_", has_type_id = false)]
3363 public enum MarkupParseFlags {
3368 [CCode (free_function = "g_markup_parse_context_free")]
3369 public class MarkupParseContext {
3370 public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
3371 public bool parse (string text, ssize_t text_len) throws MarkupError;
3372 public bool end_parse () throws MarkupError;
3373 public unowned string get_element ();
3374 public unowned SList<string> get_element_stack ();
3375 public void get_position (out int line_number, out int char_number);
3376 public void push (MarkupParser parser, void* user_data);
3377 public void* pop ();
3380 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;
3382 public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
3384 public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
3386 public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
3388 public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
3390 public struct MarkupParser {
3391 public unowned MarkupParserStartElementFunc start_element;
3392 public unowned MarkupParserEndElementFunc end_element;
3393 public unowned MarkupParserTextFunc text;
3394 public unowned MarkupParserPassthroughFunc passthrough;
3395 public unowned MarkupParserErrorFunc error;
3399 [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)]
3400 public enum CollectType {
3409 public static string escape_text (string text, ssize_t length = -1);
3411 public static string printf_escaped (string format, ...);
3412 public static string vprintf_escaped (string format, va_list args);
3413 [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")]
3414 public static bool collect_attributes (string element_name, string[] attribute_names, string[] attribute_values, ...) throws MarkupError;
3417 /* Key-value file parser */
3419 public errordomain KeyFileError {
3429 [CCode (free_function = "g_key_file_free")]
3430 public class KeyFile {
3432 public void set_list_separator (char separator);
3433 public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError;
3434 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;
3435 public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError;
3436 public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
3437 // g_key_file_to_data never throws an error according to the documentation
3438 public string to_data (out size_t length = null, out GLib.Error error = null);
3439 public string get_start_group ();
3440 [CCode (array_length_type = "gsize")]
3441 public string[] get_groups ();
3442 [CCode (array_length_type = "gsize")]
3443 public string[] get_keys (string group_name) throws KeyFileError;
3444 public bool has_group (string group_name);
3445 public bool has_key (string group_name, string key) throws KeyFileError;
3446 public string get_value (string group_name, string key) throws KeyFileError;
3447 public string get_string (string group_name, string key) throws KeyFileError;
3448 public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError;
3449 public bool get_boolean (string group_name, string key) throws KeyFileError;
3450 public int get_integer (string group_name, string key) throws KeyFileError;
3451 public int64 get_int64 (string group_name, string key) throws KeyFileError;
3452 public uint64 get_uint64 (string group_name, string key) throws KeyFileError;
3453 public double get_double (string group_name, string key) throws KeyFileError;
3454 [CCode (array_length_type = "gsize")]
3455 public string[] get_string_list (string group_name, string key) throws KeyFileError;
3456 [CCode (array_length_type = "gsize")]
3457 public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError;
3458 [CCode (array_length_type = "gsize")]
3459 public bool[] get_boolean_list (string group_name, string key) throws KeyFileError;
3460 [CCode (array_length_type = "gsize")]
3461 public int[] get_integer_list (string group_name, string key) throws KeyFileError;
3462 [CCode (array_length_type = "gsize")]
3463 public double[] get_double_list (string group_name, string key) throws KeyFileError;
3464 public string get_comment (string? group_name, string? key) throws KeyFileError;
3465 public void set_value (string group_name, string key, string value);
3466 public void set_string (string group_name, string key, string str);
3467 public void set_locale_string (string group_name, string key, string locale, string str);
3468 public void set_boolean (string group_name, string key, bool value);
3469 public void set_integer (string group_name, string key, int value);
3470 public void set_int64 (string group_name, string key, int64 value);
3471 public void set_uint64 (string group_name, string key, uint64 value);
3472 public void set_double (string group_name, string key, double value);
3473 public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list);
3474 public void set_locale_string_list (string group_name, string key, string locale, string[] list);
3475 public void set_boolean_list (string group_name, string key, bool[] list);
3476 public void set_integer_list (string group_name, string key, int[] list);
3477 public void set_double_list (string group_name, string key, double[] list);
3478 public void set_comment (string? group_name, string? key, string comment) throws KeyFileError;
3479 public void remove_group (string group_name) throws KeyFileError;
3480 public void remove_key (string group_name, string key) throws KeyFileError;
3481 public void remove_comment (string group_name, string key) throws KeyFileError;
3484 [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)]
3485 public enum KeyFileFlags {
3491 [CCode (cprefix = "G_KEY_FILE_DESKTOP_")]
3492 namespace KeyFileDesktop {
3493 public static const string GROUP;
3494 public static const string KEY_TYPE;
3495 public static const string KEY_VERSION;
3496 public static const string KEY_NAME;
3497 public static const string KEY_GENERIC_NAME;
3498 public static const string KEY_NO_DISPLAY;
3499 public static const string KEY_COMMENT;
3500 public static const string KEY_ICON;
3501 public static const string KEY_HIDDEN;
3502 public static const string KEY_ONLY_SHOW_IN;
3503 public static const string KEY_NOT_SHOW_IN;
3504 public static const string KEY_TRY_EXEC;
3505 public static const string KEY_EXEC;
3506 public static const string KEY_PATH;
3507 public static const string KEY_TERMINAL;
3508 public static const string KEY_MIME_TYPE;
3509 public static const string KEY_CATEGORIES;
3510 public static const string KEY_STARTUP_NOTIFY;
3511 public static const string KEY_STARTUP_WM_CLASS;
3512 public static const string KEY_URL;
3513 public static const string TYPE_APPLICATION;
3514 public static const string TYPE_LINK;
3515 public static const string TYPE_DIRECTORY;
3518 /* Bookmark file parser */
3521 [CCode (free_function = "g_bookmark_file_free")]
3522 public class BookmarkFile {
3523 public BookmarkFile ();
3524 public bool load_from_file (string file) throws BookmarkFileError;
3525 public bool load_from_data (string data, size_t length) throws BookmarkFileError;
3526 public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError;
3527 public string to_data (out size_t length) throws BookmarkFileError;
3528 public bool to_file (string filename) throws BookmarkFileError;
3529 public bool has_item (string uri);
3530 public bool has_group (string uri, string group) throws BookmarkFileError;
3531 public bool has_application (string uri, string name) throws BookmarkFileError;
3532 public int get_size ();
3533 public string[] get_uris ();
3534 public string get_title (string uri) throws BookmarkFileError;
3535 public string get_description (string uri) throws BookmarkFileError;
3536 public string get_mime_type (string uri) throws BookmarkFileError;
3537 public bool get_is_private (string uri) throws BookmarkFileError;
3538 public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError;
3539 public time_t get_added (string uri) throws BookmarkFileError;
3540 public time_t get_modified (string uri) throws BookmarkFileError;
3541 public time_t get_visited (string uri) throws BookmarkFileError;
3542 public string[] get_groups (string uri) throws BookmarkFileError;
3543 public string[] get_applications (string uri) throws BookmarkFileError;
3544 public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError;
3545 public void set_title (string uri, string title);
3546 public void set_description (string uri, string description);
3547 public void set_mime_type (string uri, string mime_type);
3548 public void set_is_private (string uri, bool is_private);
3549 public void set_icon (string uri, string href, string mime_type);
3550 public void set_added (string uri, time_t added);
3551 public void set_groups (string uri, string[] groups);
3552 public void set_modified (string uri, time_t modified);
3553 public void set_visited (string uri, time_t visited);
3554 public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError;
3555 public void add_group (string uri, string group);
3556 public void add_application (string uri, string name, string exec);
3557 public bool remove_group (string uri, string group) throws BookmarkFileError;
3558 public bool remove_application (string uri, string name) throws BookmarkFileError;
3559 public bool remove_item (string uri) throws BookmarkFileError;
3560 public bool move_item (string old_uri, string new_uri) throws BookmarkFileError;
3563 public errordomain BookmarkFileError {
3578 public static void minimized_result (double minimized_quantity, string format, ...);
3580 public static void maximized_result (double maximized_quantity, string format, ...);
3581 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...);
3582 public static bool quick ();
3583 public static bool slow ();
3584 public static bool thorough ();
3585 public static bool perf ();
3586 public static bool verbose ();
3587 public static bool quiet ();
3588 public static int run ();
3589 public static void add_func (string testpath, Callback test_funcvoid);
3590 public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9)] DataTestFunc test_funcvoid);
3592 public static void message (string format, ...);
3593 public static void bug_base (string uri_pattern);
3594 public static void bug (string bug_uri_snippet);
3595 public static void timer_start ();
3596 public static double timer_elapsed ();
3597 public static double timer_last ();
3598 public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags);
3599 public static bool trap_has_passed ();
3600 public static bool trap_reached_timeout ();
3601 public static void trap_assert_passed ();
3602 public static void trap_assert_failed ();
3603 public static void trap_assert_stdout (string soutpattern);
3604 public static void trap_assert_stdout_unmatched (string soutpattern);
3605 public static void trap_assert_stderr (string serrpattern);
3606 public static void trap_assert_stderr_unmatched (string serrpattern);
3607 public static bool rand_bit ();
3608 public static int32 rand_int ();
3609 public static int32 rand_int_range (int32 begin, int32 end);
3610 public static double rand_double ();
3611 public static double rand_double_range ();
3612 public static void log_set_fatal_handler (LogFatalFunc log_func);
3615 public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message);
3618 [CCode (cname = "GTestCase", ref_function = "", unref_function = "")]
3619 public class TestCase {
3620 [CCode (cname = "g_test_create_case")]
3621 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);
3625 [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")]
3626 public class TestSuite {
3627 [CCode (cname = "g_test_create_suite")]
3628 public TestSuite (string name);
3629 [CCode (cname = "g_test_get_root")]
3630 public static TestSuite get_root ();
3631 [CCode (cname = "g_test_suite_add")]
3632 public void add (TestCase test_case);
3633 [CCode (cname = "g_test_suite_add_suite")]
3634 public void add_suite (TestSuite test_suite);
3637 public delegate void TestFunc (void* fixture);
3638 public delegate void DataTestFunc ();
3641 [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)]
3642 public enum TestTrapFlags {
3648 /* Doubly-Linked Lists */
3651 [CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
3652 public class List<G> {
3655 [ReturnsModifiedPointer ()]
3656 public void append (owned G data);
3657 [ReturnsModifiedPointer ()]
3658 public void prepend (owned G data);
3659 [ReturnsModifiedPointer ()]
3660 public void insert (owned G data, int position);
3661 [ReturnsModifiedPointer ()]
3662 public void insert_before (List<G> sibling, owned G data);
3663 [ReturnsModifiedPointer ()]
3664 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
3665 [ReturnsModifiedPointer ()]
3666 public void remove (G data);
3667 [ReturnsModifiedPointer ()]
3668 public void remove_link (List<G> llink);
3669 [ReturnsModifiedPointer ()]
3670 public void delete_link (List<G> link_);
3671 [ReturnsModifiedPointer ()]
3672 public void remove_all (G data);
3674 public uint length ();
3675 public List<unowned G> copy ();
3676 [ReturnsModifiedPointer ()]
3677 public void reverse ();
3678 [ReturnsModifiedPointer ()]
3679 public void sort (CompareFunc<G> compare_func);
3680 [ReturnsModifiedPointer ()]
3681 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
3682 [ReturnsModifiedPointer ()]
3683 public void sort_with_data (CompareDataFunc<G> compare_func);
3684 [ReturnsModifiedPointer ()]
3685 public void concat (owned List<G> list2);
3686 public void @foreach (Func<G> func);
3688 public unowned List<G> first ();
3689 public unowned List<G> last ();
3690 public unowned List<G> nth (uint n);
3691 public unowned G nth_data (uint n);
3692 public unowned List<G> nth_prev (uint n);
3694 public unowned List<G> find (G data);
3695 public unowned List<G> find_custom (G data, CompareFunc<G> func);
3696 public int position (List<G> llink);
3697 public int index (G data);
3700 public List<G> next;
3701 public unowned List<G> prev;
3704 /* Singly-Linked Lists */
3707 [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
3708 public class SList<G> {
3711 [ReturnsModifiedPointer ()]
3712 public void append (owned G data);
3713 [ReturnsModifiedPointer ()]
3714 public void prepend (owned G data);
3715 [ReturnsModifiedPointer ()]
3716 public void insert (owned G data, int position);
3717 [ReturnsModifiedPointer ()]
3718 public void insert_before (SList<G> sibling, owned G data);
3719 [ReturnsModifiedPointer ()]
3720 public void insert_sorted (owned G data, CompareFunc<G> compare_func);
3721 [ReturnsModifiedPointer ()]
3722 public void remove (G data);
3723 [ReturnsModifiedPointer ()]
3724 public void remove_link (SList<G> llink);
3725 [ReturnsModifiedPointer ()]
3726 public void delete_link (SList<G> link_);
3727 [ReturnsModifiedPointer ()]
3728 public void remove_all (G data);
3730 public uint length ();
3731 public SList<unowned G> copy ();
3732 [ReturnsModifiedPointer ()]
3733 public void reverse ();
3734 [ReturnsModifiedPointer ()]
3735 public void insert_sorted_with_data (owned G data, CompareDataFunc<G> compare_func);
3736 [ReturnsModifiedPointer ()]
3737 public void sort (CompareFunc<G> compare_func);
3738 [ReturnsModifiedPointer ()]
3739 public void sort_with_data (CompareDataFunc<G> compare_func);
3740 [ReturnsModifiedPointer ()]
3741 public void concat (owned SList<G> list2);
3742 public void @foreach (Func<G> func);
3744 public unowned SList<G> last ();
3745 public unowned SList<G> nth (uint n);
3746 public unowned G nth_data (uint n);
3748 public unowned SList<G> find (G data);
3749 public unowned SList<G> find_custom (G data, CompareFunc<G> func);
3750 public int position (SList<G> llink);
3751 public int index (G data);
3754 public SList<G> next;
3757 [CCode (has_target = false)]
3758 public delegate int CompareFunc<G> (G a, G b);
3760 public delegate int CompareDataFunc<G> (G a, G b);
3762 [CCode (cname = "g_strcmp0")]
3763 public static GLib.CompareFunc<string> strcmp;
3765 /* Double-ended Queues */
3768 [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
3769 public class Queue<G> {
3770 public unowned List<G> head;
3771 public unowned List<G> tail;
3776 public void clear ();
3777 public bool is_empty ();
3778 public uint get_length ();
3779 public void reverse ();
3780 public Queue copy ();
3781 public unowned List<G> find (G data);
3782 public unowned List<G> find_custom (G data, CompareFunc<G> func);
3783 public void sort (CompareDataFunc<G> compare_func);
3784 public void push_head (owned G data);
3785 public void push_tail (owned G data);
3786 public void push_nth (owned G data, int n);
3787 public G pop_head ();
3788 public G pop_tail ();
3789 public G pop_nth (uint n);
3790 public unowned G peek_head ();
3791 public unowned G peek_tail ();
3792 public unowned G peek_nth (uint n);
3793 public int index (G data);
3794 public void remove (G data);
3795 public void remove_all (G data);
3796 public void delete_link (List<G> link);
3797 public void unlink (List<G> link);
3798 public void insert_before (List<G> sibling, owned G data);
3799 public void insert_after (List<G> sibling, owned G data);
3800 public void insert_sorted (owned G data, CompareDataFunc<G> func);
3806 [CCode (free_function = "g_sequence_free")]
3807 public class Sequence<G> {
3808 public Sequence (DestroyNotify? data_destroy);
3809 public int get_length ();
3810 public void @foreach (Func<G> func);
3811 public static void foreach_range (SequenceIter<G> begin, SequenceIter<G> end, Func<G> func);
3812 public void sort (CompareDataFunc<G> cmp_func);
3813 public void sort_iter (SequenceIterCompareFunc<G> func);
3814 public SequenceIter<G> get_begin_iter ();
3815 public SequenceIter<G> get_end_iter ();
3816 public SequenceIter<G> get_iter_at_pos (int pos);
3817 public SequenceIter<G> append (owned G data);
3818 public SequenceIter<G> prepend (owned G data);
3819 public static SequenceIter<G> insert_before (SequenceIter<G> iter, owned G data);
3820 public static void move (SequenceIter<G> src, SequenceIter<G> dest);
3821 public static void swap (SequenceIter<G> src, SequenceIter<G> dest);
3822 public SequenceIter<G> insert_sorted (owned G data, CompareDataFunc<G> cmp_func);
3823 public SequenceIter<G> insert_sorted_iter (owned G data, SequenceIterCompareFunc<G> iter_cmp);
3824 public static void sort_changed (SequenceIter<G> iter, CompareDataFunc<G> cmp_func);
3825 public static void sort_changed_iter (SequenceIter<G> iter, SequenceIterCompareFunc<G> iter_cmp);
3826 public static void remove (SequenceIter<G> iter);
3827 public static void remove_range (SequenceIter<G> begin, SequenceIter<G> end);
3828 public static void move_range (SequenceIter<G> dest, SequenceIter<G> begin, SequenceIter<G> end);
3829 public SequenceIter<G> search (G data, CompareDataFunc<G> cmp_func);
3830 public SequenceIter<G> search_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
3831 public static unowned G get (SequenceIter<G> iter);
3832 public static void set (SequenceIter<G> iter, owned G data);
3833 public static SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
3837 [CCode (ref_function = "", unref_function = "")]
3838 public class SequenceIter<G> {
3839 public bool is_begin ();
3840 public bool is_end ();
3841 public SequenceIter<G> next ();
3842 public SequenceIter<G> prev ();
3843 public int get_position ();
3844 public SequenceIter<G> move (int delta);
3845 public Sequence<G> get_sequence ();
3846 public int compare (SequenceIter<G> other);
3848 [CCode (cname = "g_sequence_get")]
3849 public unowned G get ();
3852 public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
3857 [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
3858 public class HashTable<K,V> {
3859 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
3860 public HashTable (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func);
3861 public HashTable.full (HashFunc<K>? hash_func, EqualFunc<K>? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
3862 public void insert (owned K key, owned V value);
3863 public void replace (owned K key, owned V value);
3864 public unowned V lookup (K key);
3865 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
3866 public bool remove (K key);
3867 public void remove_all ();
3868 public List<unowned K> get_keys ();
3869 public List<unowned V> get_values ();
3870 public void @foreach (HFunc<K,V> func);
3871 [CCode (cname = "g_hash_table_foreach")]
3872 public void for_each (HFunc<K,V> func);
3873 public unowned V find (HRFunc<K,V> predicate);
3874 public uint size ();
3875 public bool steal (K key);
3876 public void steal_all ();
3879 public struct HashTableIter<K,V> {
3880 public HashTableIter (GLib.HashTable<K,V> table);
3881 public bool next (out unowned K key, out unowned V value);
3882 public void remove ();
3883 public void steal ();
3884 public unowned GLib.HashTable<K,V> get_hash_table ();
3887 [CCode (has_target = false)]
3888 public delegate uint HashFunc<K> (K key);
3889 [CCode (has_target = false)]
3890 public delegate bool EqualFunc<G> (G a, G b);
3891 public delegate void HFunc<K,V> (K key, V value);
3892 public delegate bool HRFunc<K,V> (K key, V value);
3894 [CCode (has_target = false)]
3895 public delegate void DestroyNotify (void* data);
3897 [CCode (cname = "g_direct_hash")]
3898 public static GLib.HashFunc<void*> direct_hash;
3899 [CCode (cname = "g_direct_equal")]
3900 public static GLib.EqualFunc<void*> direct_equal;
3901 [CCode (cname = "g_int64_hash")]
3902 public static GLib.HashFunc<int64?> int64_hash;
3903 [CCode (cname = "g_int64_equal")]
3904 public static GLib.EqualFunc<int64?> int64_equal;
3905 [CCode (cname = "g_int_hash")]
3906 public static GLib.HashFunc<int?> int_hash;
3907 [CCode (cname = "g_int_equal")]
3908 public static GLib.EqualFunc<int?> int_equal;
3909 [CCode (cname = "g_str_hash")]
3910 public static GLib.HashFunc<string> str_hash;
3911 [CCode (cname = "g_str_equal")]
3912 public static GLib.EqualFunc<string> str_equal;
3913 [CCode (cname = "g_free")]
3914 public static GLib.DestroyNotify g_free;
3915 [CCode (cname = "g_object_unref")]
3916 public static GLib.DestroyNotify g_object_unref;
3917 [CCode (cname = "g_list_free")]
3918 public static GLib.DestroyNotify g_list_free;
3919 [CCode (cname = "((GDestroyNotify) g_variant_unref)")]
3920 public static GLib.DestroyNotify g_variant_unref;
3925 [GIR (name = "String")]
3926 [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
3927 public class StringBuilder {
3928 public StringBuilder (string init = "");
3929 [CCode (cname = "g_string_sized_new")]
3930 public StringBuilder.sized (size_t dfl_size);
3931 public unowned StringBuilder assign (string rval);
3932 public unowned StringBuilder append (string val);
3933 public unowned StringBuilder append_c (char c);
3934 public unowned StringBuilder append_unichar (unichar wc);
3935 public unowned StringBuilder append_len (string val, ssize_t len);
3936 public unowned StringBuilder prepend (string val);
3937 public unowned StringBuilder prepend_c (char c);
3938 public unowned StringBuilder prepend_unichar (unichar wc);
3939 public unowned StringBuilder prepend_len (string val, ssize_t len);
3940 public unowned StringBuilder insert (ssize_t pos, string val);
3941 public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
3942 public unowned StringBuilder truncate (size_t len = 0);
3945 public void printf (string format, ...);
3947 public void append_printf (string format, ...);
3948 public void vprintf (string format, va_list args);
3949 public void append_vprintf (string format, va_list args);
3953 public ssize_t allocated_len;
3959 [CCode (free_function = "g_string_chunk_free")]
3960 public class StringChunk {
3961 public StringChunk (size_t size);
3962 public unowned string insert (string str);
3963 public unowned string insert_const (string str);
3964 public unowned string insert_len (string str, ssize_t len);
3965 public void clear ();
3968 /* Pointer Arrays */
3972 [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
3974 [CCode (free_function = "g_ptr_array_free")]
3976 public class PtrArray {
3978 public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func);
3979 [CCode (cname = "g_ptr_array_sized_new")]
3980 public PtrArray.sized (uint reserved_size);
3981 public void add (void* data);
3982 public void foreach (GLib.Func<void*> func);
3983 [CCode (cname = "g_ptr_array_index")]
3984 public void* index(uint index);
3985 public bool remove (void* data);
3986 public void* remove_index (uint index);
3987 public bool remove_fast (void *data);
3988 public void remove_index_fast (uint index);
3989 public void remove_range (uint index, uint length);
3990 public void sort (CompareFunc compare_func);
3991 public void sort_with_data (CompareDataFunc compare_func);
3992 public void set_free_func (GLib.DestroyNotify? element_free_function);
3993 public void set_size (int length);
3996 public void** pdata;
4000 [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")]
4001 public class GenericArray<G> {
4002 [CCode (cname = "g_ptr_array_new_with_free_func", simple_generics = true)]
4003 public GenericArray ();
4004 public void add (owned G data);
4005 public void foreach (GLib.Func<G> func);
4006 [CCode (cname = "g_ptr_array_index")]
4007 public unowned G get (uint index);
4008 public bool remove (G data);
4009 public void remove_index (uint index);
4010 public bool remove_fast (G data);
4011 public void remove_index_fast (uint index);
4012 public void remove_range (uint index, uint length);
4013 public void set (uint index, owned G data) {
4014 this.add ((owned) data);
4015 this.remove_index_fast (index);
4017 public void sort (GLib.CompareFunc<G> compare_func);
4018 public void sort_with_data (GLib.CompareDataFunc<G> compare_func);
4019 private void set_size (int length);
4022 get { return (int) this.len; }
4023 set { this.set_size (value); }
4033 [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")]
4035 [CCode (cprefix = "g_byte_array_", free_function = "g_byte_array_free")]
4037 public class ByteArray {
4038 public ByteArray ();
4039 [CCode (cname = "g_byte_array_sized_new")]
4040 public ByteArray.sized (uint reserved_size);
4041 public void append (uint8[] data);
4042 public void prepend (uint8[] data);
4043 public void remove_index (uint index);
4044 public void remove_index_fast (uint index);
4045 public void remove_range (uint index, uint length);
4046 public void sort (CompareFunc<int8> compare_func);
4047 public void sort_with_data (CompareDataFunc<int8> compare_func);
4048 public void set_size (uint length);
4051 [CCode (array_length_cname = "len", array_length_type = "guint")]
4052 public uint8[] data;
4057 public delegate bool NodeTraverseFunc (Node node);
4058 public delegate void NodeForeachFunc (Node node);
4060 [CCode (cprefix = "G_TRAVERSE_")]
4061 public enum TraverseFlags {
4068 [CCode (dup_function = "g_node_copy", free_function = "g_node_destroy")]
4069 public class Node<G> {
4070 public Node(owned G? data = null);
4071 public Node<unowned G> copy ();
4072 public unowned Node<G> insert (int position, owned Node<G> node);
4073 public unowned Node<G> insert_before (Node<G> sibling, owned Node<G> node);
4074 public unowned Node<G> insert_after (Node<G> sibling, owned Node<G> node);
4075 public unowned Node<G> append (owned Node<G> node);
4076 public unowned Node<G> prepend (owned Node<G> node);
4077 public unowned Node<G> insert_data (int position, owned G data);
4078 public unowned Node<G> insert_data_before (Node<G> sibling, owned G data);
4079 public unowned Node<G> append_data (owned G data);
4080 public unowned Node<G> prepend_data (owned G data);
4081 public void reverse_children ();
4082 public void traverse (TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func);
4083 public void children_foreach (TraverseFlags flags, NodeForeachFunc func);
4084 public unowned Node<G> get_root ();
4085 public unowned Node<G> find (TraverseType order, TraverseFlags flags, G data);
4086 public unowned Node<G> find_child (TraverseFlags flags, G data);
4087 public int child_index (G data);
4088 public int child_position (Node<G> child);
4089 public unowned Node<G> first_child ();
4090 public unowned Node<G> last_child ();
4091 public unowned Node<G> nth_child ();
4092 public unowned Node<G> first_sibling ();
4093 public unowned Node<G> next_sibling ();
4094 public unowned Node<G> prev_sibling ();
4095 public unowned Node<G> last_sibling ();
4097 [CCode (cname = "G_NODE_IS_LEAF")]
4098 public bool is_leaf ();
4099 [CCode (cname = "G_NODE_IS_ROOT")]
4100 public bool is_root ();
4101 public bool is_ancestor (Node<G> descendant);
4103 public uint depth ();
4104 public uint n_nodes (TraverseFlags flags);
4105 public uint max_height ();
4107 [CCode (cname = "g_node_unlink")]
4108 public void _unlink ();
4109 [CCode (cname = "g_node_unlink_vala")]
4110 public Node<G> unlink ()
4114 return (Node<G>) (owned) ptr;
4121 public Node children;
4126 [CCode (type_id = "G_TYPE_UINT")]
4127 public struct Quark : uint32 {
4128 public static Quark from_string (string str);
4129 public static Quark try_string (string str);
4130 public unowned string to_string ();
4133 /* Keyed Data Lists */
4135 [CCode (cname = "GData*")]
4136 public struct Datalist<G> {
4138 public void clear ();
4139 public unowned G id_get_data (Quark key_id);
4140 public void id_set_data (Quark key_id, owned G data);
4141 public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
4142 public void id_remove_data (Quark key_id);
4143 public G id_remove_no_notify (Quark key_id);
4144 public void @foreach (DataForeachFunc func);
4145 public unowned G get_data (string key);
4146 public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
4147 public G remove_no_notify (string key);
4148 public void set_data (string key, owned G data);
4149 public void remove_data (string key);
4152 public delegate void DataForeachFunc<G> (Quark key_id, G data);
4158 [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")]
4160 [CCode (free_function = "g_array_free")]
4162 public class Array<G> {
4163 [CCode (cname = "len")]
4166 public Array (bool zero_terminated, bool clear, ulong element_size);
4167 [CCode (cname = "g_array_sized_new")]
4168 public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
4169 public void append_val (owned G value);
4170 public void append_vals (void* data, uint len);
4171 public void prepend_val (owned G value);
4172 public void prepend_vals (void* data, uint len);
4173 public void insert_val (uint index, owned G value);
4174 public void insert_vals (uint index, void* data, uint len);
4175 public void remove_index (uint index);
4176 public void remove_index_fast (uint index);
4177 public void remove_range (uint index, uint length);
4178 public void sort (CompareFunc<G> compare_func);
4179 public void sort_with_data (CompareDataFunc<G> compare_func);
4180 [CCode (generic_type_pos = 0.1)]
4181 public unowned G index (uint index);
4182 public void set_size (uint length);
4187 public delegate int TraverseFunc (void* key, void* value);
4189 [CCode (cprefix = "G_", has_type_id = false)]
4190 public enum TraverseType {
4197 public delegate int TreeSearchFunc<K> (K key);
4201 [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")]
4203 [CCode (free_function = "g_tree_destroy")]
4205 public class Tree<K,V> {
4206 public Tree (CompareFunc<K> key_compare_func);
4207 public Tree.with_data (CompareDataFunc<K> key_compare_func);
4208 public Tree.full (CompareDataFunc<K> key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
4209 public void insert (owned K key, owned V value);
4210 public void replace (owned K key, owned V value);
4211 public int nnodes ();
4212 public int height ();
4213 public unowned V lookup (K key);
4214 public bool lookup_extended (K lookup_key, K orig_key, V value);
4215 public void foreach (TraverseFunc traverse_func);
4216 public unowned V search (TreeSearchFunc<K> search_func);
4217 [CCode (cname = "g_tree_search")]
4218 public unowned V search_key (CompareFunc<K> search_func, K key);
4219 public bool remove (K key);
4220 public bool steal (K key);
4223 /* Internationalization */
4225 [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4226 public static unowned string _ (string str);
4227 [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4228 public static unowned string Q_ (string str);
4229 [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4230 public static unowned string N_ (string str);
4231 [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")]
4232 public static unowned string ngettext (string msgid, string msgid_plural, ulong n);
4233 [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")]
4234 public static unowned string dgettext (string? domain, string msgid);
4235 [CCode (cname = "g_dcgettext", cheader_filename = "glib/gi18n-lib.h")]
4236 public static unowned string dcgettext (string? domain, string msgid, int category);
4237 [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")]
4238 public static unowned string dngettext (string? domain, string msgid, string msgid_plural, ulong n);
4239 [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")]
4240 public static unowned string dpgettext (string? domain, string msgctxid, size_t msgidoffset);
4241 [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")]
4242 public static unowned string dpgettext2 (string? domain, string context, string msgid);
4244 [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
4245 public enum LocaleCategory {
4256 [CCode (cname = "setlocale", cheader_filename = "locale.h")]
4257 public static unowned string? setlocale (LocaleCategory category, string? locale);
4258 [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")]
4259 public static unowned string? bindtextdomain (string domainname, string? dirname);
4260 [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")]
4261 public static unowned string? textdomain (string? domainname);
4262 [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")]
4263 public static unowned string? bind_textdomain_codeset (string domainname, string? codeset);
4264 [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)]
4265 public static unowned string[] get_language_names ();
4266 [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")]
4267 public static unowned string strip_context (string msgid, string msgval);
4271 public class PatternSpec {
4272 public PatternSpec (string pattern);
4273 public bool equal (PatternSpec pspec);
4274 [CCode (cname = "g_pattern_match")]
4275 public bool match (uint string_length, string str, string? str_reversed);
4276 [CCode (cname = "g_pattern_match_string")]
4277 public bool match_string (string str);
4278 [CCode (cname = "g_pattern_match_simple")]
4279 public static bool match_simple (string pattern, string str);
4283 public string error_message (int error);
4284 public string getlocale ();
4285 public string get_package_installation_directory_of_module (void* hmodule);
4286 public uint get_windows_version ();
4287 public string locale_filename_from_utf8 (string utf8filename);
4288 [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")]
4289 public bool have_widechar_api ();
4290 [CCode (cname = "G_WIN32_IS_NT_BASED")]
4291 public bool is_nt_based ();
4296 [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
4297 public class VariantType {
4298 [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
4299 public static VariantType BOOLEAN;
4300 [CCode (cname = "G_VARIANT_TYPE_BYTE")]
4301 public static VariantType BYTE;
4302 [CCode (cname = "G_VARIANT_TYPE_INT16")]
4303 public static VariantType INT16;
4304 [CCode (cname = "G_VARIANT_TYPE_UINT16")]
4305 public static VariantType UINT16;
4306 [CCode (cname = "G_VARIANT_TYPE_INT32")]
4307 public static VariantType INT32;
4308 [CCode (cname = "G_VARIANT_TYPE_UINT32")]
4309 public static VariantType UINT32;
4310 [CCode (cname = "G_VARIANT_TYPE_INT64")]
4311 public static VariantType INT64;
4312 [CCode (cname = "G_VARIANT_TYPE_UINT64")]
4313 public static VariantType UINT64;
4314 [CCode (cname = "G_VARIANT_TYPE_DOUBLE")]
4315 public static VariantType DOUBLE;
4316 [CCode (cname = "G_VARIANT_TYPE_STRING")]
4317 public static VariantType STRING;
4318 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")]
4319 public static VariantType OBJECT_PATH;
4320 [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")]
4321 public static VariantType SIGNATURE;
4322 [CCode (cname = "G_VARIANT_TYPE_VARIANT")]
4323 public static VariantType VARIANT;
4324 [CCode (cname = "G_VARIANT_TYPE_UNIT")]
4325 public static VariantType UNIT;
4326 [CCode (cname = "G_VARIANT_TYPE_ANY")]
4327 public static VariantType ANY;
4328 [CCode (cname = "G_VARIANT_TYPE_BASIC")]
4329 public static VariantType BASIC;
4330 [CCode (cname = "G_VARIANT_TYPE_MAYBE")]
4331 public static VariantType MAYBE;
4332 [CCode (cname = "G_VARIANT_TYPE_ARRAY")]
4333 public static VariantType ARRAY;
4334 [CCode (cname = "G_VARIANT_TYPE_TUPLE")]
4335 public static VariantType TUPLE;
4336 [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")]
4337 public static VariantType DICT_ENTRY;
4338 [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")]
4339 public static VariantType DICTIONARY;
4341 public static bool string_is_valid (string type_string);
4342 public static bool string_scan (string type_string, char *limit, out char* endptr);
4344 public VariantType (string type_string);
4345 public size_t get_string_length ();
4346 public char* peek_string ();
4347 public string dup_string ();
4349 public bool is_definite ();
4350 public bool is_container ();
4351 public bool is_basic ();
4352 public bool is_maybe ();
4353 public bool is_array ();
4354 public bool is_tuple ();
4355 public bool is_dict_entry ();
4356 public bool is_variant ();
4358 public uint hash ();
4359 public bool equal (VariantType other);
4360 public bool is_subtype_of (VariantType supertype);
4362 public unowned VariantType element ();
4363 public unowned VariantType first ();
4364 public unowned VariantType next ();
4365 public unowned VariantType n_items ();
4366 public unowned VariantType key ();
4367 public unowned VariantType value ();
4369 public VariantType.array (VariantType element);
4370 public VariantType.maybe (VariantType element);
4371 public VariantType.tuple (VariantType[] items);
4372 public VariantType.dict_entry (VariantType key, VariantType value);
4376 [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")]
4377 public class Variant {
4378 [CCode (has_type_id = false)]
4380 BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64,
4381 UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH,
4382 SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY
4385 public unowned VariantType get_type ();
4386 public unowned string get_type_string ();
4387 public bool is_of_type (VariantType type);
4388 public bool is_container ();
4389 public bool is_floating ();
4390 public Class classify ();
4391 public int compare (Variant other);
4393 public Variant.boolean (bool value);
4394 public Variant.byte (uchar value);
4395 public Variant.int16 (int16 value);
4396 public Variant.uint16 (uint16 value);
4397 public Variant.int32 (int32 value);
4398 public Variant.uint32 (uint32 value);
4399 public Variant.int64 (int64 value);
4400 public Variant.uint64 (uint64 value);
4401 public Variant.handle (int32 value);
4402 public Variant.double (double value);
4403 public Variant.string (string value);
4404 public Variant.bytestring (string value);
4405 public Variant.object_path (string object_path);
4406 public static bool is_object_path (string object_path);
4407 public Variant.signature (string signature);
4408 public static bool is_signature (string signature);
4410 public bool get_boolean ();
4411 public uint8 get_byte ();
4412 public int16 get_int16 ();
4413 public uint16 get_uint16 ();
4414 public int32 get_int32 ();
4415 public uint32 get_uint32 ();
4416 public int64 get_int64 ();
4417 public uint64 get_uint64 ();
4418 public int32 get_handle ();
4419 public double get_double ();
4420 public unowned string get_string (out size_t length = null);
4421 public string dup_string (out size_t length = null);
4422 public unowned string get_bytestring ();
4423 public string dup_bytestring (out size_t length);
4425 public Variant.strv (string[] value);
4426 [CCode (array_length_type = "size_t")]
4427 public string*[] get_strv ();
4428 [CCode (array_length_type = "size_t")]
4429 public string[] dup_strv ();
4431 public Variant.bytestring_array (string[] value);
4432 [CCode (array_length_type = "size_t")]
4433 public string*[] get_bytestring_array ();
4434 [CCode (array_length_type = "size_t")]
4435 public string[] dup_bytestring_array ();
4437 public Variant (string format, ...);
4438 // note: the function changes its behaviour when end_ptr is null, so 'out char *' is wrong
4439 public Variant.va (string format, char **end_ptr, va_list *app);
4440 public void get (string format, ...);
4441 public void get_va (string format, char **end_ptr, va_list *app);
4443 public Variant.variant (Variant value);
4444 public Variant.maybe (VariantType? child_type, Variant? child);
4445 public Variant.array (VariantType? child_type, Variant[] children);
4446 public Variant.tuple (Variant[] children);
4447 public Variant.dict_entry (Variant key, Variant value);
4448 public Variant get_variant ();
4449 public Variant? get_maybe ();
4451 public size_t n_children ();
4452 public Variant get_child_value (size_t index);
4454 public Variant? lookup_value (string key, VariantType? expected_type);
4455 public bool lookup (string key, string format_string, ...);
4457 public size_t get_size ();
4458 public void *get_data ();
4459 public void store (void *data);
4461 public string print (bool type_annotate);
4462 public StringBuilder print_string (StringBuilder? builder, bool type_annotate);
4464 public uint hash ();
4465 public bool equal (Variant other);
4467 public Variant byteswap ();
4468 public Variant get_normal_form ();
4469 public bool is_normal_form ();
4470 [CCode (returns_floating_reference = true, simple_generics = true)]
4471 public static Variant new_from_data<T> (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null);
4473 [CCode (cname = "g_variant_iter_new")]
4474 public VariantIter iterator ();
4476 public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError;
4477 public Variant.parsed (string format_string, ...);
4480 public errordomain VariantParseError {
4485 [CCode (copy_func = "g_variant_iter_copy", free_func = "g_variant_iter_free")]
4486 public class VariantIter {
4487 public VariantIter (Variant value);
4488 public size_t n_children ();
4489 public Variant? next_value ();
4490 public bool next (string format_string, ...);
4494 [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref")]
4495 public class VariantBuilder {
4496 public VariantBuilder (VariantType type);
4497 public void open (VariantType type);
4498 public void close ();
4499 public void add_value (Variant value);
4500 public void add (string format_string, ...);
4501 [CCode (returns_floating_reference = true)]
4502 public Variant end ();
4506 [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")]
4507 public class ObjectPath : string {
4508 [CCode (cname = "g_strdup")]
4509 public ObjectPath (string path);
4512 [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")]
4513 public class BusName : string {
4514 [CCode (cname = "g_strdup")]
4515 public BusName (string bus_name);
4519 [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]
4520 public static bool likely (bool expression);
4521 [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")]
4522 public static bool unlikely (bool expression);
4523 [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")]
4524 public static void static_assert (bool expression);
4526 [CCode (simple_generics = true)]
4527 private static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc<T> compare_func);