3 * Copyright (C) 2006-2010 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 [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")]
35 public string to_string () {
45 [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")]
46 [IntegerType (rank = 2, min = 0, max = 127)]
48 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
49 public string to_string (string format = "%c");
50 public bool isalnum ();
51 public bool isalpha ();
52 public bool iscntrl ();
53 public bool isdigit ();
54 public bool isgraph ();
55 public bool islower ();
56 public bool isprint ();
57 public bool ispunct ();
58 public bool isspace ();
59 public bool isupper ();
60 public bool isxdigit ();
61 public int digit_value ();
62 public int xdigit_value ();
63 public char tolower ();
64 public char toupper ();
66 [CCode (cname = "MIN")]
67 public static char min (char a, char b);
68 [CCode (cname = "MAX")]
69 public static char max (char a, char b);
70 [CCode (cname = "CLAMP")]
71 public char clamp (char low, char high);
75 [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")]
76 [IntegerType (rank = 3, min = 0, max = 255)]
78 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
79 public string to_string (string format = "%hhu");
81 [CCode (cname = "MIN")]
82 public static uchar min (uchar a, uchar b);
83 [CCode (cname = "MAX")]
84 public static uchar max (uchar a, uchar b);
85 [CCode (cname = "CLAMP")]
86 public uchar clamp (uchar low, uchar high);
90 [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")]
91 [IntegerType (rank = 6)]
93 [CCode (cname = "G_MININT")]
94 public static int MIN;
95 [CCode (cname = "G_MAXINT")]
96 public static int MAX;
98 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
99 public string to_string (string format = "%i");
101 [CCode (cname = "MIN")]
102 public static int min (int a, int b);
103 [CCode (cname = "MAX")]
104 public static int max (int a, int b);
105 [CCode (cname = "CLAMP")]
106 public int clamp (int low, int high);
108 [CCode (cname = "GINT_TO_POINTER")]
109 public void* to_pointer ();
111 [CCode (cname = "abs", cheader_filename = "stdlib.h")]
114 [CCode (cname = "GINT_TO_BE")]
115 public int to_big_endian ();
116 [CCode (cname = "GINT_TO_LE")]
117 public int to_little_endian ();
119 [CCode (cname = "GINT_FROM_BE")]
120 public static int from_big_endian (int val);
121 [CCode (cname = "GINT_FROM_LE")]
122 public static int from_little_endian (int val);
126 [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")]
127 [IntegerType (rank = 7)]
129 [CCode (cname = "0")]
130 public static uint MIN;
131 [CCode (cname = "G_MAXUINT")]
132 public static uint MAX;
134 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
135 public string to_string (string format = "%u");
137 [CCode (cname = "MIN")]
138 public static uint min (uint a, uint b);
139 [CCode (cname = "MAX")]
140 public static uint max (uint a, uint b);
141 [CCode (cname = "CLAMP")]
142 public uint clamp (uint low, uint high);
144 [CCode (cname = "GUINT_TO_POINTER")]
145 public void* to_pointer ();
147 [CCode (cname = "GUINT_TO_BE")]
148 public uint to_big_endian ();
149 [CCode (cname = "GUINT_TO_LE")]
150 public uint to_little_endian ();
152 [CCode (cname = "GUINT_FROM_BE")]
153 public static uint from_big_endian (uint val);
154 [CCode (cname = "GUINT_FROM_LE")]
155 public static uint from_little_endian (uint val);
159 [CCode (cname = "gshort", cheader_filename = "glib.h", has_type_id = false, default_value = "0", type_signature = "n")]
160 [IntegerType (rank = 4, min = -32768, max = 32767)]
161 public struct short {
162 [CCode (cname = "G_MINSHORT")]
163 public static short MIN;
164 [CCode (cname = "G_MAXSHORT")]
165 public static short MAX;
167 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
168 public string to_string (string format = "%hi");
170 [CCode (cname = "MIN")]
171 public static short min (short a, short b);
172 [CCode (cname = "MAX")]
173 public static short max (short a, short b);
174 [CCode (cname = "CLAMP")]
175 public short clamp (short low, short high);
179 [CCode (cname = "gushort", cheader_filename = "glib.h", has_type_id = false, default_value = "0U", type_signature = "q")]
180 [IntegerType (rank = 5, min = 0, max = 65535)]
181 public struct ushort {
182 [CCode (cname = "0U")]
183 public static ushort MIN;
184 [CCode (cname = "G_MAXUSHORT")]
185 public static ushort MAX;
187 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
188 public string to_string (string format = "%hu");
190 [CCode (cname = "MIN")]
191 public static ushort min (ushort a, ushort b);
192 [CCode (cname = "MAX")]
193 public static ushort max (ushort a, ushort b);
194 [CCode (cname = "CLAMP")]
195 public ushort clamp (ushort low, ushort high);
199 [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")]
200 [IntegerType (rank = 8)]
202 [CCode (cname = "G_MINLONG")]
203 public static long MIN;
204 [CCode (cname = "G_MAXLONG")]
205 public static long MAX;
207 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
208 public string to_string (string format = "%li");
210 [CCode (cname = "MIN")]
211 public static long min (long a, long b);
212 [CCode (cname = "MAX")]
213 public static long max (long a, long b);
214 [CCode (cname = "CLAMP")]
215 public long clamp (long low, long high);
216 [CCode (cname = "labs", cheader_filename = "stdlib.h")]
219 [CCode (cname = "GLONG_TO_BE")]
220 public long to_big_endian ();
221 [CCode (cname = "GLONG_TO_LE")]
222 public long to_little_endian ();
224 [CCode (cname = "GLONG_FROM_BE")]
225 public static long from_big_endian (long val);
226 [CCode (cname = "GLONG_FROM_LE")]
227 public static long from_little_endian (long val);
231 [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")]
232 [IntegerType (rank = 9)]
233 public struct ulong {
234 [CCode (cname = "0UL")]
235 public static ulong MIN;
236 [CCode (cname = "G_MAXULONG")]
237 public static ulong MAX;
239 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
240 public string to_string (string format = "%lu");
242 [CCode (cname = "MIN")]
243 public static ulong min (ulong a, ulong b);
244 [CCode (cname = "MAX")]
245 public static ulong max (ulong a, ulong b);
246 [CCode (cname = "CLAMP")]
247 public ulong clamp (ulong low, ulong high);
249 [CCode (cname = "GULONG_TO_BE")]
250 public ulong to_big_endian ();
251 [CCode (cname = "GULONG_TO_LE")]
252 public ulong to_little_endian ();
254 [CCode (cname = "GULONG_FROM_BE")]
255 public static ulong from_big_endian (ulong val);
256 [CCode (cname = "GULONG_FROM_LE")]
257 public static ulong from_little_endian (ulong val);
261 [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")]
262 [IntegerType (rank = 9)]
263 public struct size_t {
264 [CCode (cname = "0UL")]
265 public static ulong MIN;
266 [CCode (cname = "G_MAXSIZE")]
267 public static ulong MAX;
269 [CCode (cname = "G_GSIZE_FORMAT")]
270 public const string FORMAT;
271 [CCode (cname = "G_GSIZE_MODIFIER")]
272 public const string FORMAT_MODIFIER;
274 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
275 public string to_string (string format = "%zu");
277 [CCode (cname = "GSIZE_TO_POINTER")]
278 public void* to_pointer ();
280 [CCode (cname = "MIN")]
281 public static size_t min (size_t a, size_t b);
282 [CCode (cname = "MAX")]
283 public static size_t max (size_t a, size_t b);
284 [CCode (cname = "CLAMP")]
285 public size_t clamp (size_t low, size_t high);
289 [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")]
290 [IntegerType (rank = 8)]
291 public struct ssize_t {
292 [CCode (cname = "G_MINSSIZE")]
293 public static long MIN;
294 [CCode (cname = "G_MAXSSIZE")]
295 public static long MAX;
297 [CCode (cname = "G_GSSIZE_FORMAT")]
298 public const string FORMAT;
299 [CCode (cname = "G_GSIZE_MODIFIER")]
300 public const string FORMAT_MODIFIER;
302 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
303 public string to_string (string format = "%zi");
305 [CCode (cname = "MIN")]
306 public static ssize_t min (ssize_t a, ssize_t b);
307 [CCode (cname = "MAX")]
308 public static ssize_t max (ssize_t a, ssize_t b);
309 [CCode (cname = "CLAMP")]
310 public ssize_t clamp (ssize_t low, ssize_t high);
314 [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")]
315 [IntegerType (rank = 1, min = -128, max = 127)]
317 [CCode (cname = "G_MININT8")]
318 public static int8 MIN;
319 [CCode (cname = "G_MAXINT8")]
320 public static int8 MAX;
322 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
323 public string to_string (string format = "%hhi");
325 [CCode (cname = "MIN")]
326 public static int8 min (int8 a, int8 b);
327 [CCode (cname = "MAX")]
328 public static int8 max (int8 a, int8 b);
329 [CCode (cname = "CLAMP")]
330 public int8 clamp (int8 low, int8 high);
334 [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")]
335 [IntegerType (rank = 3, min = 0, max = 255)]
336 public struct uint8 {
337 [CCode (cname = "0U")]
338 public static uint8 MIN;
339 [CCode (cname = "G_MAXUINT8")]
340 public static uint8 MAX;
342 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
343 public string to_string (string format = "%hhu");
345 [CCode (cname = "MIN")]
346 public static uint8 min (uint8 a, uint8 b);
347 [CCode (cname = "MAX")]
348 public static uint8 max (uint8 a, uint8 b);
349 [CCode (cname = "CLAMP")]
350 public uint8 clamp (uint8 low, uint8 high);
354 [CCode (cname = "gint16", cheader_filename = "glib.h", default_value = "0", type_signature = "n", has_type_id = false)]
355 [IntegerType (rank = 4, min = -32768, max = 32767)]
356 public struct int16 {
357 [CCode (cname = "G_MININT16")]
358 public static int16 MIN;
359 [CCode (cname = "G_MAXINT16")]
360 public static int16 MAX;
362 [CCode (cname = "G_GINT16_FORMAT")]
363 public const string FORMAT;
364 [CCode (cname = "G_GINT16_MODIFIER")]
365 public const string FORMAT_MODIFIER;
367 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
368 public string to_string (string format = "%hi");
370 [CCode (cname = "MIN")]
371 public static int16 min (int16 a, int16 b);
372 [CCode (cname = "MAX")]
373 public static int16 max (int16 a, int16 b);
374 [CCode (cname = "CLAMP")]
375 public int16 clamp (int16 low, int16 high);
377 [CCode (cname = "GINT16_TO_BE")]
378 public int16 to_big_endian ();
379 [CCode (cname = "GINT16_TO_LE")]
380 public int16 to_little_endian ();
382 [CCode (cname = "GINT16_FROM_BE")]
383 public static int16 from_big_endian (int16 val);
384 [CCode (cname = "GINT16_FROM_LE")]
385 public static int16 from_little_endian (int16 val);
389 [CCode (cname = "guint16", cheader_filename = "glib.h", default_value = "0U", type_signature = "q", has_type_id = false)]
390 [IntegerType (rank = 5, min = 0, max = 65535)]
391 public struct uint16 {
392 [CCode (cname = "0U")]
393 public static uint16 MIN;
394 [CCode (cname = "G_MAXUINT16")]
395 public static uint16 MAX;
397 [CCode (cname = "G_GUINT16_FORMAT")]
398 public const string FORMAT;
399 [CCode (cname = "G_GINT16_MODIFIER")]
400 public const string FORMAT_MODIFIER;
402 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
403 public string to_string (string format = "%hu");
405 [CCode (cname = "MIN")]
406 public static uint16 min (uint16 a, uint16 b);
407 [CCode (cname = "MAX")]
408 public static uint16 max (uint16 a, uint16 b);
409 [CCode (cname = "CLAMP")]
410 public uint16 clamp (uint16 low, uint16 high);
412 [CCode (cname = "GUINT16_TO_BE")]
413 public uint16 to_big_endian ();
414 [CCode (cname = "GUINT16_TO_LE")]
415 public uint16 to_little_endian ();
417 [CCode (cname = "GUINT16_FROM_BE")]
418 public static uint16 from_big_endian (uint16 val);
419 [CCode (cname = "GUINT16_FROM_LE")]
420 public static uint16 from_little_endian (uint16 val);
422 [CCode (cname = "GUINT16_SWAP_BE_PDP")]
423 public uint16 swap_big_endian_pdp ();
424 [CCode (cname = "GUINT16_SWAP_LE_BE")]
425 public uint16 swap_little_endian_big_endian ();
426 [CCode (cname = "GUINT16_SWAP_LE_PDP")]
427 public uint16 swap_little_endian_pdp ();
431 [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")]
432 [IntegerType (rank = 6)]
433 public struct int32 {
434 [CCode (cname = "G_MININT32")]
435 public static int32 MIN;
436 [CCode (cname = "G_MAXINT32")]
437 public static int32 MAX;
439 [CCode (cname = "G_GINT32_FORMAT")]
440 public const string FORMAT;
441 [CCode (cname = "G_GINT32_MODIFIER")]
442 public const string FORMAT_MODIFIER;
444 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
445 public string to_string (string format = "%i");
447 [CCode (cname = "MIN")]
448 public static int32 min (int32 a, int32 b);
449 [CCode (cname = "MAX")]
450 public static int32 max (int32 a, int32 b);
451 [CCode (cname = "CLAMP")]
452 public int32 clamp (int32 low, int32 high);
454 [CCode (cname = "GINT32_TO_BE")]
455 public int32 to_big_endian ();
456 [CCode (cname = "GINT32_TO_LE")]
457 public int32 to_little_endian ();
459 [CCode (cname = "GINT32_FROM_BE")]
460 public static int32 from_big_endian (int32 val);
461 [CCode (cname = "GINT32_FROM_LE")]
462 public static int32 from_little_endian (int32 val);
466 [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")]
467 [IntegerType (rank = 7)]
468 public struct uint32 {
469 [CCode (cname = "0U")]
470 public static uint32 MIN;
471 [CCode (cname = "G_MAXUINT32")]
472 public static uint32 MAX;
474 [CCode (cname = "G_GUINT32_FORMAT")]
475 public const string FORMAT;
476 [CCode (cname = "G_GINT32_MODIFIER")]
477 public const string FORMAT_MODIFIER;
479 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
480 public string to_string (string format = "%u");
482 [CCode (cname = "MIN")]
483 public static uint32 min (uint32 a, uint32 b);
484 [CCode (cname = "MAX")]
485 public static uint32 max (uint32 a, uint32 b);
486 [CCode (cname = "CLAMP")]
487 public uint32 clamp (uint32 low, uint32 high);
489 [CCode (cname = "GUINT32_TO_BE")]
490 public uint32 to_big_endian ();
491 [CCode (cname = "GUINT32_TO_LE")]
492 public uint32 to_little_endian ();
494 [CCode (cname = "GUINT32_FROM_BE")]
495 public static uint32 from_big_endian (uint32 val);
496 [CCode (cname = "GUINT32_FROM_LE")]
497 public static uint32 from_little_endian (uint32 val);
499 [CCode (cname = "GUINT32_SWAP_BE_PDP")]
500 public uint32 swap_big_endian_pdp ();
501 [CCode (cname = "GUINT32_SWAP_LE_BE")]
502 public uint32 swap_little_endian_big_endian ();
503 [CCode (cname = "GUINT32_SWAP_LE_PDP")]
504 public uint32 swap_little_endian_pdp ();
508 [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")]
509 [IntegerType (rank = 10)]
510 public struct int64 {
511 [CCode (cname = "G_MININT64")]
512 public static int64 MIN;
513 [CCode (cname = "G_MAXINT64")]
514 public static int64 MAX;
516 [CCode (cname = "G_GINT64_FORMAT")]
517 public const string FORMAT;
518 [CCode (cname = "G_GINT64_MODIFIER")]
519 public const string FORMAT_MODIFIER;
521 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
522 public string to_string (string format = "%lli");
524 [CCode (cname = "MIN")]
525 public static int64 min (int64 a, int64 b);
526 [CCode (cname = "MAX")]
527 public static int64 max (int64 a, int64 b);
528 [CCode (cname = "CLAMP")]
529 public int64 clamp (int64 low, int64 high);
530 [CCode (cname = "llabs", cheader_filename = "stdlib.h")]
533 [CCode (cname = "GINT64_TO_BE")]
534 public int64 to_big_endian ();
535 [CCode (cname = "GINT64_TO_LE")]
536 public int64 to_little_endian ();
538 [CCode (cname = "GINT64_FROM_BE")]
539 public static int64 from_big_endian (int64 val);
540 [CCode (cname = "GINT64_FROM_LE")]
541 public static int64 from_little_endian (int64 val);
543 [CCode (cname = "GUINT64_SWAP_LE_BE")]
544 public uint64 swap_little_endian_big_endian ();
548 [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")]
549 [IntegerType (rank = 11)]
550 public struct uint64 {
551 [CCode (cname = "0ULL")]
552 public static uint64 MIN;
553 [CCode (cname = "G_MAXUINT64")]
554 public static uint64 MAX;
556 [CCode (cname = "G_GUINT64_FORMAT")]
557 public const string FORMAT;
558 [CCode (cname = "G_GINT64_MODIFIER")]
559 public const string FORMAT_MODIFIER;
561 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
562 public string to_string (string format = "%llu");
564 [CCode (cname = "MIN")]
565 public static uint64 min (uint64 a, uint64 b);
566 [CCode (cname = "MAX")]
567 public static uint64 max (uint64 a, uint64 b);
568 [CCode (cname = "CLAMP")]
569 public uint64 clamp (uint64 low, uint64 high);
571 [CCode (cname = "GUINT64_TO_BE")]
572 public uint64 to_big_endian ();
573 [CCode (cname = "GUINT64_TO_LE")]
574 public uint64 to_little_endian ();
576 [CCode (cname = "GUINT64_FROM_BE")]
577 public static uint64 from_big_endian (uint64 val);
578 [CCode (cname = "GUINT64_FROM_LE")]
579 public static uint64 from_little_endian (uint64 val);
583 [CCode (cname = "float", 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")]
584 [FloatingType (rank = 1)]
585 public struct float {
586 [CCode (cname = "FLT_MANT_DIG")]
587 public static int MANT_DIG;
588 [CCode (cname = "FLT_DIG")]
589 public static int DIG;
591 [CCode (cname = "FLT_MIN_EXP")]
592 public static int MIN_EXP;
593 [CCode (cname = "FLT_MAX_EXP")]
594 public static int MAX_EXP;
596 [CCode (cname = "FLT_MIN_10_EXP")]
597 public static int MIN_10_EXP;
598 [CCode (cname = "FLT_MAX_10_EXP")]
599 public static int MAX_10_EXP;
601 [CCode (cname = "FLT_EPSILON")]
602 public static float EPSILON;
603 [CCode (cname = "FLT_MIN")]
604 public static float MIN;
605 [CCode (cname = "FLT_MAX")]
606 public static float MAX;
608 [CCode (cname = "NAN")]
609 public static float NAN;
610 [CCode (cname = "INFINITY")]
611 public static float INFINITY;
613 [CCode (cname = "isnan")]
614 public bool is_nan ();
615 [CCode (cname = "isfinite")]
616 public bool is_finite ();
617 [CCode (cname = "isnormal")]
618 public bool is_normal ();
619 [CCode (cname = "isinf")]
620 public int is_infinity ();
622 [CCode (cname = "g_strdup_printf", instance_pos = -1)]
623 public string to_string (string format = "%g");
625 [CCode (cname = "MIN")]
626 public static float min (float a, float b);
627 [CCode (cname = "MAX")]
628 public static float max (float a, float b);
629 [CCode (cname = "CLAMP")]
630 public float clamp (float low, float high);
634 [CCode (cname = "double", 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")]
635 [FloatingType (rank = 2)]
636 public struct double {
637 [CCode (cname = "DBL_MANT_DIG")]
638 public static int MANT_DIG;
639 [CCode (cname = "DBL_DIG")]
640 public static int DIG;
642 [CCode (cname = "DBL_MIN_EXP")]
643 public static int MIN_EXP;
644 [CCode (cname = "DBL_MAX_EXP")]
645 public static int MAX_EXP;
647 [CCode (cname = "DBL_MIN_10_EXP")]
648 public static int MIN_10_EXP;
649 [CCode (cname = "DBL_MAX_10_EXP")]
650 public static int MAX_10_EXP;
652 [CCode (cname = "DBL_EPSILON")]
653 public static double EPSILON;
654 [CCode (cname = "DBL_MIN")]
655 public static double MIN;
656 [CCode (cname = "DBL_MAX")]
657 public static double MAX;
659 [CCode (cname = "((double) NAN)")]
660 public static double NAN;
661 [CCode (cname = "((double) INFINITY)")]
662 public static double INFINITY;
664 [CCode (cname = "isnan")]
665 public bool is_nan ();
666 [CCode (cname = "isfinite")]
667 public bool is_finite ();
668 [CCode (cname = "isnormal")]
669 public bool is_normal ();
670 [CCode (cname = "isinf")]
671 public int is_infinity ();
673 [CCode (cname = "MIN")]
674 public static double min (double a, double b);
675 [CCode (cname = "MAX")]
676 public static double max (double a, double b);
677 [CCode (cname = "CLAMP")]
678 public double clamp (double low, double high);
680 [CCode (cname = "G_ASCII_DTOSTR_BUF_SIZE")]
681 public const int DTOSTR_BUF_SIZE;
682 [CCode (cname = "g_ascii_dtostr", instance_pos = -1)]
683 public unowned string to_str (char[] buffer);
684 [CCode (cname = "g_ascii_formatd", instance_pos = -1)]
685 public unowned string format (char[] buffer, string format = "%g");
687 public string to_string () {
688 return this.to_str(new char[DTOSTR_BUF_SIZE]);
692 [CCode (cheader_filename = "time.h", has_type_id = false)]
693 [IntegerType (rank = 8)]
694 public struct time_t {
695 [CCode (cname = "time")]
696 public time_t (out time_t result = null);
700 [CCode (cheader_filename="stdarg.h", cprefix="va_", has_type_id = false, destroy_function = "va_end")]
701 public struct va_list {
702 [CCode (cname = "va_start")]
704 [CCode (cname = "va_copy")]
705 public va_list.copy (va_list src);
706 [CCode (generic_type_pos = 1.1)]
707 public unowned G arg<G> ();
711 [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")]
712 [IntegerType (rank = 7)]
713 public struct unichar {
714 public bool validate ();
715 public bool isalnum ();
716 public bool isalpha ();
717 public bool iscntrl ();
718 public bool isdigit ();
719 public bool isgraph ();
720 public bool islower ();
721 public bool isprint ();
722 public bool ispunct ();
723 public bool isspace ();
724 public bool isupper ();
725 public bool isxdigit ();
726 public bool istitle ();
727 public bool isdefined ();
728 public bool iswide ();
729 public bool iswide_cjk ();
730 public bool iszerowidth ();
731 public unichar toupper ();
732 public unichar tolower ();
733 public unichar totitle ();
734 public int digit_value ();
735 public int xdigit_value ();
736 public UnicodeType type ();
737 public UnicodeBreakType break_type ();
738 public UnicodeScript get_script();
740 public int to_utf8 (string? outbuf);
742 public string? to_string () {
743 string str = (string) new char[7];
748 [CCode (cname = "MIN")]
749 public static unichar min (unichar a, unichar b);
750 [CCode (cname = "MAX")]
751 public static unichar max (unichar a, unichar b);
752 [CCode (cname = "CLAMP")]
753 public unichar clamp (unichar low, unichar high);
756 [CCode (cname = "GUnicodeScript", cprefix = "G_UNICODE_SCRIPT_", has_type_id = false)]
757 public enum UnicodeScript {
843 [CCode (cname = "GUnicodeType", cprefix = "G_UNICODE_", has_type_id = false)]
844 public enum UnicodeType {
877 [CCode (cname = "GUnicodeBreakType", cprefix = "G_UNICODE_BREAK_", has_type_id = false)]
878 public enum UnicodeBreakType {
917 [CCode (cname = "GNormalizeMode", cprefix = "G_NORMALIZE_", has_type_id = false)]
918 public enum NormalizeMode {
932 [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 = "s")]
933 public class string {
934 [CCode (cname = "strstr")]
935 public unowned string? str (string needle);
936 [CCode (cname = "g_strrstr")]
937 public unowned string? rstr (string needle);
938 [CCode (cname = "g_strrstr_len")]
939 public unowned string? rstr_len (ssize_t haystack_len, string needle);
940 [CCode (cname = "g_str_has_prefix")]
941 public bool has_prefix (string prefix);
942 [CCode (cname = "g_str_has_suffix")]
943 public bool has_suffix (string suffix);
944 [CCode (cname = "g_strdup_printf"), PrintfFormat]
945 public string printf (...);
946 [CCode (cname = "g_strdup_vprintf")]
947 public string vprintf (va_list args);
948 [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat]
949 public int scanf (...);
950 [CCode (cname = "g_strconcat")]
951 public string concat (string string2, ...);
952 [CCode (cname = "g_strescape")]
953 public string escape (string exceptions);
954 [CCode (cname = "g_strcompress")]
955 public string compress ();
956 [CCode (cname = "g_strsplit", array_length = false, array_null_terminated = true)]
957 public string[] split (string delimiter, int max_tokens = 0);
958 [CCode (cname = "g_strsplit_set", array_length = false, array_null_terminated = true)]
959 public string[] split_set (string delimiters, int max_tokens = 0);
960 [CCode (cname = "g_strjoinv")]
961 public static string joinv (string separator, [CCode (array_length = false, array_null_terminated = true)] string[] str_array);
962 [CCode (cname = "g_strjoin")]
963 public static string join (string separator, ...);
964 [CCode (cname = "g_strnfill")]
965 public static string nfill (size_t length, char fill_char);
967 [CCode (cname = "g_utf8_next_char")]
968 public unowned string next_char ();
969 [CCode (cname = "g_utf8_get_char")]
970 public unichar get_char ();
971 [CCode (cname = "g_utf8_get_char_validated")]
972 public unichar get_char_validated (ssize_t max_len = -1);
973 [CCode (cname = "g_utf8_offset_to_pointer")]
974 public unowned string offset (long offset);
975 [CCode (cname = "g_utf8_pointer_to_offset")]
976 public long pointer_to_offset (string pos);
977 [CCode (cname = "g_utf8_prev_char")]
978 public unowned string prev_char ();
979 [CCode (cname = "g_utf8_strlen")]
980 public long len (ssize_t max = -1);
981 [CCode (cname = "g_utf8_strchr")]
982 public unowned string chr (ssize_t len, unichar c);
983 [CCode (cname = "g_utf8_strrchr")]
984 public unowned string rchr (ssize_t len, unichar c);
985 [CCode (cname = "g_utf8_strreverse")]
986 public string reverse (ssize_t len = -1);
987 [CCode (cname = "g_utf8_validate")]
988 public bool validate (ssize_t max_len = -1, out char* end = null);
989 [CCode (cname = "g_utf8_normalize")]
990 public string normalize (ssize_t len = -1, NormalizeMode mode = NormalizeMode.DEFAULT);
992 [CCode (cname = "g_utf8_strup")]
993 public string up (ssize_t len = -1);
994 [CCode (cname = "g_utf8_strdown")]
995 public string down (ssize_t len = -1);
996 [CCode (cname = "g_utf8_casefold")]
997 public string casefold (ssize_t len = -1);
998 [CCode (cname = "g_utf8_collate")]
999 public int collate (string str2);
1000 [CCode (cname = "g_utf8_collate_key")]
1001 public string collate_key (ssize_t len = -1);
1002 [CCode (cname = "g_utf8_collate_key_for_filename")]
1003 public string collate_key_for_filename (ssize_t len = -1);
1005 [CCode (cname = "g_locale_to_utf8")]
1006 public string locale_to_utf8 (ssize_t len, out size_t bytes_read, out size_t bytes_written, out GLib.Error error = null);
1008 [CCode (cname = "g_strchomp")]
1009 public unowned string _chomp();
1010 public string chomp () {
1011 string result = this.dup ();
1016 [CCode (cname = "g_strchug")]
1017 public unowned string _chug();
1018 public string chug () {
1019 string result = this.dup ();
1024 [CCode (cname = "g_strstrip")]
1025 public unowned string _strip ();
1026 public string strip () {
1027 string result = this.dup ();
1032 [CCode (cname = "g_strdelimit")]
1033 public unowned string _delimit (string delimiters, char new_delimiter);
1034 public string delimit (string delimiters, char new_delimiter) {
1035 string result = this.dup ();
1036 result._delimit (delimiters, new_delimiter);
1040 [CCode (cname = "g_str_hash")]
1041 public uint hash ();
1043 [CCode (cname = "atoi")]
1044 public int to_int ();
1045 [CCode (cname = "strtol")]
1046 public long to_long (out unowned string endptr = null, int _base = 0);
1047 [CCode (cname = "g_ascii_strtod")]
1048 public double to_double (out unowned string endptr = null);
1049 [CCode (cname = "strtoul")]
1050 public ulong to_ulong (out unowned string endptr = null, int _base = 0);
1051 [CCode (cname = "g_ascii_strtoll")]
1052 public int64 to_int64 (out unowned string endptr = null, int _base = 0);
1053 [CCode (cname = "g_ascii_strtoull")]
1054 public uint64 to_uint64 (out unowned string endptr = null, int _base = 0);
1056 public bool to_bool () {
1057 if (this == "true") {
1064 [CCode (cname = "strlen")]
1065 public size_t size ();
1067 [CCode (cname = "g_ascii_strcasecmp")]
1068 public int ascii_casecmp (string s2);
1069 [CCode (cname = "g_ascii_strncasecmp")]
1070 public int ascii_ncasecmp (string s2, size_t n);
1072 [CCode (cname = "g_utf8_skip")]
1073 public static char[] skip;
1075 /* modifies string in place */
1076 [CCode (cname = "g_strcanon")]
1077 public void canon (string valid_chars, char substitutor);
1079 [CCode (cname = "g_strdup")]
1080 public string dup ();
1081 // n is size in bytes, not length in characters
1082 [CCode (cname = "g_strndup")]
1083 public string ndup (size_t n);
1085 public string substring (long offset, long len = -1) {
1086 long string_length = this.len ();
1088 offset = string_length + offset;
1089 GLib.return_val_if_fail (offset >= 0, null);
1091 GLib.return_val_if_fail (offset <= string_length, null);
1094 len = string_length - offset;
1096 GLib.return_val_if_fail (offset + len <= string_length, null);
1097 unowned string start = this.offset (offset);
1098 return start.ndup (((char*) start.offset (len)) - ((char*) start));
1101 public string slice (long start, long end) {
1102 long string_length = this.len ();
1104 start = string_length + start;
1107 end = string_length + end;
1109 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1110 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1111 GLib.return_val_if_fail (start <= end, null);
1112 unowned string start_string = this.offset (start);
1113 return start_string.ndup (((char*) start_string.offset (end - start)) - ((char*) start_string));
1116 public string splice (long start, long end, string? str = null) {
1117 long string_length = this.len ();
1119 start = string_length + start;
1122 end = string_length + end;
1124 GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
1125 GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
1126 GLib.return_val_if_fail (start <= end, null);
1128 unowned string start_string = this.offset (start);
1129 unowned string end_string = start_string.offset (end - start);
1134 str_size = str.size ();
1137 string* result = GLib.malloc0 (this.size () - ((char*) end_string - (char*) start_string) + str_size + 1);
1139 char* dest = (char*) result;
1141 GLib.Memory.copy (dest, this, (char*) start_string - (char*) this);
1142 dest += (char*) start_string - (char*) this;
1144 GLib.Memory.copy (dest, str, str_size);
1147 GLib.Memory.copy (dest, end_string, end_string.size ());
1149 return (owned) result;
1152 public bool contains (string needle) {
1153 return this.str (needle) != null;
1156 public string replace (string old, string replacement) {
1158 var regex = new GLib.Regex (GLib.Regex.escape_string (old));
1159 return regex.replace_literal (this, -1, 0, replacement);
1160 } catch (GLib.RegexError e) {
1161 GLib.assert_not_reached ();
1165 public long length {
1166 get { return this.len (); }
1169 public char[] to_utf8 () {
1170 char[] result = new char[this.size () + 1];
1172 GLib.Memory.copy (result, this, this.size ());
1176 public unowned string to_string () {
1181 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
1183 [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
1185 [CCode (cname = "G_E")]
1186 public const double E;
1188 [CCode (cname = "G_PI")]
1189 public const double PI;
1191 [CCode (cname = "G_LN2")]
1192 public const double LN2;
1194 [CCode (cname = "G_LN10")]
1195 public const double LN10;
1197 [CCode (cname = "G_PI_2")]
1198 public const double PI_2;
1200 [CCode (cname = "G_PI_4")]
1201 public const double PI_4;
1203 [CCode (cname = "G_SQRT2")]
1204 public const double SQRT2;
1206 /* generated from <bits/mathcalls.h> of glibc */
1207 public static double acos (double x);
1208 public static float acosf (float x);
1209 public static double asin (double x);
1210 public static float asinf (float x);
1211 public static double atan (double x);
1212 public static float atanf (float x);
1213 public static double atan2 (double y, double x);
1214 public static float atan2f (float y, float x);
1215 public static double cos (double x);
1216 public static float cosf (float x);
1217 public static double sin (double x);
1218 public static float sinf (float x);
1219 public static double tan (double x);
1220 public static float tanf (float x);
1221 public static double cosh (double x);
1222 public static float coshf (float x);
1223 public static double sinh (double x);
1224 public static float sinhf (float x);
1225 public static double tanh (double x);
1226 public static float tanhf (float x);
1227 public static void sincos (double x, out double sinx, out double cosx);
1228 public static void sincosf (float x, out float sinx, out float cosx);
1229 public static double acosh (double x);
1230 public static float acoshf (float x);
1231 public static double asinh (double x);
1232 public static float asinhf (float x);
1233 public static double atanh (double x);
1234 public static float atanhf (float x);
1235 public static double exp (double x);
1236 public static float expf (float x);
1237 public static double frexp (double x, out int exponent);
1238 public static float frexpf (float x, out int exponent);
1239 public static double ldexp (double x, int exponent);
1240 public static float ldexpf (float x, int exponent);
1241 public static double log (double x);
1242 public static float logf (float x);
1243 public static double log10 (double x);
1244 public static float log10f (float x);
1245 public static double modf (double x, out double iptr);
1246 public static float modff (float x, out float iptr);
1247 public static double exp10 (double x);
1248 public static float exp10f (float x);
1249 public static double pow10 (double x);
1250 public static float pow10f (float x);
1251 public static double expm1 (double x);
1252 public static float expm1f (float x);
1253 public static double log1p (double x);
1254 public static float log1pf (float x);
1255 public static double logb (double x);
1256 public static float logbf (float x);
1257 public static double exp2 (double x);
1258 public static float exp2f (float x);
1259 public static double log2 (double x);
1260 public static float log2f (float x);
1261 public static double pow (double x, double y);
1262 public static float powf (float x, float y);
1263 public static double sqrt (double x);
1264 public static float sqrtf (float x);
1265 public static double hypot (double x, double y);
1266 public static float hypotf (float x, float y);
1267 public static double cbrt (double x);
1268 public static float cbrtf (float x);
1269 public static double ceil (double x);
1270 public static float ceilf (float x);
1271 public static double fabs (double x);
1272 public static float fabsf (float x);
1273 public static double floor (double x);
1274 public static float floorf (float x);
1275 public static double fmod (double x, double y);
1276 public static float fmodf (float x, float y);
1277 public static int isinf (double value);
1278 public static int isinff (float value);
1279 public static int finite (double value);
1280 public static int finitef (float value);
1281 public static double drem (double x, double y);
1282 public static float dremf (float x, float y);
1283 public static double significand (double x);
1284 public static float significandf (float x);
1285 public static double copysign (double x, double y);
1286 public static float copysignf (float x, float y);
1287 public static double nan (string tagb);
1288 public static float nanf (string tagb);
1289 public static int isnan (double value);
1290 public static int isnanf (float value);
1291 public static double j0 (double x0);
1292 public static float j0f (float x0);
1293 public static double j1 (double x0);
1294 public static float j1f (float x0);
1295 public static double jn (int x0, double x1);
1296 public static float jnf (int x0, float x1);
1297 public static double y0 (double x0);
1298 public static float y0f (float x0);
1299 public static double y1 (double x0);
1300 public static float y1f (float x0);
1301 public static double yn (int x0, double x1);
1302 public static float ynf (int x0, float x1);
1303 public static double erf (double x0);
1304 public static float erff (float x0);
1305 public static double erfc (double x0);
1306 public static float erfcf (float x0);
1307 public static double lgamma (double x0);
1308 public static float lgammaf (float x0);
1309 public static double tgamma (double x0);
1310 public static float tgammaf (float x0);
1311 public static double gamma (double x0);
1312 public static float gammaf (float x0);
1313 public static double lgamma_r (double x0, out int signgamp);
1314 public static float lgamma_rf (float x0, out int signgamp);
1315 public static double rint (double x);
1316 public static float rintf (float x);
1317 public static double nextafter (double x, double y);
1318 public static float nextafterf (float x, float y);
1319 public static double nexttoward (double x, double y);
1320 public static float nexttowardf (float x, double y);
1321 public static double remainder (double x, double y);
1322 public static float remainderf (float x, float y);
1323 public static double scalbn (double x, int n);
1324 public static float scalbnf (float x, int n);
1325 public static int ilogb (double x);
1326 public static int ilogbf (float x);
1327 public static double scalbln (double x, long n);
1328 public static float scalblnf (float x, long n);
1329 public static double nearbyint (double x);
1330 public static float nearbyintf (float x);
1331 public static double round (double x);
1332 public static float roundf (float x);
1333 public static double trunc (double x);
1334 public static float truncf (float x);
1335 public static double remquo (double x, double y, out int quo);
1336 public static float remquof (float x, float y, out int quo);
1337 public static long lrint (double x);
1338 public static long lrintf (float x);
1339 public static int64 llrint (double x);
1340 public static int64 llrintf (float x);
1341 public static long lround (double x);
1342 public static long lroundf (float x);
1343 public static int64 llround (double x);
1344 public static int64 llroundf (float x);
1345 public static double fdim (double x, double y);
1346 public static float fdimf (float x, float y);
1347 public static double fmax (double x, double y);
1348 public static float fmaxf (float x, float y);
1349 public static double fmin (double x, double y);
1350 public static float fminf (float x, float y);
1351 public static double fma (double x, double y, double z);
1352 public static float fmaf (float x, float y, float z);
1353 public static double scalb (double x, double n);
1354 public static float scalbf (float x, float n);
1358 [CCode (cprefix = "G_", cname = "int", has_type_id = false)]
1359 public enum ByteOrder {
1360 [CCode (cname = "G_BYTE_ORDER")]
1367 public const ByteOrder BYTE_ORDER;
1369 /* Atomic Operations */
1371 namespace AtomicInt {
1372 public static int get (ref int atomic);
1373 public static void set (ref int atomic, int newval);
1374 public static void add (ref int atomic, int val);
1375 public static int exchange_and_add (ref int atomic, int val);
1376 public static bool compare_and_exchange (ref int atomic, int oldval, int newval);
1377 public static void inc (ref int atomic);
1378 public static bool dec_and_test (ref int atomic);
1381 namespace AtomicPointer {
1382 public static void* get (void** atomic);
1383 public static void set (void** atomic, void* newval);
1384 public static bool compare_and_exchange (void** atomic, void* oldval, void* newval);
1387 /* The Main Event Loop */
1390 [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
1391 public class MainLoop {
1392 public MainLoop (MainContext? context = null, bool is_running = false);
1394 public void quit ();
1395 public bool is_running ();
1396 public unowned MainContext get_context ();
1399 namespace Priority {
1400 public const int HIGH;
1401 public const int DEFAULT;
1402 public const int HIGH_IDLE;
1403 public const int DEFAULT_IDLE;
1404 public const int LOW;
1408 [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
1409 public class MainContext {
1410 public MainContext ();
1411 public static unowned MainContext @default ();
1412 public bool iteration (bool may_block);
1413 public bool pending ();
1414 public unowned Source find_source_by_id (uint source_id);
1415 public unowned Source find_source_by_user_data (void* user_data);
1416 public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data);
1417 public void wakeup ();
1418 public bool acquire ();
1419 public void release ();
1420 public bool is_owner ();
1421 public bool wait (Cond cond, Mutex mutex);
1422 public bool prepare (out int priority);
1423 public int query (int max_priority, out int timeout_, PollFD[] fds);
1424 [CCode (array_length = false)]
1425 public int check (int max_priority, PollFD[] fds, int n_fds);
1426 public void dispatch ();
1427 public void set_poll_func (PollFunc func);
1428 public PollFunc get_poll_func ();
1429 public void add_poll (ref PollFD fd, int priority);
1430 public void remove_poll (ref PollFD fd);
1431 public int depth ();
1432 [CCode (cname = "g_main_current_source")]
1433 public static unowned Source current_source ();
1434 public static unowned MainContext get_thread_default ();
1435 public void push_thread_default ();
1436 public void pop_thread_default ();
1439 [CCode (has_target = false)]
1440 public delegate int PollFunc (PollFD[] ufds, uint nfsd, int timeout_);
1442 [CCode (cname = "GSource")]
1443 public class TimeoutSource : Source {
1444 public TimeoutSource (uint interval);
1445 public TimeoutSource.seconds (uint interval);
1449 [CCode (cname = "g_timeout_add_full")]
1450 public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1451 public static uint add_full (int priority, uint interval, owned SourceFunc function);
1452 [CCode (cname = "g_timeout_add_seconds_full")]
1453 public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT);
1454 public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function);
1457 [CCode (cname = "GSource")]
1458 public class IdleSource : Source {
1459 public IdleSource ();
1463 [CCode (cname = "g_idle_add_full")]
1464 public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1465 public static uint add_full (int priority, owned SourceFunc function);
1466 public static bool remove_by_data (void* data);
1469 [CCode (default_value = "0")]
1470 [IntegerType (rank = 6)]
1474 public delegate void ChildWatchFunc (Pid pid, int status);
1476 public class ChildWatchSource : Source {
1477 public ChildWatchSource (Pid pid, int status, void* data);
1480 namespace ChildWatch {
1481 [CCode (cname = "g_child_watch_add_full")]
1482 public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE);
1483 public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function);
1486 public struct PollFD {
1488 public IOCondition events;
1489 public IOCondition revents;
1493 [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
1494 public class Source {
1495 public Source (SourceFuncs source_funcs, uint struct_size /* = sizeof (Source) */);
1496 public void set_funcs (SourceFuncs funcs);
1497 public uint attach (MainContext? context);
1498 public void destroy ();
1499 public bool is_destroyed ();
1500 public void set_priority (int priority);
1501 public int get_priority ();
1502 public void set_can_recurse (bool can_recurse);
1503 public bool get_can_recurse ();
1504 public uint get_id ();
1505 public unowned MainContext get_context ();
1506 public void set_callback (owned SourceFunc func);
1507 public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs);
1508 public void add_poll (ref PollFD fd);
1509 public void remove_poll (ref PollFD fd);
1510 public void get_current_time (out TimeVal timeval);
1511 public static bool remove (uint id);
1512 public static bool remove_by_funcs_user_data (void* user_data);
1513 public static bool remove_by_user_data (void* user_data);
1516 [CCode (has_target = false)]
1517 public delegate void SourceDummyMarshal ();
1519 [CCode (has_target = false)]
1520 public delegate bool SourcePrepareFunc (Source source, out int timeout_);
1521 [CCode (has_target = false)]
1522 public delegate bool SourceCheckFunc (Source source);
1523 [CCode (has_target = false)]
1524 public delegate bool SourceDispatchFunc (Source source, SourceFunc _callback);
1525 [CCode (has_target = false)]
1526 public delegate void SourceFinalizeFunc (Source source);
1529 public class SourceFuncs {
1530 public SourcePrepareFunc prepare;
1531 public SourceCheckFunc check;
1532 public SourceDispatchFunc dispatch;
1533 public SourceFinalizeFunc finalize;
1536 [CCode (has_target = false)]
1537 public delegate void SourceCallbackRefFunc (void* cb_data);
1538 [CCode (has_target = false)]
1539 public delegate void SourceCallbackUnrefFunc (void* cb_data);
1540 [CCode (has_target = false)]
1541 public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
1544 public class SourceCallbackFuncs {
1545 public SourceCallbackRefFunc @ref;
1546 public SourceCallbackUnrefFunc unref;
1547 public SourceCallbackGetFunc @get;
1550 public delegate bool SourceFunc ();
1552 public errordomain ThreadError {
1556 /* Thread support */
1558 public delegate void* ThreadFunc ();
1559 public delegate void Func (void* data);
1561 [CCode (has_type_id = false)]
1562 public enum ThreadPriority {
1570 public class Thread {
1571 public static bool supported ();
1572 public static unowned Thread create (ThreadFunc func, bool joinable) throws ThreadError;
1573 public static unowned Thread create_full (ThreadFunc func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
1574 public static unowned Thread self ();
1575 public void* join ();
1576 public void set_priority (ThreadPriority priority);
1577 public static void yield ();
1578 public static void exit (void* retval);
1579 public static void @foreach (Func thread_func);
1581 [CCode (cname = "g_usleep")]
1582 public static void usleep (ulong microseconds);
1586 [CCode (free_function = "g_mutex_free")]
1587 public class Mutex {
1589 public void @lock ();
1590 public bool trylock ();
1591 public void unlock ();
1594 [CCode (destroy_function = "g_static_mutex_free")]
1595 public struct StaticMutex {
1596 public StaticMutex ();
1597 public void lock ();
1598 public bool trylock ();
1599 public void unlock ();
1600 public void lock_full ();
1603 [CCode (destroy_function = "g_static_rec_mutex_free")]
1604 public struct StaticRecMutex {
1605 public StaticRecMutex ();
1606 public void lock ();
1607 public bool trylock ();
1608 public void unlock ();
1609 public void lock_full ();
1612 [CCode (destroy_function = "g_static_rw_lock_free")]
1613 public struct StaticRWLock {
1614 public StaticRWLock ();
1615 public void reader_lock ();
1616 public bool reader_trylock ();
1617 public void reader_unlock ();
1618 public void writer_lock ();
1619 public bool writer_trylock ();
1620 public void writer_unlock ();
1624 [CCode (ref_function = "", unref_function = "")]
1625 public class Private {
1626 public Private (DestroyNotify destroy_func);
1627 public void* get ();
1628 public void set (void* data);
1631 [CCode (destroy_function = "g_static_private_free")]
1632 public struct StaticPrivate {
1633 public StaticPrivate ();
1634 public void* get ();
1635 public void set (void* data, DestroyNotify? destroy_func);
1639 [CCode (free_function = "g_cond_free")]
1642 public void @signal ();
1643 public void broadcast ();
1644 public void wait (Mutex mutex);
1645 public bool timed_wait (Mutex mutex, TimeVal abs_time);
1651 [CCode (free_function = "g_thread_pool_free")]
1652 public class ThreadPool {
1653 public ThreadPool (Func func, int max_threads, bool exclusive) throws ThreadError;
1654 public void push (void* data) throws ThreadError;
1655 public void set_max_threads (int max_threads) throws ThreadError;
1656 public int get_max_threads ();
1657 public uint get_num_threads ();
1658 public uint unprocessed ();
1659 public static void set_max_unused_threads (int max_threads);
1660 public static int get_max_unused_threads ();
1661 public static uint get_num_unused_threads ();
1662 public static void stop_unused_threads ();
1663 public void set_sort_function (CompareDataFunc func);
1664 public static void set_max_idle_time (uint interval);
1665 public static uint get_max_idle_time ();
1668 /* Asynchronous Queues */
1671 [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
1672 public class AsyncQueue<G> {
1673 public AsyncQueue ();
1674 public void push (owned G data);
1675 public void push_sorted (owned G data, CompareDataFunc func);
1677 public G try_pop ();
1678 public G timed_pop (ref TimeVal end_time);
1679 public int length ();
1680 public void sort (CompareDataFunc func);
1681 public void @lock ();
1682 public void unlock ();
1683 public void ref_unlocked ();
1684 public void unref_and_unlock ();
1685 public void push_unlocked (owned G data);
1686 public void push_sorted_unlocked (owned G data, CompareDataFunc func);
1687 public G pop_unlocked ();
1688 public G try_pop_unlocked ();
1689 public G timed_pop_unlocked (ref TimeVal end_time);
1690 public int length_unlocked ();
1691 public void sort_unlocked (CompareDataFunc func);
1694 /* Memory Allocation */
1696 public static void* malloc (size_t n_bytes);
1697 public static void* malloc0 (size_t n_bytes);
1698 public static void* realloc (void* mem, size_t n_bytes);
1700 public static void* try_malloc (size_t n_bytes);
1701 public static void* try_malloc0 (size_t n_bytes);
1702 public static void* try_realloc (void* mem, size_t n_bytes);
1704 public static void free (void* mem);
1706 public class MemVTable {
1709 [CCode (cname = "glib_mem_profiler_table")]
1710 public static MemVTable mem_profiler_table;
1712 public static void mem_set_vtable (MemVTable vtable);
1713 public static void mem_profile ();
1715 [CCode (cheader_filename = "string.h")]
1717 [CCode (cname = "memcmp")]
1718 public static int cmp (void* s1, void* s2, size_t n);
1719 [CCode (cname = "memcpy")]
1720 public static void* copy (void* dest, void* src, size_t n);
1721 [CCode (cname = "memset")]
1722 public static void* set (void* dest, int src, size_t n);
1723 [CCode (cname = "g_memmove")]
1724 public static void* move (void* dest, void* src, size_t n);
1725 [CCode (cname = "g_memdup")]
1726 public static void* dup (void* mem, uint n);
1730 public static void* alloc (size_t block_size);
1731 public static void* alloc0 (size_t block_size);
1732 public static void* copy (size_t block_size, void* mem_block);
1733 [CCode (cname = "g_slice_free1")]
1734 public static void free (size_t block_size, void* mem_block);
1735 public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset);
1741 [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
1742 public class IOChannel {
1743 [CCode (cname = "g_io_channel_unix_new")]
1744 public IOChannel.unix_new (int fd);
1745 public int unix_get_fd ();
1746 [CCode (cname = "g_io_channel_win32_new_fd")]
1747 public IOChannel.win32_new_fd (int fd);
1748 [CCode (cname = "g_io_channel_win32_new_socket")]
1749 public IOChannel.win32_socket (int socket);
1750 [CCode (cname = "g_io_channel_win32_new_messages")]
1751 public IOChannel.win32_messages (size_t hwnd);
1752 public void init ();
1753 public IOChannel.file (string filename, string mode) throws FileError;
1754 public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError;
1755 public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
1756 public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError;
1757 public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError;
1758 public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError;
1759 public IOStatus write_chars (char[] buf, out size_t bytes_written) throws ConvertError, IOChannelError;
1760 public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
1761 public IOStatus flush () throws IOChannelError;
1762 public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
1763 public IOStatus shutdown (bool flush) throws IOChannelError;
1764 [CCode (cname = "g_io_create_watch")]
1765 public GLib.Source create_watch (IOCondition condition);
1766 [CCode (cname = "g_io_add_watch")]
1767 public uint add_watch (IOCondition condition, IOFunc func);
1768 [CCode (cname = "g_io_add_watch_full")]
1769 public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func);
1770 public size_t get_buffer_size ();
1771 public void set_buffer_size (size_t size);
1772 public IOCondition get_buffer_condition ();
1773 public IOFlags get_flags ();
1774 public IOStatus set_flags (IOFlags flags) throws IOChannelError;
1775 public unowned string get_line_term (out int length);
1776 public void set_line_term (string line_term, int length);
1777 public bool get_buffered ();
1778 public void set_buffered (bool buffered);
1779 public unowned string get_encoding ();
1780 public IOStatus set_encoding (string? encoding) throws IOChannelError;
1781 public bool get_close_on_unref ();
1782 public void set_close_on_unref (bool do_close);
1785 [CCode (cprefix = "G_SEEK_", has_type_id = false)]
1786 public enum SeekType {
1792 [CCode (has_type_id = false)]
1793 public enum IOStatus {
1800 public errordomain IOChannelError {
1813 [CCode (cprefix = "G_IO_")]
1814 public enum IOCondition {
1823 public delegate bool IOFunc (IOChannel source, IOCondition condition);
1825 [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)]
1826 public enum IOFlags {
1837 /* Error Reporting */
1841 [CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
1842 public class Error {
1844 public Error (Quark domain, int code, string format, ...);
1845 public Error copy ();
1846 public bool matches (Quark domain, int code);
1848 public Quark domain;
1850 public string message;
1853 /* Message Output and Debugging Functions */
1856 public static void print (string format, ...);
1857 public static void set_print_handler (PrintFunc func);
1858 [CCode (has_target = false)]
1859 public delegate void PrintFunc (string text);
1861 public static void printerr (string format, ...);
1862 public static void set_printerr_handler (PrintFunc func);
1864 public static void return_if_fail (bool expr);
1865 [CCode (sentinel = "")]
1866 public static void return_val_if_fail (bool expr, ...);
1868 public static void return_if_reached ();
1870 [CCode (sentinel = "")]
1871 public static void return_val_if_reached (...);
1872 public static void warn_if_fail (bool expr);
1873 public static void warn_if_reached ();
1876 public static void assert (bool expr);
1878 public static void assert_not_reached ();
1880 public static void on_error_query (string? prg_name = null);
1881 public static void on_error_stack_trace (string? prg_name = null);
1882 [CCode (cname = "G_BREAKPOINT")]
1883 public static void breakpoint ();
1885 /* Message Logging */
1887 [CCode (cprefix = "G_LOG_", has_type_id = false)]
1888 public enum LogLevelFlags {
1893 /* GLib log levels */
1906 public void log (string? log_domain, LogLevelFlags log_level, string format, ...);
1910 public void message (string format, ...);
1913 public void warning (string format, ...);
1916 public void critical (string format, ...);
1919 public void error (string format, ...);
1922 public void debug (string format, ...);
1924 public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message);
1927 public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
1928 public static void set_default_handler (LogFunc log_func);
1929 public static void default_handler (string? log_domain, LogLevelFlags log_level, string message, void* unused_data = null);
1930 public static void set_fatal_mask (string log_domain, LogLevelFlags log_levels);
1931 public static void set_always_fatal (LogLevelFlags log_levels);
1933 public const string FILE;
1934 public const int LINE;
1935 public const string METHOD;
1938 [CCode (has_type_id = false)]
1939 public struct DebugKey {
1944 public uint parse_debug_string (string? debug_string, DebugKey[] keys);
1946 /* String Utility Functions */
1948 public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array);
1950 [CCode (cname = "errno", cheader_filename = "errno.h")]
1952 public unowned string strerror (int errnum);
1954 /* Character Set Conversions */
1956 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;
1957 public static bool get_charset (out unowned string charset);
1959 public struct IConv {
1960 [CCode (cname = "g_iconv_open")]
1961 public IConv (string to_codeset, string from_codeset);
1962 [CCode (cname = "g_iconv")]
1963 public uint iconv (out string inbuf, out uint inbytes_left, out string outbuf, out uint outbytes_left);
1964 public int close ();
1967 namespace Filename {
1968 public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
1969 public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError;
1970 public static string from_uri (string uri, out string hostname = null) throws ConvertError;
1971 public static string to_uri (string filename, string? hostname = null) throws ConvertError;
1972 public static string display_name (string filename);
1973 public static string display_basename (string filename);
1976 public errordomain ConvertError {
1985 /* Base64 Encoding */
1988 public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save);
1989 public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
1990 public static string encode (uchar[] data);
1991 public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
1992 [CCode (array_length_type = "size_t")]
1993 public static uchar[] decode (string text);
1996 /* Data Checksums */
1998 [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)]
1999 public enum ChecksumType {
2004 public ssize_t get_length ();
2008 [CCode (free_function = "g_checksum_free")]
2009 public class Checksum {
2010 public Checksum (ChecksumType checksum_type);
2011 public Checksum copy ();
2012 public void update ([CCode (array_length = false)] uchar[] data, size_t length);
2013 public unowned string get_string ();
2014 public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
2015 [CCode (cname = "g_compute_checksum_for_data")]
2016 public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
2017 [CCode (cname = "g_compute_checksum_for_string")]
2018 public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1);
2021 /* Date and Time Functions */
2023 [CCode (has_type_id = false)]
2024 public struct TimeVal {
2026 public long tv_usec;
2028 [CCode (cname = "g_get_current_time")]
2030 [CCode (cname = "g_get_current_time")]
2031 public void get_current_time ();
2032 public void add (long microseconds);
2033 [CCode (instance_pos = -1)]
2034 public bool from_iso8601 (string iso_date);
2035 [InstanceByReference]
2036 public string to_iso8601 ();
2039 public struct DateDay : uchar {
2040 [CCode (cname = "G_DATE_BAD_DAY")]
2041 public static DateDay BAD_DAY;
2043 [CCode (cname = "g_date_valid_day")]
2044 public bool valid ();
2047 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2048 public enum DateMonth {
2063 [CCode (cname = "g_date_get_days_in_month")]
2064 public uchar get_days_in_month (DateYear year);
2065 [CCode (cname = "g_date_valid_month")]
2066 public bool valid ();
2069 public struct DateYear : ushort {
2070 [CCode (cname = "G_DATE_BAD_YEAR")]
2071 public static DateDay BAD_YEAR;
2073 [CCode (cname = "g_date_is_leap_year")]
2074 public bool is_leap_year ();
2075 [CCode (cname = "g_date_get_monday_weeks_in_year")]
2076 public uchar get_monday_weeks_in_year ();
2077 [CCode (cname = "g_date_get_sunday_weeks_in_year")]
2078 public uchar get_sunday_weeks_in_year ();
2079 [CCode (cname = "g_date_valid_year")]
2080 public bool valid ();
2083 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2084 public enum DateWeekday {
2094 [CCode (cname = "g_date_valid_weekday")]
2095 public bool valid ();
2098 [CCode (cprefix = "G_DATE_", has_type_id = false)]
2099 public enum DateDMY {
2105 [CCode (type_id = "G_TYPE_DATE")]
2106 public struct Date {
2107 public void clear (uint n_dates = 1);
2108 public void set_day (DateDay day);
2109 public void set_month (DateMonth month);
2110 public void set_year (DateYear year);
2111 public void set_dmy (DateDay day, int month, DateYear y);
2112 public void set_julian (uint julian_day);
2113 public void set_time_t (time_t timet);
2114 public void set_time_val (TimeVal timeval);
2115 public void set_parse (string str);
2116 public void add_days (uint n_days);
2117 public void subtract_days (uint n_days);
2118 public void add_months (uint n_months);
2119 public void subtract_months (uint n_months);
2120 public void add_years (uint n_years);
2121 public void subtract_years (uint n_years);
2122 public int days_between (Date date2);
2123 public int compare (Date rhs);
2124 public void clamp (Date min_date, Date max_date);
2125 public void order (Date date2);
2126 public DateDay get_day ();
2127 public DateMonth get_month ();
2128 public DateYear get_year ();
2129 public uint get_julian ();
2130 public DateWeekday get_weekday ();
2131 public uint get_day_of_year ();
2132 public bool is_first_of_month ();
2133 public bool is_last_of_month ();
2134 public uint get_monday_week_of_year ();
2135 public uint get_sunday_week_of_year ();
2136 public uint get_iso8601_week_of_year ();
2137 [CCode (instance_pos = -1)]
2138 public size_t strftime (char[] s, string format);
2139 [CCode (cname = "g_date_to_struct_tm")]
2140 public void to_time (out Time tm);
2141 public bool valid ();
2142 public static uchar get_days_in_month (DateMonth month, DateYear year);
2143 public static bool valid_day (DateDay day);
2144 public static bool valid_dmy (DateDay day, DateMonth month, DateYear year);
2145 public static bool valid_julian (uint julian_date);
2146 public static bool valid_weekday (DateWeekday weekday);
2149 [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)]
2150 public struct Time {
2151 [CCode (cname = "tm_sec")]
2153 [CCode (cname = "tm_min")]
2155 [CCode (cname = "tm_hour")]
2157 [CCode (cname = "tm_mday")]
2159 [CCode (cname = "tm_mon")]
2161 [CCode (cname = "tm_year")]
2163 [CCode (cname = "tm_wday")]
2165 [CCode (cname = "tm_yday")]
2166 public int day_of_year;
2167 [CCode (cname = "tm_isdst")]
2170 [CCode (cname = "gmtime_r")]
2171 static void gmtime_r (ref time_t time, out Time result);
2172 [CCode (cname = "localtime_r")]
2173 static void localtime_r (ref time_t time, out Time result);
2175 public static Time gm (time_t time) {
2177 gmtime_r (ref time, out result);
2180 public static Time local (time_t time) {
2182 localtime_r (ref time, out result);
2186 public string to_string () {
2187 return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second);
2190 public string format (string format) {
2191 var buffer = new char[64];
2192 this.strftime (buffer, format);
2193 return (string) buffer;
2196 [CCode (cname = "mktime")]
2197 public time_t mktime ();
2199 [CCode (cname = "strftime", instance_pos = -1)]
2200 public size_t strftime (char[] s, string format);
2201 [CCode (cname = "strptime", instance_pos = -1)]
2202 public unowned string? strptime (string buf, string format);
2205 /* Random Numbers */
2208 [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
2210 public Rand.with_seed (uint32 seed);
2211 public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2213 public void set_seed (uint32 seed);
2214 public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
2215 public bool boolean ();
2216 [CCode (cname = "g_rand_int")]
2217 public uint32 next_int ();
2218 public int32 int_range (int32 begin, int32 end);
2219 [CCode (cname = "g_rand_double")]
2220 public double next_double ();
2221 public double double_range (double begin, double end);
2225 public static void set_seed (uint32 seed);
2226 public static bool boolean ();
2227 [CCode (cname = "g_random_int")]
2228 public static uint32 next_int ();
2229 public static int32 int_range (int32 begin, int32 end);
2230 [CCode (cname = "g_random_double")]
2231 public static double next_double ();
2232 public static double double_range (double begin, double end);
2235 /* Miscellaneous Utility Functions */
2237 namespace Environment {
2238 [CCode (cname = "g_get_application_name")]
2239 public static unowned string? get_application_name ();
2240 [CCode (cname = "g_set_application_name")]
2241 public static void set_application_name (string application_name);
2242 [CCode (cname = "g_get_prgname")]
2243 public static unowned string get_prgname ();
2244 [CCode (cname = "g_set_prgname")]
2245 public static void set_prgname (string application_name);
2246 [CCode (cname = "g_getenv")]
2247 public static unowned string? get_variable (string variable);
2248 [CCode (cname = "g_setenv")]
2249 public static bool set_variable (string variable, string value, bool overwrite);
2250 [CCode (cname = "g_unsetenv")]
2251 public static void unset_variable (string variable);
2252 [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)]
2253 public static string[] list_variables ();
2254 [CCode (cname = "g_get_user_name")]
2255 public static unowned string get_user_name ();
2256 [CCode (cname = "g_get_real_name")]
2257 public static unowned string get_real_name ();
2258 [CCode (cname = "g_get_user_cache_dir")]
2259 public static unowned string get_user_cache_dir ();
2260 [CCode (cname = "g_get_user_data_dir")]
2261 public static unowned string get_user_data_dir ();
2262 [CCode (cname = "g_get_user_config_dir")]
2263 public static unowned string get_user_config_dir ();
2264 [CCode (cname = "g_get_user_special_dir")]
2265 public static unowned string get_user_special_dir (UserDirectory directory);
2266 [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)]
2267 public static unowned string[] get_system_data_dirs ();
2268 [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)]
2269 public static unowned string[] get_system_config_dirs ();
2270 [CCode (cname = "g_get_host_name")]
2271 public static unowned string get_host_name ();
2272 [CCode (cname = "g_get_home_dir")]
2273 public static unowned string get_home_dir ();
2274 [CCode (cname = "g_get_tmp_dir")]
2275 public static unowned string get_tmp_dir ();
2276 [CCode (cname = "g_get_current_dir")]
2277 public static string get_current_dir ();
2278 [CCode (cname = "g_find_program_in_path")]
2279 public static string? find_program_in_path (string program);
2280 [CCode (cname = "g_atexit")]
2281 public static void atexit (VoidFunc func);
2282 [CCode (cname = "g_chdir")]
2283 public static int set_current_dir (string path);
2286 [CCode (has_type_id = false)]
2287 public enum UserDirectory {
2299 public static bool is_absolute (string file_name);
2300 public static unowned string skip_root (string file_name);
2301 public static string get_basename (string file_name);
2302 public static string get_dirname (string file_name);
2303 [CCode (cname = "g_build_filename")]
2304 public static string build_filename (string first_element, ...);
2305 [CCode (cname = "g_build_path")]
2306 public static string build_path (string separator, string first_element, ...);
2308 [CCode (cname = "G_DIR_SEPARATOR")]
2309 public const char DIR_SEPARATOR;
2310 [CCode (cname = "G_DIR_SEPARATOR_S")]
2311 public const string DIR_SEPARATOR_S;
2312 [CCode (cname = "G_IS_DIR_SEPARATOR")]
2313 public static bool is_dir_separator (unichar c);
2314 [CCode (cname = "G_SEARCHPATH_SEPARATOR")]
2315 public const char SEARCHPATH_SEPARATOR;
2316 [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")]
2317 public const string SEARCHPATH_SEPARATOR_S;
2321 public static int nth_lsf (ulong mask, int nth_bit);
2322 public static int nth_msf (ulong mask, int nth_bit);
2323 public static uint storage (ulong number);
2326 namespace SpacedPrimes {
2327 public static uint closest (uint num);
2330 [CCode (has_target = false)]
2331 public delegate void FreeFunc (void* data);
2332 [CCode (has_target = false)]
2333 public delegate void VoidFunc ();
2335 public string format_size_for_display (int64 size);
2337 /* Lexical Scanner */
2338 [CCode (has_target = false)]
2339 public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error);
2342 [CCode (free_function = "g_scanner_destroy")]
2343 public class Scanner {
2344 public unowned string input_name;
2345 public TokenType token;
2346 public TokenValue value;
2348 public uint position;
2349 public TokenType next_token;
2350 public TokenValue next_value;
2351 public uint next_line;
2352 public uint next_position;
2353 public ScannerMsgFunc msg_handler;
2354 public ScannerConfig? config;
2355 public Scanner (ScannerConfig? config_templ);
2356 public void input_file (int input_fd);
2357 public void sync_file_offset ();
2358 public void input_text (string text, uint text_len);
2359 public TokenType peek_next_token ();
2360 public TokenType get_next_token ();
2362 public int cur_line ();
2363 public int cur_position ();
2364 public TokenType cur_token ();
2365 public TokenValue cur_value ();
2366 public uint set_scope (uint scope_id);
2367 public void scope_add_symbol (uint scope_id, string symbol, void* value);
2368 public void scope_foreach_symbol (uint scope_id, HFunc func);
2369 public void* scope_lookup_symbol (uint scope_id, string symbol);
2370 public void scope_remove_symbol (uint scope_id, string symbol);
2371 public void* lookup_symbol (string symbol);
2373 public void warn (string format, ...);
2375 public void error (string format, ...);
2376 public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error);
2379 public struct ScannerConfig {
2380 public string* cset_skip_characters;
2381 public string* cset_identifier_first;
2382 public string* cset_identifier_nth;
2383 public string* cpair_comment_single;
2384 public bool case_sensitive;
2385 public bool skip_comment_multi;
2386 public bool skip_comment_single;
2387 public bool scan_comment_multi;
2388 public bool scan_identifier;
2389 public bool scan_identifier_1char;
2390 public bool scan_identifier_NULL;
2391 public bool scan_symbols;
2392 public bool scan_binary;
2393 public bool scan_octal;
2394 public bool scan_float;
2395 public bool scan_hex;
2396 public bool scan_hex_dollar;
2397 public bool scan_string_sq;
2398 public bool scan_string_dq;
2399 public bool numbers_2_int;
2400 public bool int_2_float;
2401 public bool identifier_2_string;
2402 public bool char_2_token;
2403 public bool symbol_2_token;
2404 public bool scope_0_fallback;
2405 public bool store_int64;
2408 [CCode (lower_case_cprefix="G_CSET_")]
2409 namespace CharacterSet {
2410 public const string A_2_Z;
2411 public const string a_2_z;
2412 public const string DIGITS;
2413 public const string LATINC;
2414 public const string LATINS;
2417 [CCode (cprefix = "G_TOKEN_", has_type_id = false)]
2418 public enum TokenType
2447 public struct TokenValue {
2448 [CCode (cname="v_symbol")]
2449 public void* symbol;
2450 [CCode (cname="v_identifier")]
2451 public unowned string identifier;
2452 [CCode (cname="v_binary")]
2453 public ulong binary;
2454 [CCode (cname="v_octal")]
2456 [CCode (cname="v_int")]
2458 [CCode (cname="v_int64")]
2460 [CCode (cname="v_float")]
2461 public double float;
2462 [CCode (cname="v_hex")]
2464 [CCode (cname="v_string")]
2465 public unowned string string;
2466 [CCode (cname="v_comment")]
2467 public unowned string comment;
2468 [CCode (cname="v_char")]
2470 [CCode (cname="v_error")]
2474 [CCode (cprefix = "G_ERR_", has_type_id = false)]
2475 public enum ErrorType
2479 UNEXP_EOF_IN_STRING,
2480 UNEXP_EOF_IN_COMMENT,
2487 /* Automatic String Completion */
2490 [CCode (free_function = "g_completion_free")]
2491 public class Completion {
2492 public Completion (CompletionFunc? func = null);
2493 public List<void*> items;
2494 public CompletionFunc func;
2495 public string prefix;
2496 public List<void*> cache;
2497 public CompletionStrncmpFunc strncmp_func;
2498 public void add_items (List<void*> items);
2499 public void remove_items (List<void*> items);
2500 public void clear_items ();
2501 public unowned List<void*> complete (string prefix, out string? new_prefix = null);
2502 public unowned List<void*> complete_utf8 (string prefix, out string? new_prefix = null);
2505 [CCode (has_target = false)]
2506 public delegate string CompletionFunc (void* item);
2507 [CCode (has_target = false)]
2508 public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n);
2513 [CCode (free_function = "g_timer_destroy")]
2514 public class Timer {
2516 public void start ();
2517 public void stop ();
2518 public void @continue ();
2519 public double elapsed (out ulong microseconds = null);
2520 public void reset ();
2523 /* Spawning Processes */
2525 public errordomain SpawnError {
2548 [CCode (cprefix = "G_SPAWN_", has_type_id = false)]
2549 public enum SpawnFlags {
2550 LEAVE_DESCRIPTORS_OPEN,
2555 CHILD_INHERITS_STDIN,
2559 public delegate void SpawnChildSetupFunc ();
2561 [CCode (lower_case_cprefix = "g_")]
2563 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;
2564 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;
2565 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;
2566 public static bool spawn_command_line_async (string command_line) throws SpawnError;
2567 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;
2568 [CCode (cname = "g_spawn_close_pid")]
2569 public static void close_pid (Pid pid);
2571 /* these macros are required to examine the exit status of a process */
2572 [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")]
2573 public static bool if_exited (int status);
2574 [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")]
2575 public static int exit_status (int status);
2576 [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")]
2577 public static bool if_signaled (int status);
2578 [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")]
2579 public static ProcessSignal term_sig (int status);
2580 [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")]
2581 public static bool core_dump (int status);
2582 [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")]
2583 public static bool if_stopped (int status);
2584 [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")]
2585 public static ProcessSignal stop_sig (int status);
2586 [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")]
2587 public static bool if_continued (int status);
2590 [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")]
2591 public enum ProcessSignal {
2616 /* File Utilities */
2618 public errordomain FileError {
2646 [CCode (has_type_id = false)]
2647 public enum FileTest {
2655 [CCode (cprefix = "SEEK_", has_type_id = false)]
2656 public enum FileSeek {
2663 [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
2664 public class FileStream {
2665 [CCode (cname = "EOF", cheader_filename = "stdio.h")]
2666 public const int EOF;
2668 [CCode (cname = "fopen")]
2669 public static FileStream? open (string path, string mode);
2670 [CCode (cname = "fdopen")]
2671 public static FileStream? fdopen (int fildes, string mode);
2672 [CCode (cname = "fprintf")]
2674 public void printf (string format, ...);
2675 [CCode (cname = "fputc", instance_pos = -1)]
2676 public void putc (char c);
2677 [CCode (cname = "fputs", instance_pos = -1)]
2678 public void puts (string s);
2679 [CCode (cname = "fgetc")]
2681 [CCode (cname = "fgets", instance_pos = -1)]
2682 public unowned string gets (char[] s);
2683 [CCode (cname = "feof")]
2685 [CCode (cname = "fscanf"), ScanfFormat]
2686 public int scanf (string format, ...);
2687 [CCode (cname = "fflush")]
2688 public int flush ();
2689 [CCode (cname = "fseek")]
2690 public int seek (long offset, FileSeek whence);
2691 [CCode (cname = "ftell")]
2692 public long tell ();
2693 [CCode (cname = "rewind")]
2694 public void rewind ();
2695 [CCode (cname = "fileno")]
2696 public int fileno ();
2697 [CCode (cname = "ferror")]
2698 public int error ();
2699 [CCode (cname = "clearerr")]
2700 public void clearerr ();
2701 [CCode (cname = "fread", instance_pos = -1)]
2702 public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
2703 [CCode (cname = "fwrite", instance_pos = -1)]
2704 public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1);
2706 public string? read_line () {
2708 StringBuilder? ret = null;
2709 while ((c = getc ()) != EOF) {
2711 ret = new StringBuilder ();
2716 ret.append_c ((char) c);
2726 [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
2727 namespace FileUtils {
2728 public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError;
2729 public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError;
2730 [CCode (cname = "g_file_get_contents")]
2731 public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "size_t")] out uint8[] contents) throws FileError;
2732 [CCode (cname = "g_file_set_contents")]
2733 public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "size_t")] uint8[] contents) throws FileError;
2734 public static bool test (string filename, FileTest test);
2735 public static int open_tmp (string tmpl, out string name_used) throws FileError;
2736 public static string read_link (string filename) throws FileError;
2738 [CCode (cname = "g_mkstemp")]
2739 public static int mkstemp (string tmpl);
2740 [CCode (cname = "g_rename")]
2741 public static int rename (string oldfilename, string newfilename);
2742 [CCode (cname = "g_remove")]
2743 public static int remove (string filename);
2744 [CCode (cname = "g_unlink")]
2745 public static int unlink (string filename);
2746 [CCode (cname = "g_chmod")]
2747 public static int chmod (string filename, int mode);
2749 [CCode (cname = "symlink")]
2750 public static int symlink (string oldpath, string newpath);
2752 [CCode (cname = "close", cheader_filename = "unistd.h")]
2753 public static int close (int fd);
2756 [CCode (cname = "stat")]
2757 public struct Stat {
2761 [CCode (free_function = "g_dir_close")]
2763 public static Dir open (string filename, uint _flags = 0) throws FileError;
2764 public unowned string? read_name ();
2765 public void rewind ();
2768 namespace DirUtils {
2769 [CCode (cname = "g_mkdir")]
2770 public static int create (string pathname, int mode);
2771 [CCode (cname = "g_mkdir_with_parents")]
2772 public static int create_with_parents (string pathname, int mode);
2773 [CCode (cname = "mkdtemp")]
2774 public static unowned string mkdtemp (string template);
2775 [CCode (cname = "g_rmdir")]
2776 public static int remove (string filename);
2781 [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref")]
2783 [CCode (free_function = "g_mapped_file_free")]
2785 public class MappedFile {
2786 public MappedFile (string filename, bool writable) throws FileError;
2787 public size_t get_length ();
2788 public unowned char* get_contents ();
2791 [CCode (cname = "stdin", cheader_filename = "stdio.h")]
2792 public static FileStream stdin;
2794 [CCode (cname = "stdout", cheader_filename = "stdio.h")]
2795 public static FileStream stdout;
2797 [CCode (cname = "stderr", cheader_filename = "stdio.h")]
2798 public static FileStream stderr;
2803 public const string RESERVED_CHARS_ALLOWED_IN_PATH;
2804 public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
2805 public const string RESERVED_CHARS_ALLOWED_IN_USERINFO;
2806 public const string RESERVED_CHARS_GENERIC_DELIMITERS;
2807 public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS;
2809 public static string parse_scheme (string uri);
2810 public static string escape_string (string unescaped, string reserved_chars_allowed, bool allow_utf8);
2811 public static string unescape_string (string escaped_string, string? illegal_characters = null);
2812 public static string unescape_segment (string escaped_string, string escaped_string_end, string? illegal_characters = null);
2813 [CCode (array_length = false, array_null_terminated = true)]
2814 public static string[] list_extract_uris (string uri_list);
2817 /* Shell-related Utilities */
2819 public errordomain ShellError {
2826 public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError;
2827 public static string quote (string unquoted_string);
2828 public static string unquote (string quoted_string) throws ShellError;
2831 /* Commandline option parser */
2833 public errordomain OptionError {
2840 [CCode (free_function = "g_option_context_free")]
2841 public class OptionContext {
2842 public OptionContext (string parameter_string);
2843 public void set_summary (string summary);
2844 public unowned string get_summary ();
2845 public void set_description (string description);
2846 public void get_description ();
2847 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
2848 public void set_translation_domain (string domain);
2849 public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError;
2850 public void set_help_enabled (bool help_enabled);
2851 public bool get_help_enabled ();
2852 public void set_ignore_unknown_options (bool ignore_unknown);
2853 public bool get_ignore_unknown_options ();
2854 public string get_help (bool main_help, OptionGroup? group);
2855 public void add_main_entries ([CCode (array_length = false)] OptionEntry[] entries, string? translation_domain);
2856 public void add_group (owned OptionGroup group);
2857 public void set_main_group (owned OptionGroup group);
2858 public unowned OptionGroup get_main_group ();
2861 public delegate unowned string TranslateFunc (string str);
2863 [CCode (has_type_id = false)]
2864 public enum OptionArg {
2877 [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)]
2878 public enum OptionFlags {
2888 public struct OptionEntry {
2889 public unowned string long_name;
2890 public char short_name;
2893 public OptionArg arg;
2894 public void* arg_data;
2896 public unowned string description;
2897 public unowned string arg_description;
2901 [CCode (free_function = "g_option_group_free")]
2902 public class OptionGroup {
2903 public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null);
2904 public void add_entries ([CCode (array_length = false)] OptionEntry[] entries);
2905 public void set_parse_hooks (OptionParseFunc pre_parse_func, OptionParseFunc post_parse_hook);
2906 public void set_error_hook (OptionErrorFunc error_func);
2907 public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
2908 public void set_translation_domain (string domain);
2911 [CCode (has_target = false)]
2912 public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError;
2913 [CCode (has_target = false)]
2914 public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error);
2916 /* Perl-compatible regular expressions */
2918 public errordomain RegexError {
2925 [CCode (cprefix = "G_REGEX_", has_type_id = false)]
2926 public enum RegexCompileFlags {
2943 [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)]
2944 public enum RegexMatchFlags {
2957 [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")]
2958 public class Regex {
2959 public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
2960 public unowned string get_pattern ();
2961 public int get_max_backref ();
2962 public int get_capture_count ();
2963 public int get_string_number (string name);
2964 public static string escape_string (string str, int length = -1);
2965 public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
2966 public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
2967 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;
2968 public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
2969 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;
2970 [CCode (array_length = false, array_null_terminated = true)]
2971 public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
2972 [CCode (array_length = false, array_null_terminated = true)]
2973 public string[] split (string str, RegexMatchFlags match_options = 0);
2974 [CCode (array_length = false, array_null_terminated = true)]
2975 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;
2976 public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
2977 public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
2978 public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval) throws RegexError;
2979 public static bool check_replacement (out bool has_references = null) throws RegexError;
2982 public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
2985 [CCode (free_function = "g_match_info_free")]
2986 public class MatchInfo {
2987 public unowned Regex get_regex ();
2988 public unowned string get_string ();
2989 public bool matches ();
2990 public bool next () throws RegexError;
2991 public int get_match_count ();
2992 public bool is_partial_match ();
2993 public string expand_references (string string_to_expand) throws RegexError;
2994 public string? fetch (int match_num);
2995 public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
2996 public string? fetch_named (string name);
2997 public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
2998 [CCode (array_length = false, array_null_terminated = true)]
2999 public string[] fetch_all ();
3002 /* Simple XML Subset Parser
3003 See http://live.gnome.org/Vala/MarkupSample for an example */
3005 public errordomain MarkupError {
3015 [CCode (cprefix = "G_MARKUP_", has_type_id = false)]
3016 public enum MarkupParseFlags {
3021 [CCode (free_function = "g_markup_parse_context_free")]
3022 public class MarkupParseContext {
3023 public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
3024 public bool parse (string text, ssize_t text_len) throws MarkupError;
3025 public bool end_parse () throws MarkupError;
3026 public unowned string get_element ();
3027 public unowned SList<string> get_element_stack ();
3028 public void get_position (out int line_number, out int char_number);
3029 public void push (MarkupParser parser, void* user_data);
3030 public void* pop ();
3033 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;
3035 public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
3037 public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
3039 public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
3041 public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
3043 public struct MarkupParser {
3044 public unowned MarkupParserStartElementFunc start_element;
3045 public unowned MarkupParserEndElementFunc end_element;
3046 public unowned MarkupParserTextFunc text;
3047 public unowned MarkupParserPassthroughFunc passthrough;
3048 public unowned MarkupParserErrorFunc error;
3052 [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)]
3053 public enum CollectType {
3062 public static string escape_text (string text, ssize_t length = -1);
3064 public static string printf_escaped (string format, ...);
3065 public static string vprintf_escaped (string format, va_list args);
3066 [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")]
3067 public static bool collect_attributes (string element_name, string[] attribute_names, string[] attribute_values, ...) throws MarkupError;
3070 /* Key-value file parser */
3072 public errordomain KeyFileError {
3082 [CCode (free_function = "g_key_file_free")]
3083 public class KeyFile {
3085 public void set_list_separator (char separator);
3086 public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError;
3087 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;
3088 public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError;
3089 public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError;
3090 // g_key_file_to_data never throws an error according to the documentation
3091 public string to_data (out size_t length = null, out GLib.Error error = null);
3092 public string get_start_group ();
3093 [CCode (array_length_type = "gsize")]
3094 public string[] get_groups ();
3095 [CCode (array_length_type = "gsize")]
3096 public string[] get_keys (string group_name) throws KeyFileError;
3097 public bool has_group (string group_name);
3098 public bool has_key (string group_name, string key) throws KeyFileError;
3099 public string get_value (string group_name, string key) throws KeyFileError;
3100 public string get_string (string group_name, string key) throws KeyFileError;
3101 public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError;
3102 public bool get_boolean (string group_name, string key) throws KeyFileError;
3103 public int get_integer (string group_name, string key) throws KeyFileError;
3104 public double get_double (string group_name, string key) throws KeyFileError;
3105 [CCode (array_length_type = "gsize")]
3106 public string[] get_string_list (string group_name, string key) throws KeyFileError;
3107 [CCode (array_length_type = "gsize")]
3108 public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError;
3109 [CCode (array_length_type = "gsize")]
3110 public bool[] get_boolean_list (string group_name, string key) throws KeyFileError;
3111 [CCode (array_length_type = "gsize")]
3112 public int[] get_integer_list (string group_name, string key) throws KeyFileError;
3113 [CCode (array_length_type = "gsize")]
3114 public double[] get_double_list (string group_name, string key) throws KeyFileError;
3115 public string get_comment (string group_name, string key) throws KeyFileError;
3116 public void set_value (string group_name, string key, string value);
3117 public void set_string (string group_name, string key, string str);
3118 public void set_locale_string (string group_name, string key, string locale, string str);
3119 public void set_boolean (string group_name, string key, bool value);
3120 public void set_integer (string group_name, string key, int value);
3121 public void set_double (string group_name, string key, double value);
3122 public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list);
3123 public void set_locale_string_list (string group_name, string key, string locale, string[] list);
3124 public void set_boolean_list (string group_name, string key, bool[] list);
3125 public void set_integer_list (string group_name, string key, int[] list);
3126 public void set_double_list (string group_name, string key, double[] list);
3127 public void set_comment (string group_name, string key, string comment) throws KeyFileError;
3128 public void remove_group (string group_name) throws KeyFileError;
3129 public void remove_key (string group_name, string key) throws KeyFileError;
3130 public void remove_comment (string group_name, string key) throws KeyFileError;
3133 [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)]
3134 public enum KeyFileFlags {
3140 [CCode (cprefix = "G_KEY_FILE_DESKTOP_")]
3141 namespace KeyFileDesktop {
3142 public static const string GROUP;
3143 public static const string KEY_TYPE;
3144 public static const string KEY_VERSION;
3145 public static const string KEY_NAME;
3146 public static const string KEY_GENERIC_NAME;
3147 public static const string KEY_NO_DISPLAY;
3148 public static const string KEY_COMMENT;
3149 public static const string KEY_ICON;
3150 public static const string KEY_HIDDEN;
3151 public static const string KEY_ONLY_SHOW_IN;
3152 public static const string KEY_NOT_SHOW_IN;
3153 public static const string KEY_TRY_EXEC;
3154 public static const string KEY_EXEC;
3155 public static const string KEY_PATH;
3156 public static const string KEY_TERMINAL;
3157 public static const string KEY_MIME_TYPE;
3158 public static const string KEY_CATEGORIES;
3159 public static const string KEY_STARTUP_NOTIFY;
3160 public static const string KEY_STARTUP_WM_CLASS;
3161 public static const string KEY_URL;
3162 public static const string TYPE_APPLICATION;
3163 public static const string TYPE_LINK;
3164 public static const string TYPE_DIRECTORY;
3167 /* Bookmark file parser */
3170 [CCode (free_function = "g_bookmark_file_free")]
3171 public class BookmarkFile {
3172 public BookmarkFile ();
3173 public bool load_from_file (string file) throws BookmarkFileError;
3174 public bool load_from_data (string data, size_t length) throws BookmarkFileError;
3175 public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError;
3176 public string to_data (out size_t length) throws BookmarkFileError;
3177 public bool to_file (string filename) throws BookmarkFileError;
3178 public bool has_item (string uri);
3179 public bool has_group (string uri, string group) throws BookmarkFileError;
3180 public bool has_application (string uri, string name) throws BookmarkFileError;
3181 public int get_size ();
3182 public string[] get_uris ();
3183 public string get_title (string uri) throws BookmarkFileError;
3184 public string get_description (string uri) throws BookmarkFileError;
3185 public string get_mime_type (string uri) throws BookmarkFileError;
3186 public bool get_is_private (string uri) throws BookmarkFileError;
3187 public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError;
3188 public time_t get_added (string uri) throws BookmarkFileError;
3189 public time_t get_modified (string uri) throws BookmarkFileError;
3190 public time_t get_visited (string uri) throws BookmarkFileError;
3191 public string[] get_groups (string uri) throws BookmarkFileError;
3192 public string[] get_applications (string uri) throws BookmarkFileError;
3193 public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError;
3194 public void set_title (string uri, string title);
3195 public void set_description (string uri, string description);
3196 public void set_mime_type (string uri, string mime_type);
3197 public void set_is_private (string uri, bool is_private);
3198 public void set_icon (string uri, string href, string mime_type);
3199 public void set_added (string uri, time_t added);
3200 public void set_groups (string uri, string[] groups);
3201 public void set_modified (string uri, time_t modified);
3202 public void set_visited (string uri, time_t visited);
3203 public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError;
3204 public void add_group (string uri, string group);
3205 public void add_application (string uri, string name, string exec);
3206 public bool remove_group (string uri, string group) throws BookmarkFileError;
3207 public bool remove_application (string uri, string name) throws BookmarkFileError;
3208 public bool remove_item (string uri) throws BookmarkFileError;
3209 public bool move_item (string old_uri, string new_uri) throws BookmarkFileError;
3212 public errordomain BookmarkFileError {
3227 public static void minimized_result (double minimized_quantity, string format, ...);
3229 public static void maximized_result (double maximized_quantity, string format, ...);
3230 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...);
3231 public static bool quick ();
3232 public static bool slow ();
3233 public static bool thorough ();
3234 public static bool perf ();
3235 public static bool verbose ();
3236 public static bool quiet ();
3237 public static int run ();
3238 public static void add_func (string testpath, Callback test_funcvoid);
3239 public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9)] DataTestFunc test_funcvoid);
3241 public static void message (string format, ...);
3242 public static void bug_base (string uri_pattern);
3243 public static void bug (string bug_uri_snippet);
3244 public static void timer_start ();
3245 public static double timer_elapsed ();
3246 public static double timer_last ();
3247 public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags);
3248 public static bool trap_has_passed ();
3249 public static bool trap_reached_timeout ();
3250 public static void trap_assert_passed ();
3251 public static void trap_assert_failed ();
3252 public static void trap_assert_stdout (string soutpattern);
3253 public static void trap_assert_stdout_unmatched (string soutpattern);
3254 public static void trap_assert_stderr (string serrpattern);
3255 public static void trap_assert_stderr_unmatched (string serrpattern);
3256 public static bool rand_bit ();
3257 public static int32 rand_int ();
3258 public static int32 rand_int_range (int32 begin, int32 end);
3259 public static double rand_double ();
3260 public static double rand_double_range ();
3261 public static void log_set_fatal_handler (LogFatalFunc log_func);
3264 public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message);
3267 [CCode (cname = "GTestCase", ref_function = "", unref_function = "")]
3268 public class TestCase {
3269 [CCode (cname = "g_test_create_case")]
3270 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);
3274 [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")]
3275 public class TestSuite {
3276 [CCode (cname = "g_test_create_suite")]
3277 public TestSuite (string name);
3278 [CCode (cname = "g_test_get_root")]
3279 public static TestSuite get_root ();
3280 [CCode (cname = "g_test_suite_add")]
3281 public void add (TestCase test_case);
3282 [CCode (cname = "g_test_suite_add_suite")]
3283 public void add_suite (TestSuite test_suite);
3286 public delegate void TestFunc (void* fixture);
3287 public delegate void DataTestFunc ();
3290 [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)]
3291 public enum TestTrapFlags {
3297 /* Doubly-Linked Lists */
3300 [CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
3301 public class List<G> {
3304 [ReturnsModifiedPointer ()]
3305 public void append (owned G data);
3306 [ReturnsModifiedPointer ()]
3307 public void prepend (owned G data);
3308 [ReturnsModifiedPointer ()]
3309 public void insert (owned G data, int position);
3310 [ReturnsModifiedPointer ()]
3311 public void insert_before (List<G> sibling, owned G data);
3312 [ReturnsModifiedPointer ()]
3313 public void insert_sorted (owned G data, CompareFunc compare_func);
3314 [ReturnsModifiedPointer ()]
3315 public void remove (G data);
3316 [ReturnsModifiedPointer ()]
3317 public void remove_link (List<G> llink);
3318 [ReturnsModifiedPointer ()]
3319 public void delete_link (List<G> link_);
3320 [ReturnsModifiedPointer ()]
3321 public void remove_all (G data);
3323 public uint length ();
3324 public List<unowned G> copy ();
3325 [ReturnsModifiedPointer ()]
3326 public void reverse ();
3327 [ReturnsModifiedPointer ()]
3328 public void sort (CompareFunc compare_func);
3329 [ReturnsModifiedPointer ()]
3330 public void insert_sorted_with_data (owned G data, CompareDataFunc compare_func);
3331 [ReturnsModifiedPointer ()]
3332 public void sort_with_data (CompareDataFunc compare_func);
3333 [ReturnsModifiedPointer ()]
3334 public void concat (owned List<G> list2);
3335 public void @foreach (Func func);
3337 public unowned List<G> first ();
3338 public unowned List<G> last ();
3339 public unowned List<G> nth (uint n);
3340 public unowned G nth_data (uint n);
3341 public unowned List<G> nth_prev (uint n);
3343 public unowned List<G> find (G data);
3344 public unowned List<G> find_custom (G data, CompareFunc func);
3345 public int position (List<G> llink);
3346 public int index (G data);
3349 public List<G> next;
3350 public unowned List<G> prev;
3353 /* Singly-Linked Lists */
3356 [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
3357 public class SList<G> {
3360 [ReturnsModifiedPointer ()]
3361 public void append (owned G data);
3362 [ReturnsModifiedPointer ()]
3363 public void prepend (owned G data);
3364 [ReturnsModifiedPointer ()]
3365 public void insert (owned G data, int position);
3366 [ReturnsModifiedPointer ()]
3367 public void insert_before (SList<G> sibling, owned G data);
3368 [ReturnsModifiedPointer ()]
3369 public void insert_sorted (owned G data, CompareFunc compare_func);
3370 [ReturnsModifiedPointer ()]
3371 public void remove (G data);
3372 [ReturnsModifiedPointer ()]
3373 public void remove_link (SList<G> llink);
3374 [ReturnsModifiedPointer ()]
3375 public void delete_link (SList<G> link_);
3376 [ReturnsModifiedPointer ()]
3377 public void remove_all (G data);
3379 public uint length ();
3380 public SList<unowned G> copy ();
3381 [ReturnsModifiedPointer ()]
3382 public void reverse ();
3383 [ReturnsModifiedPointer ()]
3384 public void insert_sorted_with_data (owned G data, CompareDataFunc compare_func);
3385 [ReturnsModifiedPointer ()]
3386 public void sort (CompareFunc compare_func);
3387 [ReturnsModifiedPointer ()]
3388 public void sort_with_data (CompareDataFunc compare_func);
3389 [ReturnsModifiedPointer ()]
3390 public void concat (owned SList<G> list2);
3391 public void @foreach (Func func);
3393 public unowned SList<G> last ();
3394 public unowned SList<G> nth (uint n);
3395 public unowned G nth_data (uint n);
3397 public unowned SList<G> find (G data);
3398 public unowned SList<G> find_custom (G data, CompareFunc func);
3399 public int position (SList<G> llink);
3400 public int index (G data);
3403 public SList<G> next;
3406 [CCode (has_target = false)]
3407 public delegate int CompareFunc (void* a, void* b);
3409 public delegate int CompareDataFunc (void* a, void* b);
3411 [CCode (cname = "g_strcmp0")]
3412 public static GLib.CompareFunc strcmp;
3414 /* Double-ended Queues */
3417 [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
3418 public class Queue<G> {
3419 public unowned List<G> head;
3420 public unowned List<G> tail;
3425 public void clear ();
3426 public bool is_empty ();
3427 public uint get_length ();
3428 public void reverse ();
3429 public Queue copy ();
3430 public unowned List<G> find (G data);
3431 public unowned List<G> find_custom (G data, CompareFunc func);
3432 public void sort (CompareDataFunc compare_func);
3433 public void push_head (owned G data);
3434 public void push_tail (owned G data);
3435 public void push_nth (owned G data, int n);
3436 public G pop_head ();
3437 public G pop_tail ();
3438 public G pop_nth (uint n);
3439 public unowned G peek_head ();
3440 public unowned G peek_tail ();
3441 public unowned G peek_nth (uint n);
3442 public int index (G data);
3443 public void remove (G data);
3444 public void remove_all (G data);
3445 public void insert_before (List<G> sibling, owned G data);
3446 public void insert_after (List<G> sibling, owned G data);
3447 public void insert_sorted (owned G data, CompareDataFunc func);
3453 [CCode (free_function = "g_sequence_free")]
3454 public class Sequence<G> {
3455 public Sequence (DestroyNotify? data_destroy);
3456 public int get_length ();
3457 public void @foreach (Func func);
3458 public static void foreach_range (SequenceIter<G> begin, SequenceIter<G> end, Func func);
3459 public void sort (CompareDataFunc cmp_func);
3460 public void sort_iter (SequenceIterCompareFunc<G> func);
3461 public SequenceIter<G> get_begin_iter ();
3462 public SequenceIter<G> get_end_iter ();
3463 public SequenceIter<G> get_iter_at_pos (int pos);
3464 public SequenceIter<G> append (owned G data);
3465 public SequenceIter<G> prepend (owned G data);
3466 public static SequenceIter<G> insert_before (SequenceIter<G> iter, owned G data);
3467 public static void move (SequenceIter<G> src, SequenceIter<G> dest);
3468 public static void swap (SequenceIter<G> src, SequenceIter<G> dest);
3469 public SequenceIter<G> insert_sorted (owned G data, CompareDataFunc cmp_func);
3470 public SequenceIter<G> insert_sorted_iter (owned G data, SequenceIterCompareFunc<G> iter_cmp);
3471 public static void sort_changed (SequenceIter<G> iter, CompareDataFunc cmp_func);
3472 public static void sort_changed_iter (SequenceIter<G> iter, SequenceIterCompareFunc<G> iter_cmp);
3473 public static void remove (SequenceIter<G> iter);
3474 public static void remove_range (SequenceIter<G> begin, SequenceIter<G> end);
3475 public static void move_range (SequenceIter<G> dest, SequenceIter<G> begin, SequenceIter<G> end);
3476 public SequenceIter<G> search (G data, CompareDataFunc cmp_func);
3477 public SequenceIter<G> search_iter (G data, SequenceIterCompareFunc<G> iter_cmp);
3478 public static unowned G get (SequenceIter<G> iter);
3479 public static void set (SequenceIter<G> iter, owned G data);
3480 public static SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
3484 [CCode (ref_function = "", unref_function = "")]
3485 public class SequenceIter<G> {
3486 public bool is_begin ();
3487 public bool is_end ();
3488 public SequenceIter<G> next ();
3489 public SequenceIter<G> prev ();
3490 public int get_position ();
3491 public SequenceIter<G> move (int delta);
3492 public Sequence<G> get_sequence ();
3493 public int compare (SequenceIter<G> other);
3495 [CCode (cname = "g_sequence_get")]
3496 public unowned G get ();
3499 public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
3504 [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")]
3505 public class HashTable<K,V> {
3506 [CCode (cname = "g_hash_table_new_full", simple_generics = true)]
3507 public HashTable (HashFunc? hash_func, EqualFunc? key_equal_func);
3508 public HashTable.full (HashFunc? hash_func, EqualFunc? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
3509 public void insert (owned K key, owned V value);
3510 public void replace (owned K key, owned V value);
3511 public unowned V lookup (K key);
3512 public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value);
3513 public bool remove (K key);
3514 public void remove_all ();
3515 public List<unowned K> get_keys ();
3516 public List<unowned V> get_values ();
3517 public void @foreach (HFunc func);
3518 [CCode (cname = "g_hash_table_foreach")]
3519 public void for_each (HFunc func);
3520 public uint size ();
3521 public bool steal (K key);
3522 public void steal_all ();
3525 public struct HashTableIter<K,V> {
3526 public HashTableIter (GLib.HashTable<K,V> table);
3527 public bool next (out unowned K key, out unowned V value);
3528 public void remove ();
3529 public void steal ();
3530 public unowned GLib.HashTable<K,V> get_hash_table ();
3533 [CCode (has_target = false)]
3534 public delegate uint HashFunc (void* key);
3535 [CCode (has_target = false)]
3536 public delegate bool EqualFunc (void* a, void* b);
3537 public delegate void HFunc (void* key, void* value);
3539 [CCode (has_target = false)]
3540 public delegate void DestroyNotify (void* data);
3542 [CCode (cname = "g_direct_hash")]
3543 public static GLib.HashFunc direct_hash;
3544 [CCode (cname = "g_direct_equal")]
3545 public static GLib.EqualFunc direct_equal;
3546 [CCode (cname = "g_int_hash")]
3547 public static GLib.HashFunc int_hash;
3548 [CCode (cname = "g_int_equal")]
3549 public static GLib.EqualFunc int_equal;
3550 [CCode (cname = "g_str_hash")]
3551 public static GLib.HashFunc str_hash;
3552 [CCode (cname = "g_str_equal")]
3553 public static GLib.EqualFunc str_equal;
3554 [CCode (cname = "g_free")]
3555 public static GLib.DestroyNotify g_free;
3556 [CCode (cname = "g_object_unref")]
3557 public static GLib.DestroyNotify g_object_unref;
3558 [CCode (cname = "g_list_free")]
3559 public static GLib.DestroyNotify g_list_free;
3560 [CCode (cname = "((GDestroyNotify) g_variant_unref)")]
3561 public static GLib.DestroyNotify g_variant_unref;
3566 [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
3567 public class StringBuilder {
3568 public StringBuilder (string init = "");
3569 [CCode (cname = "g_string_sized_new")]
3570 public StringBuilder.sized (size_t dfl_size);
3571 public unowned StringBuilder assign (string rval);
3572 public unowned StringBuilder append (string val);
3573 public unowned StringBuilder append_c (char c);
3574 public unowned StringBuilder append_unichar (unichar wc);
3575 public unowned StringBuilder append_len (string val, ssize_t len);
3576 public unowned StringBuilder prepend (string val);
3577 public unowned StringBuilder prepend_c (char c);
3578 public unowned StringBuilder prepend_unichar (unichar wc);
3579 public unowned StringBuilder prepend_len (string val, ssize_t len);
3580 public unowned StringBuilder insert (ssize_t pos, string val);
3581 public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
3582 public unowned StringBuilder truncate (size_t len = 0);
3585 public void printf (string format, ...);
3587 public void append_printf (string format, ...);
3588 public void vprintf (string format, va_list args);
3589 public void append_vprintf (string format, va_list args);
3593 public ssize_t allocated_len;
3599 [CCode (free_function = "g_string_chunk_free")]
3600 public class StringChunk {
3601 public StringChunk (size_t size);
3602 public unowned string insert (string str);
3603 public unowned string insert_const (string str);
3604 public unowned string insert_len (string str, ssize_t len);
3605 public void clear ();
3608 /* Pointer Arrays */
3612 [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
3614 [CCode (free_function = "g_ptr_array_free")]
3616 public class PtrArray {
3618 public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func);
3619 [CCode (cname = "g_ptr_array_sized_new")]
3620 public PtrArray.sized (uint reserved_size);
3621 public void add (void* data);
3622 public void foreach (GLib.Func func);
3623 [CCode (cname = "g_ptr_array_index")]
3624 public void* index(uint index);
3625 public bool remove (void* data);
3626 public void* remove_index (uint index);
3627 public bool remove_fast (void *data);
3628 public void remove_index_fast (uint index);
3629 public void remove_range (uint index, uint length);
3630 public void sort (CompareFunc compare_func);
3631 public void sort_with_data (CompareDataFunc compare_func);
3632 public void set_free_func (GLib.DestroyNotify? element_free_function);
3633 public void set_size (int length);
3636 public void** pdata;
3640 [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")]
3641 public class GenericArray<G> {
3642 [CCode (cname = "g_ptr_array_new_with_free_func", simple_generics = true)]
3643 public GenericArray ();
3644 public void add (owned G data);
3645 public void foreach (GLib.Func func);
3646 [CCode (cname = "g_ptr_array_index")]
3647 public unowned G get (uint index);
3648 public bool remove (G data);
3649 public void remove_index (uint index);
3650 public bool remove_fast (G data);
3651 public void remove_index_fast (uint index);
3652 public void remove_range (uint index, uint length);
3653 public void set (uint index, owned G data) {
3654 this.add ((owned) data);
3655 this.remove_index_fast (index);
3657 public void sort (GLib.CompareFunc compare_func);
3658 public void sort_with_data (GLib.CompareDataFunc compare_func);
3659 private void set_size (int length);
3662 get { return (int) this.len; }
3663 set { this.set_size (value); }
3673 [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")]
3675 [CCode (cprefix = "g_byte_array_", free_function = "g_byte_array_free")]
3677 public class ByteArray {
3678 public ByteArray ();
3679 [CCode (cname = "g_byte_array_sized_new")]
3680 public ByteArray.sized (uint reserved_size);
3681 public void append (uint8[] data);
3682 public void prepend (uint8[] data);
3683 public void remove_index (uint index);
3684 public void remove_index_fast (uint index);
3685 public void remove_range (uint index, uint length);
3686 public void sort (CompareFunc compare_func);
3687 public void sort_with_data (CompareDataFunc compare_func);
3688 public void set_size (uint length);
3691 [CCode (array_length_cname = "len", array_length_type = "guint")]
3692 public uint8[] data;
3698 [CCode (free_function = "g_node_destroy")]
3699 public class Node<G> {
3704 public Node children;
3709 [CCode (type_id = "G_TYPE_UINT")]
3710 public struct Quark : uint32 {
3711 public static Quark from_string (string str);
3712 public static Quark try_string (string str);
3713 public unowned string to_string ();
3716 /* Keyed Data Lists */
3718 [CCode (cname = "GData*")]
3719 public struct Datalist<G> {
3721 public void clear ();
3722 public unowned G id_get_data (Quark key_id);
3723 public void id_set_data (Quark key_id, owned G data);
3724 public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
3725 public void id_remove_data (Quark key_id);
3726 public G id_remove_no_notify (Quark key_id);
3727 public void @foreach (DataForeachFunc func);
3728 public unowned G get_data (string key);
3729 public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
3730 public G remove_no_notify (string key);
3731 public void set_data (string key, owned G data);
3732 public void remove_data (string key);
3735 public delegate void DataForeachFunc<G> (Quark key_id, G data);
3741 [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")]
3743 [CCode (free_function = "g_array_free")]
3745 public class Array<G> {
3746 [CCode (cname = "len")]
3749 public Array (bool zero_terminated, bool clear, ulong element_size);
3750 [CCode (cname = "g_array_sized_new")]
3751 public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
3752 public void append_val (G value);
3753 public void append_vals (void* data, uint len);
3754 public void prepend_val (G value);
3755 public void prepend_vals (void* data, uint len);
3756 public void insert_val (uint index, G value);
3757 public void insert_vals (uint index, void* data, uint len);
3758 public void remove_index (uint index);
3759 public void remove_index_fast (uint index);
3760 public void remove_range (uint index, uint length);
3761 public void sort (CompareFunc compare_func);
3762 public void sort_with_data (CompareDataFunc compare_func);
3763 [CCode (generic_type_pos = 0.1)]
3764 public G index (uint index);
3765 public void set_size (uint length);
3770 public delegate int TraverseFunc (void* key, void* value);
3772 [CCode (c_prefix="C_", has_type_id = false)]
3773 public enum TraverseType {
3782 [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")]
3784 [CCode (free_function = "g_tree_destroy")]
3786 public class Tree<K,V> {
3787 public Tree (CompareFunc key_compare_func);
3788 public Tree.with_data (CompareDataFunc key_compare_func);
3789 public Tree.full (CompareDataFunc key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func);
3790 public void insert (owned K key, owned V value);
3791 public void replace (owned K key, owned V value);
3792 public int nnodes ();
3793 public int height ();
3794 public unowned V lookup (K key);
3795 public bool lookup_extended (K lookup_key, K orig_key, V value);
3796 public void foreach (TraverseFunc traverse_func);
3797 public unowned V search (CompareFunc search_func, void* user_data);
3798 public bool remove (K key);
3799 public bool steal (K key);
3802 /* Internationalization */
3804 [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
3805 public static unowned string _ (string str);
3806 [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
3807 public static unowned string Q_ (string str);
3808 [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")]
3809 public static unowned string N_ (string str);
3810 [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")]
3811 public static unowned string ngettext (string msgid, string msgid_plural, ulong n);
3812 [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")]
3813 public static unowned string dgettext (string? domain, string msgid);
3814 [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")]
3815 public static unowned string dngettext (string? domain, string msgid, string msgid_plural, ulong n);
3816 [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")]
3817 public static unowned string dpgettext (string? domain, string msgctxid, size_t msgidoffset);
3818 [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")]
3819 public static unowned string dpgettext2 (string? domain, string context, string msgid);
3821 [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
3822 public enum LocaleCategory {
3833 [CCode (cname = "setlocale", cheader_filename = "locale.h")]
3834 public static unowned string? setlocale (LocaleCategory category, string? locale);
3835 [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")]
3836 public static unowned string? bindtextdomain (string domainname, string? dirname);
3837 [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")]
3838 public static unowned string? textdomain (string? domainname);
3839 [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")]
3840 public static unowned string? bind_textdomain_codeset (string domainname, string? codeset);
3841 [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)]
3842 public static unowned string[] get_language_names ();
3843 [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")]
3844 public static unowned string strip_context (string msgid, string msgval);
3848 public class PatternSpec {
3849 public PatternSpec (string pattern);
3850 public bool equal (PatternSpec pspec);
3851 [CCode (cname = "g_pattern_match")]
3852 public bool match (uint string_length, string str, string? str_reversed);
3853 [CCode (cname = "g_pattern_match_string")]
3854 public bool match_string (string str);
3855 [CCode (cname = "g_pattern_match_simple")]
3856 public static bool match_simple (string pattern, string str);
3860 public string error_message (int error);
3861 public string getlocale ();
3862 public string get_package_installation_directory_of_module (void* hmodule);
3863 public uint get_windows_version ();
3864 public string locale_filename_from_utf8 (string utf8filename);
3865 [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")]
3866 public bool have_widechar_api ();
3867 [CCode (cname = "G_WIN32_IS_NT_BASED")]
3868 public bool is_nt_based ();
3872 [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
3873 public class VariantType {
3874 [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
3875 public static VariantType BOOLEAN;
3876 [CCode (cname = "G_VARIANT_TYPE_BYTE")]
3877 public static VariantType BYTE;
3878 [CCode (cname = "G_VARIANT_TYPE_INT16")]
3879 public static VariantType INT16;
3880 [CCode (cname = "G_VARIANT_TYPE_UINT16")]
3881 public static VariantType UINT16;
3882 [CCode (cname = "G_VARIANT_TYPE_INT32")]
3883 public static VariantType INT32;
3884 [CCode (cname = "G_VARIANT_TYPE_UINT32")]
3885 public static VariantType UINT32;
3886 [CCode (cname = "G_VARIANT_TYPE_INT64")]
3887 public static VariantType INT64;
3888 [CCode (cname = "G_VARIANT_TYPE_UINT64")]
3889 public static VariantType UINT64;
3890 [CCode (cname = "G_VARIANT_TYPE_DOUBLE")]
3891 public static VariantType DOUBLE;
3892 [CCode (cname = "G_VARIANT_TYPE_STRING")]
3893 public static VariantType STRING;
3894 [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")]
3895 public static VariantType OBJECT_PATH;
3896 [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")]
3897 public static VariantType SIGNATURE;
3898 [CCode (cname = "G_VARIANT_TYPE_VARIANT")]
3899 public static VariantType VARIANT;
3900 [CCode (cname = "G_VARIANT_TYPE_UNIT")]
3901 public static VariantType UNIT;
3902 [CCode (cname = "G_VARIANT_TYPE_ANY")]
3903 public static VariantType ANY;
3904 [CCode (cname = "G_VARIANT_TYPE_BASIC")]
3905 public static VariantType BASIC;
3906 [CCode (cname = "G_VARIANT_TYPE_MAYBE")]
3907 public static VariantType MAYBE;
3908 [CCode (cname = "G_VARIANT_TYPE_ARRAY")]
3909 public static VariantType ARRAY;
3910 [CCode (cname = "G_VARIANT_TYPE_TUPLE")]
3911 public static VariantType TUPLE;
3912 [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")]
3913 public static VariantType DICT_ENTRY;
3914 [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")]
3915 public static VariantType DICTIONARY;
3917 public static bool string_is_valid (string type_string);
3918 public static bool string_scan (string type_string, char *limit, out char* endptr);
3920 public VariantType (string type_string);
3921 public size_t get_string_length ();
3922 public char* peek_string ();
3923 public string dup_string ();
3925 public bool is_definite ();
3926 public bool is_container ();
3927 public bool is_basic ();
3928 public bool is_maybe ();
3929 public bool is_array ();
3930 public bool is_tuple ();
3931 public bool is_dict_entry ();
3932 public bool is_variant ();
3934 public uint hash ();
3935 public bool equal (VariantType other);
3936 public bool is_subtype_of (VariantType supertype);
3938 public unowned VariantType element ();
3939 public unowned VariantType first ();
3940 public unowned VariantType next ();
3941 public unowned VariantType n_items ();
3942 public unowned VariantType key ();
3943 public unowned VariantType value ();
3945 public VariantType.array (VariantType element);
3946 public VariantType.maybe (VariantType element);
3947 public VariantType.tuple (VariantType[] items);
3948 public VariantType.dict_entry (VariantType key, VariantType value);
3952 [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")]
3953 public class Variant {
3955 BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64,
3956 UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH,
3957 SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY
3960 public unowned VariantType get_type ();
3961 public unowned string get_type_string ();
3962 public bool is_of_type (VariantType type);
3963 public bool is_container ();
3964 public Class classify ();
3966 public Variant.boolean (bool value);
3967 public Variant.byte (uchar value);
3968 public Variant.int16 (int16 value);
3969 public Variant.uint16 (uint16 value);
3970 public Variant.int32 (int32 value);
3971 public Variant.uint32 (uint32 value);
3972 public Variant.int64 (int64 value);
3973 public Variant.uint64 (uint64 value);
3974 public Variant.handle (int32 value);
3975 public Variant.double (double value);
3976 public Variant.string (string value);
3977 public Variant.object_path (string object_path);
3978 public static bool is_object_path (string object_path);
3979 public Variant.signature (string signature);
3980 public static bool is_signature (string signature);
3982 public bool get_boolean ();
3983 public uint8 get_byte ();
3984 public int16 get_int16 ();
3985 public uint16 get_uint16 ();
3986 public int32 get_int32 ();
3987 public uint32 get_uint32 ();
3988 public int64 get_int64 ();
3989 public uint64 get_uint64 ();
3990 public int32 get_handle ();
3991 public double get_double ();
3992 public unowned string get_string (out size_t length = null);
3993 public string dup_string ();
3995 public Variant.strv (string[] value);
3996 [CCode (array_length_type = "size_t")]
3997 public string*[] get_strv ();
3998 [CCode (array_length_type = "size_t")]
3999 public string[] dup_strv ();
4001 public Variant (string format, ...);
4002 public void get (string format, ...);
4004 public Variant.variant (Variant value);
4005 public Variant.maybe (VariantType? child_type, Variant? child);
4006 public Variant.array (VariantType? child_type, Variant[] children);
4007 public Variant.tuple (VariantType[] children);
4008 public Variant.dict_entry (Variant key, Variant value);
4009 public Variant get_variant ();
4010 public Variant? get_maybe ();
4012 public size_t n_children ();
4013 public Variant get_child_value (size_t index);
4015 public size_t get_size ();
4016 public void *get_data ();
4017 public void store (void *data);
4019 public string print (bool type_annotate);
4020 public StringBuilder print_string (StringBuilder? builder, bool type_annotate);
4022 public uint hash ();
4023 public bool equal (Variant other);
4025 public Variant byteswap ();
4026 public Variant get_normal_form ();
4027 public bool is_normal_form ();
4028 [CCode (returns_floating_reference = true, simple_generics = true)]
4029 public static Variant new_from_data<T> (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null);
4031 [CCode (cname = "g_variant_iter_new")]
4032 public VariantIter iterator ();
4034 public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError;
4035 public Variant.parsed (string format_string, ...);
4038 public errordomain VariantParseError {
4043 [CCode (copy_func = "g_variant_iter_copy", free_func = "g_variant_iter_free")]
4044 public class VariantIter {
4045 public VariantIter (Variant value);
4046 public size_t n_children ();
4047 public Variant? next_value ();
4048 public bool next (string format_string, ...);
4052 [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref")]
4053 public class VariantBuilder {
4054 public VariantBuilder (VariantType type);
4055 public void open (VariantType type);
4056 public void close ();
4057 public void add_value (Variant value);
4058 public void add (string format_string, ...);
4059 [CCode (returns_floating_reference = true)]
4060 public Variant end ();
4064 [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 = "DBUS_TYPE_G_OBJECT_PATH", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "o")]
4065 public class ObjectPath : string {
4066 [CCode (cname = "g_strdup")]
4067 public ObjectPath (string path);
4071 [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]
4072 public static bool likely (bool expression);
4073 [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")]
4074 public static bool unlikely (bool expression);
4075 [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")]
4076 public static void static_assert (bool expression);
4078 [CCode (simple_generics = true)]
4079 private static void qsort_with_data<T> (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc compare_func);