Regenerate, restoring full UpCast functionality.
[girtod.git] / gtk2 / glib2.d
blob49ec475d1c00f23d70d640a5f1e70df2207d24f5
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/GLib-2.0.gir"
4 module GLib2;
6 // package: "glib-2.0";
7 // C header: "glib.h";
9 // c:symbol-prefixes: ["g", "glib"]
10 // c:identifier-prefixes: ["G"]
12 // module GLib2;
14 // --- mixin/GLib2__MODULE_HEAD.d --->
16 import core.stdc.limits: c_long, c_ulong;
17 alias int c_int; // Assumes 32-bit wide int.
18 alias uint c_uint; // Assumes 32-bit wide int.
20 import core.sys.posix.sys.types : time_t, ssize_t;
21 import std.c.stdarg : va_list;
22 import std.c.stdio : FILE;
24 alias int gboolean;
27 auto UpCast(DT, ST)(ST src) {
28 static if (is(typeof(function DT(ST a) { return a; })))
29 return src;
30 else static if (is(typeof(function DT(ST a) { return UpCast!DT(&a.tupleof[0]); })))
31 return UpCast!DT(&src.tupleof[0]);
32 else static if (is(typeof(function DT(ST a) { return UpCast!DT(a.tupleof[0]); })))
33 // If we're already doing some magic, we can just as well go
34 // all the way, and make the inheritance work not only for "true"
35 // struct inheritance (ie parent embedded as first field), but
36 // also for pointers to "base" structs. This allows extending
37 // builtin widgets, when it's not possible to modify or embed
38 // the opaque structures allocated by the libraries.
39 return UpCast!DT(src.tupleof[0]);
40 else
41 return src;
44 // The only purpose of this write-only pointer is to prevent the compiler
45 // from optimizing away stores to local static variables meant to hold on
46 // to a pointer so that the GC can find it.
47 // It's not the ideal solution -- WPO *could* remove this variable too,
48 // but D currently does not have C-style "volatile"; "shared" could work,
49 // but would need more explicit casts; hopefully this will be enough for
50 // now.
51 public __gshared void* _volatile_dummy;
53 auto toCString(DT, ST)(ST src) {
54 static if (is(typeof(src):DT))
55 return src;
56 else {
57 import std.string;
58 static if (is(typeof(cast(char*)toStringz(src)):DT)) {
59 static DT undead;
60 _volatile_dummy = undead;
61 undead = cast(DT)toStringz(src);
62 return undead;
64 else
65 return src;
69 // A wrapper that makes type <S> behave like a reference type.
71 struct Ref(S) {
72 S* __refpointer;
74 alias __refpointer this;
76 this(S:S)(ref S s) { __refpointer = &s; }
77 this(SP:S*)(SP s) { __refpointer = s; }
78 this(A...)(A s) { __refpointer = new S(s); }
80 void toString(FT)(scope void delegate(const(char)[]) sink, FT fmt) {
81 import std.format;
82 formatValue(sink, *__refpointer, fmt);
86 // Helpers; used by gtk.init, clutter.init etc.
88 auto argvToC(string argv[]) {
89 alias char* GTK_STRING;
90 GTK_STRING[] c_argv = new GTK_STRING[argv.length];
92 foreach (i, arg; argv)
93 c_argv[i] = cast(GTK_STRING)arg.ptr;
95 return c_argv.ptr;
98 string[] argvFromC(c_int argc, const(char*)* argv) {
99 import std.string;
100 string[] result = new string[argc];
102 for(c_int i=0; i<argc; i++) {
103 auto len = indexOf(argv[i][0..int.max], '\0');
104 result[i] = cast(string)argv[i][0..len];
107 return result;
111 // Debugging helpers.
113 void _dumpObj(T)(T o, bool deep=0) {
114 auto ts = o.tupleof;
115 _print(typeid(o), " {");
117 static if (is(typeof(*T)==union)) {
118 _print(*o, "}\n");
119 return;
121 else {
122 _println();
124 foreach (i, t; ts) {
125 string fieldName = T.tupleof[i].stringof;
126 // Skip everything until the first '.'.
127 foreach (i, c; fieldName)
128 if (c=='.') {
129 fieldName = fieldName[i+1..$];
130 break;
133 _print(" (", typeid(t), " ", fieldName, ") ", t);
134 if (deep)
135 static if (is(typeof(*t)))
136 if (ts[i])
137 _print(" {", *ts[i], "}");
138 _print(i!=ts.length-1 ? "\n" : "\n}\n");
143 void _println(A...)(A a) {
144 import std.stdio;
145 try writeln(a); catch (Exception e) {}
147 void _printf(A...)(A a) {
148 import std.stdio;
149 try writef(a); catch (Exception e) {}
151 void _print(A...)(A a) {
152 import std.stdio;
153 try write(a); catch (Exception e) {}
156 // Template helpers.
157 // Give the user at least a chance to figure out what's wrong when a template
158 // constraint doesn't match - print both the found and the expected types.
159 bool _ttmm(T, E)() {
160 pragma(msg, "\nExpected: '" ~ E.stringof ~"';\n found: '" ~ T.stringof ~"'.\n");
161 return 0;
164 // <--- mixin/GLib2__MODULE_HEAD.d ---
167 // Integer representing a day of the month; between 1 and
168 // 31. #G_DATE_BAD_DAY represents an invalid day of the month.
169 alias ubyte DateDay;
171 // Integer representing a year; #G_DATE_BAD_YEAR is the invalid
172 // value. The year must be 1 or higher; negative (BC) years are not
173 // allowed. The year is represented with four digits.
174 alias ushort DateYear;
176 // A type which is used to hold a process identification.
178 // On UNIX, processes are identified by a process id (an integer),
179 // while Windows uses process handles (which are pointers).
181 // GPid is used in GLib only for descendant processes spawned with
182 // the g_spawn functions.
183 alias int Pid;
185 // A GQuark is a non-zero integer which uniquely identifies a
186 // particular string. A GQuark value of zero is associated to %NULL.
187 alias uint Quark;
188 // A C representable type name for #G_TYPE_STRV.
189 alias void* Strv;
191 // Simply a replacement for <type>time_t</type>. It has been deprecated
192 // since it is <emphasis>not</emphasis> equivalent to <type>time_t</type>
193 // on 64-bit platforms with a 64-bit <type>time_t</type>.
194 // Unrelated to #GTimer.
196 // Note that <type>GTime</type> is defined to always be a 32bit integer,
197 // unlike <type>time_t</type> which may be 64bit on some systems.
198 // Therefore, <type>GTime</type> will overflow in the year 2038, and
199 // you cannot use the address of a <type>GTime</type> variable as argument
200 // to the UNIX time() function. Instead, do the following:
201 // |[
202 // time_t ttime;
203 // GTime gtime;
205 // time (&amp;ttime);
206 // gtime = (GTime)ttime;
207 // ]|
208 alias int Time;
209 // A value representing an interval of time, in microseconds.
210 alias long TimeSpan;
212 // A numerical value which represents the unique identifier of a registered
213 // type.
214 alias size_t Type;
215 enum int ASCII_DTOSTR_BUF_SIZE = 39;
216 // Contains the public fields of an <link linkend="glib-Arrays">Array</link>.
217 struct Array {
218 char* data;
219 uint len;
222 // Unintrospectable function: append_vals() / g_array_append_vals()
223 // Adds @len elements onto the end of the array.
224 // <array>: a #GArray.
225 // <data>: a pointer to the elements to append to the end of the array.
226 // <len>: the number of elements to append.
227 static Array* append_vals(AT0, AT1)(AT0 /*Array*/ array, AT1 /*const(void)*/ data, uint len) nothrow {
228 return g_array_append_vals(UpCast!(Array*)(array), UpCast!(const(void)*)(data), len);
231 // Frees the memory allocated for the #GArray. If @free_segment is
232 // %TRUE it frees the memory block holding the elements as well and
233 // also each element if @array has a @element_free_func set. Pass
234 // %FALSE if you want to free the #GArray wrapper but preserve the
235 // underlying array for use elsewhere. If the reference count of @array
236 // is greater than one, the #GArray wrapper is preserved but the size
237 // of @array will be set to zero.
239 // <note><para>If array elements contain dynamically-allocated memory,
240 // they should be freed separately.</para></note>
241 // <array>: a #GArray.
242 // <free_segment>: if %TRUE the actual element data is freed as well.
243 static char* /*new*/ free(AT0)(AT0 /*Array*/ array, int free_segment) nothrow {
244 return g_array_free(UpCast!(Array*)(array), free_segment);
247 // VERSION: 2.22
248 // Gets the size of the elements in @array.
249 // RETURNS: Size of each element, in bytes.
250 // <array>: A #GArray.
251 static uint get_element_size(AT0)(AT0 /*Array*/ array) nothrow {
252 return g_array_get_element_size(UpCast!(Array*)(array));
255 // Unintrospectable function: insert_vals() / g_array_insert_vals()
256 // Inserts @len elements into a #GArray at the given index.
257 // <array>: a #GArray.
258 // <index_>: the index to place the elements at.
259 // <data>: a pointer to the elements to insert.
260 // <len>: the number of elements to insert.
261 static Array* insert_vals(AT0, AT1)(AT0 /*Array*/ array, uint index_, AT1 /*const(void)*/ data, uint len) nothrow {
262 return g_array_insert_vals(UpCast!(Array*)(array), index_, UpCast!(const(void)*)(data), len);
265 // Unintrospectable function: new() / g_array_new()
266 // Creates a new #GArray with a reference count of 1.
267 // <zero_terminated>: %TRUE if the array should have an extra element at the end which is set to 0.
268 // <clear_>: %TRUE if #GArray elements should be automatically cleared to 0 when they are allocated.
269 // <element_size>: the size of each element in bytes.
270 static Array* new_()(int zero_terminated, int clear_, uint element_size) nothrow {
271 return g_array_new(zero_terminated, clear_, element_size);
274 // Unintrospectable function: prepend_vals() / g_array_prepend_vals()
275 // Adds @len elements onto the start of the array.
277 // This operation is slower than g_array_append_vals() since the
278 // existing elements in the array have to be moved to make space for
279 // the new elements.
280 // <array>: a #GArray.
281 // <data>: a pointer to the elements to prepend to the start of the array.
282 // <len>: the number of elements to prepend.
283 static Array* prepend_vals(AT0, AT1)(AT0 /*Array*/ array, AT1 /*const(void)*/ data, uint len) nothrow {
284 return g_array_prepend_vals(UpCast!(Array*)(array), UpCast!(const(void)*)(data), len);
287 // Unintrospectable function: ref() / g_array_ref()
288 // VERSION: 2.22
289 // Atomically increments the reference count of @array by one. This
290 // function is MT-safe and may be called from any thread.
291 // RETURNS: The passed in #GArray.
292 // <array>: A #GArray.
293 static Array* ref_(AT0)(AT0 /*Array*/ array) nothrow {
294 return g_array_ref(UpCast!(Array*)(array));
297 // Unintrospectable function: remove_index() / g_array_remove_index()
298 // Removes the element at the given index from a #GArray. The following
299 // elements are moved down one place.
300 // <array>: a #GArray.
301 // <index_>: the index of the element to remove.
302 static Array* remove_index(AT0)(AT0 /*Array*/ array, uint index_) nothrow {
303 return g_array_remove_index(UpCast!(Array*)(array), index_);
306 // Unintrospectable function: remove_index_fast() / g_array_remove_index_fast()
307 // Removes the element at the given index from a #GArray. The last
308 // element in the array is used to fill in the space, so this function
309 // does not preserve the order of the #GArray. But it is faster than
310 // g_array_remove_index().
311 // <array>: a @GArray.
312 // <index_>: the index of the element to remove.
313 static Array* remove_index_fast(AT0)(AT0 /*Array*/ array, uint index_) nothrow {
314 return g_array_remove_index_fast(UpCast!(Array*)(array), index_);
317 // Unintrospectable function: remove_range() / g_array_remove_range()
318 // VERSION: 2.4
319 // Removes the given number of elements starting at the given index
320 // from a #GArray. The following elements are moved to close the gap.
321 // <array>: a @GArray.
322 // <index_>: the index of the first element to remove.
323 // <length>: the number of elements to remove.
324 static Array* remove_range(AT0)(AT0 /*Array*/ array, uint index_, uint length) nothrow {
325 return g_array_remove_range(UpCast!(Array*)(array), index_, length);
328 // VERSION: 2.32
329 // Sets a function to clear an element of @array.
331 // The @clear_func will be called when an element in the array
332 // data segment is removed and when the array is freed and data
333 // segment is deallocated as well.
335 // Note that in contrast with other uses of #GDestroyNotify
336 // functions, @clear_func is expected to clear the contents of
337 // the array element it is given, but not free the element itself.
338 // <array>: A #GArray
339 // <clear_func>: a function to clear an element of @array
340 static void set_clear_func(AT0)(AT0 /*Array*/ array, DestroyNotify clear_func) nothrow {
341 g_array_set_clear_func(UpCast!(Array*)(array), clear_func);
344 // Unintrospectable function: set_size() / g_array_set_size()
345 // Sets the size of the array, expanding it if necessary. If the array
346 // was created with @clear_ set to %TRUE, the new elements are set to 0.
347 // <array>: a #GArray.
348 // <length>: the new size of the #GArray.
349 static Array* set_size(AT0)(AT0 /*Array*/ array, uint length) nothrow {
350 return g_array_set_size(UpCast!(Array*)(array), length);
353 // Unintrospectable function: sized_new() / g_array_sized_new()
354 // Creates a new #GArray with @reserved_size elements preallocated and
355 // a reference count of 1. This avoids frequent reallocation, if you
356 // are going to add many elements to the array. Note however that the
357 // size of the array is still 0.
358 // <zero_terminated>: %TRUE if the array should have an extra element at the end with all bits cleared.
359 // <clear_>: %TRUE if all bits in the array should be cleared to 0 on allocation.
360 // <element_size>: size of each element in the array.
361 // <reserved_size>: number of elements preallocated.
362 static Array* sized_new()(int zero_terminated, int clear_, uint element_size, uint reserved_size) nothrow {
363 return g_array_sized_new(zero_terminated, clear_, element_size, reserved_size);
366 // Unintrospectable function: sort() / g_array_sort()
367 // Sorts a #GArray using @compare_func which should be a qsort()-style
368 // comparison function (returns less than zero for first arg is less
369 // than second arg, zero for equal, greater zero if first arg is
370 // greater than second arg).
372 // This is guaranteed to be a stable sort since version 2.32.
373 // <array>: a #GArray.
374 // <compare_func>: comparison function.
375 static void sort(AT0)(AT0 /*Array*/ array, CompareFunc compare_func) nothrow {
376 g_array_sort(UpCast!(Array*)(array), compare_func);
379 // Unintrospectable function: sort_with_data() / g_array_sort_with_data()
380 // Like g_array_sort(), but the comparison function receives an extra
381 // user data argument.
383 // This is guaranteed to be a stable sort since version 2.32.
385 // There used to be a comment here about making the sort stable by
386 // using the addresses of the elements in the comparison function.
387 // This did not actually work, so any such code should be removed.
388 // <array>: a #GArray.
389 // <compare_func>: comparison function.
390 // <user_data>: data to pass to @compare_func.
391 static void sort_with_data(AT0, AT1)(AT0 /*Array*/ array, CompareDataFunc compare_func, AT1 /*void*/ user_data) nothrow {
392 g_array_sort_with_data(UpCast!(Array*)(array), compare_func, UpCast!(void*)(user_data));
395 // VERSION: 2.22
396 // Atomically decrements the reference count of @array by one. If the
397 // reference count drops to 0, all memory allocated by the array is
398 // released. This function is MT-safe and may be called from any
399 // thread.
400 // <array>: A #GArray.
401 static void unref(AT0)(AT0 /*Array*/ array) nothrow {
402 g_array_unref(UpCast!(Array*)(array));
406 enum AsciiType {
407 ALNUM = 1,
408 ALPHA = 2,
409 CNTRL = 4,
410 DIGIT = 8,
411 GRAPH = 16,
412 LOWER = 32,
413 PRINT = 64,
414 PUNCT = 128,
415 SPACE = 256,
416 UPPER = 512,
417 XDIGIT = 1024
420 // The GAsyncQueue struct is an opaque data structure which represents
421 // an asynchronous queue. It should only be accessed through the
422 // <function>g_async_queue_*</function> functions.
423 struct AsyncQueue {
425 // Returns the length of the queue.
427 // Actually this function returns the number of data items in
428 // the queue minus the number of waiting threads, so a negative
429 // value means waiting threads, and a positive value means available
430 // entries in the @queue. A return value of 0 could mean n entries
431 // in the queue and n threads waiting. This can happen due to locking
432 // of the queue or due to scheduling.
433 // RETURNS: the length of the @queue
434 int length()() nothrow {
435 return g_async_queue_length(&this);
438 // Returns the length of the queue.
440 // Actually this function returns the number of data items in
441 // the queue minus the number of waiting threads, so a negative
442 // value means waiting threads, and a positive value means available
443 // entries in the @queue. A return value of 0 could mean n entries
444 // in the queue and n threads waiting. This can happen due to locking
445 // of the queue or due to scheduling.
447 // This function must be called while holding the @queue's lock.
448 // RETURNS: the length of the @queue.
449 int length_unlocked()() nothrow {
450 return g_async_queue_length_unlocked(&this);
453 // Acquires the @queue's lock. If another thread is already
454 // holding the lock, this call will block until the lock
455 // becomes available.
457 // Call g_async_queue_unlock() to drop the lock again.
459 // While holding the lock, you can only call the
460 // <function>g_async_queue_*_unlocked()</function> functions
461 // on @queue. Otherwise, deadlock may occur.
462 void lock()() nothrow {
463 g_async_queue_lock(&this);
466 // Unintrospectable method: pop() / g_async_queue_pop()
467 // Pops data from the @queue. If @queue is empty, this function
468 // blocks until data becomes available.
469 // RETURNS: data from the queue
470 void* pop()() nothrow {
471 return g_async_queue_pop(&this);
474 // Unintrospectable method: pop_unlocked() / g_async_queue_pop_unlocked()
475 // Pops data from the @queue. If @queue is empty, this function
476 // blocks until data becomes available.
478 // This function must be called while holding the @queue's lock.
479 // RETURNS: data from the queue.
480 void* pop_unlocked()() nothrow {
481 return g_async_queue_pop_unlocked(&this);
484 // Pushes the @data into the @queue. @data must not be %NULL.
485 // <data>: @data to push into the @queue
486 void push(AT0)(AT0 /*void*/ data) nothrow {
487 g_async_queue_push(&this, UpCast!(void*)(data));
490 // Unintrospectable method: push_sorted() / g_async_queue_push_sorted()
491 // VERSION: 2.10
492 // Inserts @data into @queue using @func to determine the new
493 // position.
495 // This function requires that the @queue is sorted before pushing on
496 // new elements, see g_async_queue_sort().
498 // This function will lock @queue before it sorts the queue and unlock
499 // it when it is finished.
501 // For an example of @func see g_async_queue_sort().
502 // <data>: the @data to push into the @queue
503 // <func>: the #GCompareDataFunc is used to sort @queue
504 // <user_data>: user data passed to @func.
505 void push_sorted(AT0, AT1)(AT0 /*void*/ data, CompareDataFunc func, AT1 /*void*/ user_data) nothrow {
506 g_async_queue_push_sorted(&this, UpCast!(void*)(data), func, UpCast!(void*)(user_data));
509 // Unintrospectable method: push_sorted_unlocked() / g_async_queue_push_sorted_unlocked()
510 // VERSION: 2.10
511 // Inserts @data into @queue using @func to determine the new
512 // position.
514 // The sort function @func is passed two elements of the @queue.
515 // It should return 0 if they are equal, a negative value if the
516 // first element should be higher in the @queue or a positive value
517 // if the first element should be lower in the @queue than the second
518 // element.
520 // This function requires that the @queue is sorted before pushing on
521 // new elements, see g_async_queue_sort().
523 // This function must be called while holding the @queue's lock.
525 // For an example of @func see g_async_queue_sort().
526 // <data>: the @data to push into the @queue
527 // <func>: the #GCompareDataFunc is used to sort @queue
528 // <user_data>: user data passed to @func.
529 void push_sorted_unlocked(AT0, AT1)(AT0 /*void*/ data, CompareDataFunc func, AT1 /*void*/ user_data) nothrow {
530 g_async_queue_push_sorted_unlocked(&this, UpCast!(void*)(data), func, UpCast!(void*)(user_data));
533 // Pushes the @data into the @queue. @data must not be %NULL.
535 // This function must be called while holding the @queue's lock.
536 // <data>: @data to push into the @queue
537 void push_unlocked(AT0)(AT0 /*void*/ data) nothrow {
538 g_async_queue_push_unlocked(&this, UpCast!(void*)(data));
541 // Unintrospectable method: ref() / g_async_queue_ref()
542 // Increases the reference count of the asynchronous @queue by 1.
543 // You do not need to hold the lock to call this function.
544 // RETURNS: the @queue that was passed in (since 2.6)
545 AsyncQueue* ref_()() nothrow {
546 return g_async_queue_ref(&this);
549 // Increases the reference count of the asynchronous @queue by 1.
551 // so g_async_queue_ref() can be used regardless of the @queue's
552 // lock.
553 void ref_unlocked()() nothrow {
554 g_async_queue_ref_unlocked(&this);
557 // Unintrospectable method: sort() / g_async_queue_sort()
558 // VERSION: 2.10
559 // Sorts @queue using @func.
561 // The sort function @func is passed two elements of the @queue.
562 // It should return 0 if they are equal, a negative value if the
563 // first element should be higher in the @queue or a positive value
564 // if the first element should be lower in the @queue than the second
565 // element.
567 // This function will lock @queue before it sorts the queue and unlock
568 // it when it is finished.
570 // If you were sorting a list of priority numbers to make sure the
571 // lowest priority would be at the top of the queue, you could use:
572 // |[
573 // gint32 id1;
574 // gint32 id2;
576 // id1 = GPOINTER_TO_INT (element1);
577 // id2 = GPOINTER_TO_INT (element2);
579 // return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);
580 // ]|
581 // <func>: the #GCompareDataFunc is used to sort @queue
582 // <user_data>: user data passed to @func
583 void sort(AT0)(CompareDataFunc func, AT0 /*void*/ user_data) nothrow {
584 g_async_queue_sort(&this, func, UpCast!(void*)(user_data));
587 // Unintrospectable method: sort_unlocked() / g_async_queue_sort_unlocked()
588 // VERSION: 2.10
589 // Sorts @queue using @func.
591 // The sort function @func is passed two elements of the @queue.
592 // It should return 0 if they are equal, a negative value if the
593 // first element should be higher in the @queue or a positive value
594 // if the first element should be lower in the @queue than the second
595 // element.
597 // This function must be called while holding the @queue's lock.
598 // <func>: the #GCompareDataFunc is used to sort @queue
599 // <user_data>: user data passed to @func
600 void sort_unlocked(AT0)(CompareDataFunc func, AT0 /*void*/ user_data) nothrow {
601 g_async_queue_sort_unlocked(&this, func, UpCast!(void*)(user_data));
604 // Unintrospectable method: timed_pop() / g_async_queue_timed_pop()
605 // DEPRECATED method: timed_pop - use g_async_queue_timeout_pop().
606 // Pops data from the @queue. If the queue is empty, blocks until
607 // @end_time or until data becomes available.
609 // If no data is received before @end_time, %NULL is returned.
611 // To easily calculate @end_time, a combination of g_get_current_time()
612 // and g_time_val_add() can be used.
614 // received before @end_time.
615 // RETURNS: data from the queue or %NULL, when no data is
616 // <end_time>: a #GTimeVal, determining the final time
617 void* timed_pop(AT0)(AT0 /*TimeVal*/ end_time) nothrow {
618 return g_async_queue_timed_pop(&this, UpCast!(TimeVal*)(end_time));
621 // Unintrospectable method: timed_pop_unlocked() / g_async_queue_timed_pop_unlocked()
622 // DEPRECATED method: timed_pop_unlocked - use g_async_queue_timeout_pop_unlocked().
623 // Pops data from the @queue. If the queue is empty, blocks until
624 // @end_time or until data becomes available.
626 // If no data is received before @end_time, %NULL is returned.
628 // To easily calculate @end_time, a combination of g_get_current_time()
629 // and g_time_val_add() can be used.
631 // This function must be called while holding the @queue's lock.
633 // received before @end_time.
634 // RETURNS: data from the queue or %NULL, when no data is
635 // <end_time>: a #GTimeVal, determining the final time
636 void* timed_pop_unlocked(AT0)(AT0 /*TimeVal*/ end_time) nothrow {
637 return g_async_queue_timed_pop_unlocked(&this, UpCast!(TimeVal*)(end_time));
640 // Unintrospectable method: timeout_pop() / g_async_queue_timeout_pop()
641 // Pops data from the @queue. If the queue is empty, blocks for
642 // @timeout microseconds, or until data becomes available.
644 // If no data is received before the timeout, %NULL is returned.
646 // received before the timeout.
647 // RETURNS: data from the queue or %NULL, when no data is
648 // <timeout>: the number of microseconds to wait
649 void* timeout_pop()(ulong timeout) nothrow {
650 return g_async_queue_timeout_pop(&this, timeout);
653 // Unintrospectable method: timeout_pop_unlocked() / g_async_queue_timeout_pop_unlocked()
654 // Pops data from the @queue. If the queue is empty, blocks for
655 // @timeout microseconds, or until data becomes available.
657 // If no data is received before the timeout, %NULL is returned.
659 // This function must be called while holding the @queue's lock.
661 // received before the timeout.
662 // RETURNS: data from the queue or %NULL, when no data is
663 // <timeout>: the number of microseconds to wait
664 void* timeout_pop_unlocked()(ulong timeout) nothrow {
665 return g_async_queue_timeout_pop_unlocked(&this, timeout);
668 // Unintrospectable method: try_pop() / g_async_queue_try_pop()
669 // Tries to pop data from the @queue. If no data is available,
670 // %NULL is returned.
672 // available immediately.
673 // RETURNS: data from the queue or %NULL, when no data is
674 void* try_pop()() nothrow {
675 return g_async_queue_try_pop(&this);
678 // Unintrospectable method: try_pop_unlocked() / g_async_queue_try_pop_unlocked()
679 // Tries to pop data from the @queue. If no data is available,
680 // %NULL is returned.
682 // This function must be called while holding the @queue's lock.
684 // available immediately.
685 // RETURNS: data from the queue or %NULL, when no data is
686 void* try_pop_unlocked()() nothrow {
687 return g_async_queue_try_pop_unlocked(&this);
690 // Releases the queue's lock.
692 // Calling this function when you have not acquired
693 // the with g_async_queue_lock() leads to undefined
694 // behaviour.
695 void unlock()() nothrow {
696 g_async_queue_unlock(&this);
699 // Decreases the reference count of the asynchronous @queue by 1.
701 // If the reference count went to 0, the @queue will be destroyed
702 // and the memory allocated will be freed. So you are not allowed
703 // to use the @queue afterwards, as it might have disappeared.
704 // You do not need to hold the lock to call this function.
705 void unref()() nothrow {
706 g_async_queue_unref(&this);
709 // Decreases the reference count of the asynchronous @queue by 1
710 // and releases the lock. This function must be called while holding
711 // the @queue's lock. If the reference count went to 0, the @queue
712 // will be destroyed and the memory allocated will be freed.
714 // so g_async_queue_unref() can be used regardless of the @queue's
715 // lock.
716 void unref_and_unlock()() nothrow {
717 g_async_queue_unref_and_unlock(&this);
720 // Unintrospectable function: new() / g_async_queue_new()
721 // Creates a new asynchronous queue.
722 // RETURNS: a new #GAsyncQueue. Free with g_async_queue_unref()
723 static AsyncQueue* new_()() nothrow {
724 return g_async_queue_new();
727 // Unintrospectable function: new_full() / g_async_queue_new_full()
728 // VERSION: 2.16
729 // Creates a new asynchronous queue and sets up a destroy notify
730 // function that is used to free any remaining queue items when
731 // the queue is destroyed after the final unref.
732 // RETURNS: a new #GAsyncQueue. Free with g_async_queue_unref()
733 // <item_free_func>: function to free queue elements
734 static AsyncQueue* new_full()(DestroyNotify item_free_func) nothrow {
735 return g_async_queue_new_full(item_free_func);
739 enum int BIG_ENDIAN = 4321;
741 // The <structname>GBookmarkFile</structname> struct contains only
742 // private data and should not be directly accessed.
743 struct BookmarkFile {
745 // VERSION: 2.12
746 // Adds the application with @name and @exec to the list of
747 // applications that have registered a bookmark for @uri into
748 // @bookmark.
750 // Every bookmark inside a #GBookmarkFile must have at least an
751 // application registered. Each application must provide a name, a
752 // command line useful for launching the bookmark, the number of times
753 // the bookmark has been registered by the application and the last
754 // time the application registered this bookmark.
756 // If @name is %NULL, the name of the application will be the
757 // same returned by g_get_application_name(); if @exec is %NULL, the
758 // command line will be a composition of the program name as
759 // returned by g_get_prgname() and the "\%u" modifier, which will be
760 // expanded to the bookmark's URI.
762 // This function will automatically take care of updating the
763 // registrations count and timestamping in case an application
764 // with the same @name had already registered a bookmark for
765 // @uri inside @bookmark.
767 // If no bookmark for @uri is found, one is created.
768 // <uri>: a valid URI
769 // <name>: the name of the application registering the bookmark or %NULL
770 // <exec>: command line to be used to launch the bookmark or %NULL
771 void add_application(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char*/ name, AT2 /*char*/ exec) nothrow {
772 g_bookmark_file_add_application(&this, toCString!(char*)(uri), toCString!(char*)(name), toCString!(char*)(exec));
775 // VERSION: 2.12
776 // Adds @group to the list of groups to which the bookmark for @uri
777 // belongs to.
779 // If no bookmark for @uri is found then it is created.
780 // <uri>: a valid URI
781 // <group>: the group name to be added
782 void add_group(AT0, AT1)(AT0 /*char*/ uri, AT1 /*char*/ group) nothrow {
783 g_bookmark_file_add_group(&this, toCString!(char*)(uri), toCString!(char*)(group));
786 // VERSION: 2.12
787 // Frees a #GBookmarkFile.
788 void free()() nothrow {
789 g_bookmark_file_free(&this);
792 // VERSION: 2.12
793 // Gets the time the bookmark for @uri was added to @bookmark
795 // In the event the URI cannot be found, -1 is returned and
796 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
797 // RETURNS: a timestamp
798 // <uri>: a valid URI
799 time_t get_added(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
800 return g_bookmark_file_get_added(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
803 // VERSION: 2.12
804 // Gets the registration informations of @app_name for the bookmark for
805 // @uri. See g_bookmark_file_set_app_info() for more informations about
806 // the returned data.
808 // The string returned in @app_exec must be freed.
810 // In the event the URI cannot be found, %FALSE is returned and
811 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
812 // event that no application with name @app_name has registered a bookmark
813 // for @uri, %FALSE is returned and error is set to
814 // #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
815 // the command line fails, an error of the #G_SHELL_ERROR domain is
816 // set and %FALSE is returned.
817 // RETURNS: %TRUE on success.
818 // <uri>: a valid URI
819 // <name>: an application's name
820 // <exec>: location for the command line of the application, or %NULL
821 // <count>: return location for the registration count, or %NULL
822 // <stamp>: return location for the last registration time, or %NULL
823 int get_app_info(AT0, AT1, AT2, AT3, AT4, AT5)(AT0 /*char*/ uri, AT1 /*char*/ name, AT2 /*char**/ exec, AT3 /*uint*/ count, AT4 /*time_t*/ stamp, AT5 /*GLib2.Error**/ error=null) nothrow {
824 return g_bookmark_file_get_app_info(&this, toCString!(char*)(uri), toCString!(char*)(name), toCString!(char**)(exec), UpCast!(uint*)(count), UpCast!(time_t*)(stamp), UpCast!(GLib2.Error**)(error));
827 // Unintrospectable method: get_applications() / g_bookmark_file_get_applications()
828 // VERSION: 2.12
829 // Retrieves the names of the applications that have registered the
830 // bookmark for @uri.
832 // In the event the URI cannot be found, %NULL is returned and
833 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
835 // Use g_strfreev() to free it.
836 // RETURNS: a newly allocated %NULL-terminated array of strings.
837 // <uri>: a valid URI
838 // <length>: return location of the length of the returned list, or %NULL
839 char** get_applications(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*size_t*/ length, AT2 /*GLib2.Error**/ error=null) nothrow {
840 return g_bookmark_file_get_applications(&this, toCString!(char*)(uri), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
843 // VERSION: 2.12
844 // Retrieves the description of the bookmark for @uri.
846 // In the event the URI cannot be found, %NULL is returned and
847 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
849 // URI cannot be found.
850 // RETURNS: a newly allocated string or %NULL if the specified
851 // <uri>: a valid URI
852 char* /*new*/ get_description(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
853 return g_bookmark_file_get_description(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
856 // Unintrospectable method: get_groups() / g_bookmark_file_get_groups()
857 // VERSION: 2.12
858 // Retrieves the list of group names of the bookmark for @uri.
860 // In the event the URI cannot be found, %NULL is returned and
861 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
863 // The returned array is %NULL terminated, so @length may optionally
864 // be %NULL.
866 // Use g_strfreev() to free it.
867 // RETURNS: a newly allocated %NULL-terminated array of group names.
868 // <uri>: a valid URI
869 // <length>: return location for the length of the returned string, or %NULL
870 char** get_groups(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*size_t*/ length, AT2 /*GLib2.Error**/ error=null) nothrow {
871 return g_bookmark_file_get_groups(&this, toCString!(char*)(uri), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
874 // VERSION: 2.12
875 // Gets the icon of the bookmark for @uri.
877 // In the event the URI cannot be found, %FALSE is returned and
878 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
880 // You should free the returned strings.
881 // RETURNS: %TRUE if the icon for the bookmark for the URI was found.
882 // <uri>: a valid URI
883 // <href>: return location for the icon's location or %NULL
884 // <mime_type>: return location for the icon's MIME type or %NULL
885 int get_icon(AT0, AT1, AT2, AT3)(AT0 /*char*/ uri, AT1 /*char**/ href, AT2 /*char**/ mime_type, AT3 /*GLib2.Error**/ error=null) nothrow {
886 return g_bookmark_file_get_icon(&this, toCString!(char*)(uri), toCString!(char**)(href), toCString!(char**)(mime_type), UpCast!(GLib2.Error**)(error));
889 // VERSION: 2.12
890 // Gets whether the private flag of the bookmark for @uri is set.
892 // In the event the URI cannot be found, %FALSE is returned and
893 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
894 // event that the private flag cannot be found, %FALSE is returned and
895 // @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
896 // RETURNS: %TRUE if the private flag is set, %FALSE otherwise.
897 // <uri>: a valid URI
898 int get_is_private(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
899 return g_bookmark_file_get_is_private(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
902 // VERSION: 2.12
903 // Retrieves the MIME type of the resource pointed by @uri.
905 // In the event the URI cannot be found, %NULL is returned and
906 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
907 // event that the MIME type cannot be found, %NULL is returned and
908 // @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
910 // URI cannot be found.
911 // RETURNS: a newly allocated string or %NULL if the specified
912 // <uri>: a valid URI
913 char* /*new*/ get_mime_type(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
914 return g_bookmark_file_get_mime_type(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
917 // VERSION: 2.12
918 // Gets the time when the bookmark for @uri was last modified.
920 // In the event the URI cannot be found, -1 is returned and
921 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
922 // RETURNS: a timestamp
923 // <uri>: a valid URI
924 time_t get_modified(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
925 return g_bookmark_file_get_modified(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
928 // VERSION: 2.12
929 // Gets the number of bookmarks inside @bookmark.
930 // RETURNS: the number of bookmarks
931 int get_size()() nothrow {
932 return g_bookmark_file_get_size(&this);
935 // VERSION: 2.12
936 // Returns the title of the bookmark for @uri.
938 // If @uri is %NULL, the title of @bookmark is returned.
940 // In the event the URI cannot be found, %NULL is returned and
941 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
943 // URI cannot be found.
944 // RETURNS: a newly allocated string or %NULL if the specified
945 // <uri>: a valid URI or %NULL
946 char* /*new*/ get_title(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
947 return g_bookmark_file_get_title(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
950 // Unintrospectable method: get_uris() / g_bookmark_file_get_uris()
951 // VERSION: 2.12
952 // Returns all URIs of the bookmarks in the bookmark file @bookmark.
953 // The array of returned URIs will be %NULL-terminated, so @length may
954 // optionally be %NULL.
956 // Use g_strfreev() to free it.
957 // RETURNS: a newly allocated %NULL-terminated array of strings.
958 // <length>: return location for the number of returned URIs, or %NULL
959 char** get_uris(AT0)(AT0 /*size_t*/ length) nothrow {
960 return g_bookmark_file_get_uris(&this, UpCast!(size_t*)(length));
963 // VERSION: 2.12
964 // Gets the time the bookmark for @uri was last visited.
966 // In the event the URI cannot be found, -1 is returned and
967 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
968 // RETURNS: a timestamp.
969 // <uri>: a valid URI
970 time_t get_visited(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
971 return g_bookmark_file_get_visited(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
974 // VERSION: 2.12
975 // Checks whether the bookmark for @uri inside @bookmark has been
976 // registered by application @name.
978 // In the event the URI cannot be found, %FALSE is returned and
979 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
980 // RETURNS: %TRUE if the application @name was found
981 // <uri>: a valid URI
982 // <name>: the name of the application
983 int has_application(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char*/ name, AT2 /*GLib2.Error**/ error=null) nothrow {
984 return g_bookmark_file_has_application(&this, toCString!(char*)(uri), toCString!(char*)(name), UpCast!(GLib2.Error**)(error));
987 // VERSION: 2.12
988 // Checks whether @group appears in the list of groups to which
989 // the bookmark for @uri belongs to.
991 // In the event the URI cannot be found, %FALSE is returned and
992 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
993 // RETURNS: %TRUE if @group was found.
994 // <uri>: a valid URI
995 // <group>: the group name to be searched
996 int has_group(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char*/ group, AT2 /*GLib2.Error**/ error=null) nothrow {
997 return g_bookmark_file_has_group(&this, toCString!(char*)(uri), toCString!(char*)(group), UpCast!(GLib2.Error**)(error));
1000 // VERSION: 2.12
1001 // Looks whether the desktop bookmark has an item with its URI set to @uri.
1002 // RETURNS: %TRUE if @uri is inside @bookmark, %FALSE otherwise
1003 // <uri>: a valid URI
1004 int has_item(AT0)(AT0 /*char*/ uri) nothrow {
1005 return g_bookmark_file_has_item(&this, toCString!(char*)(uri));
1008 // VERSION: 2.12
1009 // Loads a bookmark file from memory into an empty #GBookmarkFile
1010 // structure. If the object cannot be created then @error is set to a
1011 // #GBookmarkFileError.
1012 // RETURNS: %TRUE if a desktop bookmark could be loaded.
1013 // <data>: desktop bookmarks loaded in memory
1014 // <length>: the length of @data in bytes
1015 int load_from_data(AT0, AT1)(AT0 /*char*/ data, size_t length, AT1 /*GLib2.Error**/ error=null) nothrow {
1016 return g_bookmark_file_load_from_data(&this, toCString!(char*)(data), length, UpCast!(GLib2.Error**)(error));
1019 // VERSION: 2.12
1020 // This function looks for a desktop bookmark file named @file in the
1021 // paths returned from g_get_user_data_dir() and g_get_system_data_dirs(),
1022 // loads the file into @bookmark and returns the file's full path in
1023 // @full_path. If the file could not be loaded then an %error is
1024 // set to either a #GFileError or #GBookmarkFileError.
1025 // RETURNS: %TRUE if a key file could be loaded, %FALSE otherwise
1026 // <file>: a relative path to a filename to open and parse
1027 // <full_path>: return location for a string containing the full path of the file, or %NULL
1028 int load_from_data_dirs(AT0, AT1, AT2)(AT0 /*char*/ file, AT1 /*char**/ full_path, AT2 /*GLib2.Error**/ error=null) nothrow {
1029 return g_bookmark_file_load_from_data_dirs(&this, toCString!(char*)(file), toCString!(char**)(full_path), UpCast!(GLib2.Error**)(error));
1032 // VERSION: 2.12
1033 // Loads a desktop bookmark file into an empty #GBookmarkFile structure.
1034 // If the file could not be loaded then @error is set to either a #GFileError
1035 // or #GBookmarkFileError.
1036 // RETURNS: %TRUE if a desktop bookmark file could be loaded
1037 // <filename>: the path of a filename to load, in the GLib file name encoding
1038 int load_from_file(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) nothrow {
1039 return g_bookmark_file_load_from_file(&this, toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
1042 // VERSION: 2.12
1043 // Changes the URI of a bookmark item from @old_uri to @new_uri. Any
1044 // existing bookmark for @new_uri will be overwritten. If @new_uri is
1045 // %NULL, then the bookmark is removed.
1047 // In the event the URI cannot be found, %FALSE is returned and
1048 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
1049 // RETURNS: %TRUE if the URI was successfully changed
1050 // <old_uri>: a valid URI
1051 // <new_uri>: a valid URI, or %NULL
1052 int move_item(AT0, AT1, AT2)(AT0 /*char*/ old_uri, AT1 /*char*/ new_uri, AT2 /*GLib2.Error**/ error=null) nothrow {
1053 return g_bookmark_file_move_item(&this, toCString!(char*)(old_uri), toCString!(char*)(new_uri), UpCast!(GLib2.Error**)(error));
1056 // VERSION: 2.12
1057 // Removes application registered with @name from the list of applications
1058 // that have registered a bookmark for @uri inside @bookmark.
1060 // In the event the URI cannot be found, %FALSE is returned and
1061 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
1062 // In the event that no application with name @app_name has registered
1063 // a bookmark for @uri, %FALSE is returned and error is set to
1064 // #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.
1065 // RETURNS: %TRUE if the application was successfully removed.
1066 // <uri>: a valid URI
1067 // <name>: the name of the application
1068 int remove_application(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char*/ name, AT2 /*GLib2.Error**/ error=null) nothrow {
1069 return g_bookmark_file_remove_application(&this, toCString!(char*)(uri), toCString!(char*)(name), UpCast!(GLib2.Error**)(error));
1072 // VERSION: 2.12
1073 // Removes @group from the list of groups to which the bookmark
1074 // for @uri belongs to.
1076 // In the event the URI cannot be found, %FALSE is returned and
1077 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
1078 // In the event no group was defined, %FALSE is returned and
1079 // @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
1080 // RETURNS: %TRUE if @group was successfully removed.
1081 // <uri>: a valid URI
1082 // <group>: the group name to be removed
1083 int remove_group(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char*/ group, AT2 /*GLib2.Error**/ error=null) nothrow {
1084 return g_bookmark_file_remove_group(&this, toCString!(char*)(uri), toCString!(char*)(group), UpCast!(GLib2.Error**)(error));
1087 // VERSION: 2.12
1088 // Removes the bookmark for @uri from the bookmark file @bookmark.
1089 // RETURNS: %TRUE if the bookmark was removed successfully.
1090 // <uri>: a valid URI
1091 int remove_item(AT0, AT1)(AT0 /*char*/ uri, AT1 /*GLib2.Error**/ error=null) nothrow {
1092 return g_bookmark_file_remove_item(&this, toCString!(char*)(uri), UpCast!(GLib2.Error**)(error));
1095 // VERSION: 2.12
1096 // Sets the time the bookmark for @uri was added into @bookmark.
1098 // If no bookmark for @uri is found then it is created.
1099 // <uri>: a valid URI
1100 // <added>: a timestamp or -1 to use the current time
1101 void set_added(AT0)(AT0 /*char*/ uri, time_t added) nothrow {
1102 g_bookmark_file_set_added(&this, toCString!(char*)(uri), added);
1105 // VERSION: 2.12
1106 // Sets the meta-data of application @name inside the list of
1107 // applications that have registered a bookmark for @uri inside
1108 // @bookmark.
1110 // You should rarely use this function; use g_bookmark_file_add_application()
1111 // and g_bookmark_file_remove_application() instead.
1113 // @name can be any UTF-8 encoded string used to identify an
1114 // application.
1115 // be expanded as the local file name retrieved from the bookmark's
1116 // URI; "\%u", which will be expanded as the bookmark's URI.
1117 // The expansion is done automatically when retrieving the stored
1118 // command line using the g_bookmark_file_get_app_info() function.
1119 // @count is the number of times the application has registered the
1120 // bookmark; if is < 0, the current registration count will be increased
1121 // by one, if is 0, the application with @name will be removed from
1122 // the list of registered applications.
1123 // @stamp is the Unix time of the last registration; if it is -1, the
1124 // current time will be used.
1126 // If you try to remove an application by setting its registration count to
1127 // zero, and no bookmark for @uri is found, %FALSE is returned and
1128 // @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
1129 // in the event that no application @name has registered a bookmark
1130 // for @uri, %FALSE is returned and error is set to
1131 // #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, if no bookmark
1132 // for @uri is found, one is created.
1134 // changed.
1135 // RETURNS: %TRUE if the application's meta-data was successfully
1136 // <uri>: a valid URI
1137 // <name>: an application's name
1138 // <exec>: an application's command line
1139 // <count>: the number of registrations done for this application
1140 // <stamp>: the time of the last registration for this application
1141 int set_app_info(AT0, AT1, AT2, AT3)(AT0 /*char*/ uri, AT1 /*char*/ name, AT2 /*char*/ exec, int count, time_t stamp, AT3 /*GLib2.Error**/ error=null) nothrow {
1142 return g_bookmark_file_set_app_info(&this, toCString!(char*)(uri), toCString!(char*)(name), toCString!(char*)(exec), count, stamp, UpCast!(GLib2.Error**)(error));
1145 // VERSION: 2.12
1146 // Sets @description as the description of the bookmark for @uri.
1148 // If @uri is %NULL, the description of @bookmark is set.
1150 // If a bookmark for @uri cannot be found then it is created.
1151 // <uri>: a valid URI or %NULL
1152 // <description>: a string
1153 void set_description(AT0, AT1)(AT0 /*char*/ uri, AT1 /*char*/ description) nothrow {
1154 g_bookmark_file_set_description(&this, toCString!(char*)(uri), toCString!(char*)(description));
1157 // VERSION: 2.12
1158 // Sets a list of group names for the item with URI @uri. Each previously
1159 // set group name list is removed.
1161 // If @uri cannot be found then an item for it is created.
1162 // <uri>: an item's URI
1163 // <groups>: an array of group names, or %NULL to remove all groups
1164 // <length>: number of group name values in @groups
1165 void set_groups(AT0, AT1)(AT0 /*char*/ uri, AT1 /*char**/ groups, size_t length) nothrow {
1166 g_bookmark_file_set_groups(&this, toCString!(char*)(uri), toCString!(char**)(groups), length);
1169 // VERSION: 2.12
1170 // Sets the icon for the bookmark for @uri. If @href is %NULL, unsets
1171 // the currently set icon. @href can either be a full URL for the icon
1172 // file or the icon name following the Icon Naming specification.
1174 // If no bookmark for @uri is found one is created.
1175 // <uri>: a valid URI
1176 // <href>: the URI of the icon for the bookmark, or %NULL
1177 // <mime_type>: the MIME type of the icon for the bookmark
1178 void set_icon(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char*/ href, AT2 /*char*/ mime_type) nothrow {
1179 g_bookmark_file_set_icon(&this, toCString!(char*)(uri), toCString!(char*)(href), toCString!(char*)(mime_type));
1182 // VERSION: 2.12
1183 // Sets the private flag of the bookmark for @uri.
1185 // If a bookmark for @uri cannot be found then it is created.
1186 // <uri>: a valid URI
1187 // <is_private>: %TRUE if the bookmark should be marked as private
1188 void set_is_private(AT0)(AT0 /*char*/ uri, int is_private) nothrow {
1189 g_bookmark_file_set_is_private(&this, toCString!(char*)(uri), is_private);
1192 // VERSION: 2.12
1193 // Sets @mime_type as the MIME type of the bookmark for @uri.
1195 // If a bookmark for @uri cannot be found then it is created.
1196 // <uri>: a valid URI
1197 // <mime_type>: a MIME type
1198 void set_mime_type(AT0, AT1)(AT0 /*char*/ uri, AT1 /*char*/ mime_type) nothrow {
1199 g_bookmark_file_set_mime_type(&this, toCString!(char*)(uri), toCString!(char*)(mime_type));
1202 // VERSION: 2.12
1203 // Sets the last time the bookmark for @uri was last modified.
1205 // If no bookmark for @uri is found then it is created.
1207 // The "modified" time should only be set when the bookmark's meta-data
1208 // was actually changed. Every function of #GBookmarkFile that
1209 // modifies a bookmark also changes the modification time, except for
1210 // g_bookmark_file_set_visited().
1211 // <uri>: a valid URI
1212 // <modified>: a timestamp or -1 to use the current time
1213 void set_modified(AT0)(AT0 /*char*/ uri, time_t modified) nothrow {
1214 g_bookmark_file_set_modified(&this, toCString!(char*)(uri), modified);
1217 // VERSION: 2.12
1218 // Sets @title as the title of the bookmark for @uri inside the
1219 // bookmark file @bookmark.
1221 // If @uri is %NULL, the title of @bookmark is set.
1223 // If a bookmark for @uri cannot be found then it is created.
1224 // <uri>: a valid URI or %NULL
1225 // <title>: a UTF-8 encoded string
1226 void set_title(AT0, AT1)(AT0 /*char*/ uri, AT1 /*char*/ title) nothrow {
1227 g_bookmark_file_set_title(&this, toCString!(char*)(uri), toCString!(char*)(title));
1230 // VERSION: 2.12
1231 // Sets the time the bookmark for @uri was last visited.
1233 // If no bookmark for @uri is found then it is created.
1235 // The "visited" time should only be set if the bookmark was launched,
1236 // either using the command line retrieved by g_bookmark_file_get_app_info()
1237 // or by the default application for the bookmark's MIME type, retrieved
1238 // using g_bookmark_file_get_mime_type(). Changing the "visited" time
1239 // does not affect the "modified" time.
1240 // <uri>: a valid URI
1241 // <visited>: a timestamp or -1 to use the current time
1242 void set_visited(AT0)(AT0 /*char*/ uri, time_t visited) nothrow {
1243 g_bookmark_file_set_visited(&this, toCString!(char*)(uri), visited);
1246 // VERSION: 2.12
1247 // This function outputs @bookmark as a string.
1249 // the contents of the #GBookmarkFile
1250 // RETURNS: a newly allocated string holding
1251 // <length>: return location for the length of the returned string, or %NULL
1252 char* /*new*/ to_data(AT0, AT1)(AT0 /*size_t*/ length, AT1 /*GLib2.Error**/ error=null) nothrow {
1253 return g_bookmark_file_to_data(&this, UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
1256 // VERSION: 2.12
1257 // This function outputs @bookmark into a file. The write process is
1258 // guaranteed to be atomic by using g_file_set_contents() internally.
1259 // RETURNS: %TRUE if the file was successfully written.
1260 // <filename>: path of the output file
1261 int to_file(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) nothrow {
1262 return g_bookmark_file_to_file(&this, toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
1264 static Quark error_quark()() nothrow {
1265 return g_bookmark_file_error_quark();
1268 // Unintrospectable function: new() / g_bookmark_file_new()
1269 // VERSION: 2.12
1270 // Creates a new empty #GBookmarkFile object.
1272 // Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data()
1273 // or g_bookmark_file_load_from_data_dirs() to read an existing bookmark
1274 // file.
1275 // RETURNS: an empty #GBookmarkFile
1276 static BookmarkFile* new_()() nothrow {
1277 return g_bookmark_file_new();
1281 // Error codes returned by bookmark file parsing.
1282 enum BookmarkFileError {
1283 INVALID_URI = 0,
1284 INVALID_VALUE = 1,
1285 APP_NOT_REGISTERED = 2,
1286 URI_NOT_FOUND = 3,
1287 READ = 4,
1288 UNKNOWN_ENCODING = 5,
1289 WRITE = 6,
1290 FILE_NOT_FOUND = 7
1293 // The <structname>GByteArray</structname> struct allows access to the
1294 // public fields of a <structname>GByteArray</structname>.
1295 struct ByteArray {
1296 ubyte* data;
1297 uint len;
1300 // Unintrospectable function: append() / g_byte_array_append()
1301 // Adds the given bytes to the end of the #GByteArray. The array will
1302 // grow in size automatically if necessary.
1303 // <array>: a #GByteArray.
1304 // <data>: the byte data to be added.
1305 // <len>: the number of bytes to add.
1306 static ByteArray* append(AT0, AT1)(AT0 /*ByteArray*/ array, AT1 /*ubyte*/ data, uint len) nothrow {
1307 return g_byte_array_append(UpCast!(ByteArray*)(array), UpCast!(ubyte*)(data), len);
1310 // Frees the memory allocated by the #GByteArray. If @free_segment is
1311 // %TRUE it frees the actual byte data. If the reference count of
1312 // @array is greater than one, the #GByteArray wrapper is preserved but
1313 // the size of @array will be set to zero.
1314 // <array>: a #GByteArray.
1315 // <free_segment>: if %TRUE the actual byte data is freed as well.
1316 static ubyte* free(AT0)(AT0 /*ByteArray*/ array, int free_segment) nothrow {
1317 return g_byte_array_free(UpCast!(ByteArray*)(array), free_segment);
1320 // VERSION: 2.32
1321 // Transfers the data from the #GByteArray into a new immutable #GBytes.
1323 // The #GByteArray is freed unless the reference count of @array is greater
1324 // than one, the #GByteArray wrapper is preserved but the size of @array
1325 // will be set to zero.
1327 // This is identical to using g_bytes_new_take() and g_byte_array_free()
1328 // together.
1331 // data that was in the array
1332 // RETURNS: a new immutable #GBytes representing same byte
1333 // <array>: a #GByteArray
1334 static Bytes* /*new*/ free_to_bytes(AT0)(AT0 /*ByteArray*/ array) nothrow {
1335 return g_byte_array_free_to_bytes(UpCast!(ByteArray*)(array));
1338 // Unintrospectable function: new() / g_byte_array_new()
1339 // Creates a new #GByteArray with a reference count of 1.
1340 static ByteArray* new_()() nothrow {
1341 return g_byte_array_new();
1344 // VERSION: 2.32
1345 // Create byte array containing the data. The data will be owned by the array
1346 // and will be freed with g_free(), i.e. it could be allocated using g_strdup().
1347 // RETURNS: a new #GByteArray
1348 // <data>: byte data for the array
1349 // <len>: length of @data
1350 static ByteArray* /*new*/ new_take(AT0)(AT0 /*ubyte*/ data, size_t len) nothrow {
1351 return g_byte_array_new_take(UpCast!(ubyte*)(data), len);
1354 // Unintrospectable function: prepend() / g_byte_array_prepend()
1355 // Adds the given data to the start of the #GByteArray. The array will
1356 // grow in size automatically if necessary.
1357 // <array>: a #GByteArray.
1358 // <data>: the byte data to be added.
1359 // <len>: the number of bytes to add.
1360 static ByteArray* prepend(AT0, AT1)(AT0 /*ByteArray*/ array, AT1 /*ubyte*/ data, uint len) nothrow {
1361 return g_byte_array_prepend(UpCast!(ByteArray*)(array), UpCast!(ubyte*)(data), len);
1364 // Unintrospectable function: ref() / g_byte_array_ref()
1365 // VERSION: 2.22
1366 // Atomically increments the reference count of @array by one. This
1367 // function is MT-safe and may be called from any thread.
1368 // RETURNS: The passed in #GByteArray.
1369 // <array>: A #GByteArray.
1370 static ByteArray* ref_(AT0)(AT0 /*ByteArray*/ array) nothrow {
1371 return g_byte_array_ref(UpCast!(ByteArray*)(array));
1374 // Unintrospectable function: remove_index() / g_byte_array_remove_index()
1375 // Removes the byte at the given index from a #GByteArray. The
1376 // following bytes are moved down one place.
1377 // <array>: a #GByteArray.
1378 // <index_>: the index of the byte to remove.
1379 static ByteArray* remove_index(AT0)(AT0 /*ByteArray*/ array, uint index_) nothrow {
1380 return g_byte_array_remove_index(UpCast!(ByteArray*)(array), index_);
1383 // Unintrospectable function: remove_index_fast() / g_byte_array_remove_index_fast()
1384 // Removes the byte at the given index from a #GByteArray. The last
1385 // element in the array is used to fill in the space, so this function
1386 // does not preserve the order of the #GByteArray. But it is faster
1387 // than g_byte_array_remove_index().
1388 // <array>: a #GByteArray.
1389 // <index_>: the index of the byte to remove.
1390 static ByteArray* remove_index_fast(AT0)(AT0 /*ByteArray*/ array, uint index_) nothrow {
1391 return g_byte_array_remove_index_fast(UpCast!(ByteArray*)(array), index_);
1394 // Unintrospectable function: remove_range() / g_byte_array_remove_range()
1395 // VERSION: 2.4
1396 // Removes the given number of bytes starting at the given index from a
1397 // #GByteArray. The following elements are moved to close the gap.
1398 // <array>: a @GByteArray.
1399 // <index_>: the index of the first byte to remove.
1400 // <length>: the number of bytes to remove.
1401 static ByteArray* remove_range(AT0)(AT0 /*ByteArray*/ array, uint index_, uint length) nothrow {
1402 return g_byte_array_remove_range(UpCast!(ByteArray*)(array), index_, length);
1405 // Unintrospectable function: set_size() / g_byte_array_set_size()
1406 // Sets the size of the #GByteArray, expanding it if necessary.
1407 // <array>: a #GByteArray.
1408 // <length>: the new size of the #GByteArray.
1409 static ByteArray* set_size(AT0)(AT0 /*ByteArray*/ array, uint length) nothrow {
1410 return g_byte_array_set_size(UpCast!(ByteArray*)(array), length);
1413 // Unintrospectable function: sized_new() / g_byte_array_sized_new()
1414 // Creates a new #GByteArray with @reserved_size bytes preallocated.
1415 // This avoids frequent reallocation, if you are going to add many
1416 // bytes to the array. Note however that the size of the array is still
1417 // 0.
1418 // <reserved_size>: number of bytes preallocated.
1419 static ByteArray* sized_new()(uint reserved_size) nothrow {
1420 return g_byte_array_sized_new(reserved_size);
1423 // Unintrospectable function: sort() / g_byte_array_sort()
1424 // Sorts a byte array, using @compare_func which should be a
1425 // qsort()-style comparison function (returns less than zero for first
1426 // arg is less than second arg, zero for equal, greater than zero if
1427 // first arg is greater than second arg).
1429 // If two array elements compare equal, their order in the sorted array
1430 // is undefined. If you want equal elements to keep their order (i.e.
1431 // you want a stable sort) you can write a comparison function that,
1432 // if two elements would otherwise compare equal, compares them by
1433 // their addresses.
1434 // <array>: a #GByteArray.
1435 // <compare_func>: comparison function.
1436 static void sort(AT0)(AT0 /*ByteArray*/ array, CompareFunc compare_func) nothrow {
1437 g_byte_array_sort(UpCast!(ByteArray*)(array), compare_func);
1440 // Unintrospectable function: sort_with_data() / g_byte_array_sort_with_data()
1441 // Like g_byte_array_sort(), but the comparison function takes an extra
1442 // user data argument.
1443 // <array>: a #GByteArray.
1444 // <compare_func>: comparison function.
1445 // <user_data>: data to pass to @compare_func.
1446 static void sort_with_data(AT0, AT1)(AT0 /*ByteArray*/ array, CompareDataFunc compare_func, AT1 /*void*/ user_data) nothrow {
1447 g_byte_array_sort_with_data(UpCast!(ByteArray*)(array), compare_func, UpCast!(void*)(user_data));
1450 // VERSION: 2.22
1451 // Atomically decrements the reference count of @array by one. If the
1452 // reference count drops to 0, all memory allocated by the array is
1453 // released. This function is MT-safe and may be called from any
1454 // thread.
1455 // <array>: A #GByteArray.
1456 static void unref(AT0)(AT0 /*ByteArray*/ array) nothrow {
1457 g_byte_array_unref(UpCast!(ByteArray*)(array));
1462 // A simple refcounted data type representing an immutable byte sequence
1463 // from an unspecified origin.
1465 // The purpose of a #GBytes is to keep the memory region that it holds
1466 // alive for as long as anyone holds a reference to the bytes. When
1467 // the last reference count is dropped, the memory is released. Multiple
1468 // unrelated callers can use byte data in the #GBytes without coordinating
1469 // their activities, resting assured that the byte data will not change or
1470 // move while they hold a reference.
1472 // A #GBytes can come from many different origins that may have
1473 // different procedures for freeing the memory region. Examples are
1474 // memory from g_malloc(), from memory slices, from a #GMappedFile or
1475 // memory from other allocators.
1477 // #GBytes work well as keys in #GHashTable. Use g_bytes_equal() and
1478 // g_bytes_hash() as parameters to g_hash_table_new() or g_hash_table_new_full().
1479 // #GBytes can also be used as keys in a #GTree by passing the g_bytes_compare()
1480 // function to g_tree_new().
1482 // The data pointed to by this bytes must not be modified. For a mutable
1483 // array of bytes see #GByteArray. Use g_bytes_unref_to_array() to create a
1484 // mutable array for a #GBytes sequence. To create an immutable #GBytes from
1485 // a mutable #GByteArray, use the g_byte_array_free_to_bytes() function.
1486 struct Bytes /* Version 2.32 */ {
1488 // VERSION: 2.32
1489 // Creates a new #GBytes from @data.
1491 // @data is copied.
1492 // RETURNS: a new #GBytes
1493 // <data>: the data to be used for the bytes
1494 // <size>: the size of @data
1495 static Bytes* /*new*/ new_(AT0)(AT0 /*const(void)*/ data, size_t size) nothrow {
1496 return g_bytes_new(UpCast!(const(void)*)(data), size);
1498 static auto opCall(AT0)(AT0 /*const(void)*/ data, size_t size) {
1499 return g_bytes_new(UpCast!(const(void)*)(data), size);
1502 // VERSION: 2.32
1503 // Creates a new #GBytes from static data.
1504 // RETURNS: a new #GBytes
1505 // <data>: the data to be used for the bytes
1506 // <size>: the size of @data
1507 static Bytes* /*new*/ new_static(AT0)(AT0 /*const(void)*/ data, size_t size) nothrow {
1508 return g_bytes_new_static(UpCast!(const(void)*)(data), size);
1510 static auto opCall(AT0)(AT0 /*const(void)*/ data, size_t size) {
1511 return g_bytes_new_static(UpCast!(const(void)*)(data), size);
1514 // VERSION: 2.32
1515 // Creates a new #GBytes from @data.
1517 // After this call, @data belongs to the bytes and may no longer be
1518 // modified by the caller. g_free() will be called on @data when the
1519 // bytes is no longer in use. Because of this @data must have been created by
1520 // a call to g_malloc(), g_malloc0() or g_realloc() or by one of the many
1521 // functions that wrap these calls (such as g_new(), g_strdup(), etc).
1523 // For creating #GBytes with memory from other allocators, see
1524 // g_bytes_new_with_free_func().
1525 // RETURNS: a new #GBytes
1526 // <data>: the data to be used for the bytes
1527 // <size>: the size of @data
1528 static Bytes* /*new*/ new_take(AT0)(AT0 /*void*/ data, size_t size) nothrow {
1529 return g_bytes_new_take(UpCast!(void*)(data), size);
1531 static auto opCall(AT0)(AT0 /*void*/ data, size_t size) {
1532 return g_bytes_new_take(UpCast!(void*)(data), size);
1535 // VERSION: 2.32
1536 // Creates a #GBytes from @data.
1538 // When the last reference is dropped, @free_func will be called with the
1539 // @user_data argument.
1541 // @data must not be modified after this call is made until @free_func has
1542 // been called to indicate that the bytes is no longer in use.
1543 // RETURNS: a new #GBytes
1544 // <data>: the data to be used for the bytes
1545 // <size>: the size of @data
1546 // <free_func>: the function to call to release the data
1547 // <user_data>: data to pass to @free_func
1548 static Bytes* /*new*/ new_with_free_func(AT0, AT1)(AT0 /*const(void)*/ data, size_t size, DestroyNotify free_func, AT1 /*void*/ user_data) nothrow {
1549 return g_bytes_new_with_free_func(UpCast!(const(void)*)(data), size, free_func, UpCast!(void*)(user_data));
1551 static auto opCall(AT0, AT1)(AT0 /*const(void)*/ data, size_t size, DestroyNotify free_func, AT1 /*void*/ user_data) {
1552 return g_bytes_new_with_free_func(UpCast!(const(void)*)(data), size, free_func, UpCast!(void*)(user_data));
1555 // VERSION: 2.32
1556 // Compares the two #GBytes values.
1558 // This function can be used to sort GBytes instances in lexographical order.
1560 // greater, and zero if bytes2 is equal to bytes1
1561 // RETURNS: a negative value if bytes2 is lesser, a positive value if bytes2 is
1562 // <bytes2>: a pointer to a #GBytes to compare with @bytes1
1563 int compare(AT0)(AT0 /*const(Bytes)*/ bytes2) nothrow {
1564 return g_bytes_compare(&this, UpCast!(const(Bytes)*)(bytes2));
1567 // VERSION: 2.32
1568 // Compares the two #GBytes values being pointed to and returns
1569 // %TRUE if they are equal.
1571 // This function can be passed to g_hash_table_new() as the @key_equal_func
1572 // parameter, when using non-%NULL #GBytes pointers as keys in a #GHashTable.
1573 // RETURNS: %TRUE if the two keys match.
1574 // <bytes2>: a pointer to a #GBytes to compare with @bytes1
1575 int equal(AT0)(AT0 /*const(Bytes)*/ bytes2) nothrow {
1576 return g_bytes_equal(&this, UpCast!(const(Bytes)*)(bytes2));
1579 // Unintrospectable method: get_data() / g_bytes_get_data()
1580 // VERSION: 2.32
1581 // Get the byte data in the #GBytes. This data should not be modified.
1583 // This function will always return the same pointer for a given #GBytes.
1584 // RETURNS: a pointer to the byte data
1585 // <size>: location to return size of byte data
1586 const(ubyte)* get_data(AT0)(/*out*/ AT0 /*size_t*/ size=null) nothrow {
1587 return g_bytes_get_data(&this, UpCast!(size_t*)(size));
1590 // VERSION: 2.32
1591 // Get the size of the byte data in the #GBytes.
1593 // This function will always return the same value for a given #GBytes.
1594 // RETURNS: the size
1595 size_t get_size()() nothrow {
1596 return g_bytes_get_size(&this);
1599 // VERSION: 2.32
1600 // Creates an integer hash code for the byte data in the #GBytes.
1602 // This function can be passed to g_hash_table_new() as the @key_equal_func
1603 // parameter, when using non-%NULL #GBytes pointers as keys in a #GHashTable.
1604 // RETURNS: a hash value corresponding to the key.
1605 uint hash()() nothrow {
1606 return g_bytes_hash(&this);
1609 // VERSION: 2.32
1610 // Creates a #GBytes which is a subsection of another #GBytes. The @offset +
1611 // @length may not be longer than the size of @bytes.
1613 // A reference to @bytes will be held by the newly created #GBytes until
1614 // the byte data is no longer needed.
1615 // RETURNS: a new #GBytes
1616 // <offset>: offset which subsection starts at
1617 // <length>: length of subsection
1618 Bytes* /*new*/ new_from_bytes()(size_t offset, size_t length) nothrow {
1619 return g_bytes_new_from_bytes(&this, offset, length);
1622 // VERSION: 2.32
1623 // Increase the reference count on @bytes.
1624 // RETURNS: the #GBytes
1625 Bytes* /*new*/ ref_()() nothrow {
1626 return g_bytes_ref(&this);
1629 // VERSION: 2.32
1630 // Releases a reference on @bytes. This may result in the bytes being
1631 // freed.
1632 void unref()() nothrow {
1633 g_bytes_unref(&this);
1636 // VERSION: 2.32
1637 // Unreferences the bytes, and returns a new mutable #GByteArray containing
1638 // the same byte data.
1640 // As an optimization, the byte data is transferred to the array without copying
1641 // if this was the last reference to bytes and bytes was created with
1642 // g_bytes_new(), g_bytes_new_take() or g_byte_array_free_to_bytes(). In all
1643 // other cases the data is copied.
1644 // RETURNS: a new mutable #GByteArray containing the same byte data
1645 ByteArray* /*new*/ unref_to_array()() nothrow {
1646 return g_bytes_unref_to_array(&this);
1649 // VERSION: 2.32
1650 // Unreferences the bytes, and returns a pointer the same byte data
1651 // contents.
1653 // As an optimization, the byte data is returned without copying if this was
1654 // the last reference to bytes and bytes was created with g_bytes_new(),
1655 // g_bytes_new_take() or g_byte_array_free_to_bytes(). In all other cases the
1656 // data is copied.
1658 // be freed with g_free()
1659 // RETURNS: a pointer to the same byte data, which should
1660 // <size>: location to place the length of the returned data
1661 void* /*new*/ unref_to_data(AT0)(AT0 /*size_t*/ size) nothrow {
1662 return g_bytes_unref_to_data(&this, UpCast!(size_t*)(size));
1666 enum int CAN_INLINE = 1;
1667 enum CSET_A_2_Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1668 enum CSET_DIGITS = "0123456789";
1669 enum CSET_a_2_z = "abcdefghijklmnopqrstuvwxyz";
1671 // An opaque structure representing a checksumming operation.
1672 // To create a new GChecksum, use g_checksum_new(). To free
1673 // a GChecksum, use g_checksum_free().
1674 struct Checksum /* Version 2.16 */ {
1676 // Unintrospectable method: copy() / g_checksum_copy()
1677 // VERSION: 2.16
1678 // Copies a #GChecksum. If @checksum has been closed, by calling
1679 // g_checksum_get_string() or g_checksum_get_digest(), the copied
1680 // checksum will be closed as well.
1682 // when finished using it.
1683 // RETURNS: the copy of the passed #GChecksum. Use g_checksum_free()
1684 Checksum* copy()() nothrow {
1685 return g_checksum_copy(&this);
1688 // VERSION: 2.16
1689 // Frees the memory allocated for @checksum.
1690 void free()() nothrow {
1691 g_checksum_free(&this);
1694 // VERSION: 2.16
1695 // Gets the digest from @checksum as a raw binary vector and places it
1696 // into @buffer. The size of the digest depends on the type of checksum.
1698 // Once this function has been called, the #GChecksum is closed and can
1699 // no longer be updated with g_checksum_update().
1700 // <buffer>: output buffer
1701 // <digest_len>: an inout parameter. The caller initializes it to the size of @buffer. After the call it contains the length of the digest.
1702 void get_digest(AT0, AT1)(AT0 /*ubyte*/ buffer, AT1 /*size_t*/ digest_len) nothrow {
1703 g_checksum_get_digest(&this, UpCast!(ubyte*)(buffer), UpCast!(size_t*)(digest_len));
1706 // VERSION: 2.16
1707 // Gets the digest as an hexadecimal string.
1709 // Once this function has been called the #GChecksum can no longer be
1710 // updated with g_checksum_update().
1712 // The hexadecimal characters will be lower case.
1714 // returned string is owned by the checksum and should not be modified
1715 // or freed.
1716 // RETURNS: the hexadecimal representation of the checksum. The
1717 char* get_string()() nothrow {
1718 return g_checksum_get_string(&this);
1721 // VERSION: 2.18
1722 // Resets the state of the @checksum back to its initial state.
1723 void reset()() nothrow {
1724 g_checksum_reset(&this);
1727 // VERSION: 2.16
1728 // Feeds @data into an existing #GChecksum. The checksum must still be
1729 // open, that is g_checksum_get_string() or g_checksum_get_digest() must
1730 // not have been called on @checksum.
1731 // <data>: buffer used to compute the checksum
1732 // <length>: size of the buffer, or -1 if it is a null-terminated string.
1733 void update(AT0)(AT0 /*ubyte*/ data, ssize_t length) nothrow {
1734 g_checksum_update(&this, UpCast!(ubyte*)(data), length);
1737 // Unintrospectable function: new() / g_checksum_new()
1738 // VERSION: 2.16
1739 // Creates a new #GChecksum, using the checksum algorithm @checksum_type.
1740 // If the @checksum_type is not known, %NULL is returned.
1741 // A #GChecksum can be used to compute the checksum, or digest, of an
1742 // arbitrary binary blob, using different hashing algorithms.
1744 // A #GChecksum works by feeding a binary blob through g_checksum_update()
1745 // until there is data to be checked; the digest can then be extracted
1746 // using g_checksum_get_string(), which will return the checksum as a
1747 // hexadecimal string; or g_checksum_get_digest(), which will return a
1748 // vector of raw bytes. Once either g_checksum_get_string() or
1749 // g_checksum_get_digest() have been called on a #GChecksum, the checksum
1750 // will be closed and it won't be possible to call g_checksum_update()
1751 // on it anymore.
1753 // Use g_checksum_free() to free the memory allocated by it.
1754 // RETURNS: the newly created #GChecksum, or %NULL.
1755 // <checksum_type>: the desired type of checksum
1756 static Checksum* new_()(ChecksumType checksum_type) nothrow {
1757 return g_checksum_new(checksum_type);
1760 // VERSION: 2.16
1761 // Gets the length in bytes of digests of type @checksum_type
1763 // not supported.
1764 // RETURNS: the checksum length, or -1 if @checksum_type is
1765 // <checksum_type>: a #GChecksumType
1766 static ssize_t type_get_length()(ChecksumType checksum_type) nothrow {
1767 return g_checksum_type_get_length(checksum_type);
1772 // The hashing algorithm to be used by #GChecksum when performing the
1773 // digest of some data.
1775 // Note that the #GChecksumType enumeration may be extended at a later
1776 // date to include new hashing algorithm types.
1777 enum ChecksumType /* Version 2.16 */ {
1778 MD5 = 0,
1779 SHA1 = 1,
1780 SHA256 = 2
1783 // The type of functions to be called when a child exists.
1784 // <pid>: the process id of the child process
1785 // <status>: Status information about the child process, see waitpid(2) for more information about this field
1786 // <user_data>: user data passed to g_child_watch_add()
1787 extern (C) alias void function (Pid pid, int status, void* user_data) nothrow ChildWatchFunc;
1790 // Specifies the type of a comparison function used to compare two
1791 // values. The function should return a negative integer if the first
1792 // value comes before the second, 0 if they are equal, or a positive
1793 // integer if the first value comes after the second.
1794 // <a>: a value.
1795 // <b>: a value to compare with.
1796 // <user_data>: user data to pass to comparison function.
1797 extern (C) alias int function (const(void)* a, const(void)* b, void* user_data) nothrow CompareDataFunc;
1800 // Specifies the type of a comparison function used to compare two
1801 // values. The function should return a negative integer if the first
1802 // value comes before the second, 0 if they are equal, or a positive
1803 // integer if the first value comes after the second.
1804 // <a>: a value.
1805 // <b>: a value to compare with.
1806 extern (C) alias int function (const(void)* a, const(void)* b) nothrow CompareFunc;
1809 // The #GCond struct is an opaque data structure that represents a
1810 // condition. Threads can block on a #GCond if they find a certain
1811 // condition to be false. If other threads change the state of this
1812 // condition they signal the #GCond, and that causes the waiting
1813 // threads to be woken up.
1815 // Consider the following example of a shared variable. One or more
1816 // threads can wait for data to be published to the variable and when
1817 // another thread publishes the data, it can signal one of the waiting
1818 // threads to wake up to collect the data.
1820 // <example>
1821 // <title>
1822 // Using GCond to block a thread until a condition is satisfied
1823 // </title>
1824 // <programlisting>
1825 // gpointer current_data = NULL;
1826 // GMutex data_mutex;
1827 // GCond data_cond;
1829 // void
1830 // push_data (gpointer data)
1831 // {
1832 // g_mutex_lock (&data_mutex);
1833 // current_data = data;
1834 // g_cond_signal (&data_cond);
1835 // g_mutex_unlock (&data_mutex);
1836 // }
1838 // gpointer
1839 // pop_data (void)
1840 // {
1841 // gpointer data;
1843 // g_mutex_lock (&data_mutex);
1844 // while (!current_data)
1845 // g_cond_wait (&data_cond, &data_mutex);
1846 // data = current_data;
1847 // current_data = NULL;
1848 // g_mutex_unlock (&data_mutex);
1850 // return data;
1851 // }
1852 // </programlisting>
1853 // </example>
1855 // Whenever a thread calls pop_data() now, it will wait until
1856 // current_data is non-%NULL, i.e. until some other thread
1857 // has called push_data().
1859 // The example shows that use of a condition variable must always be
1860 // paired with a mutex. Without the use of a mutex, there would be a
1861 // race between the check of <varname>current_data</varname> by the
1862 // while loop in <function>pop_data</function> and waiting.
1863 // Specifically, another thread could set <varname>pop_data</varname>
1864 // after the check, and signal the cond (with nobody waiting on it)
1865 // before the first thread goes to sleep. #GCond is specifically useful
1866 // for its ability to release the mutex and go to sleep atomically.
1868 // It is also important to use the g_cond_wait() and g_cond_wait_until()
1869 // functions only inside a loop which checks for the condition to be
1870 // true. See g_cond_wait() for an explanation of why the condition may
1871 // not be true even after it returns.
1873 // If a #GCond is allocated in static storage then it can be used
1874 // without initialisation. Otherwise, you should call g_cond_init() on
1875 // it and g_cond_clear() when done.
1877 // A #GCond should only be accessed via the <function>g_cond_</function>
1878 // functions.
1879 struct Cond {
1880 private void* p;
1881 private uint[2] i;
1884 // If threads are waiting for @cond, all of them are unblocked.
1885 // If no threads are waiting for @cond, this function has no effect.
1886 // It is good practice to lock the same mutex as the waiting threads
1887 // while calling this function, though not required.
1888 void broadcast()() nothrow {
1889 g_cond_broadcast(&this);
1892 // VERSION: 2.32
1893 // Frees the resources allocated to a #GCond with g_cond_init().
1895 // This function should not be used with a #GCond that has been
1896 // statically allocated.
1898 // Calling g_cond_clear() for a #GCond on which threads are
1899 // blocking leads to undefined behaviour.
1900 void clear()() nothrow {
1901 g_cond_clear(&this);
1904 // VERSION: 2.32
1905 // Initialises a #GCond so that it can be used.
1907 // This function is useful to initialise a #GCond that has been
1908 // allocated as part of a larger structure. It is not necessary to
1909 // initialise a #GCond that has been statically allocated.
1911 // To undo the effect of g_cond_init() when a #GCond is no longer
1912 // needed, use g_cond_clear().
1914 // Calling g_cond_init() on an already-initialised #GCond leads
1915 // to undefined behaviour.
1916 void init()() nothrow {
1917 g_cond_init(&this);
1920 // If threads are waiting for @cond, at least one of them is unblocked.
1921 // If no threads are waiting for @cond, this function has no effect.
1922 // It is good practice to hold the same lock as the waiting thread
1923 // while calling this function, though not required.
1924 void signal()() nothrow {
1925 g_cond_signal(&this);
1928 // Atomically releases @mutex and waits until @cond is signalled.
1930 // When using condition variables, it is possible that a spurious wakeup
1931 // may occur (ie: g_cond_wait() returns even though g_cond_signal() was
1932 // not called). It's also possible that a stolen wakeup may occur.
1933 // This is when g_cond_signal() is called, but another thread acquires
1934 // @mutex before this thread and modifies the state of the program in
1935 // such a way that when g_cond_wait() is able to return, the expected
1936 // condition is no longer met.
1938 // For this reason, g_cond_wait() must always be used in a loop. See
1939 // the documentation for #GCond for a complete example.
1940 // <mutex>: a #GMutex that is currently locked
1941 void wait(AT0)(AT0 /*Mutex*/ mutex) nothrow {
1942 g_cond_wait(&this, UpCast!(Mutex*)(mutex));
1945 // VERSION: 2.32
1946 // Waits until either @cond is signalled or @end_time has passed.
1948 // As with g_cond_wait() it is possible that a spurious or stolen wakeup
1949 // could occur. For that reason, waiting on a condition variable should
1950 // always be in a loop, based on an explicitly-checked predicate.
1952 // %TRUE is returned if the condition variable was signalled (or in the
1953 // case of a spurious wakeup). %FALSE is returned if @end_time has
1954 // passed.
1956 // The following code shows how to correctly perform a timed wait on a
1957 // condition variable (extended the example presented in the
1958 // documentation for #GCond):
1960 // |[
1961 // gpointer
1962 // pop_data_timed (void)
1963 // {
1964 // gint64 end_time;
1965 // gpointer data;
1967 // g_mutex_lock (&data_mutex);
1969 // end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
1970 // while (!current_data)
1971 // if (!g_cond_wait_until (&data_cond, &data_mutex, end_time))
1972 // {
1973 // // timeout has passed.
1974 // g_mutex_unlock (&data_mutex);
1975 // return NULL;
1976 // }
1978 // // there is data for us
1979 // data = current_data;
1980 // current_data = NULL;
1982 // g_mutex_unlock (&data_mutex);
1984 // return data;
1985 // }
1986 // ]|
1988 // Notice that the end time is calculated once, before entering the
1989 // loop and reused. This is the motivation behind the use of absolute
1990 // time on this API -- if a relative time of 5 seconds were passed
1991 // directly to the call and a spurious wakeup occurred, the program would
1992 // have to start over waiting again (which would lead to a total wait
1993 // time of more than 5 seconds).
1994 // RETURNS: %TRUE on a signal, %FALSE on a timeout
1995 // <mutex>: a #GMutex that is currently locked
1996 // <end_time>: the monotonic time to wait until
1997 int wait_until(AT0)(AT0 /*Mutex*/ mutex, long end_time) nothrow {
1998 return g_cond_wait_until(&this, UpCast!(Mutex*)(mutex), end_time);
2002 // Error codes returned by character set conversion routines.
2003 enum ConvertError {
2004 NO_CONVERSION = 0,
2005 ILLEGAL_SEQUENCE = 1,
2006 FAILED = 2,
2007 PARTIAL_INPUT = 3,
2008 BAD_URI = 4,
2009 NOT_ABSOLUTE_PATH = 5
2012 // Unintrospectable callback: CopyFunc() / ()
2013 // VERSION: 2.4
2014 // A function of this signature is used to copy the node data
2015 // when doing a deep-copy of a tree.
2016 // RETURNS: A pointer to the copy
2017 // <src>: A pointer to the data which should be copied
2018 // <data>: Additional data
2019 extern (C) alias void* function (const(void)* src, void* data) nothrow CopyFunc;
2021 enum int DATALIST_FLAGS_MASK = 3;
2022 enum int DATE_BAD_DAY = 0;
2023 enum int DATE_BAD_JULIAN = 0;
2024 enum int DATE_BAD_YEAR = 0;
2025 enum int DIR_SEPARATOR = 92;
2026 enum DIR_SEPARATOR_S = "\\";
2028 // The #GData struct is an opaque data structure to represent a <link
2029 // linkend="glib-Keyed-Data-Lists">Keyed Data List</link>. It should
2030 // only be accessed via the following functions.
2031 struct Data {
2035 // Specifies the type of function passed to g_dataset_foreach(). It is
2036 // called with each #GQuark id and associated data element, together
2037 // with the @user_data parameter supplied to g_dataset_foreach().
2038 // <key_id>: the #GQuark id to identifying the data element.
2039 // <data>: the data element.
2040 // <user_data>: user data passed to g_dataset_foreach().
2041 extern (C) alias void function (Quark key_id, void* data, void* user_data) nothrow DataForeachFunc;
2044 // Represents a day between January 1, Year 1 and a few thousand years in
2045 // the future. None of its members should be accessed directly. If the
2046 // <structname>GDate</structname> is obtained from g_date_new(), it will
2047 // be safe to mutate but invalid and thus not safe for calendrical
2048 // computations. If it's declared on the stack, it will contain garbage
2049 // so must be initialized with g_date_clear(). g_date_clear() makes the
2050 // date invalid but sane. An invalid date doesn't represent a day, it's
2051 // "empty." A date becomes valid after you set it to a Julian day or you
2052 // set a day, month, and year.
2053 struct Date {
2054 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2055 uint, "julian_days", 32,
2056 uint, "julian", 1,
2057 uint, "dmy", 1,
2058 uint, "day", 6,
2059 uint, "month", 4,
2060 uint, "year", 16,
2061 uint, "__dummy64A", 4));
2064 // Allocates a #GDate and initializes
2065 // it to a sane state. The new date will
2066 // be cleared (as if you'd called g_date_clear()) but invalid (it won't
2067 // represent an existing day). Free the return value with g_date_free().
2068 // RETURNS: a newly-allocated #GDate
2069 static Date* /*new*/ new_()() nothrow {
2070 return g_date_new();
2072 static auto opCall()() {
2073 return g_date_new();
2076 // Like g_date_new(), but also sets the value of the date. Assuming the
2077 // day-month-year triplet you pass in represents an existing day, the
2078 // returned date will be valid.
2079 // RETURNS: a newly-allocated #GDate initialized with @day, @month, and @year
2080 // <day>: day of the month
2081 // <month>: month of the year
2082 // <year>: year
2083 static Date* /*new*/ new_dmy()(DateDay day, DateMonth month, DateYear year) nothrow {
2084 return g_date_new_dmy(day, month, year);
2086 static auto opCall()(DateDay day, DateMonth month, DateYear year) {
2087 return g_date_new_dmy(day, month, year);
2090 // Like g_date_new(), but also sets the value of the date. Assuming the
2091 // Julian day number you pass in is valid (greater than 0, less than an
2092 // unreasonably large number), the returned date will be valid.
2093 // RETURNS: a newly-allocated #GDate initialized with @julian_day
2094 // <julian_day>: days since January 1, Year 1
2095 static Date* /*new*/ new_julian()(uint julian_day) nothrow {
2096 return g_date_new_julian(julian_day);
2098 static auto opCall()(uint julian_day) {
2099 return g_date_new_julian(julian_day);
2102 // Increments a date some number of days.
2103 // To move forward by weeks, add weeks*7 days.
2104 // The date must be valid.
2105 // <n_days>: number of days to move the date forward
2106 void add_days()(uint n_days) nothrow {
2107 g_date_add_days(&this, n_days);
2110 // Increments a date by some number of months.
2111 // If the day of the month is greater than 28,
2112 // this routine may change the day of the month
2113 // (because the destination month may not have
2114 // the current day in it). The date must be valid.
2115 // <n_months>: number of months to move forward
2116 void add_months()(uint n_months) nothrow {
2117 g_date_add_months(&this, n_months);
2120 // Increments a date by some number of years.
2121 // If the date is February 29, and the destination
2122 // year is not a leap year, the date will be changed
2123 // to February 28. The date must be valid.
2124 // <n_years>: number of years to move forward
2125 void add_years()(uint n_years) nothrow {
2126 g_date_add_years(&this, n_years);
2129 // If @date is prior to @min_date, sets @date equal to @min_date.
2130 // If @date falls after @max_date, sets @date equal to @max_date.
2131 // Otherwise, @date is unchanged.
2132 // Either of @min_date and @max_date may be %NULL.
2133 // All non-%NULL dates must be valid.
2134 // <min_date>: minimum accepted value for @date
2135 // <max_date>: maximum accepted value for @date
2136 void clamp(AT0, AT1)(AT0 /*Date*/ min_date, AT1 /*Date*/ max_date) nothrow {
2137 g_date_clamp(&this, UpCast!(Date*)(min_date), UpCast!(Date*)(max_date));
2140 // Initializes one or more #GDate structs to a sane but invalid
2141 // state. The cleared dates will not represent an existing date, but will
2142 // not contain garbage. Useful to init a date declared on the stack.
2143 // Validity can be tested with g_date_valid().
2144 // <n_dates>: number of dates to clear
2145 void clear()(uint n_dates) nothrow {
2146 g_date_clear(&this, n_dates);
2149 // qsort()-style comparison function for dates.
2150 // Both dates must be valid.
2152 // greater than zero if @lhs is greater than @rhs
2153 // RETURNS: 0 for equal, less than zero if @lhs is less than @rhs,
2154 // <rhs>: second date to compare
2155 int compare(AT0)(AT0 /*Date*/ rhs) nothrow {
2156 return g_date_compare(&this, UpCast!(Date*)(rhs));
2159 // Computes the number of days between two dates.
2160 // If @date2 is prior to @date1, the returned value is negative.
2161 // Both dates must be valid.
2162 // RETURNS: the number of days between @date1 and @date2
2163 // <date2>: the second date
2164 int days_between(AT0)(AT0 /*Date*/ date2) nothrow {
2165 return g_date_days_between(&this, UpCast!(Date*)(date2));
2167 // Frees a #GDate returned from g_date_new().
2168 void free()() nothrow {
2169 g_date_free(&this);
2172 // Returns the day of the month. The date must be valid.
2173 // RETURNS: day of the month
2174 DateDay get_day()() nothrow {
2175 return g_date_get_day(&this);
2178 // Returns the day of the year, where Jan 1 is the first day of the
2179 // year. The date must be valid.
2180 // RETURNS: day of the year
2181 uint get_day_of_year()() nothrow {
2182 return g_date_get_day_of_year(&this);
2185 // VERSION: 2.6
2186 // Returns the week of the year, where weeks are interpreted according
2187 // to ISO 8601.
2188 // RETURNS: ISO 8601 week number of the year.
2189 uint get_iso8601_week_of_year()() nothrow {
2190 return g_date_get_iso8601_week_of_year(&this);
2193 // Returns the Julian day or "serial number" of the #GDate. The
2194 // Julian day is simply the number of days since January 1, Year 1; i.e.,
2195 // January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
2196 // etc. The date must be valid.
2197 // RETURNS: Julian day
2198 uint get_julian()() nothrow {
2199 return g_date_get_julian(&this);
2202 // Returns the week of the year, where weeks are understood to start on
2203 // Monday. If the date is before the first Monday of the year, return
2204 // 0. The date must be valid.
2205 // RETURNS: week of the year
2206 uint get_monday_week_of_year()() nothrow {
2207 return g_date_get_monday_week_of_year(&this);
2210 // Returns the month of the year. The date must be valid.
2211 // RETURNS: month of the year as a #GDateMonth
2212 DateMonth get_month()() nothrow {
2213 return g_date_get_month(&this);
2216 // Returns the week of the year during which this date falls, if weeks
2217 // are understood to being on Sunday. The date must be valid. Can return
2218 // 0 if the day is before the first Sunday of the year.
2219 // RETURNS: week number
2220 uint get_sunday_week_of_year()() nothrow {
2221 return g_date_get_sunday_week_of_year(&this);
2224 // Returns the day of the week for a #GDate. The date must be valid.
2225 // RETURNS: day of the week as a #GDateWeekday.
2226 DateWeekday get_weekday()() nothrow {
2227 return g_date_get_weekday(&this);
2230 // Returns the year of a #GDate. The date must be valid.
2231 // RETURNS: year in which the date falls
2232 DateYear get_year()() nothrow {
2233 return g_date_get_year(&this);
2236 // Returns %TRUE if the date is on the first of a month.
2237 // The date must be valid.
2238 // RETURNS: %TRUE if the date is the first of the month
2239 int is_first_of_month()() nothrow {
2240 return g_date_is_first_of_month(&this);
2243 // Returns %TRUE if the date is the last day of the month.
2244 // The date must be valid.
2245 // RETURNS: %TRUE if the date is the last day of the month
2246 int is_last_of_month()() nothrow {
2247 return g_date_is_last_of_month(&this);
2250 // Checks if @date1 is less than or equal to @date2,
2251 // and swap the values if this is not the case.
2252 // <date2>: the second date
2253 void order(AT0)(AT0 /*Date*/ date2) nothrow {
2254 g_date_order(&this, UpCast!(Date*)(date2));
2257 // Sets the day of the month for a #GDate. If the resulting
2258 // day-month-year triplet is invalid, the date will be invalid.
2259 // <day>: day to set
2260 void set_day()(DateDay day) nothrow {
2261 g_date_set_day(&this, day);
2264 // Sets the value of a #GDate from a day, month, and year.
2265 // The day-month-year triplet must be valid; if you aren't
2266 // sure it is, call g_date_valid_dmy() to check before you
2267 // set it.
2268 // <day>: day
2269 // <month>: month
2270 // <y>: year
2271 void set_dmy()(DateDay day, DateMonth month, DateYear y) nothrow {
2272 g_date_set_dmy(&this, day, month, y);
2275 // Sets the value of a #GDate from a Julian day number.
2276 // <julian_date>: Julian day number (days since January 1, Year 1)
2277 void set_julian()(uint julian_date) nothrow {
2278 g_date_set_julian(&this, julian_date);
2281 // Sets the month of the year for a #GDate. If the resulting
2282 // day-month-year triplet is invalid, the date will be invalid.
2283 // <month>: month to set
2284 void set_month()(DateMonth month) nothrow {
2285 g_date_set_month(&this, month);
2288 // Parses a user-inputted string @str, and try to figure out what date it
2289 // represents, taking the <link linkend="setlocale">current locale</link>
2290 // into account. If the string is successfully parsed, the date will be
2291 // valid after the call. Otherwise, it will be invalid. You should check
2292 // using g_date_valid() to see whether the parsing succeeded.
2294 // This function is not appropriate for file formats and the like; it
2295 // isn't very precise, and its exact behavior varies with the locale.
2296 // It's intended to be a heuristic routine that guesses what the user
2297 // means by a given string (and it does work pretty well in that
2298 // capacity).
2299 // <str>: string to parse
2300 void set_parse(AT0)(AT0 /*char*/ str) nothrow {
2301 g_date_set_parse(&this, toCString!(char*)(str));
2304 // DEPRECATED (v2.10) method: set_time - Use g_date_set_time_t() instead.
2305 // Sets the value of a date from a #GTime value.
2306 // The time to date conversion is done using the user's current timezone.
2307 // <time_>: #GTime value to set.
2308 void set_time()(Time time_) nothrow {
2309 g_date_set_time(&this, time_);
2312 // VERSION: 2.10
2313 // Sets the value of a date to the date corresponding to a time
2314 // specified as a time_t. The time to date conversion is done using
2315 // the user's current timezone.
2317 // To set the value of a date to the current day, you could write:
2318 // |[
2319 // g_date_set_time_t (date, time (NULL));
2320 // ]|
2321 // <timet>: <type>time_t</type> value to set
2322 void set_time_t()(time_t timet) nothrow {
2323 g_date_set_time_t(&this, timet);
2326 // VERSION: 2.10
2327 // Sets the value of a date from a #GTimeVal value. Note that the
2328 // @tv_usec member is ignored, because #GDate can't make use of the
2329 // additional precision.
2331 // The time to date conversion is done using the user's current timezone.
2332 // <timeval>: #GTimeVal value to set
2333 void set_time_val(AT0)(AT0 /*TimeVal*/ timeval) nothrow {
2334 g_date_set_time_val(&this, UpCast!(TimeVal*)(timeval));
2337 // Sets the year for a #GDate. If the resulting day-month-year
2338 // triplet is invalid, the date will be invalid.
2339 // <year>: year to set
2340 void set_year()(DateYear year) nothrow {
2341 g_date_set_year(&this, year);
2344 // Moves a date some number of days into the past.
2345 // To move by weeks, just move by weeks*7 days.
2346 // The date must be valid.
2347 // <n_days>: number of days to move
2348 void subtract_days()(uint n_days) nothrow {
2349 g_date_subtract_days(&this, n_days);
2352 // Moves a date some number of months into the past.
2353 // If the current day of the month doesn't exist in
2354 // the destination month, the day of the month
2355 // may change. The date must be valid.
2356 // <n_months>: number of months to move
2357 void subtract_months()(uint n_months) nothrow {
2358 g_date_subtract_months(&this, n_months);
2361 // Moves a date some number of years into the past.
2362 // If the current day doesn't exist in the destination
2363 // year (i.e. it's February 29 and you move to a non-leap-year)
2364 // then the day is changed to February 29. The date
2365 // must be valid.
2366 // <n_years>: number of years to move
2367 void subtract_years()(uint n_years) nothrow {
2368 g_date_subtract_years(&this, n_years);
2371 // Fills in the date-related bits of a <structname>struct tm</structname>
2372 // using the @date value. Initializes the non-date parts with something
2373 // sane but meaningless.
2374 // <tm>: <structname>struct tm</structname> to fill
2375 void to_struct_tm(AT0)(AT0 /*void**/ tm) nothrow {
2376 g_date_to_struct_tm(&this, UpCast!(void**)(tm));
2379 // Returns %TRUE if the #GDate represents an existing day. The date must not
2380 // contain garbage; it should have been initialized with g_date_clear()
2381 // if it wasn't allocated by one of the g_date_new() variants.
2382 // RETURNS: Whether the date is valid
2383 int valid()() nothrow {
2384 return g_date_valid(&this);
2387 // Returns the number of days in a month, taking leap
2388 // years into account.
2389 // RETURNS: number of days in @month during the @year
2390 // <month>: month
2391 // <year>: year
2392 static ubyte get_days_in_month()(DateMonth month, DateYear year) nothrow {
2393 return g_date_get_days_in_month(month, year);
2396 // Returns the number of weeks in the year, where weeks
2397 // are taken to start on Monday. Will be 52 or 53. The
2398 // date must be valid. (Years always have 52 7-day periods,
2399 // plus 1 or 2 extra days depending on whether it's a leap
2400 // year. This function is basically telling you how many
2401 // Mondays are in the year, i.e. there are 53 Mondays if
2402 // one of the extra days happens to be a Monday.)
2403 // RETURNS: number of Mondays in the year
2404 // <year>: a year
2405 static ubyte get_monday_weeks_in_year()(DateYear year) nothrow {
2406 return g_date_get_monday_weeks_in_year(year);
2409 // Returns the number of weeks in the year, where weeks
2410 // are taken to start on Sunday. Will be 52 or 53. The
2411 // date must be valid. (Years always have 52 7-day periods,
2412 // plus 1 or 2 extra days depending on whether it's a leap
2413 // year. This function is basically telling you how many
2414 // Sundays are in the year, i.e. there are 53 Sundays if
2415 // one of the extra days happens to be a Sunday.)
2416 // RETURNS: the number of weeks in @year
2417 // <year>: year to count weeks in
2418 static ubyte get_sunday_weeks_in_year()(DateYear year) nothrow {
2419 return g_date_get_sunday_weeks_in_year(year);
2422 // Returns %TRUE if the year is a leap year.
2423 // <footnote><para>For the purposes of this function,
2424 // leap year is every year divisible by 4 unless that year
2425 // is divisible by 100. If it is divisible by 100 it would
2426 // be a leap year only if that year is also divisible
2427 // by 400.</para></footnote>
2428 // RETURNS: %TRUE if the year is a leap year
2429 // <year>: year to check
2430 static int is_leap_year()(DateYear year) nothrow {
2431 return g_date_is_leap_year(year);
2434 // Generates a printed representation of the date, in a
2435 // <link linkend="setlocale">locale</link>-specific way.
2436 // Works just like the platform's C library strftime() function,
2437 // but only accepts date-related formats; time-related formats
2438 // give undefined results. Date must be valid. Unlike strftime()
2439 // (which uses the locale encoding), works on a UTF-8 format
2440 // string and stores a UTF-8 result.
2442 // This function does not provide any conversion specifiers in
2443 // addition to those implemented by the platform's C library.
2444 // For example, don't expect that using g_date_strftime() would
2445 // make the \%F provided by the C99 strftime() work on Windows
2446 // where the C library only complies to C89.
2447 // RETURNS: number of characters written to the buffer, or 0 the buffer was too small
2448 // <s>: destination buffer
2449 // <slen>: buffer size
2450 // <format>: format string
2451 // <date>: valid #GDate
2452 static size_t strftime(AT0, AT1, AT2)(AT0 /*char*/ s, size_t slen, AT1 /*char*/ format, AT2 /*Date*/ date) nothrow {
2453 return g_date_strftime(toCString!(char*)(s), slen, toCString!(char*)(format), UpCast!(Date*)(date));
2456 // Returns %TRUE if the day of the month is valid (a day is valid if it's
2457 // between 1 and 31 inclusive).
2458 // RETURNS: %TRUE if the day is valid
2459 // <day>: day to check
2460 static int valid_day()(DateDay day) nothrow {
2461 return g_date_valid_day(day);
2464 // Returns %TRUE if the day-month-year triplet forms a valid, existing day
2465 // in the range of days #GDate understands (Year 1 or later, no more than
2466 // a few thousand years in the future).
2467 // RETURNS: %TRUE if the date is a valid one
2468 // <day>: day
2469 // <month>: month
2470 // <year>: year
2471 static int valid_dmy()(DateDay day, DateMonth month, DateYear year) nothrow {
2472 return g_date_valid_dmy(day, month, year);
2475 // Returns %TRUE if the Julian day is valid. Anything greater than zero
2476 // is basically a valid Julian, though there is a 32-bit limit.
2477 // RETURNS: %TRUE if the Julian day is valid
2478 // <julian_date>: Julian day to check
2479 static int valid_julian()(uint julian_date) nothrow {
2480 return g_date_valid_julian(julian_date);
2483 // Returns %TRUE if the month value is valid. The 12 #GDateMonth
2484 // enumeration values are the only valid months.
2485 // RETURNS: %TRUE if the month is valid
2486 // <month>: month
2487 static int valid_month()(DateMonth month) nothrow {
2488 return g_date_valid_month(month);
2491 // Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
2492 // values are the only valid weekdays.
2493 // RETURNS: %TRUE if the weekday is valid
2494 // <weekday>: weekday
2495 static int valid_weekday()(DateWeekday weekday) nothrow {
2496 return g_date_valid_weekday(weekday);
2499 // Returns %TRUE if the year is valid. Any year greater than 0 is valid,
2500 // though there is a 16-bit limit to what #GDate will understand.
2501 // RETURNS: %TRUE if the year is valid
2502 // <year>: year
2503 static int valid_year()(DateYear year) nothrow {
2504 return g_date_valid_year(year);
2509 // This enumeration isn't used in the API, but may be useful if you need
2510 // to mark a number as a day, month, or year.
2511 enum DateDMY {
2512 DAY = 0,
2513 MONTH = 1,
2514 YEAR = 2
2517 // Enumeration representing a month; values are #G_DATE_JANUARY,
2518 // #G_DATE_FEBRUARY, etc. #G_DATE_BAD_MONTH is the invalid value.
2519 enum DateMonth {
2520 BAD_MONTH = 0,
2521 JANUARY = 1,
2522 FEBRUARY = 2,
2523 MARCH = 3,
2524 APRIL = 4,
2525 MAY = 5,
2526 JUNE = 6,
2527 JULY = 7,
2528 AUGUST = 8,
2529 SEPTEMBER = 9,
2530 OCTOBER = 10,
2531 NOVEMBER = 11,
2532 DECEMBER = 12
2535 // <structname>GDateTime</structname> is an opaque structure whose members
2536 // cannot be accessed directly.
2537 struct DateTime /* Version 2.26 */ {
2539 // VERSION: 2.26
2540 // Creates a new #GDateTime corresponding to the given date and time in
2541 // the time zone @tz.
2543 // The @year must be between 1 and 9999, @month between 1 and 12 and @day
2544 // between 1 and 28, 29, 30 or 31 depending on the month and the year.
2546 // @hour must be between 0 and 23 and @minute must be between 0 and 59.
2548 // @seconds must be at least 0.0 and must be strictly less than 60.0.
2549 // It will be rounded down to the nearest microsecond.
2551 // If the given time is not representable in the given time zone (for
2552 // example, 02:30 on March 14th 2010 in Toronto, due to daylight savings
2553 // time) then the time will be rounded up to the nearest existing time
2554 // (in this case, 03:00). If this matters to you then you should verify
2555 // the return value for containing the same as the numbers you gave.
2557 // In the case that the given time is ambiguous in the given time zone
2558 // (for example, 01:30 on November 7th 2010 in Toronto, due to daylight
2559 // savings time) then the time falling within standard (ie:
2560 // non-daylight) time is taken.
2562 // It not considered a programmer error for the values to this function
2563 // to be out of range, but in the case that they are, the function will
2564 // return %NULL.
2566 // You should release the return value by calling g_date_time_unref()
2567 // when you are done with it.
2568 // RETURNS: a new #GDateTime, or %NULL
2569 // <tz>: a #GTimeZone
2570 // <year>: the year component of the date
2571 // <month>: the month component of the date
2572 // <day>: the day component of the date
2573 // <hour>: the hour component of the date
2574 // <minute>: the minute component of the date
2575 // <seconds>: the number of seconds past the minute
2576 static DateTime* /*new*/ new_(AT0)(AT0 /*TimeZone*/ tz, int year, int month, int day, int hour, int minute, double seconds) nothrow {
2577 return g_date_time_new(UpCast!(TimeZone*)(tz), year, month, day, hour, minute, seconds);
2579 static auto opCall(AT0)(AT0 /*TimeZone*/ tz, int year, int month, int day, int hour, int minute, double seconds) {
2580 return g_date_time_new(UpCast!(TimeZone*)(tz), year, month, day, hour, minute, seconds);
2583 // VERSION: 2.26
2584 // Creates a #GDateTime corresponding to the given #GTimeVal @tv in the
2585 // local time zone.
2587 // The time contained in a #GTimeVal is always stored in the form of
2588 // seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the
2589 // local time offset.
2591 // This call can fail (returning %NULL) if @tv represents a time outside
2592 // of the supported range of #GDateTime.
2594 // You should release the return value by calling g_date_time_unref()
2595 // when you are done with it.
2596 // RETURNS: a new #GDateTime, or %NULL
2597 // <tv>: a #GTimeVal
2598 static DateTime* /*new*/ new_from_timeval_local(AT0)(AT0 /*TimeVal*/ tv) nothrow {
2599 return g_date_time_new_from_timeval_local(UpCast!(TimeVal*)(tv));
2601 static auto opCall(AT0)(AT0 /*TimeVal*/ tv) {
2602 return g_date_time_new_from_timeval_local(UpCast!(TimeVal*)(tv));
2605 // VERSION: 2.26
2606 // Creates a #GDateTime corresponding to the given #GTimeVal @tv in UTC.
2608 // The time contained in a #GTimeVal is always stored in the form of
2609 // seconds elapsed since 1970-01-01 00:00:00 UTC.
2611 // This call can fail (returning %NULL) if @tv represents a time outside
2612 // of the supported range of #GDateTime.
2614 // You should release the return value by calling g_date_time_unref()
2615 // when you are done with it.
2616 // RETURNS: a new #GDateTime, or %NULL
2617 // <tv>: a #GTimeVal
2618 static DateTime* /*new*/ new_from_timeval_utc(AT0)(AT0 /*TimeVal*/ tv) nothrow {
2619 return g_date_time_new_from_timeval_utc(UpCast!(TimeVal*)(tv));
2621 static auto opCall(AT0)(AT0 /*TimeVal*/ tv) {
2622 return g_date_time_new_from_timeval_utc(UpCast!(TimeVal*)(tv));
2625 // VERSION: 2.26
2626 // Creates a #GDateTime corresponding to the given Unix time @t in the
2627 // local time zone.
2629 // Unix time is the number of seconds that have elapsed since 1970-01-01
2630 // 00:00:00 UTC, regardless of the local time offset.
2632 // This call can fail (returning %NULL) if @t represents a time outside
2633 // of the supported range of #GDateTime.
2635 // You should release the return value by calling g_date_time_unref()
2636 // when you are done with it.
2637 // RETURNS: a new #GDateTime, or %NULL
2638 // <t>: the Unix time
2639 static DateTime* /*new*/ new_from_unix_local()(long t) nothrow {
2640 return g_date_time_new_from_unix_local(t);
2642 static auto opCall()(long t) {
2643 return g_date_time_new_from_unix_local(t);
2646 // VERSION: 2.26
2647 // Creates a #GDateTime corresponding to the given Unix time @t in UTC.
2649 // Unix time is the number of seconds that have elapsed since 1970-01-01
2650 // 00:00:00 UTC.
2652 // This call can fail (returning %NULL) if @t represents a time outside
2653 // of the supported range of #GDateTime.
2655 // You should release the return value by calling g_date_time_unref()
2656 // when you are done with it.
2657 // RETURNS: a new #GDateTime, or %NULL
2658 // <t>: the Unix time
2659 static DateTime* /*new*/ new_from_unix_utc()(long t) nothrow {
2660 return g_date_time_new_from_unix_utc(t);
2662 static auto opCall()(long t) {
2663 return g_date_time_new_from_unix_utc(t);
2666 // VERSION: 2.26.
2667 // Creates a new #GDateTime corresponding to the given date and time in
2668 // the local time zone.
2670 // This call is equivalent to calling g_date_time_new() with the time
2671 // zone returned by g_time_zone_new_local().
2672 // RETURNS: a #GDateTime, or %NULL
2673 // <year>: the year component of the date
2674 // <month>: the month component of the date
2675 // <day>: the day component of the date
2676 // <hour>: the hour component of the date
2677 // <minute>: the minute component of the date
2678 // <seconds>: the number of seconds past the minute
2679 static DateTime* /*new*/ new_local()(int year, int month, int day, int hour, int minute, double seconds) nothrow {
2680 return g_date_time_new_local(year, month, day, hour, minute, seconds);
2682 static auto opCall()(int year, int month, int day, int hour, int minute, double seconds) {
2683 return g_date_time_new_local(year, month, day, hour, minute, seconds);
2686 // VERSION: 2.26
2687 // Creates a #GDateTime corresponding to this exact instant in the given
2688 // time zone @tz. The time is as accurate as the system allows, to a
2689 // maximum accuracy of 1 microsecond.
2691 // This function will always succeed unless the system clock is set to
2692 // truly insane values (or unless GLib is still being used after the
2693 // year 9999).
2695 // You should release the return value by calling g_date_time_unref()
2696 // when you are done with it.
2697 // RETURNS: a new #GDateTime, or %NULL
2698 // <tz>: a #GTimeZone
2699 static DateTime* /*new*/ new_now(AT0)(AT0 /*TimeZone*/ tz) nothrow {
2700 return g_date_time_new_now(UpCast!(TimeZone*)(tz));
2702 static auto opCall(AT0)(AT0 /*TimeZone*/ tz) {
2703 return g_date_time_new_now(UpCast!(TimeZone*)(tz));
2706 // VERSION: 2.26
2707 // Creates a #GDateTime corresponding to this exact instant in the local
2708 // time zone.
2710 // This is equivalent to calling g_date_time_new_now() with the time
2711 // zone returned by g_time_zone_new_local().
2712 // RETURNS: a new #GDateTime, or %NULL
2713 static DateTime* /*new*/ new_now_local()() nothrow {
2714 return g_date_time_new_now_local();
2717 // VERSION: 2.26
2718 // Creates a #GDateTime corresponding to this exact instant in UTC.
2720 // This is equivalent to calling g_date_time_new_now() with the time
2721 // zone returned by g_time_zone_new_utc().
2722 // RETURNS: a new #GDateTime, or %NULL
2723 static DateTime* /*new*/ new_now_utc()() nothrow {
2724 return g_date_time_new_now_utc();
2727 // VERSION: 2.26.
2728 // Creates a new #GDateTime corresponding to the given date and time in
2729 // UTC.
2731 // This call is equivalent to calling g_date_time_new() with the time
2732 // zone returned by g_time_zone_new_utc().
2733 // RETURNS: a #GDateTime, or %NULL
2734 // <year>: the year component of the date
2735 // <month>: the month component of the date
2736 // <day>: the day component of the date
2737 // <hour>: the hour component of the date
2738 // <minute>: the minute component of the date
2739 // <seconds>: the number of seconds past the minute
2740 static DateTime* /*new*/ new_utc()(int year, int month, int day, int hour, int minute, double seconds) nothrow {
2741 return g_date_time_new_utc(year, month, day, hour, minute, seconds);
2743 static auto opCall()(int year, int month, int day, int hour, int minute, double seconds) {
2744 return g_date_time_new_utc(year, month, day, hour, minute, seconds);
2747 // VERSION: 2.26
2748 // Creates a copy of @datetime and adds the specified timespan to the copy.
2750 // g_date_time_unref().
2751 // RETURNS: the newly created #GDateTime which should be freed with
2752 // <timespan>: a #GTimeSpan
2753 DateTime* /*new*/ add()(TimeSpan timespan) nothrow {
2754 return g_date_time_add(&this, timespan);
2757 // VERSION: 2.26
2758 // Creates a copy of @datetime and adds the specified number of days to the
2759 // copy.
2761 // g_date_time_unref().
2762 // RETURNS: the newly created #GDateTime which should be freed with
2763 // <days>: the number of days
2764 DateTime* /*new*/ add_days()(int days) nothrow {
2765 return g_date_time_add_days(&this, days);
2768 // VERSION: 2.26
2769 // Creates a new #GDateTime adding the specified values to the current date and
2770 // time in @datetime.
2772 // g_date_time_unref().
2773 // RETURNS: the newly created #GDateTime that should be freed with
2774 // <years>: the number of years to add
2775 // <months>: the number of months to add
2776 // <days>: the number of days to add
2777 // <hours>: the number of hours to add
2778 // <minutes>: the number of minutes to add
2779 // <seconds>: the number of seconds to add
2780 DateTime* /*new*/ add_full()(int years, int months, int days, int hours, int minutes, double seconds) nothrow {
2781 return g_date_time_add_full(&this, years, months, days, hours, minutes, seconds);
2784 // VERSION: 2.26
2785 // Creates a copy of @datetime and adds the specified number of hours
2787 // g_date_time_unref().
2788 // RETURNS: the newly created #GDateTime which should be freed with
2789 // <hours>: the number of hours to add
2790 DateTime* /*new*/ add_hours()(int hours) nothrow {
2791 return g_date_time_add_hours(&this, hours);
2794 // VERSION: 2.26
2795 // Creates a copy of @datetime adding the specified number of minutes.
2797 // g_date_time_unref().
2798 // RETURNS: the newly created #GDateTime which should be freed with
2799 // <minutes>: the number of minutes to add
2800 DateTime* /*new*/ add_minutes()(int minutes) nothrow {
2801 return g_date_time_add_minutes(&this, minutes);
2804 // VERSION: 2.26
2805 // Creates a copy of @datetime and adds the specified number of months to the
2806 // copy.
2808 // g_date_time_unref().
2809 // RETURNS: the newly created #GDateTime which should be freed with
2810 // <months>: the number of months
2811 DateTime* /*new*/ add_months()(int months) nothrow {
2812 return g_date_time_add_months(&this, months);
2815 // VERSION: 2.26
2816 // Creates a copy of @datetime and adds the specified number of seconds.
2818 // g_date_time_unref().
2819 // RETURNS: the newly created #GDateTime which should be freed with
2820 // <seconds>: the number of seconds to add
2821 DateTime* /*new*/ add_seconds()(double seconds) nothrow {
2822 return g_date_time_add_seconds(&this, seconds);
2825 // VERSION: 2.26
2826 // Creates a copy of @datetime and adds the specified number of weeks to the
2827 // copy.
2829 // g_date_time_unref().
2830 // RETURNS: the newly created #GDateTime which should be freed with
2831 // <weeks>: the number of weeks
2832 DateTime* /*new*/ add_weeks()(int weeks) nothrow {
2833 return g_date_time_add_weeks(&this, weeks);
2836 // VERSION: 2.26
2837 // Creates a copy of @datetime and adds the specified number of years to the
2838 // copy.
2840 // g_date_time_unref().
2841 // RETURNS: the newly created #GDateTime which should be freed with
2842 // <years>: the number of years
2843 DateTime* /*new*/ add_years()(int years) nothrow {
2844 return g_date_time_add_years(&this, years);
2847 // VERSION: 2.26
2848 // Calculates the difference in time between @end and @begin. The
2849 // #GTimeSpan that is returned is effectively @end - @begin (ie:
2850 // positive if the first simparameter is larger).
2852 // span expressed in microseconds.
2853 // RETURNS: the difference between the two #GDateTime, as a time
2854 // <begin>: a #GDateTime
2855 TimeSpan difference(AT0)(AT0 /*DateTime*/ begin) nothrow {
2856 return g_date_time_difference(&this, UpCast!(DateTime*)(begin));
2859 // VERSION: 2.26
2860 // Creates a newly allocated string representing the requested @format.
2862 // The format strings understood by this function are a subset of the
2863 // strftime() format language as specified by C99. The \%D, \%U and \%W
2864 // conversions are not supported, nor is the 'E' modifier. The GNU
2865 // extensions \%k, \%l, \%s and \%P are supported, however, as are the
2866 // '0', '_' and '-' modifiers.
2868 // In contrast to strftime(), this function always produces a UTF-8
2869 // string, regardless of the current locale. Note that the rendering of
2870 // many formats is locale-dependent and may not match the strftime()
2871 // output exactly.
2873 // The following format specifiers are supported:
2875 // <variablelist>
2876 // <varlistentry><term>
2877 // <literal>\%a</literal>:
2878 // </term><listitem><simpara>
2879 // the abbreviated weekday name according to the current locale
2880 // </simpara></listitem></varlistentry>
2881 // <varlistentry><term>
2882 // <literal>\%A</literal>:
2883 // </term><listitem><simpara>
2884 // the full weekday name according to the current locale
2885 // </simpara></listitem></varlistentry>
2886 // <varlistentry><term>
2887 // <literal>\%b</literal>:
2888 // </term><listitem><simpara>
2889 // the abbreviated month name according to the current locale
2890 // </simpara></listitem></varlistentry>
2891 // <varlistentry><term>
2892 // <literal>\%B</literal>:
2893 // </term><listitem><simpara>
2894 // the full month name according to the current locale
2895 // </simpara></listitem></varlistentry>
2896 // <varlistentry><term>
2897 // <literal>\%c</literal>:
2898 // </term><listitem><simpara>
2899 // the preferred date and time representation for the current locale
2900 // </simpara></listitem></varlistentry>
2901 // <varlistentry><term>
2902 // <literal>\%C</literal>:
2903 // </term><listitem><simpara>
2904 // The century number (year/100) as a 2-digit integer (00-99)
2905 // </simpara></listitem></varlistentry>
2906 // <varlistentry><term>
2907 // <literal>\%d</literal>:
2908 // </term><listitem><simpara>
2909 // the day of the month as a decimal number (range 01 to 31)
2910 // </simpara></listitem></varlistentry>
2911 // <varlistentry><term>
2912 // <literal>\%e</literal>:
2913 // </term><listitem><simpara>
2914 // the day of the month as a decimal number (range 1 to 31)
2915 // </simpara></listitem></varlistentry>
2916 // <varlistentry><term>
2917 // <literal>\%F</literal>:
2918 // </term><listitem><simpara>
2919 // equivalent to <literal>\%Y-\%m-\%d</literal> (the ISO 8601 date
2920 // format)
2921 // </simpara></listitem></varlistentry>
2922 // <varlistentry><term>
2923 // <literal>\%g</literal>:
2924 // </term><listitem><simpara>
2925 // the last two digits of the ISO 8601 week-based year as a decimal
2926 // number (00-99). This works well with \%V and \%u.
2927 // </simpara></listitem></varlistentry>
2928 // <varlistentry><term>
2929 // <literal>\%G</literal>:
2930 // </term><listitem><simpara>
2931 // the ISO 8601 week-based year as a decimal number. This works well
2932 // with \%V and \%u.
2933 // </simpara></listitem></varlistentry>
2934 // <varlistentry><term>
2935 // <literal>\%h</literal>:
2936 // </term><listitem><simpara>
2937 // equivalent to <literal>\%b</literal>
2938 // </simpara></listitem></varlistentry>
2939 // <varlistentry><term>
2940 // <literal>\%H</literal>:
2941 // </term><listitem><simpara>
2942 // the hour as a decimal number using a 24-hour clock (range 00 to
2943 // 23)
2944 // </simpara></listitem></varlistentry>
2945 // <varlistentry><term>
2946 // <literal>\%I</literal>:
2947 // </term><listitem><simpara>
2948 // the hour as a decimal number using a 12-hour clock (range 01 to
2949 // 12)
2950 // </simpara></listitem></varlistentry>
2951 // <varlistentry><term>
2952 // <literal>\%j</literal>:
2953 // </term><listitem><simpara>
2954 // the day of the year as a decimal number (range 001 to 366)
2955 // </simpara></listitem></varlistentry>
2956 // <varlistentry><term>
2957 // <literal>\%k</literal>:
2958 // </term><listitem><simpara>
2959 // the hour (24-hour clock) as a decimal number (range 0 to 23);
2960 // single digits are preceded by a blank
2961 // </simpara></listitem></varlistentry>
2962 // <varlistentry><term>
2963 // <literal>\%l</literal>:
2964 // </term><listitem><simpara>
2965 // the hour (12-hour clock) as a decimal number (range 1 to 12);
2966 // single digits are preceded by a blank
2967 // </simpara></listitem></varlistentry>
2968 // <varlistentry><term>
2969 // <literal>\%m</literal>:
2970 // </term><listitem><simpara>
2971 // the month as a decimal number (range 01 to 12)
2972 // </simpara></listitem></varlistentry>
2973 // <varlistentry><term>
2974 // <literal>\%M</literal>:
2975 // </term><listitem><simpara>
2976 // the minute as a decimal number (range 00 to 59)
2977 // </simpara></listitem></varlistentry>
2978 // <varlistentry><term>
2979 // <literal>\%p</literal>:
2980 // </term><listitem><simpara>
2981 // either "AM" or "PM" according to the given time value, or the
2982 // corresponding strings for the current locale. Noon is treated as
2983 // "PM" and midnight as "AM".
2984 // </simpara></listitem></varlistentry>
2985 // <varlistentry><term>
2986 // <literal>\%P</literal>:
2987 // </term><listitem><simpara>
2988 // like \%p but lowercase: "am" or "pm" or a corresponding string for
2989 // the current locale
2990 // </simpara></listitem></varlistentry>
2991 // <varlistentry><term>
2992 // <literal>\%r</literal>:
2993 // </term><listitem><simpara>
2994 // the time in a.m. or p.m. notation
2995 // </simpara></listitem></varlistentry>
2996 // <varlistentry><term>
2997 // <literal>\%R</literal>:
2998 // </term><listitem><simpara>
2999 // the time in 24-hour notation (<literal>\%H:\%M</literal>)
3000 // </simpara></listitem></varlistentry>
3001 // <varlistentry><term>
3002 // <literal>\%s</literal>:
3003 // </term><listitem><simpara>
3004 // the number of seconds since the Epoch, that is, since 1970-01-01
3005 // 00:00:00 UTC
3006 // </simpara></listitem></varlistentry>
3007 // <varlistentry><term>
3008 // <literal>\%S</literal>:
3009 // </term><listitem><simpara>
3010 // the second as a decimal number (range 00 to 60)
3011 // </simpara></listitem></varlistentry>
3012 // <varlistentry><term>
3013 // <literal>\%t</literal>:
3014 // </term><listitem><simpara>
3015 // a tab character
3016 // </simpara></listitem></varlistentry>
3017 // <varlistentry><term>
3018 // <literal>\%T</literal>:
3019 // </term><listitem><simpara>
3020 // the time in 24-hour notation with seconds (<literal>\%H:\%M:\%S</literal>)
3021 // </simpara></listitem></varlistentry>
3022 // <varlistentry><term>
3023 // <literal>\%u</literal>:
3024 // </term><listitem><simpara>
3025 // the ISO 8601 standard day of the week as a decimal, range 1 to 7,
3026 // Monday being 1. This works well with \%G and \%V.
3027 // </simpara></listitem></varlistentry>
3028 // <varlistentry><term>
3029 // <literal>\%V</literal>:
3030 // </term><listitem><simpara>
3031 // the ISO 8601 standard week number of the current year as a decimal
3032 // number, range 01 to 53, where week 1 is the first week that has at
3033 // least 4 days in the new year. See g_date_time_get_week_of_year().
3034 // This works well with \%G and \%u.
3035 // </simpara></listitem></varlistentry>
3036 // <varlistentry><term>
3037 // <literal>\%w</literal>:
3038 // </term><listitem><simpara>
3039 // the day of the week as a decimal, range 0 to 6, Sunday being 0.
3040 // This is not the ISO 8601 standard format -- use \%u instead.
3041 // </simpara></listitem></varlistentry>
3042 // <varlistentry><term>
3043 // <literal>\%x</literal>:
3044 // </term><listitem><simpara>
3045 // the preferred date representation for the current locale without
3046 // the time
3047 // </simpara></listitem></varlistentry>
3048 // <varlistentry><term>
3049 // <literal>\%X</literal>:
3050 // </term><listitem><simpara>
3051 // the preferred time representation for the current locale without
3052 // the date
3053 // </simpara></listitem></varlistentry>
3054 // <varlistentry><term>
3055 // <literal>\%y</literal>:
3056 // </term><listitem><simpara>
3057 // the year as a decimal number without the century
3058 // </simpara></listitem></varlistentry>
3059 // <varlistentry><term>
3060 // <literal>\%Y</literal>:
3061 // </term><listitem><simpara>
3062 // the year as a decimal number including the century
3063 // </simpara></listitem></varlistentry>
3064 // <varlistentry><term>
3065 // <literal>\%z</literal>:
3066 // </term><listitem><simpara>
3067 // the time-zone as hour offset from UTC
3068 // </simpara></listitem></varlistentry>
3069 // <varlistentry><term>
3070 // <literal>\%Z</literal>:
3071 // </term><listitem><simpara>
3072 // the time zone or name or abbreviation
3073 // </simpara></listitem></varlistentry>
3074 // <varlistentry><term>
3075 // <literal>\%\%</literal>:
3076 // </term><listitem><simpara>
3077 // a literal <literal>\%</literal> character
3078 // </simpara></listitem></varlistentry>
3079 // </variablelist>
3081 // Some conversion specifications can be modified by preceding the
3082 // conversion specifier by one or more modifier characters. The
3083 // following modifiers are supported for many of the numeric
3084 // conversions:
3085 // <variablelist>
3086 // <varlistentry>
3087 // <term>O</term>
3088 // <listitem>
3089 // Use alternative numeric symbols, if the current locale
3090 // supports those.
3091 // </listitem>
3092 // </varlistentry>
3093 // <varlistentry>
3094 // <term>_</term>
3095 // <listitem>
3096 // Pad a numeric result with spaces.
3097 // This overrides the default padding for the specifier.
3098 // </listitem>
3099 // </varlistentry>
3100 // <varlistentry>
3101 // <term>-</term>
3102 // <listitem>
3103 // Do not pad a numeric result.
3104 // This overrides the default padding for the specifier.
3105 // </listitem>
3106 // </varlistentry>
3107 // <varlistentry>
3108 // <term>0</term>
3109 // <listitem>
3110 // Pad a numeric result with zeros.
3111 // This overrides the default padding for the specifier.
3112 // </listitem>
3113 // </varlistentry>
3114 // </variablelist>
3116 // or %NULL in the case that there was an error. The string
3117 // should be freed with g_free().
3118 // RETURNS: a newly allocated string formatted to the requested format
3119 // <format>: a valid UTF-8 string, containing the format for the #GDateTime
3120 char* /*new*/ format(AT0)(AT0 /*char*/ format) nothrow {
3121 return g_date_time_format(&this, toCString!(char*)(format));
3124 // VERSION: 2.26
3125 // Retrieves the day of the month represented by @datetime in the gregorian
3126 // calendar.
3127 // RETURNS: the day of the month
3128 int get_day_of_month()() nothrow {
3129 return g_date_time_get_day_of_month(&this);
3132 // VERSION: 2.26
3133 // Retrieves the ISO 8601 day of the week on which @datetime falls (1 is
3134 // Monday, 2 is Tuesday... 7 is Sunday).
3135 // RETURNS: the day of the week
3136 int get_day_of_week()() nothrow {
3137 return g_date_time_get_day_of_week(&this);
3140 // VERSION: 2.26
3141 // Retrieves the day of the year represented by @datetime in the Gregorian
3142 // calendar.
3143 // RETURNS: the day of the year
3144 int get_day_of_year()() nothrow {
3145 return g_date_time_get_day_of_year(&this);
3148 // VERSION: 2.26
3149 // Retrieves the hour of the day represented by @datetime
3150 // RETURNS: the hour of the day
3151 int get_hour()() nothrow {
3152 return g_date_time_get_hour(&this);
3155 // VERSION: 2.26
3156 // Retrieves the microsecond of the date represented by @datetime
3157 // RETURNS: the microsecond of the second
3158 int get_microsecond()() nothrow {
3159 return g_date_time_get_microsecond(&this);
3162 // VERSION: 2.26
3163 // Retrieves the minute of the hour represented by @datetime
3164 // RETURNS: the minute of the hour
3165 int get_minute()() nothrow {
3166 return g_date_time_get_minute(&this);
3169 // VERSION: 2.26
3170 // Retrieves the month of the year represented by @datetime in the Gregorian
3171 // calendar.
3172 // RETURNS: the month represented by @datetime
3173 int get_month()() nothrow {
3174 return g_date_time_get_month(&this);
3177 // VERSION: 2.26
3178 // Retrieves the second of the minute represented by @datetime
3179 // RETURNS: the second represented by @datetime
3180 int get_second()() nothrow {
3181 return g_date_time_get_second(&this);
3184 // VERSION: 2.26
3185 // Retrieves the number of seconds since the start of the last minute,
3186 // including the fractional part.
3187 // RETURNS: the number of seconds
3188 double get_seconds()() nothrow {
3189 return g_date_time_get_seconds(&this);
3192 // VERSION: 2.26
3193 // Determines the time zone abbreviation to be used at the time and in
3194 // the time zone of @datetime.
3196 // For example, in Toronto this is currently "EST" during the winter
3197 // months and "EDT" during the summer months when daylight savings
3198 // time is in effect.
3200 // string is owned by the #GDateTime and it should not be
3201 // modified or freed
3202 // RETURNS: the time zone abbreviation. The returned
3203 char* get_timezone_abbreviation()() nothrow {
3204 return g_date_time_get_timezone_abbreviation(&this);
3207 // VERSION: 2.26
3208 // Determines the offset to UTC in effect at the time and in the time
3209 // zone of @datetime.
3211 // The offset is the number of microseconds that you add to UTC time to
3212 // arrive at local time for the time zone (ie: negative numbers for time
3213 // zones west of GMT, positive numbers for east).
3215 // If @datetime represents UTC time, then the offset is always zero.
3217 // get the local time
3218 // RETURNS: the number of microseconds that should be added to UTC to
3219 TimeSpan get_utc_offset()() nothrow {
3220 return g_date_time_get_utc_offset(&this);
3223 // VERSION: 2.26
3224 // Returns the ISO 8601 week-numbering year in which the week containing
3225 // @datetime falls.
3227 // This function, taken together with g_date_time_get_week_of_year() and
3228 // g_date_time_get_day_of_week() can be used to determine the full ISO
3229 // week date on which @datetime falls.
3231 // This is usually equal to the normal Gregorian year (as returned by
3232 // g_date_time_get_year()), except as detailed below:
3234 // For Thursday, the week-numbering year is always equal to the usual
3235 // calendar year. For other days, the number is such that every day
3236 // within a complete week (Monday to Sunday) is contained within the
3237 // same week-numbering year.
3239 // For Monday, Tuesday and Wednesday occurring near the end of the year,
3240 // this may mean that the week-numbering year is one greater than the
3241 // calendar year (so that these days have the same week-numbering year
3242 // as the Thursday occurring early in the next year).
3244 // For Friday, Saturaday and Sunday occurring near the start of the year,
3245 // this may mean that the week-numbering year is one less than the
3246 // calendar year (so that these days have the same week-numbering year
3247 // as the Thursday occurring late in the previous year).
3249 // An equivalent description is that the week-numbering year is equal to
3250 // the calendar year containing the majority of the days in the current
3251 // week (Monday to Sunday).
3253 // Note that January 1 0001 in the proleptic Gregorian calendar is a
3254 // Monday, so this function never returns 0.
3255 // RETURNS: the ISO 8601 week-numbering year for @datetime
3256 int get_week_numbering_year()() nothrow {
3257 return g_date_time_get_week_numbering_year(&this);
3260 // VERSION: 2.26
3261 // Returns the ISO 8601 week number for the week containing @datetime.
3262 // The ISO 8601 week number is the same for every day of the week (from
3263 // Moday through Sunday). That can produce some unusual results
3264 // (described below).
3266 // The first week of the year is week 1. This is the week that contains
3267 // the first Thursday of the year. Equivalently, this is the first week
3268 // that has more than 4 of its days falling within the calendar year.
3270 // The value 0 is never returned by this function. Days contained
3271 // within a year but occurring before the first ISO 8601 week of that
3272 // year are considered as being contained in the last week of the
3273 // previous year. Similarly, the final days of a calendar year may be
3274 // considered as being part of the first ISO 8601 week of the next year
3275 // if 4 or more days of that week are contained within the new year.
3276 // RETURNS: the ISO 8601 week number for @datetime.
3277 int get_week_of_year()() nothrow {
3278 return g_date_time_get_week_of_year(&this);
3281 // VERSION: 2.26
3282 // Retrieves the year represented by @datetime in the Gregorian calendar.
3283 // RETURNS: the year represented by @datetime
3284 int get_year()() nothrow {
3285 return g_date_time_get_year(&this);
3288 // VERSION: 2.26
3289 // Retrieves the Gregorian day, month, and year of a given #GDateTime.
3290 // <year>: the return location for the gregorian year, or %NULL.
3291 // <month>: the return location for the month of the year, or %NULL.
3292 // <day>: the return location for the day of the month, or %NULL.
3293 void get_ymd()(/*out*/ int* year, /*out*/ int* month, /*out*/ int* day) nothrow {
3294 g_date_time_get_ymd(&this, year, month, day);
3297 // VERSION: 2.26
3298 // Determines if daylight savings time is in effect at the time and in
3299 // the time zone of @datetime.
3300 // RETURNS: %TRUE if daylight savings time is in effect
3301 int is_daylight_savings()() nothrow {
3302 return g_date_time_is_daylight_savings(&this);
3305 // VERSION: 2.26
3306 // Atomically increments the reference count of @datetime by one.
3307 // RETURNS: the #GDateTime with the reference count increased
3308 DateTime* /*new*/ ref_()() nothrow {
3309 return g_date_time_ref(&this);
3312 // VERSION: 2.26
3313 // Creates a new #GDateTime corresponding to the same instant in time as
3314 // @datetime, but in the local time zone.
3316 // This call is equivalent to calling g_date_time_to_timezone() with the
3317 // time zone returned by g_time_zone_new_local().
3318 // RETURNS: the newly created #GDateTime
3319 DateTime* /*new*/ to_local()() nothrow {
3320 return g_date_time_to_local(&this);
3323 // VERSION: 2.26
3324 // Stores the instant in time that @datetime represents into @tv.
3326 // The time contained in a #GTimeVal is always stored in the form of
3327 // seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the time
3328 // zone associated with @datetime.
3330 // On systems where 'long' is 32bit (ie: all 32bit systems and all
3331 // Windows systems), a #GTimeVal is incapable of storing the entire
3332 // range of values that #GDateTime is capable of expressing. On those
3333 // systems, this function returns %FALSE to indicate that the time is
3334 // out of range.
3336 // On systems where 'long' is 64bit, this function never fails.
3337 // RETURNS: %TRUE if successful, else %FALSE
3338 // <tv>: a #GTimeVal to modify
3339 int to_timeval(AT0)(AT0 /*TimeVal*/ tv) nothrow {
3340 return g_date_time_to_timeval(&this, UpCast!(TimeVal*)(tv));
3343 // VERSION: 2.26
3344 // Create a new #GDateTime corresponding to the same instant in time as
3345 // @datetime, but in the time zone @tz.
3347 // This call can fail in the case that the time goes out of bounds. For
3348 // example, converting 0001-01-01 00:00:00 UTC to a time zone west of
3349 // Greenwich will fail (due to the year 0 being out of range).
3351 // You should release the return value by calling g_date_time_unref()
3352 // when you are done with it.
3353 // RETURNS: a new #GDateTime, or %NULL
3354 // <tz>: the new #GTimeZone
3355 DateTime* /*new*/ to_timezone(AT0)(AT0 /*TimeZone*/ tz) nothrow {
3356 return g_date_time_to_timezone(&this, UpCast!(TimeZone*)(tz));
3359 // VERSION: 2.26
3360 // Gives the Unix time corresponding to @datetime, rounding down to the
3361 // nearest second.
3363 // Unix time is the number of seconds that have elapsed since 1970-01-01
3364 // 00:00:00 UTC, regardless of the time zone associated with @datetime.
3365 // RETURNS: the Unix time corresponding to @datetime
3366 long to_unix()() nothrow {
3367 return g_date_time_to_unix(&this);
3370 // VERSION: 2.26
3371 // Creates a new #GDateTime corresponding to the same instant in time as
3372 // @datetime, but in UTC.
3374 // This call is equivalent to calling g_date_time_to_timezone() with the
3375 // time zone returned by g_time_zone_new_utc().
3376 // RETURNS: the newly created #GDateTime
3377 DateTime* /*new*/ to_utc()() nothrow {
3378 return g_date_time_to_utc(&this);
3381 // VERSION: 2.26
3382 // Atomically decrements the reference count of @datetime by one.
3384 // When the reference count reaches zero, the resources allocated by
3385 // @datetime are freed
3386 void unref()() nothrow {
3387 g_date_time_unref(&this);
3390 // VERSION: 2.26
3391 // A comparison function for #GDateTimes that is suitable
3392 // as a #GCompareFunc. Both #GDateTimes must be non-%NULL.
3394 // than @dt2.
3395 // RETURNS: -1, 0 or 1 if @dt1 is less than, equal to or greater
3396 // <dt1>: first #GDateTime to compare
3397 // <dt2>: second #GDateTime to compare
3398 static int compare(AT0, AT1)(AT0 /*const(void)*/ dt1, AT1 /*const(void)*/ dt2) nothrow {
3399 return g_date_time_compare(UpCast!(const(void)*)(dt1), UpCast!(const(void)*)(dt2));
3402 // VERSION: 2.26
3403 // Checks to see if @dt1 and @dt2 are equal.
3405 // Equal here means that they represent the same moment after converting
3406 // them to the same time zone.
3407 // RETURNS: %TRUE if @dt1 and @dt2 are equal
3408 // <dt1>: a #GDateTime
3409 // <dt2>: a #GDateTime
3410 static int equal(AT0, AT1)(AT0 /*const(void)*/ dt1, AT1 /*const(void)*/ dt2) nothrow {
3411 return g_date_time_equal(UpCast!(const(void)*)(dt1), UpCast!(const(void)*)(dt2));
3414 // VERSION: 2.26
3415 // Hashes @datetime into a #guint, suitable for use within #GHashTable.
3416 // RETURNS: a #guint containing the hash
3417 // <datetime>: a #GDateTime
3418 static uint hash(AT0)(AT0 /*const(void)*/ datetime) nothrow {
3419 return g_date_time_hash(UpCast!(const(void)*)(datetime));
3424 // Enumeration representing a day of the week; #G_DATE_MONDAY,
3425 // #G_DATE_TUESDAY, etc. #G_DATE_BAD_WEEKDAY is an invalid weekday.
3426 enum DateWeekday {
3427 BAD_WEEKDAY = 0,
3428 MONDAY = 1,
3429 TUESDAY = 2,
3430 WEDNESDAY = 3,
3431 THURSDAY = 4,
3432 FRIDAY = 5,
3433 SATURDAY = 6,
3434 SUNDAY = 7
3437 // Associates a string with a bit flag.
3438 // Used in g_parse_debug_string().
3439 struct DebugKey {
3440 char* key;
3441 uint value;
3445 // Specifies the type of function which is called when a data element
3446 // is destroyed. It is passed the pointer to the data element and
3447 // should free any memory and resources allocated for it.
3448 // <data>: the data element.
3449 extern (C) alias void function (void* data) nothrow DestroyNotify;
3451 // An opaque structure representing an opened directory.
3452 struct Dir {
3453 // Closes the directory and deallocates all related resources.
3454 void close()() nothrow {
3455 g_dir_close(&this);
3458 // Retrieves the name of another entry in the directory, or %NULL.
3459 // The order of entries returned from this function is not defined,
3460 // and may vary by file system or other operating-system dependent
3461 // factors.
3463 // On Unix, the '.' and '..' entries are omitted, and the returned
3464 // name is in the on-disk encoding.
3466 // On Windows, as is true of all GLib functions which operate on
3467 // filenames, the returned name is in UTF-8.
3469 // more entries. The return value is owned by GLib and
3470 // must not be modified or freed.
3471 // RETURNS: The entry's name or %NULL if there are no
3472 char* read_name()() nothrow {
3473 return g_dir_read_name(&this);
3476 // Resets the given directory. The next call to g_dir_read_name()
3477 // will return the first entry again.
3478 void rewind()() nothrow {
3479 g_dir_rewind(&this);
3482 // VERSION: 2.30
3483 // Creates a subdirectory in the preferred directory for temporary
3484 // files (as returned by g_get_tmp_dir()).
3486 // @tmpl should be a string in the GLib file name encoding containing
3487 // a sequence of six 'X' characters, as the parameter to g_mkstemp().
3488 // However, unlike these functions, the template should only be a
3489 // basename, no directory components are allowed. If template is
3490 // %NULL, a default template is used.
3492 // Note that in contrast to g_mkdtemp() (and mkdtemp()) @tmpl is not
3493 // modified, and might thus be a read-only literal string.
3495 // should be freed with g_free() when not needed any longer and is
3496 // is in the GLib file name encoding. In case of errors, %NULL is
3497 // returned and @error will be set.
3498 // RETURNS: The actual name used. This string
3499 // <tmpl>: Template for directory name, as in g_mkdtemp(), basename only, or %NULL for a default template
3500 static char* /*new*/ make_tmp(AT0, AT1)(AT0 /*char*/ tmpl, AT1 /*GLib2.Error**/ error=null) nothrow {
3501 return g_dir_make_tmp(toCString!(char*)(tmpl), UpCast!(GLib2.Error**)(error));
3504 // Unintrospectable function: open() / g_dir_open()
3505 // Opens a directory for reading. The names of the files in the
3506 // directory can then be retrieved using g_dir_read_name(). Note
3507 // that the ordering is not defined.
3509 // If non-%NULL, you must free the result with g_dir_close()
3510 // when you are finished with it.
3511 // RETURNS: a newly allocated #GDir on success, %NULL on failure.
3512 // <path>: the path to the directory you are interested in. On Unix in the on-disk encoding. On Windows in UTF-8
3513 // <flags>: Currently must be set to 0. Reserved for future use.
3514 static Dir* open(AT0, AT1)(AT0 /*char*/ path, uint flags, AT1 /*GLib2.Error**/ error=null) nothrow {
3515 return g_dir_open(toCString!(char*)(path), flags, UpCast!(GLib2.Error**)(error));
3520 // The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the sign,
3521 // mantissa and exponent of IEEE floats and doubles. These unions are defined
3522 // as appropriate for a given platform. IEEE floats and doubles are supported
3523 // (used for storage) by at least Intel, PPC and Sparc.
3524 union DoubleIEEE754 {
3525 double v_double;
3527 struct mpn {
3528 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
3529 uint, "mantissa_low", 32,
3530 uint, "mantissa_high", 20,
3531 uint, "biased_exponent", 11,
3532 uint, "sign", 1));
3536 enum double E = 2.718282;
3538 // Specifies the type of a function used to test two values for
3539 // equality. The function should return %TRUE if both values are equal
3540 // and %FALSE otherwise.
3541 // RETURNS: %TRUE if @a = @b; %FALSE otherwise
3542 // <a>: a value
3543 // <b>: a value to compare with
3544 extern (C) alias int function (const(void)* a, const(void)* b) nothrow EqualFunc;
3547 // The <structname>GError</structname> structure contains
3548 // information about an error that has occurred.
3549 struct Error {
3550 Quark domain;
3551 int code;
3552 char* message;
3555 // Unintrospectable constructor: new() / g_error_new()
3556 // Creates a new #GError with the given @domain and @code,
3557 // and a message formatted with @format.
3558 // RETURNS: a new #GError
3559 // <domain>: error domain
3560 // <code>: error code
3561 // <format>: printf()-style format for error message
3562 alias g_error_new new_; // Variadic
3564 // Creates a new #GError; unlike g_error_new(), @message is
3565 // not a printf()-style format string. Use this function if
3566 // @message contains text you don't have control over,
3567 // that could include printf() escape sequences.
3568 // RETURNS: a new #GError
3569 // <domain>: error domain
3570 // <code>: error code
3571 // <message>: error message
3572 static Error* /*new*/ new_literal(AT0)(Quark domain, int code, AT0 /*char*/ message) nothrow {
3573 return g_error_new_literal(domain, code, toCString!(char*)(message));
3575 static auto opCall(AT0)(Quark domain, int code, AT0 /*char*/ message) {
3576 return g_error_new_literal(domain, code, toCString!(char*)(message));
3579 // Unintrospectable constructor: new_valist() / g_error_new_valist()
3580 // VERSION: 2.22
3581 // Creates a new #GError with the given @domain and @code,
3582 // and a message formatted with @format.
3583 // RETURNS: a new #GError
3584 // <domain>: error domain
3585 // <code>: error code
3586 // <format>: printf()-style format for error message
3587 // <args>: #va_list of parameters for the message format
3588 static Error* /*new*/ new_valist(AT0)(Quark domain, int code, AT0 /*char*/ format, va_list args) nothrow {
3589 return g_error_new_valist(domain, code, toCString!(char*)(format), args);
3591 static auto opCall(AT0)(Quark domain, int code, AT0 /*char*/ format, va_list args) {
3592 return g_error_new_valist(domain, code, toCString!(char*)(format), args);
3595 // Makes a copy of @error.
3596 // RETURNS: a new #GError
3597 Error* /*new*/ copy()() nothrow {
3598 return g_error_copy(&this);
3600 // Frees a #GError and associated resources.
3601 void free()() nothrow {
3602 g_error_free(&this);
3605 // Returns %TRUE if @error matches @domain and @code, %FALSE
3606 // otherwise. In particular, when @error is %NULL, %FALSE will
3607 // be returned.
3608 // RETURNS: whether @error has @domain and @code
3609 // <domain>: an error domain
3610 // <code>: an error code
3611 int matches()(Quark domain, int code) nothrow {
3612 return g_error_matches(&this, domain, code);
3617 // The possible errors, used in the @v_error field
3618 // of #GTokenValue, when the token is a %G_TOKEN_ERROR.
3619 enum ErrorType {
3620 UNKNOWN = 0,
3621 UNEXP_EOF = 1,
3622 UNEXP_EOF_IN_STRING = 2,
3623 UNEXP_EOF_IN_COMMENT = 3,
3624 NON_DIGIT_IN_CONST = 4,
3625 DIGIT_RADIX = 5,
3626 FLOAT_RADIX = 6,
3627 FLOAT_MALFORMED = 7
3630 // Values corresponding to @errno codes returned from file operations
3631 // on UNIX. Unlike @errno codes, GFileError values are available on
3632 // all systems, even Windows. The exact meaning of each code depends
3633 // on what sort of file operation you were performing; the UNIX
3634 // documentation gives more details. The following error code descriptions
3635 // come from the GNU C Library manual, and are under the copyright
3636 // of that manual.
3638 // It's not very portable to make detailed assumptions about exactly
3639 // which errors will be returned from a given operation. Some errors
3640 // don't occur on some systems, etc., sometimes there are subtle
3641 // differences in when a system will report a given error, etc.
3642 enum FileError {
3643 EXIST = 0,
3644 ISDIR = 1,
3645 ACCES = 2,
3646 NAMETOOLONG = 3,
3647 NOENT = 4,
3648 NOTDIR = 5,
3649 NXIO = 6,
3650 NODEV = 7,
3651 ROFS = 8,
3652 TXTBSY = 9,
3653 FAULT = 10,
3654 LOOP = 11,
3655 NOSPC = 12,
3656 NOMEM = 13,
3657 MFILE = 14,
3658 NFILE = 15,
3659 BADF = 16,
3660 INVAL = 17,
3661 PIPE = 18,
3662 AGAIN = 19,
3663 INTR = 20,
3664 IO = 21,
3665 PERM = 22,
3666 NOSYS = 23,
3667 FAILED = 24
3669 // A test to perform on a file using g_file_test().
3670 enum FileTest {
3671 IS_REGULAR = 1,
3672 IS_SYMLINK = 2,
3673 IS_DIR = 4,
3674 IS_EXECUTABLE = 8,
3675 EXISTS = 16
3678 // The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the sign,
3679 // mantissa and exponent of IEEE floats and doubles. These unions are defined
3680 // as appropriate for a given platform. IEEE floats and doubles are supported
3681 // (used for storage) by at least Intel, PPC and Sparc.
3682 union FloatIEEE754 {
3683 float v_float;
3685 struct mpn {
3686 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
3687 uint, "mantissa", 23,
3688 uint, "biased_exponent", 8,
3689 uint, "sign", 1));
3693 // Flags to modify the format of the string returned by g_format_size_full().
3694 enum FormatSizeFlags {
3695 DEFAULT = 0,
3696 LONG_FORMAT = 1,
3697 IEC_UNITS = 2
3700 // Declares a type of function which takes an arbitrary
3701 // data pointer argument and has no return value. It is
3702 // not currently used in GLib or GTK+.
3703 // <data>: a data pointer
3704 extern (C) alias void function (void* data) nothrow FreeFunc;
3707 // Specifies the type of functions passed to g_list_foreach() and
3708 // g_slist_foreach().
3709 // <data>: the element's data.
3710 // <user_data>: user data passed to g_list_foreach() or g_slist_foreach().
3711 extern (C) alias void function (void* data, void* user_data) nothrow Func;
3713 enum GINT16_FORMAT = "hi";
3714 enum GINT16_MODIFIER = "h";
3715 enum GINT32_FORMAT = "i";
3716 enum GINT32_MODIFIER = "";
3717 enum GINT64_FORMAT = "lli";
3718 enum GINT64_MODIFIER = "ll";
3719 enum GINTPTR_FORMAT = "i";
3720 enum GINTPTR_MODIFIER = "";
3721 enum GNUC_FUNCTION = "";
3722 enum GNUC_PRETTY_FUNCTION = "";
3723 enum GSIZE_FORMAT = "u";
3724 enum GSIZE_MODIFIER = "";
3725 enum GSSIZE_FORMAT = "i";
3726 enum GUINT16_FORMAT = "hu";
3727 enum GUINT32_FORMAT = "u";
3728 enum GUINT64_FORMAT = "llu";
3729 enum GUINTPTR_FORMAT = "u";
3730 enum int HAVE_GINT64 = 1;
3731 enum int HAVE_GNUC_VARARGS = 1;
3732 enum int HAVE_GNUC_VISIBILITY = 1;
3733 enum int HAVE_GROWING_STACK = 1;
3734 enum int HAVE_INLINE = 1;
3735 enum int HAVE_ISO_VARARGS = 1;
3736 enum int HAVE___INLINE = 1;
3737 enum int HAVE___INLINE__ = 1;
3739 // Specifies the type of the function passed to g_hash_table_foreach().
3740 // It is called with each key/value pair, together with the @user_data
3741 // parameter which is passed to g_hash_table_foreach().
3742 // <key>: a key
3743 // <value>: the value corresponding to the key
3744 // <user_data>: user data passed to g_hash_table_foreach()
3745 extern (C) alias void function (void* key, void* value, void* user_data) nothrow HFunc;
3747 enum int HOOK_FLAG_USER_SHIFT = 4;
3749 // Specifies the type of the function passed to
3750 // g_hash_table_foreach_remove(). It is called with each key/value
3751 // pair, together with the @user_data parameter passed to
3752 // g_hash_table_foreach_remove(). It should return %TRUE if the
3753 // key/value pair should be removed from the #GHashTable.
3755 // #GHashTable
3756 // RETURNS: %TRUE if the key/value pair should be removed from the
3757 // <key>: a key
3758 // <value>: the value associated with the key
3759 // <user_data>: user data passed to g_hash_table_remove()
3760 extern (C) alias int function (void* key, void* value, void* user_data) nothrow HRFunc;
3763 // Specifies the type of the hash function which is passed to
3764 // g_hash_table_new() when a #GHashTable is created.
3766 // The function is passed a key and should return a #guint hash value.
3767 // The functions g_direct_hash(), g_int_hash() and g_str_hash() provide
3768 // hash functions which can be used when the key is a #gpointer, #gint*,
3769 // and #gchar* respectively.
3771 // g_direct_hash() is also the appropriate hash function for keys
3772 // of the form <literal>GINT_TO_POINTER (n)</literal> (or similar macros).
3774 // <!-- FIXME: Need more here. --> A good hash functions should produce
3775 // hash values that are evenly distributed over a fairly large range.
3776 // The modulus is taken with the hash table size (a prime number) to
3777 // find the 'bucket' to place each key into. The function should also
3778 // be very fast, since it is called for each key lookup.
3780 // Note that the hash functions provided by GLib have these qualities,
3781 // but are not particularly robust against manufactured keys that
3782 // cause hash collisions. Therefore, you should consider choosing
3783 // a more secure hash function when using a GHashTable with keys
3784 // that originate in untrusted data (such as HTTP requests).
3785 // Using g_str_hash() in that situation might make your application
3786 // vulerable to <ulink url="https://lwn.net/Articles/474912/">Algorithmic Complexity Attacks</ulink>.
3788 // The key to choosing a good hash is unpredictability. Even
3789 // cryptographic hashes are very easy to find collisions for when the
3790 // remainder is taken modulo a somewhat predictable prime number. There
3791 // must be an element of randomness that an attacker is unable to guess.
3792 // RETURNS: the hash value corresponding to the key
3793 // <key>: a key
3794 extern (C) alias uint function (const(void)* key) nothrow HashFunc;
3797 // The #GHashTable struct is an opaque data structure to represent a
3798 // <link linkend="glib-Hash-Tables">Hash Table</link>. It should only be
3799 // accessed via the following functions.
3800 struct HashTable {
3802 // VERSION: 2.32
3803 // This is a convenience function for using a #GHashTable as a set. It
3804 // is equivalent to calling g_hash_table_replace() with @key as both the
3805 // key and the value.
3807 // When a hash table only ever contains keys that have themselves as the
3808 // corresponding value it is able to be stored more efficiently. See
3809 // the discussion in the section description.
3810 // <hash_table>: a #GHashTable
3811 // <key>: a key to insert
3812 static void add(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*void*/ key) nothrow {
3813 g_hash_table_add(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(void*)(key));
3816 // VERSION: 2.32
3817 // Checks if @key is in @hash_table.
3818 // <hash_table>: a #GHashTable
3819 // <key>: a key to check
3820 static int contains(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
3821 return g_hash_table_contains(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
3824 // Destroys all keys and values in the #GHashTable and decrements its
3825 // reference count by 1. If keys and/or values are dynamically allocated,
3826 // you should either free them first or create the #GHashTable with destroy
3827 // notifiers using g_hash_table_new_full(). In the latter case the destroy
3828 // functions you supplied will be called on all keys and values during the
3829 // destruction phase.
3830 // <hash_table>: a #GHashTable
3831 static void destroy(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
3832 g_hash_table_destroy(UpCast!(GLib2.HashTable*)(hash_table));
3835 // Unintrospectable function: find() / g_hash_table_find()
3836 // VERSION: 2.4
3837 // Calls the given function for key/value pairs in the #GHashTable
3838 // until @predicate returns %TRUE. The function is passed the key
3839 // and value of each pair, and the given @user_data parameter. The
3840 // hash table may not be modified while iterating over it (you can't
3841 // add/remove items).
3843 // Note, that hash tables are really only optimized for forward
3844 // lookups, i.e. g_hash_table_lookup(). So code that frequently issues
3845 // g_hash_table_find() or g_hash_table_foreach() (e.g. in the order of
3846 // once per every entry in a hash table) should probably be reworked
3847 // to use additional or different data structures for reverse lookups
3848 // (keep in mind that an O(n) find/foreach operation issued for all n
3849 // values in a hash table ends up needing O(n*n) operations).
3851 // for which @predicate evaluates to %TRUE. If no pair with the
3852 // requested property is found, %NULL is returned.
3853 // RETURNS: The value of the first key/value pair is returned,
3854 // <hash_table>: a #GHashTable
3855 // <predicate>: function to test the key/value pairs for a certain property
3856 // <user_data>: user data to pass to the function
3857 static void* find(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, HRFunc predicate, AT1 /*void*/ user_data) nothrow {
3858 return g_hash_table_find(UpCast!(GLib2.HashTable*)(hash_table), predicate, UpCast!(void*)(user_data));
3861 // Unintrospectable function: foreach() / g_hash_table_foreach()
3862 // Calls the given function for each of the key/value pairs in the
3863 // #GHashTable. The function is passed the key and value of each
3864 // pair, and the given @user_data parameter. The hash table may not
3865 // be modified while iterating over it (you can't add/remove
3866 // items). To remove all items matching a predicate, use
3867 // g_hash_table_foreach_remove().
3869 // See g_hash_table_find() for performance caveats for linear
3870 // order searches in contrast to g_hash_table_lookup().
3871 // <hash_table>: a #GHashTable
3872 // <func>: the function to call for each key/value pair
3873 // <user_data>: user data to pass to the function
3874 static void foreach_(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, HFunc func, AT1 /*void*/ user_data) nothrow {
3875 g_hash_table_foreach(UpCast!(GLib2.HashTable*)(hash_table), func, UpCast!(void*)(user_data));
3878 // Unintrospectable function: foreach_remove() / g_hash_table_foreach_remove()
3879 // Calls the given function for each key/value pair in the
3880 // #GHashTable. If the function returns %TRUE, then the key/value
3881 // pair is removed from the #GHashTable. If you supplied key or
3882 // value destroy functions when creating the #GHashTable, they are
3883 // used to free the memory allocated for the removed keys and values.
3885 // See #GHashTableIter for an alternative way to loop over the
3886 // key/value pairs in the hash table.
3887 // RETURNS: the number of key/value pairs removed
3888 // <hash_table>: a #GHashTable
3889 // <func>: the function to call for each key/value pair
3890 // <user_data>: user data to pass to the function
3891 static uint foreach_remove(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, HRFunc func, AT1 /*void*/ user_data) nothrow {
3892 return g_hash_table_foreach_remove(UpCast!(GLib2.HashTable*)(hash_table), func, UpCast!(void*)(user_data));
3895 // Unintrospectable function: foreach_steal() / g_hash_table_foreach_steal()
3896 // Calls the given function for each key/value pair in the
3897 // #GHashTable. If the function returns %TRUE, then the key/value
3898 // pair is removed from the #GHashTable, but no key or value
3899 // destroy functions are called.
3901 // See #GHashTableIter for an alternative way to loop over the
3902 // key/value pairs in the hash table.
3903 // RETURNS: the number of key/value pairs removed.
3904 // <hash_table>: a #GHashTable
3905 // <func>: the function to call for each key/value pair
3906 // <user_data>: user data to pass to the function
3907 static uint foreach_steal(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, HRFunc func, AT1 /*void*/ user_data) nothrow {
3908 return g_hash_table_foreach_steal(UpCast!(GLib2.HashTable*)(hash_table), func, UpCast!(void*)(user_data));
3911 // Unintrospectable function: get_keys() / g_hash_table_get_keys()
3912 // VERSION: 2.14
3913 // Retrieves every key inside @hash_table. The returned data
3914 // is valid until @hash_table is modified.
3916 // table. The content of the list is owned by the hash table and
3917 // should not be modified or freed. Use g_list_free() when done
3918 // using the list.
3919 // RETURNS: a #GList containing all the keys inside the hash
3920 // <hash_table>: a #GHashTable
3921 static GLib2.List* get_keys(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
3922 return g_hash_table_get_keys(UpCast!(GLib2.HashTable*)(hash_table));
3925 // Unintrospectable function: get_values() / g_hash_table_get_values()
3926 // VERSION: 2.14
3927 // Retrieves every value inside @hash_table. The returned data
3928 // is valid until @hash_table is modified.
3930 // table. The content of the list is owned by the hash table and
3931 // should not be modified or freed. Use g_list_free() when done
3932 // using the list.
3933 // RETURNS: a #GList containing all the values inside the hash
3934 // <hash_table>: a #GHashTable
3935 static GLib2.List* get_values(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
3936 return g_hash_table_get_values(UpCast!(GLib2.HashTable*)(hash_table));
3939 // Inserts a new key and value into a #GHashTable.
3941 // If the key already exists in the #GHashTable its current
3942 // value is replaced with the new value. If you supplied a
3943 // @value_destroy_func when creating the #GHashTable, the old
3944 // value is freed using that function. If you supplied a
3945 // @key_destroy_func when creating the #GHashTable, the passed
3946 // key is freed using that function.
3947 // <hash_table>: a #GHashTable
3948 // <key>: a key to insert
3949 // <value>: the value to associate with the key
3950 static void insert(AT0, AT1, AT2)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*void*/ key, AT2 /*void*/ value) nothrow {
3951 g_hash_table_insert(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(void*)(key), UpCast!(void*)(value));
3954 // Unintrospectable function: lookup() / g_hash_table_lookup()
3955 // Looks up a key in a #GHashTable. Note that this function cannot
3956 // distinguish between a key that is not present and one which is present
3957 // and has the value %NULL. If you need this distinction, use
3958 // g_hash_table_lookup_extended().
3959 // RETURNS: the associated value, or %NULL if the key is not found
3960 // <hash_table>: a #GHashTable
3961 // <key>: the key to look up
3962 static void* lookup(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
3963 return g_hash_table_lookup(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
3966 // Looks up a key in the #GHashTable, returning the original key and the
3967 // associated value and a #gboolean which is %TRUE if the key was found. This
3968 // is useful if you need to free the memory allocated for the original key,
3969 // for example before calling g_hash_table_remove().
3971 // You can actually pass %NULL for @lookup_key to test
3972 // whether the %NULL key exists, provided the hash and equal functions
3973 // of @hash_table are %NULL-safe.
3974 // RETURNS: %TRUE if the key was found in the #GHashTable
3975 // <hash_table>: a #GHashTable
3976 // <lookup_key>: the key to look up
3977 // <orig_key>: return location for the original key, or %NULL
3978 // <value>: return location for the value associated with the key, or %NULL
3979 static int lookup_extended(AT0, AT1, AT2, AT3)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ lookup_key, AT2 /*void**/ orig_key=null, AT3 /*void**/ value=null) nothrow {
3980 return g_hash_table_lookup_extended(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(lookup_key), UpCast!(void**)(orig_key), UpCast!(void**)(value));
3983 // Unintrospectable function: new() / g_hash_table_new()
3984 // Creates a new #GHashTable with a reference count of 1.
3986 // Hash values returned by @hash_func are used to determine where keys
3987 // are stored within the #GHashTable data structure. The g_direct_hash(),
3988 // g_int_hash(), g_int64_hash(), g_double_hash() and g_str_hash()
3989 // functions are provided for some common types of keys.
3990 // If @hash_func is %NULL, g_direct_hash() is used.
3992 // @key_equal_func is used when looking up keys in the #GHashTable.
3993 // The g_direct_equal(), g_int_equal(), g_int64_equal(), g_double_equal()
3994 // and g_str_equal() functions are provided for the most common types
3995 // of keys. If @key_equal_func is %NULL, keys are compared directly in
3996 // a similar fashion to g_direct_equal(), but without the overhead of
3997 // a function call.
3998 // RETURNS: a new #GHashTable
3999 // <hash_func>: a function to create a hash value from a key
4000 // <key_equal_func>: a function to check two keys for equality
4001 static GLib2.HashTable* new_()(HashFunc hash_func, EqualFunc key_equal_func) nothrow {
4002 return g_hash_table_new(hash_func, key_equal_func);
4005 // Unintrospectable function: new_full() / g_hash_table_new_full()
4006 // Creates a new #GHashTable like g_hash_table_new() with a reference
4007 // count of 1 and allows to specify functions to free the memory
4008 // allocated for the key and value that get called when removing the
4009 // entry from the #GHashTable.
4010 // RETURNS: a new #GHashTable
4011 // <hash_func>: a function to create a hash value from a key
4012 // <key_equal_func>: a function to check two keys for equality
4013 // <key_destroy_func>: a function to free the memory allocated for the key used when removing the entry from the #GHashTable, or %NULL if you don't want to supply such a function.
4014 // <value_destroy_func>: a function to free the memory allocated for the value used when removing the entry from the #GHashTable, or %NULL if you don't want to supply such a function.
4015 static GLib2.HashTable* new_full()(HashFunc hash_func, EqualFunc key_equal_func, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func) nothrow {
4016 return g_hash_table_new_full(hash_func, key_equal_func, key_destroy_func, value_destroy_func);
4019 // Unintrospectable function: ref() / g_hash_table_ref()
4020 // VERSION: 2.10
4021 // Atomically increments the reference count of @hash_table by one.
4022 // This function is MT-safe and may be called from any thread.
4023 // RETURNS: the passed in #GHashTable
4024 // <hash_table>: a valid #GHashTable
4025 static GLib2.HashTable* ref_(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
4026 return g_hash_table_ref(UpCast!(GLib2.HashTable*)(hash_table));
4029 // Removes a key and its associated value from a #GHashTable.
4031 // If the #GHashTable was created using g_hash_table_new_full(), the
4032 // key and value are freed using the supplied destroy functions, otherwise
4033 // you have to make sure that any dynamically allocated values are freed
4034 // yourself.
4035 // RETURNS: %TRUE if the key was found and removed from the #GHashTable
4036 // <hash_table>: a #GHashTable
4037 // <key>: the key to remove
4038 static int remove(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
4039 return g_hash_table_remove(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
4042 // VERSION: 2.12
4043 // Removes all keys and their associated values from a #GHashTable.
4045 // If the #GHashTable was created using g_hash_table_new_full(),
4046 // the keys and values are freed using the supplied destroy functions,
4047 // otherwise you have to make sure that any dynamically allocated
4048 // values are freed yourself.
4049 // <hash_table>: a #GHashTable
4050 static void remove_all(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
4051 g_hash_table_remove_all(UpCast!(GLib2.HashTable*)(hash_table));
4054 // Inserts a new key and value into a #GHashTable similar to
4055 // g_hash_table_insert(). The difference is that if the key
4056 // already exists in the #GHashTable, it gets replaced by the
4057 // new key. If you supplied a @value_destroy_func when creating
4058 // the #GHashTable, the old value is freed using that function.
4059 // If you supplied a @key_destroy_func when creating the
4060 // #GHashTable, the old key is freed using that function.
4061 // <hash_table>: a #GHashTable
4062 // <key>: a key to insert
4063 // <value>: the value to associate with the key
4064 static void replace(AT0, AT1, AT2)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*void*/ key, AT2 /*void*/ value) nothrow {
4065 g_hash_table_replace(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(void*)(key), UpCast!(void*)(value));
4068 // Returns the number of elements contained in the #GHashTable.
4069 // RETURNS: the number of key/value pairs in the #GHashTable.
4070 // <hash_table>: a #GHashTable
4071 static uint size(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
4072 return g_hash_table_size(UpCast!(GLib2.HashTable*)(hash_table));
4075 // Removes a key and its associated value from a #GHashTable without
4076 // calling the key and value destroy functions.
4077 // RETURNS: %TRUE if the key was found and removed from the #GHashTable
4078 // <hash_table>: a #GHashTable
4079 // <key>: the key to remove
4080 static int steal(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
4081 return g_hash_table_steal(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
4084 // VERSION: 2.12
4085 // Removes all keys and their associated values from a #GHashTable
4086 // without calling the key and value destroy functions.
4087 // <hash_table>: a #GHashTable
4088 static void steal_all(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
4089 g_hash_table_steal_all(UpCast!(GLib2.HashTable*)(hash_table));
4092 // VERSION: 2.10
4093 // Atomically decrements the reference count of @hash_table by one.
4094 // If the reference count drops to 0, all keys and values will be
4095 // destroyed, and all memory allocated by the hash table is released.
4096 // This function is MT-safe and may be called from any thread.
4097 // <hash_table>: a valid #GHashTable
4098 static void unref(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
4099 g_hash_table_unref(UpCast!(GLib2.HashTable*)(hash_table));
4104 // A GHashTableIter structure represents an iterator that can be used
4105 // to iterate over the elements of a #GHashTable. GHashTableIter
4106 // structures are typically allocated on the stack and then initialized
4107 // with g_hash_table_iter_init().
4108 struct HashTableIter {
4109 private void* dummy1, dummy2, dummy3;
4110 private int dummy4;
4111 private int dummy5;
4112 private void* dummy6;
4115 // Unintrospectable method: get_hash_table() / g_hash_table_iter_get_hash_table()
4116 // VERSION: 2.16
4117 // Returns the #GHashTable associated with @iter.
4118 // RETURNS: the #GHashTable associated with @iter.
4119 GLib2.HashTable* get_hash_table()() nothrow {
4120 return g_hash_table_iter_get_hash_table(&this);
4123 // VERSION: 2.16
4124 // Initializes a key/value pair iterator and associates it with
4125 // @hash_table. Modifying the hash table after calling this function
4126 // invalidates the returned iterator.
4127 // |[
4128 // GHashTableIter iter;
4129 // gpointer key, value;
4131 // g_hash_table_iter_init (&iter, hash_table);
4132 // while (g_hash_table_iter_next (&iter, &key, &value))
4133 // {
4134 // /&ast; do something with key and value &ast;/
4135 // }
4136 // ]|
4137 // <hash_table>: a #GHashTable
4138 void init(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
4139 g_hash_table_iter_init(&this, UpCast!(GLib2.HashTable*)(hash_table));
4142 // VERSION: 2.16
4143 // Advances @iter and retrieves the key and/or value that are now
4144 // pointed to as a result of this advancement. If %FALSE is returned,
4145 // @key and @value are not set, and the iterator becomes invalid.
4146 // RETURNS: %FALSE if the end of the #GHashTable has been reached.
4147 // <key>: a location to store the key, or %NULL
4148 // <value>: a location to store the value, or %NULL
4149 int next(AT0, AT1)(AT0 /*void**/ key, AT1 /*void**/ value) nothrow {
4150 return g_hash_table_iter_next(&this, UpCast!(void**)(key), UpCast!(void**)(value));
4153 // VERSION: 2.16
4154 // Removes the key/value pair currently pointed to by the iterator
4155 // from its associated #GHashTable. Can only be called after
4156 // g_hash_table_iter_next() returned %TRUE, and cannot be called
4157 // more than once for the same key/value pair.
4159 // If the #GHashTable was created using g_hash_table_new_full(),
4160 // the key and value are freed using the supplied destroy functions,
4161 // otherwise you have to make sure that any dynamically allocated
4162 // values are freed yourself.
4163 void remove()() nothrow {
4164 g_hash_table_iter_remove(&this);
4167 // VERSION: 2.30
4168 // Replaces the value currently pointed to by the iterator
4169 // from its associated #GHashTable. Can only be called after
4170 // g_hash_table_iter_next() returned %TRUE.
4172 // If you supplied a @value_destroy_func when creating the
4173 // #GHashTable, the old value is freed using that function.
4174 // <value>: the value to replace with
4175 void replace(AT0)(AT0 /*void*/ value) nothrow {
4176 g_hash_table_iter_replace(&this, UpCast!(void*)(value));
4179 // VERSION: 2.16
4180 // Removes the key/value pair currently pointed to by the
4181 // iterator from its associated #GHashTable, without calling
4182 // the key and value destroy functions. Can only be called
4183 // after g_hash_table_iter_next() returned %TRUE, and cannot
4184 // be called more than once for the same key/value pair.
4185 void steal()() nothrow {
4186 g_hash_table_iter_steal(&this);
4191 // An opaque structure representing a HMAC operation.
4192 // To create a new GHmac, use g_hmac_new(). To free
4193 // a GHmac, use g_hmac_unref().
4194 struct Hmac /* Version 2.30 */ {
4196 // Unintrospectable method: copy() / g_hmac_copy()
4197 // VERSION: 2.30
4198 // Copies a #GHmac. If @hmac has been closed, by calling
4199 // g_hmac_get_string() or g_hmac_get_digest(), the copied
4200 // HMAC will be closed as well.
4202 // when finished using it.
4203 // RETURNS: the copy of the passed #GHmac. Use g_hmac_unref()
4204 Hmac* copy()() nothrow {
4205 return g_hmac_copy(&this);
4208 // VERSION: 2.30
4209 // Gets the digest from @checksum as a raw binary array and places it
4210 // into @buffer. The size of the digest depends on the type of checksum.
4212 // Once this function has been called, the #GHmac is closed and can
4213 // no longer be updated with g_checksum_update().
4214 // <buffer>: output buffer
4215 // <digest_len>: an inout parameter. The caller initializes it to the size of @buffer. After the call it contains the length of the digest
4216 void get_digest(AT0, AT1)(AT0 /*ubyte*/ buffer, AT1 /*size_t*/ digest_len) nothrow {
4217 g_hmac_get_digest(&this, UpCast!(ubyte*)(buffer), UpCast!(size_t*)(digest_len));
4220 // VERSION: 2.30
4221 // Gets the HMAC as an hexadecimal string.
4223 // Once this function has been called the #GHmac can no longer be
4224 // updated with g_hmac_update().
4226 // The hexadecimal characters will be lower case.
4228 // returned string is owned by the HMAC and should not be modified
4229 // or freed.
4230 // RETURNS: the hexadecimal representation of the HMAC. The
4231 char* get_string()() nothrow {
4232 return g_hmac_get_string(&this);
4235 // Unintrospectable method: ref() / g_hmac_ref()
4236 // VERSION: 2.30
4237 // Atomically increments the reference count of @hmac by one.
4239 // This function is MT-safe and may be called from any thread.
4240 // RETURNS: the passed in #GHmac.
4241 Hmac* ref_()() nothrow {
4242 return g_hmac_ref(&this);
4245 // VERSION: 2.30
4246 // Atomically decrements the reference count of @hmac by one.
4248 // If the reference count drops to 0, all keys and values will be
4249 // destroyed, and all memory allocated by the hash table is released.
4250 // This function is MT-safe and may be called from any thread.
4251 // Frees the memory allocated for @hmac.
4252 void unref()() nothrow {
4253 g_hmac_unref(&this);
4256 // VERSION: 2.30
4257 // Feeds @data into an existing #GHmac.
4259 // The HMAC must still be open, that is g_hmac_get_string() or
4260 // g_hmac_get_digest() must not have been called on @hmac.
4261 // <data>: buffer used to compute the checksum
4262 // <length>: size of the buffer, or -1 if it is a nul-terminated string
4263 void update(AT0)(AT0 /*ubyte*/ data, ssize_t length) nothrow {
4264 g_hmac_update(&this, UpCast!(ubyte*)(data), length);
4267 // Unintrospectable function: new() / g_hmac_new()
4268 // VERSION: 2.30
4269 // Creates a new #GHmac, using the digest algorithm @digest_type.
4270 // If the @digest_type is not known, %NULL is returned.
4271 // A #GHmac can be used to compute the HMAC of a key and an
4272 // arbitrary binary blob, using different hashing algorithms.
4274 // A #GHmac works by feeding a binary blob through g_hmac_update()
4275 // until the data is complete; the digest can then be extracted
4276 // using g_hmac_get_string(), which will return the checksum as a
4277 // hexadecimal string; or g_hmac_get_digest(), which will return a
4278 // array of raw bytes. Once either g_hmac_get_string() or
4279 // g_hmac_get_digest() have been called on a #GHmac, the HMAC
4280 // will be closed and it won't be possible to call g_hmac_update()
4281 // on it anymore.
4283 // Use g_hmac_unref() to free the memory allocated by it.
4284 // RETURNS: the newly created #GHmac, or %NULL.
4285 // <digest_type>: the desired type of digest
4286 // <key>: the key for the HMAC
4287 // <key_len>: the length of the keys
4288 static Hmac* new_(AT0)(ChecksumType digest_type, AT0 /*ubyte*/ key, size_t key_len) nothrow {
4289 return g_hmac_new(digest_type, UpCast!(ubyte*)(key), key_len);
4294 // The <structname>GHook</structname> struct represents a single hook
4295 // function in a #GHookList.
4296 struct Hook {
4297 void* data;
4298 Hook* next, prev;
4299 uint ref_count;
4300 c_ulong hook_id;
4301 uint flags;
4302 void* func;
4303 DestroyNotify destroy_;
4306 // Compares the ids of two #GHook elements, returning a negative value
4307 // if the second id is greater than the first.
4308 // RETURNS: a value &lt;= 0 if the id of @sibling is >= the id of @new_hook
4309 // <sibling>: a #GHook to compare with @new_hook
4310 int compare_ids(AT0)(AT0 /*Hook*/ sibling) nothrow {
4311 return g_hook_compare_ids(&this, UpCast!(Hook*)(sibling));
4314 // Unintrospectable function: alloc() / g_hook_alloc()
4315 // Allocates space for a #GHook and initializes it.
4316 // RETURNS: a new #GHook
4317 // <hook_list>: a #GHookList
4318 static Hook* alloc(AT0)(AT0 /*HookList*/ hook_list) nothrow {
4319 return g_hook_alloc(UpCast!(HookList*)(hook_list));
4322 // Destroys a #GHook, given its ID.
4323 // RETURNS: %TRUE if the #GHook was found in the #GHookList and destroyed
4324 // <hook_list>: a #GHookList
4325 // <hook_id>: a hook ID
4326 static int destroy(AT0)(AT0 /*HookList*/ hook_list, c_ulong hook_id) nothrow {
4327 return g_hook_destroy(UpCast!(HookList*)(hook_list), hook_id);
4330 // Removes one #GHook from a #GHookList, marking it
4331 // inactive and calling g_hook_unref() on it.
4332 // <hook_list>: a #GHookList
4333 // <hook>: the #GHook to remove
4334 static void destroy_link(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
4335 g_hook_destroy_link(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
4338 // Unintrospectable function: find() / g_hook_find()
4339 // Finds a #GHook in a #GHookList using the given function to
4340 // test for a match.
4341 // RETURNS: the found #GHook or %NULL if no matching #GHook is found
4342 // <hook_list>: a #GHookList
4343 // <need_valids>: %TRUE if #GHook elements which have been destroyed should be skipped
4344 // <func>: the function to call for each #GHook, which should return %TRUE when the #GHook has been found
4345 // <data>: the data to pass to @func
4346 static Hook* find(AT0, AT1)(AT0 /*HookList*/ hook_list, int need_valids, HookFindFunc func, AT1 /*void*/ data) nothrow {
4347 return g_hook_find(UpCast!(HookList*)(hook_list), need_valids, func, UpCast!(void*)(data));
4350 // Unintrospectable function: find_data() / g_hook_find_data()
4351 // Finds a #GHook in a #GHookList with the given data.
4353 // #GHook is found
4354 // RETURNS: the #GHook with the given @data or %NULL if no matching
4355 // <hook_list>: a #GHookList
4356 // <need_valids>: %TRUE if #GHook elements which have been destroyed should be skipped
4357 // <data>: the data to find
4358 static Hook* find_data(AT0, AT1)(AT0 /*HookList*/ hook_list, int need_valids, AT1 /*void*/ data) nothrow {
4359 return g_hook_find_data(UpCast!(HookList*)(hook_list), need_valids, UpCast!(void*)(data));
4362 // Unintrospectable function: find_func() / g_hook_find_func()
4363 // Finds a #GHook in a #GHookList with the given function.
4365 // #GHook is found
4366 // RETURNS: the #GHook with the given @func or %NULL if no matching
4367 // <hook_list>: a #GHookList
4368 // <need_valids>: %TRUE if #GHook elements which have been destroyed should be skipped
4369 // <func>: the function to find
4370 static Hook* find_func(AT0, AT1)(AT0 /*HookList*/ hook_list, int need_valids, AT1 /*void*/ func) nothrow {
4371 return g_hook_find_func(UpCast!(HookList*)(hook_list), need_valids, UpCast!(void*)(func));
4374 // Unintrospectable function: find_func_data() / g_hook_find_func_data()
4375 // Finds a #GHook in a #GHookList with the given function and data.
4377 // no matching #GHook is found
4378 // RETURNS: the #GHook with the given @func and @data or %NULL if
4379 // <hook_list>: a #GHookList
4380 // <need_valids>: %TRUE if #GHook elements which have been destroyed should be skipped
4381 // <func>: the function to find
4382 // <data>: the data to find
4383 static Hook* find_func_data(AT0, AT1, AT2)(AT0 /*HookList*/ hook_list, int need_valids, AT1 /*void*/ func, AT2 /*void*/ data) nothrow {
4384 return g_hook_find_func_data(UpCast!(HookList*)(hook_list), need_valids, UpCast!(void*)(func), UpCast!(void*)(data));
4387 // Unintrospectable function: first_valid() / g_hook_first_valid()
4388 // Returns the first #GHook in a #GHookList which has not been destroyed.
4389 // The reference count for the #GHook is incremented, so you must call
4390 // g_hook_unref() to restore it when no longer needed. (Or call
4391 // g_hook_next_valid() if you are stepping through the #GHookList.)
4392 // RETURNS: the first valid #GHook, or %NULL if none are valid
4393 // <hook_list>: a #GHookList
4394 // <may_be_in_call>: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
4395 static Hook* first_valid(AT0)(AT0 /*HookList*/ hook_list, int may_be_in_call) nothrow {
4396 return g_hook_first_valid(UpCast!(HookList*)(hook_list), may_be_in_call);
4399 // Calls the #GHookList @finalize_hook function if it exists,
4400 // and frees the memory allocated for the #GHook.
4401 // <hook_list>: a #GHookList
4402 // <hook>: the #GHook to free
4403 static void free(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
4404 g_hook_free(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
4407 // Unintrospectable function: get() / g_hook_get()
4408 // Returns the #GHook with the given id, or %NULL if it is not found.
4409 // RETURNS: the #GHook with the given id, or %NULL if it is not found
4410 // <hook_list>: a #GHookList
4411 // <hook_id>: a hook id
4412 static Hook* get(AT0)(AT0 /*HookList*/ hook_list, c_ulong hook_id) nothrow {
4413 return g_hook_get(UpCast!(HookList*)(hook_list), hook_id);
4416 // Inserts a #GHook into a #GHookList, before a given #GHook.
4417 // <hook_list>: a #GHookList
4418 // <sibling>: the #GHook to insert the new #GHook before
4419 // <hook>: the #GHook to insert
4420 static void insert_before(AT0, AT1, AT2)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ sibling, AT2 /*Hook*/ hook) nothrow {
4421 g_hook_insert_before(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(sibling), UpCast!(Hook*)(hook));
4424 // Unintrospectable function: insert_sorted() / g_hook_insert_sorted()
4425 // Inserts a #GHook into a #GHookList, sorted by the given function.
4426 // <hook_list>: a #GHookList
4427 // <hook>: the #GHook to insert
4428 // <func>: the comparison function used to sort the #GHook elements
4429 static void insert_sorted(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook, HookCompareFunc func) nothrow {
4430 g_hook_insert_sorted(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook), func);
4433 // Unintrospectable function: next_valid() / g_hook_next_valid()
4434 // Returns the next #GHook in a #GHookList which has not been destroyed.
4435 // The reference count for the #GHook is incremented, so you must call
4436 // g_hook_unref() to restore it when no longer needed. (Or continue to call
4437 // g_hook_next_valid() until %NULL is returned.)
4438 // RETURNS: the next valid #GHook, or %NULL if none are valid
4439 // <hook_list>: a #GHookList
4440 // <hook>: the current #GHook
4441 // <may_be_in_call>: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
4442 static Hook* next_valid(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook, int may_be_in_call) nothrow {
4443 return g_hook_next_valid(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook), may_be_in_call);
4446 // Prepends a #GHook on the start of a #GHookList.
4447 // <hook_list>: a #GHookList
4448 // <hook>: the #GHook to add to the start of @hook_list
4449 static void prepend(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
4450 g_hook_prepend(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
4453 // Unintrospectable function: ref() / g_hook_ref()
4454 // Increments the reference count for a #GHook.
4455 // RETURNS: the @hook that was passed in (since 2.6)
4456 // <hook_list>: a #GHookList
4457 // <hook>: the #GHook to increment the reference count of
4458 static Hook* ref_(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
4459 return g_hook_ref(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
4462 // Decrements the reference count of a #GHook.
4463 // If the reference count falls to 0, the #GHook is removed
4464 // from the #GHookList and g_hook_free() is called to free it.
4465 // <hook_list>: a #GHookList
4466 // <hook>: the #GHook to unref
4467 static void unref(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
4468 g_hook_unref(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
4473 // Defines the type of a hook function that can be invoked
4474 // by g_hook_list_invoke_check().
4475 // RETURNS: %FALSE if the #GHook should be destroyed
4476 // <data>: the data field of the #GHook is passed to the hook function here
4477 extern (C) alias int function (void* data) nothrow HookCheckFunc;
4480 // Defines the type of function used by g_hook_list_marshal_check().
4481 // RETURNS: %FALSE if @hook should be destroyed
4482 // <hook>: a #GHook
4483 // <marshal_data>: user data
4484 extern (C) alias int function (Hook* hook, void* marshal_data) nothrow HookCheckMarshaller;
4487 // Defines the type of function used to compare #GHook elements in
4488 // g_hook_insert_sorted().
4489 // RETURNS: a value &lt;= 0 if @new_hook should be before @sibling
4490 // <new_hook>: the #GHook being inserted
4491 // <sibling>: the #GHook to compare with @new_hook
4492 extern (C) alias int function (Hook* new_hook, Hook* sibling) nothrow HookCompareFunc;
4495 // Defines the type of function to be called when a hook in a
4496 // list of hooks gets finalized.
4497 // <hook_list>: a #GHookList
4498 // <hook>: the hook in @hook_list that gets finalized
4499 extern (C) alias void function (HookList* hook_list, Hook* hook) nothrow HookFinalizeFunc;
4502 // Defines the type of the function passed to g_hook_find().
4503 // RETURNS: %TRUE if the required #GHook has been found
4504 // <hook>: a #GHook
4505 // <data>: user data passed to g_hook_find_func()
4506 extern (C) alias int function (Hook* hook, void* data) nothrow HookFindFunc;
4508 // Flags used internally in the #GHook implementation.
4509 enum HookFlagMask {
4510 ACTIVE = 1,
4511 IN_CALL = 2,
4512 MASK = 15
4515 // Defines the type of a hook function that can be invoked
4516 // by g_hook_list_invoke().
4517 // <data>: the data field of the #GHook is passed to the hook function here
4518 extern (C) alias void function (void* data) nothrow HookFunc;
4521 // The <structname>GHookList</structname> struct represents a
4522 // list of hook functions.
4523 struct HookList {
4524 c_ulong seq_id;
4525 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
4526 uint, "hook_size", 16,
4527 uint, "is_setup", 1,
4528 uint, "__dummy32A", 15));
4529 Hook* hooks;
4530 void* dummy3;
4531 HookFinalizeFunc finalize_hook;
4532 void*[2] dummy;
4534 // Removes all the #GHook elements from a #GHookList.
4535 void clear()() nothrow {
4536 g_hook_list_clear(&this);
4539 // Initializes a #GHookList.
4540 // This must be called before the #GHookList is used.
4541 // <hook_size>: the size of each element in the #GHookList, typically <literal>sizeof (GHook)</literal>
4542 void init()(uint hook_size) nothrow {
4543 g_hook_list_init(&this, hook_size);
4546 // Calls all of the #GHook functions in a #GHookList.
4547 // <may_recurse>: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped
4548 void invoke()(int may_recurse) nothrow {
4549 g_hook_list_invoke(&this, may_recurse);
4552 // Calls all of the #GHook functions in a #GHookList.
4553 // Any function which returns %FALSE is removed from the #GHookList.
4554 // <may_recurse>: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped
4555 void invoke_check()(int may_recurse) nothrow {
4556 g_hook_list_invoke_check(&this, may_recurse);
4559 // Unintrospectable method: marshal() / g_hook_list_marshal()
4560 // Calls a function on each valid #GHook.
4561 // <may_recurse>: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
4562 // <marshaller>: the function to call for each #GHook
4563 // <marshal_data>: data to pass to @marshaller
4564 void marshal(AT0)(int may_recurse, HookMarshaller marshaller, AT0 /*void*/ marshal_data) nothrow {
4565 g_hook_list_marshal(&this, may_recurse, marshaller, UpCast!(void*)(marshal_data));
4568 // Unintrospectable method: marshal_check() / g_hook_list_marshal_check()
4569 // Calls a function on each valid #GHook and destroys it if the
4570 // function returns %FALSE.
4571 // <may_recurse>: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
4572 // <marshaller>: the function to call for each #GHook
4573 // <marshal_data>: data to pass to @marshaller
4574 void marshal_check(AT0)(int may_recurse, HookCheckMarshaller marshaller, AT0 /*void*/ marshal_data) nothrow {
4575 g_hook_list_marshal_check(&this, may_recurse, marshaller, UpCast!(void*)(marshal_data));
4580 // Defines the type of function used by g_hook_list_marshal().
4581 // <hook>: a #GHook
4582 // <marshal_data>: user data
4583 extern (C) alias void function (Hook* hook, void* marshal_data) nothrow HookMarshaller;
4585 struct IConv {
4587 // Same as the standard UNIX routine iconv(), but
4588 // may be implemented via libiconv on UNIX flavors that lack
4589 // a native implementation.
4591 // GLib provides g_convert() and g_locale_to_utf8() which are likely
4592 // more convenient than the raw iconv wrappers.
4593 // RETURNS: count of non-reversible conversions, or -1 on error
4594 // <inbuf>: bytes to convert
4595 // <inbytes_left>: inout parameter, bytes remaining to convert in @inbuf
4596 // <outbuf>: converted output bytes
4597 // <outbytes_left>: inout parameter, bytes available to fill in @outbuf
4598 size_t /*NAME MISSING IN GIR*/ iconv(AT0, AT1, AT2, AT3)(AT0 /*char**/ inbuf, AT1 /*size_t*/ inbytes_left, AT2 /*char**/ outbuf, AT3 /*size_t*/ outbytes_left) nothrow {
4599 return g_iconv(&this, toCString!(char**)(inbuf), UpCast!(size_t*)(inbytes_left), toCString!(char**)(outbuf), UpCast!(size_t*)(outbytes_left));
4602 // Same as the standard UNIX routine iconv_close(), but
4603 // may be implemented via libiconv on UNIX flavors that lack
4604 // a native implementation. Should be called to clean up
4605 // the conversion descriptor from g_iconv_open() when
4606 // you are done converting things.
4608 // GLib provides g_convert() and g_locale_to_utf8() which are likely
4609 // more convenient than the raw iconv wrappers.
4610 // RETURNS: -1 on error, 0 on success
4611 int close()() nothrow {
4612 return g_iconv_close(&this);
4615 // Unintrospectable function: open() / g_iconv_open()
4616 // Same as the standard UNIX routine iconv_open(), but
4617 // may be implemented via libiconv on UNIX flavors that lack
4618 // a native implementation.
4620 // GLib provides g_convert() and g_locale_to_utf8() which are likely
4621 // more convenient than the raw iconv wrappers.
4623 // opening the converter failed.
4624 // RETURNS: a "conversion descriptor", or (GIConv)-1 if
4625 // <to_codeset>: destination codeset
4626 // <from_codeset>: source codeset
4627 static IConv open(AT0, AT1)(AT0 /*char*/ to_codeset, AT1 /*char*/ from_codeset) nothrow {
4628 return g_iconv_open(toCString!(char*)(to_codeset), toCString!(char*)(from_codeset));
4632 enum int IEEE754_DOUBLE_BIAS = 1023;
4633 enum int IEEE754_FLOAT_BIAS = 127;
4635 // A data structure representing an IO Channel. The fields should be
4636 // considered private and should only be accessed with the following
4637 // functions.
4638 struct IOChannel {
4639 private int ref_count;
4640 private IOFuncs* funcs;
4641 private char* encoding;
4642 private IConv read_cd, write_cd;
4643 private char* line_term;
4644 private uint line_term_len;
4645 private size_t buf_size;
4646 private String* read_buf, encoded_read_buf, write_buf;
4647 private char[6] partial_write_buf;
4648 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
4649 uint, "use_buffer", 1,
4650 uint, "do_encode", 1,
4651 uint, "close_on_unref", 1,
4652 uint, "is_readable", 1,
4653 uint, "is_writeable", 1,
4654 uint, "is_seekable", 1,
4655 uint, "__dummy32A", 26));
4656 private void* reserved1, reserved2;
4659 // Open a file @filename as a #GIOChannel using mode @mode. This
4660 // channel will be closed when the last reference to it is dropped,
4661 // so there is no need to call g_io_channel_close() (though doing
4662 // so will not cause problems, as long as no attempt is made to
4663 // access the channel after it is closed).
4664 // RETURNS: A #GIOChannel on success, %NULL on failure.
4665 // <filename>: A string containing the name of a file
4666 // <mode>: One of "r", "w", "a", "r+", "w+", "a+". These have the same meaning as in fopen()
4667 static IOChannel* /*new*/ new_file(AT0, AT1, AT2)(AT0 /*char*/ filename, AT1 /*char*/ mode, AT2 /*GLib2.Error**/ error=null) nothrow {
4668 return g_io_channel_new_file(toCString!(char*)(filename), toCString!(char*)(mode), UpCast!(GLib2.Error**)(error));
4670 static auto opCall(AT0, AT1, AT2)(AT0 /*char*/ filename, AT1 /*char*/ mode, AT2 /*GLib2.Error**/ error=null) {
4671 return g_io_channel_new_file(toCString!(char*)(filename), toCString!(char*)(mode), UpCast!(GLib2.Error**)(error));
4674 // Creates a new #GIOChannel given a file descriptor. On UNIX systems
4675 // this works for plain files, pipes, and sockets.
4677 // The returned #GIOChannel has a reference count of 1.
4679 // The default encoding for #GIOChannel is UTF-8. If your application
4680 // is reading output from a command using via pipe, you may need to set
4681 // the encoding to the encoding of the current locale (see
4682 // g_get_charset()) with the g_io_channel_set_encoding() function.
4684 // If you want to read raw binary data without interpretation, then
4685 // call the g_io_channel_set_encoding() function with %NULL for the
4686 // encoding argument.
4688 // This function is available in GLib on Windows, too, but you should
4689 // avoid using it on Windows. The domain of file descriptors and
4690 // sockets overlap. There is no way for GLib to know which one you mean
4691 // in case the argument you pass to this function happens to be both a
4692 // valid file descriptor and socket. If that happens a warning is
4693 // issued, and GLib assumes that it is the file descriptor you mean.
4694 // <fd>: a file descriptor.
4695 static IOChannel* /*new*/ unix_new()(int fd) nothrow {
4696 return g_io_channel_unix_new(fd);
4698 static auto opCall()(int fd) {
4699 return g_io_channel_unix_new(fd);
4702 // Close an IO channel. Any pending data to be written will be
4703 // flushed, ignoring errors. The channel will not be freed until the
4704 // last reference is dropped using g_io_channel_unref().
4706 // Deprecated:2.2: Use g_io_channel_shutdown() instead.
4707 void close()() nothrow {
4708 g_io_channel_close(&this);
4711 // Flushes the write buffer for the GIOChannel.
4713 // #G_IO_STATUS_NORMAL, #G_IO_STATUS_AGAIN, or
4714 // #G_IO_STATUS_ERROR.
4715 // RETURNS: the status of the operation: One of
4716 IOStatus flush(AT0)(AT0 /*GLib2.Error**/ error=null) nothrow {
4717 return g_io_channel_flush(&this, UpCast!(GLib2.Error**)(error));
4720 // This function returns a #GIOCondition depending on whether there
4721 // is data to be read/space to write data in the internal buffers in
4722 // the #GIOChannel. Only the flags %G_IO_IN and %G_IO_OUT may be set.
4723 // RETURNS: A #GIOCondition
4724 IOCondition get_buffer_condition()() nothrow {
4725 return g_io_channel_get_buffer_condition(&this);
4728 // Gets the buffer size.
4729 // RETURNS: the size of the buffer.
4730 size_t get_buffer_size()() nothrow {
4731 return g_io_channel_get_buffer_size(&this);
4734 // Returns whether @channel is buffered.
4735 // RETURNS: %TRUE if the @channel is buffered.
4736 int get_buffered()() nothrow {
4737 return g_io_channel_get_buffered(&this);
4740 // Returns whether the file/socket/whatever associated with @channel
4741 // will be closed when @channel receives its final unref and is
4742 // destroyed. The default value of this is %TRUE for channels created
4743 // by g_io_channel_new_file (), and %FALSE for all other channels.
4745 // the GIOChannel data structure.
4746 // RETURNS: Whether the channel will be closed on the final unref of
4747 int get_close_on_unref()() nothrow {
4748 return g_io_channel_get_close_on_unref(&this);
4751 // Gets the encoding for the input/output of the channel.
4752 // The internal encoding is always UTF-8. The encoding %NULL
4753 // makes the channel safe for binary data.
4755 // owned by GLib and must not be freed.
4756 // RETURNS: A string containing the encoding, this string is
4757 char* get_encoding()() nothrow {
4758 return g_io_channel_get_encoding(&this);
4761 // Gets the current flags for a #GIOChannel, including read-only
4762 // flags such as %G_IO_FLAG_IS_READABLE.
4764 // The values of the flags %G_IO_FLAG_IS_READABLE and %G_IO_FLAG_IS_WRITABLE
4765 // are cached for internal use by the channel when it is created.
4766 // If they should change at some later point (e.g. partial shutdown
4767 // of a socket with the UNIX shutdown() function), the user
4768 // should immediately call g_io_channel_get_flags() to update
4769 // the internal values of these flags.
4770 // RETURNS: the flags which are set on the channel
4771 IOFlags get_flags()() nothrow {
4772 return g_io_channel_get_flags(&this);
4775 // This returns the string that #GIOChannel uses to determine
4776 // where in the file a line break occurs. A value of %NULL
4777 // indicates autodetection.
4779 // is owned by GLib and must not be freed.
4780 // RETURNS: The line termination string. This value
4781 // <length>: a location to return the length of the line terminator
4782 char* get_line_term()(int* length) nothrow {
4783 return g_io_channel_get_line_term(&this, length);
4786 // Initializes a #GIOChannel struct.
4788 // This is called by each of the above functions when creating a
4789 // #GIOChannel, and so is not often needed by the application
4790 // programmer (unless you are creating a new type of #GIOChannel).
4791 void init()() nothrow {
4792 g_io_channel_init(&this);
4795 // Reads data from a #GIOChannel.
4798 // Deprecated:2.2: Use g_io_channel_read_chars() instead.
4799 // RETURNS: %G_IO_ERROR_NONE if the operation was successful.
4800 // <buf>: a buffer to read the data into (which should be at least count bytes long)
4801 // <count>: the number of bytes to read from the #GIOChannel
4802 // <bytes_read>: returns the number of bytes actually read
4803 IOError read(AT0, AT1)(AT0 /*char*/ buf, size_t count, AT1 /*size_t*/ bytes_read) nothrow {
4804 return g_io_channel_read(&this, toCString!(char*)(buf), count, UpCast!(size_t*)(bytes_read));
4807 // Replacement for g_io_channel_read() with the new API.
4808 // RETURNS: the status of the operation.
4809 // <buf>: a buffer to read data into
4810 // <count>: the size of the buffer. Note that the buffer may not be complelely filled even if there is data in the buffer if the remaining data is not a complete character.
4811 // <bytes_read>: The number of bytes read. This may be zero even on success if count < 6 and the channel's encoding is non-%NULL. This indicates that the next UTF-8 character is too wide for the buffer.
4812 IOStatus read_chars(AT0, AT1, AT2)(AT0 /*char*/ buf, size_t count, AT1 /*size_t*/ bytes_read, AT2 /*GLib2.Error**/ error=null) nothrow {
4813 return g_io_channel_read_chars(&this, toCString!(char*)(buf), count, UpCast!(size_t*)(bytes_read), UpCast!(GLib2.Error**)(error));
4816 // Reads a line, including the terminating character(s),
4817 // from a #GIOChannel into a newly-allocated string.
4818 // @str_return will contain allocated memory if the return
4819 // is %G_IO_STATUS_NORMAL.
4820 // RETURNS: the status of the operation.
4821 // <str_return>: The line read from the #GIOChannel, including the line terminator. This data should be freed with g_free() when no longer needed. This is a nul-terminated string. If a @length of zero is returned, this will be %NULL instead.
4822 // <length>: location to store length of the read data, or %NULL
4823 // <terminator_pos>: location to store position of line terminator, or %NULL
4824 IOStatus read_line(AT0, AT1, AT2, AT3)(AT0 /*char**/ str_return, AT1 /*size_t*/ length, AT2 /*size_t*/ terminator_pos, AT3 /*GLib2.Error**/ error=null) nothrow {
4825 return g_io_channel_read_line(&this, toCString!(char**)(str_return), UpCast!(size_t*)(length), UpCast!(size_t*)(terminator_pos), UpCast!(GLib2.Error**)(error));
4828 // Reads a line from a #GIOChannel, using a #GString as a buffer.
4829 // RETURNS: the status of the operation.
4830 // <buffer>: a #GString into which the line will be written. If @buffer already contains data, the old data will be overwritten.
4831 // <terminator_pos>: location to store position of line terminator, or %NULL
4832 IOStatus read_line_string(AT0, AT1, AT2)(AT0 /*String*/ buffer, AT1 /*size_t*/ terminator_pos, AT2 /*GLib2.Error**/ error=null) nothrow {
4833 return g_io_channel_read_line_string(&this, UpCast!(String*)(buffer), UpCast!(size_t*)(terminator_pos), UpCast!(GLib2.Error**)(error));
4836 // Reads all the remaining data from the file.
4838 // This function never returns %G_IO_STATUS_EOF.
4839 // RETURNS: %G_IO_STATUS_NORMAL on success.
4840 // <str_return>: Location to store a pointer to a string holding the remaining data in the #GIOChannel. This data should be freed with g_free() when no longer needed. This data is terminated by an extra nul character, but there may be other nuls in the intervening data.
4841 // <length>: location to store length of the data
4842 IOStatus read_to_end(AT0, AT1, AT2)(AT0 /*char**/ str_return, AT1 /*size_t*/ length, AT2 /*GLib2.Error**/ error=null) nothrow {
4843 return g_io_channel_read_to_end(&this, toCString!(char**)(str_return), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
4846 // Reads a Unicode character from @channel.
4847 // This function cannot be called on a channel with %NULL encoding.
4848 // RETURNS: a #GIOStatus
4849 // <thechar>: a location to return a character
4850 IOStatus read_unichar(AT0, AT1)(AT0 /*dchar*/ thechar, AT1 /*GLib2.Error**/ error=null) nothrow {
4851 return g_io_channel_read_unichar(&this, UpCast!(dchar*)(thechar), UpCast!(GLib2.Error**)(error));
4854 // Increments the reference count of a #GIOChannel.
4855 // RETURNS: the @channel that was passed in (since 2.6)
4856 IOChannel* /*new*/ ref_()() nothrow {
4857 return g_io_channel_ref(&this);
4860 // Sets the current position in the #GIOChannel, similar to the standard
4861 // library function fseek().
4864 // Deprecated:2.2: Use g_io_channel_seek_position() instead.
4865 // RETURNS: %G_IO_ERROR_NONE if the operation was successful.
4866 // <offset>: an offset, in bytes, which is added to the position specified by @type
4867 // <type>: the position in the file, which can be %G_SEEK_CUR (the current position), %G_SEEK_SET (the start of the file), or %G_SEEK_END (the end of the file)
4868 IOError seek()(long offset, SeekType type) nothrow {
4869 return g_io_channel_seek(&this, offset, type);
4872 // Replacement for g_io_channel_seek() with the new API.
4873 // RETURNS: the status of the operation.
4874 // <offset>: The offset in bytes from the position specified by @type
4875 // <type>: a #GSeekType. The type %G_SEEK_CUR is only allowed in those cases where a call to g_io_channel_set_encoding () is allowed. See the documentation for g_io_channel_set_encoding () for details.
4876 IOStatus seek_position(AT0)(long offset, SeekType type, AT0 /*GLib2.Error**/ error=null) nothrow {
4877 return g_io_channel_seek_position(&this, offset, type, UpCast!(GLib2.Error**)(error));
4880 // Sets the buffer size.
4881 // <size>: the size of the buffer, or 0 to let GLib pick a good size
4882 void set_buffer_size()(size_t size) nothrow {
4883 g_io_channel_set_buffer_size(&this, size);
4886 // The buffering state can only be set if the channel's encoding
4887 // is %NULL. For any other encoding, the channel must be buffered.
4889 // A buffered channel can only be set unbuffered if the channel's
4890 // internal buffers have been flushed. Newly created channels or
4891 // channels which have returned %G_IO_STATUS_EOF
4892 // not require such a flush. For write-only channels, a call to
4893 // g_io_channel_flush () is sufficient. For all other channels,
4894 // the buffers may be flushed by a call to g_io_channel_seek_position ().
4895 // This includes the possibility of seeking with seek type %G_SEEK_CUR
4896 // and an offset of zero. Note that this means that socket-based
4897 // channels cannot be set unbuffered once they have had data
4898 // read from them.
4900 // On unbuffered channels, it is safe to mix read and write
4901 // calls from the new and old APIs, if this is necessary for
4902 // maintaining old code.
4904 // The default state of the channel is buffered.
4905 // <buffered>: whether to set the channel buffered or unbuffered
4906 void set_buffered()(int buffered) nothrow {
4907 g_io_channel_set_buffered(&this, buffered);
4910 // Setting this flag to %TRUE for a channel you have already closed
4911 // can cause problems.
4912 // <do_close>: Whether to close the channel on the final unref of the GIOChannel data structure. The default value of this is %TRUE for channels created by g_io_channel_new_file (), and %FALSE for all other channels.
4913 void set_close_on_unref()(int do_close) nothrow {
4914 g_io_channel_set_close_on_unref(&this, do_close);
4917 // Sets the encoding for the input/output of the channel.
4918 // The internal encoding is always UTF-8. The default encoding
4919 // for the external file is UTF-8.
4921 // The encoding %NULL is safe to use with binary data.
4923 // The encoding can only be set if one of the following conditions
4924 // is true:
4925 // <itemizedlist>
4926 // <listitem><para>
4927 // The channel was just created, and has not been written to or read
4928 // from yet.
4929 // </para></listitem>
4930 // <listitem><para>
4931 // The channel is write-only.
4932 // </para></listitem>
4933 // <listitem><para>
4934 // The channel is a file, and the file pointer was just
4935 // repositioned by a call to g_io_channel_seek_position().
4936 // (This flushes all the internal buffers.)
4937 // </para></listitem>
4938 // <listitem><para>
4939 // The current encoding is %NULL or UTF-8.
4940 // </para></listitem>
4941 // <listitem><para>
4942 // One of the (new API) read functions has just returned %G_IO_STATUS_EOF
4943 // (or, in the case of g_io_channel_read_to_end(), %G_IO_STATUS_NORMAL).
4944 // </para></listitem>
4945 // <listitem><para>
4946 // One of the functions g_io_channel_read_chars() or
4947 // g_io_channel_read_unichar() has returned %G_IO_STATUS_AGAIN or
4948 // %G_IO_STATUS_ERROR. This may be useful in the case of
4949 // %G_CONVERT_ERROR_ILLEGAL_SEQUENCE.
4950 // Returning one of these statuses from g_io_channel_read_line(),
4951 // g_io_channel_read_line_string(), or g_io_channel_read_to_end()
4952 // does <emphasis>not</emphasis> guarantee that the encoding can
4953 // be changed.
4954 // </para></listitem>
4955 // </itemizedlist>
4956 // Channels which do not meet one of the above conditions cannot call
4957 // g_io_channel_seek_position() with an offset of %G_SEEK_CUR, and, if
4958 // they are "seekable", cannot call g_io_channel_write_chars() after
4959 // calling one of the API "read" functions.
4960 // RETURNS: %G_IO_STATUS_NORMAL if the encoding was successfully set.
4961 // <encoding>: the encoding type
4962 IOStatus set_encoding(AT0, AT1)(AT0 /*char*/ encoding, AT1 /*GLib2.Error**/ error=null) nothrow {
4963 return g_io_channel_set_encoding(&this, toCString!(char*)(encoding), UpCast!(GLib2.Error**)(error));
4966 // Sets the (writeable) flags in @channel to (@flags & %G_IO_FLAG_SET_MASK).
4967 // RETURNS: the status of the operation.
4968 // <flags>: the flags to set on the IO channel
4969 IOStatus set_flags(AT0)(IOFlags flags, AT0 /*GLib2.Error**/ error=null) nothrow {
4970 return g_io_channel_set_flags(&this, flags, UpCast!(GLib2.Error**)(error));
4973 // This sets the string that #GIOChannel uses to determine
4974 // where in the file a line break occurs.
4975 // <line_term>: The line termination string. Use %NULL for autodetect. Autodetection breaks on "\n", "\r\n", "\r", "\0", and the Unicode paragraph separator. Autodetection should not be used for anything other than file-based channels.
4976 // <length>: The length of the termination string. If -1 is passed, the string is assumed to be nul-terminated. This option allows termination strings with embedded nuls.
4977 void set_line_term(AT0)(AT0 /*char*/ line_term, int length) nothrow {
4978 g_io_channel_set_line_term(&this, toCString!(char*)(line_term), length);
4981 // Close an IO channel. Any pending data to be written will be
4982 // flushed if @flush is %TRUE. The channel will not be freed until the
4983 // last reference is dropped using g_io_channel_unref().
4984 // RETURNS: the status of the operation.
4985 // <flush>: if %TRUE, flush pending
4986 IOStatus shutdown(AT0)(int flush, AT0 /*GLib2.Error**/ error=null) nothrow {
4987 return g_io_channel_shutdown(&this, flush, UpCast!(GLib2.Error**)(error));
4990 // Returns the file descriptor of the #GIOChannel.
4992 // On Windows this function returns the file descriptor or socket of
4993 // the #GIOChannel.
4994 int unix_get_fd()() nothrow {
4995 return g_io_channel_unix_get_fd(&this);
4997 // Decrements the reference count of a #GIOChannel.
4998 void unref()() nothrow {
4999 g_io_channel_unref(&this);
5002 // Writes data to a #GIOChannel.
5005 // Deprecated:2.2: Use g_io_channel_write_chars() instead.
5006 // RETURNS: %G_IO_ERROR_NONE if the operation was successful.
5007 // <buf>: the buffer containing the data to write
5008 // <count>: the number of bytes to write
5009 // <bytes_written>: the number of bytes actually written
5010 IOError write(AT0, AT1)(AT0 /*char*/ buf, size_t count, AT1 /*size_t*/ bytes_written) nothrow {
5011 return g_io_channel_write(&this, toCString!(char*)(buf), count, UpCast!(size_t*)(bytes_written));
5014 // Replacement for g_io_channel_write() with the new API.
5016 // On seekable channels with encodings other than %NULL or UTF-8, generic
5017 // mixing of reading and writing is not allowed. A call to g_io_channel_write_chars ()
5018 // may only be made on a channel from which data has been read in the
5019 // cases described in the documentation for g_io_channel_set_encoding ().
5020 // RETURNS: the status of the operation.
5021 // <buf>: a buffer to write data from
5022 // <count>: the size of the buffer. If -1, the buffer is taken to be a nul-terminated string.
5023 // <bytes_written>: The number of bytes written. This can be nonzero even if the return value is not %G_IO_STATUS_NORMAL. If the return value is %G_IO_STATUS_NORMAL and the channel is blocking, this will always be equal to @count if @count >= 0.
5024 IOStatus write_chars(AT0, AT1, AT2)(AT0 /*char*/ buf, ssize_t count, AT1 /*size_t*/ bytes_written, AT2 /*GLib2.Error**/ error=null) nothrow {
5025 return g_io_channel_write_chars(&this, toCString!(char*)(buf), count, UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
5028 // Writes a Unicode character to @channel.
5029 // This function cannot be called on a channel with %NULL encoding.
5030 // RETURNS: a #GIOStatus
5031 // <thechar>: a character
5032 IOStatus write_unichar(AT0)(dchar thechar, AT0 /*GLib2.Error**/ error=null) nothrow {
5033 return g_io_channel_write_unichar(&this, thechar, UpCast!(GLib2.Error**)(error));
5036 // Converts an <literal>errno</literal> error number to a #GIOChannelError.
5038 // %G_IO_CHANNEL_ERROR_INVAL.
5039 // RETURNS: a #GIOChannelError error number, e.g.
5040 // <en>: an <literal>errno</literal> error number, e.g. <literal>EINVAL</literal>
5041 static IOChannelError error_from_errno()(int en) nothrow {
5042 return g_io_channel_error_from_errno(en);
5044 // RETURNS: the quark used as %G_IO_CHANNEL_ERROR
5045 static Quark error_quark()() nothrow {
5046 return g_io_channel_error_quark();
5050 // Error codes returned by #GIOChannel operations.
5051 enum IOChannelError {
5052 FBIG = 0,
5053 INVAL = 1,
5054 IO = 2,
5055 ISDIR = 3,
5056 NOSPC = 4,
5057 NXIO = 5,
5058 OVERFLOW = 6,
5059 PIPE = 7,
5060 FAILED = 8
5063 // A bitwise combination representing a condition to watch for on an
5064 // event source.
5065 enum IOCondition {
5066 IN = 1,
5067 OUT = 4,
5068 PRI = 2,
5069 ERR = 8,
5070 HUP = 16,
5071 NVAL = 32
5074 // #GIOError is only used by the deprecated functions
5075 // g_io_channel_read(), g_io_channel_write(), and g_io_channel_seek().
5076 enum IOError {
5077 NONE = 0,
5078 AGAIN = 1,
5079 INVAL = 2,
5080 UNKNOWN = 3
5083 // Specifies properties of a #GIOChannel. Some of the flags can only be
5084 // read with g_io_channel_get_flags(), but not changed with
5085 // g_io_channel_set_flags().
5086 enum IOFlags {
5087 APPEND = 1,
5088 NONBLOCK = 2,
5089 IS_READABLE = 4,
5090 IS_WRITABLE = 8,
5091 IS_SEEKABLE = 16,
5092 MASK = 31,
5093 GET_MASK = 31,
5094 SET_MASK = 3
5097 // Specifies the type of function passed to g_io_add_watch() or
5098 // g_io_add_watch_full(), which is called when the requested condition
5099 // on a #GIOChannel is satisfied.
5100 // <source>: the #GIOChannel event source
5101 // <condition>: the condition which has been satisfied
5102 // <data>: user data set in g_io_add_watch() or g_io_add_watch_full()
5103 extern (C) alias int function (IOChannel* source, IOCondition condition, void* data) nothrow IOFunc;
5106 // A table of functions used to handle different types of #GIOChannel
5107 // in a generic way.
5108 struct IOFuncs {
5109 extern (C) IOStatus function (IOChannel* channel, char* buf, size_t count, size_t* bytes_read, GLib2.Error** error=null) nothrow io_read;
5110 extern (C) IOStatus function (IOChannel* channel, char* buf, size_t count, size_t* bytes_written, GLib2.Error** error=null) nothrow io_write;
5111 extern (C) IOStatus function (IOChannel* channel, long offset, SeekType type, GLib2.Error** error=null) nothrow io_seek;
5112 extern (C) IOStatus function (IOChannel* channel, GLib2.Error** error=null) nothrow io_close;
5113 extern (C) Source* /*new*/ function (IOChannel* channel, IOCondition condition) nothrow io_create_watch;
5114 extern (C) void function (IOChannel* channel) nothrow io_free;
5115 extern (C) IOStatus function (IOChannel* channel, IOFlags flags, GLib2.Error** error=null) nothrow io_set_flags;
5116 extern (C) IOFlags function (IOChannel* channel) nothrow io_get_flags;
5119 // Stati returned by most of the #GIOFuncs functions.
5120 enum IOStatus {
5121 ERROR = 0,
5122 NORMAL = 1,
5123 EOF = 2,
5124 AGAIN = 3
5126 enum KEY_FILE_DESKTOP_GROUP = "Desktop Entry";
5127 enum KEY_FILE_DESKTOP_KEY_CATEGORIES = "Categories";
5128 enum KEY_FILE_DESKTOP_KEY_COMMENT = "Comment";
5129 enum KEY_FILE_DESKTOP_KEY_EXEC = "Exec";
5130 enum KEY_FILE_DESKTOP_KEY_GENERIC_NAME = "GenericName";
5131 enum KEY_FILE_DESKTOP_KEY_HIDDEN = "Hidden";
5132 enum KEY_FILE_DESKTOP_KEY_ICON = "Icon";
5133 enum KEY_FILE_DESKTOP_KEY_MIME_TYPE = "MimeType";
5134 enum KEY_FILE_DESKTOP_KEY_NAME = "Name";
5135 enum KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN = "NotShowIn";
5136 enum KEY_FILE_DESKTOP_KEY_NO_DISPLAY = "NoDisplay";
5137 enum KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN = "OnlyShowIn";
5138 enum KEY_FILE_DESKTOP_KEY_PATH = "Path";
5139 enum KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY = "StartupNotify";
5140 enum KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS = "StartupWMClass";
5141 enum KEY_FILE_DESKTOP_KEY_TERMINAL = "Terminal";
5142 enum KEY_FILE_DESKTOP_KEY_TRY_EXEC = "TryExec";
5143 enum KEY_FILE_DESKTOP_KEY_TYPE = "Type";
5144 enum KEY_FILE_DESKTOP_KEY_URL = "URL";
5145 enum KEY_FILE_DESKTOP_KEY_VERSION = "Version";
5146 enum KEY_FILE_DESKTOP_TYPE_APPLICATION = "Application";
5147 enum KEY_FILE_DESKTOP_TYPE_DIRECTORY = "Directory";
5148 enum KEY_FILE_DESKTOP_TYPE_LINK = "Link";
5150 // The GKeyFile struct contains only private data
5151 // and should not be accessed directly.
5152 struct KeyFile {
5154 // VERSION: 2.6
5155 // Creates a new empty #GKeyFile object. Use
5156 // g_key_file_load_from_file(), g_key_file_load_from_data(),
5157 // g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to
5158 // read an existing key file.
5159 // RETURNS: an empty #GKeyFile.
5160 static KeyFile* /*new*/ new_()() nothrow {
5161 return g_key_file_new();
5163 static auto opCall()() {
5164 return g_key_file_new();
5167 // Unintrospectable method: free() / g_key_file_free()
5168 // VERSION: 2.6
5169 // Clears all keys and groups from @key_file, and decreases the
5170 // reference count by 1. If the reference count reaches zero,
5171 // frees the key file and all its allocated memory.
5172 void free()() nothrow {
5173 g_key_file_free(&this);
5176 // VERSION: 2.6
5177 // Returns the value associated with @key under @group_name as a
5178 // boolean.
5180 // If @key cannot be found then %FALSE is returned and @error is set
5181 // to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value
5182 // associated with @key cannot be interpreted as a boolean then %FALSE
5183 // is returned and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
5185 // or %FALSE if the key was not found or could not be parsed.
5186 // RETURNS: the value associated with the key as a boolean,
5187 // <group_name>: a group name
5188 // <key>: a key
5189 int get_boolean(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5190 return g_key_file_get_boolean(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5193 // VERSION: 2.6
5194 // Returns the values associated with @key under @group_name as
5195 // booleans.
5197 // If @key cannot be found then %NULL is returned and @error is set to
5198 // #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
5199 // with @key cannot be interpreted as booleans then %NULL is returned
5200 // and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
5202 // the values associated with the key as a list of booleans, or %NULL if the
5203 // key was not found or could not be parsed. The returned list of booleans
5204 // should be freed with g_free() when no longer needed.
5205 // <group_name>: a group name
5206 // <key>: a key
5207 // <length>: the number of booleans returned
5208 int* /*new container*/ get_boolean_list(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, /*out*/ AT2 /*size_t*/ length, AT3 /*GLib2.Error**/ error=null) nothrow {
5209 return g_key_file_get_boolean_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5212 // VERSION: 2.6
5213 // Retrieves a comment above @key from @group_name.
5214 // If @key is %NULL then @comment will be read from above
5215 // @group_name. If both @key and @group_name are %NULL, then
5216 // @comment will be read from above the first group in the file.
5217 // RETURNS: a comment that should be freed with g_free()
5218 // <group_name>: a group name, or %NULL
5219 // <key>: a key
5220 char* /*new*/ get_comment(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5221 return g_key_file_get_comment(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5224 // VERSION: 2.12
5225 // Returns the value associated with @key under @group_name as a
5226 // double. If @group_name is %NULL, the start_group is used.
5228 // If @key cannot be found then 0.0 is returned and @error is set to
5229 // #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
5230 // with @key cannot be interpreted as a double then 0.0 is returned
5231 // and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
5233 // 0.0 if the key was not found or could not be parsed.
5234 // RETURNS: the value associated with the key as a double, or
5235 // <group_name>: a group name
5236 // <key>: a key
5237 double get_double(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5238 return g_key_file_get_double(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5241 // VERSION: 2.12
5242 // Returns the values associated with @key under @group_name as
5243 // doubles.
5245 // If @key cannot be found then %NULL is returned and @error is set to
5246 // #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
5247 // with @key cannot be interpreted as doubles then %NULL is returned
5248 // and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
5250 // the values associated with the key as a list of doubles, or %NULL if the
5251 // key was not found or could not be parsed. The returned list of doubles
5252 // should be freed with g_free() when no longer needed.
5253 // <group_name>: a group name
5254 // <key>: a key
5255 // <length>: the number of doubles returned
5256 double* /*new container*/ get_double_list(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, /*out*/ AT2 /*size_t*/ length, AT3 /*GLib2.Error**/ error=null) nothrow {
5257 return g_key_file_get_double_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5260 // VERSION: 2.6
5261 // Returns all groups in the key file loaded with @key_file.
5262 // The array of returned groups will be %NULL-terminated, so
5263 // @length may optionally be %NULL.
5265 // Use g_strfreev() to free it.
5266 // RETURNS: a newly-allocated %NULL-terminated array of strings.
5267 // <length>: return location for the number of returned groups, or %NULL
5268 char** /*new*/ get_groups(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
5269 return g_key_file_get_groups(&this, UpCast!(size_t*)(length));
5272 // VERSION: 2.26
5273 // Returns the value associated with @key under @group_name as a signed
5274 // 64-bit integer. This is similar to g_key_file_get_integer() but can return
5275 // 64-bit results without truncation.
5277 // 0 if the key was not found or could not be parsed.
5278 // RETURNS: the value associated with the key as a signed 64-bit integer, or
5279 // <group_name>: a non-%NULL group name
5280 // <key>: a non-%NULL key
5281 long get_int64(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5282 return g_key_file_get_int64(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5285 // VERSION: 2.6
5286 // Returns the value associated with @key under @group_name as an
5287 // integer.
5289 // If @key cannot be found then 0 is returned and @error is set to
5290 // #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
5291 // with @key cannot be interpreted as an integer then 0 is returned
5292 // and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
5294 // 0 if the key was not found or could not be parsed.
5295 // RETURNS: the value associated with the key as an integer, or
5296 // <group_name>: a group name
5297 // <key>: a key
5298 int get_integer(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5299 return g_key_file_get_integer(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5302 // VERSION: 2.6
5303 // Returns the values associated with @key under @group_name as
5304 // integers.
5306 // If @key cannot be found then %NULL is returned and @error is set to
5307 // #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
5308 // with @key cannot be interpreted as integers then %NULL is returned
5309 // and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
5311 // the values associated with the key as a list of integers, or %NULL if
5312 // the key was not found or could not be parsed. The returned list of
5313 // integers should be freed with g_free() when no longer needed.
5314 // <group_name>: a group name
5315 // <key>: a key
5316 // <length>: the number of integers returned
5317 int* /*new container*/ get_integer_list(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, /*out*/ AT2 /*size_t*/ length, AT3 /*GLib2.Error**/ error=null) nothrow {
5318 return g_key_file_get_integer_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5321 // VERSION: 2.6
5322 // Returns all keys for the group name @group_name. The array of
5323 // returned keys will be %NULL-terminated, so @length may
5324 // optionally be %NULL. In the event that the @group_name cannot
5325 // be found, %NULL is returned and @error is set to
5326 // #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
5328 // Use g_strfreev() to free it.
5329 // RETURNS: a newly-allocated %NULL-terminated array of strings.
5330 // <group_name>: a group name
5331 // <length>: return location for the number of keys returned, or %NULL
5332 char** /*new*/ get_keys(AT0, AT1, AT2)(AT0 /*char*/ group_name, /*out*/ AT1 /*size_t*/ length, AT2 /*GLib2.Error**/ error=null) nothrow {
5333 return g_key_file_get_keys(&this, toCString!(char*)(group_name), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5336 // VERSION: 2.6
5337 // Returns the value associated with @key under @group_name
5338 // translated in the given @locale if available. If @locale is
5339 // %NULL then the current locale is assumed.
5341 // If @key cannot be found then %NULL is returned and @error is set
5342 // to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated
5343 // with @key cannot be interpreted or no suitable translation can
5344 // be found then the untranslated value is returned.
5346 // key cannot be found.
5347 // RETURNS: a newly allocated string or %NULL if the specified
5348 // <group_name>: a group name
5349 // <key>: a key
5350 // <locale>: a locale identifier or %NULL
5351 char* /*new*/ get_locale_string(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ locale, AT3 /*GLib2.Error**/ error=null) nothrow {
5352 return g_key_file_get_locale_string(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(locale), UpCast!(GLib2.Error**)(error));
5355 // VERSION: 2.6
5356 // Returns the values associated with @key under @group_name
5357 // translated in the given @locale if available. If @locale is
5358 // %NULL then the current locale is assumed.
5359 // If @key cannot be found then %NULL is returned and @error is set
5360 // to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated
5361 // with @key cannot be interpreted or no suitable translations
5362 // can be found then the untranslated values are returned. The
5363 // returned array is %NULL-terminated, so @length may optionally
5364 // be %NULL.
5366 // or %NULL if the key isn't found. The string array should be freed
5367 // with g_strfreev().
5368 // RETURNS: a newly allocated %NULL-terminated string array
5369 // <group_name>: a group name
5370 // <key>: a key
5371 // <locale>: a locale identifier or %NULL
5372 // <length>: return location for the number of returned strings or %NULL
5373 char** /*new*/ get_locale_string_list(AT0, AT1, AT2, AT3, AT4)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ locale, /*out*/ AT3 /*size_t*/ length, AT4 /*GLib2.Error**/ error=null) nothrow {
5374 return g_key_file_get_locale_string_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(locale), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5377 // VERSION: 2.6
5378 // Returns the name of the start group of the file.
5379 // RETURNS: The start group of the key file.
5380 char* /*new*/ get_start_group()() nothrow {
5381 return g_key_file_get_start_group(&this);
5384 // VERSION: 2.6
5385 // Returns the string value associated with @key under @group_name.
5386 // Unlike g_key_file_get_value(), this function handles escape sequences
5387 // like \s.
5389 // In the event the key cannot be found, %NULL is returned and
5390 // @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
5391 // event that the @group_name cannot be found, %NULL is returned
5392 // and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
5394 // key cannot be found.
5395 // RETURNS: a newly allocated string or %NULL if the specified
5396 // <group_name>: a group name
5397 // <key>: a key
5398 char* /*new*/ get_string(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5399 return g_key_file_get_string(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5402 // VERSION: 2.6
5403 // Returns the values associated with @key under @group_name.
5405 // In the event the key cannot be found, %NULL is returned and
5406 // @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
5407 // event that the @group_name cannot be found, %NULL is returned
5408 // and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
5410 // a %NULL-terminated string array or %NULL if the specified
5411 // key cannot be found. The array should be freed with g_strfreev().
5412 // <group_name>: a group name
5413 // <key>: a key
5414 // <length>: return location for the number of returned strings, or %NULL
5415 char** /*new*/ get_string_list(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, /*out*/ AT2 /*size_t*/ length, AT3 /*GLib2.Error**/ error=null) nothrow {
5416 return g_key_file_get_string_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5419 // VERSION: 2.26
5420 // Returns the value associated with @key under @group_name as an unsigned
5421 // 64-bit integer. This is similar to g_key_file_get_integer() but can return
5422 // large positive results without truncation.
5424 // or 0 if the key was not found or could not be parsed.
5425 // RETURNS: the value associated with the key as an unsigned 64-bit integer,
5426 // <group_name>: a non-%NULL group name
5427 // <key>: a non-%NULL key
5428 ulong get_uint64(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5429 return g_key_file_get_uint64(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5432 // VERSION: 2.6
5433 // Returns the raw value associated with @key under @group_name.
5434 // Use g_key_file_get_string() to retrieve an unescaped UTF-8 string.
5436 // In the event the key cannot be found, %NULL is returned and
5437 // @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
5438 // event that the @group_name cannot be found, %NULL is returned
5439 // and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
5442 // key cannot be found.
5443 // RETURNS: a newly allocated string or %NULL if the specified
5444 // <group_name>: a group name
5445 // <key>: a key
5446 char* /*new*/ get_value(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5447 return g_key_file_get_value(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5450 // VERSION: 2.6
5451 // Looks whether the key file has the group @group_name.
5453 // otherwise.
5454 // RETURNS: %TRUE if @group_name is a part of @key_file, %FALSE
5455 // <group_name>: a group name
5456 int has_group(AT0)(AT0 /*char*/ group_name) nothrow {
5457 return g_key_file_has_group(&this, toCString!(char*)(group_name));
5460 // Unintrospectable method: has_key() / g_key_file_has_key()
5461 // VERSION: 2.6
5462 // Looks whether the key file has the key @key in the group
5463 // @group_name.
5465 // <note>This function does not follow the rules for #GError strictly;
5466 // the return value both carries meaning and signals an error. To use
5467 // this function, you must pass a #GError pointer in @error, and check
5468 // whether it is not %NULL to see if an error occurred.</note>
5470 // Language bindings should use g_key_file_get_value() to test whether
5471 // or not a key exists.
5473 // otherwise.
5474 // RETURNS: %TRUE if @key is a part of @group_name, %FALSE
5475 // <group_name>: a group name
5476 // <key>: a key name
5477 int has_key(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5478 return g_key_file_has_key(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5481 // VERSION: 2.6
5482 // Loads a key file from memory into an empty #GKeyFile structure.
5483 // If the object cannot be created then %error is set to a #GKeyFileError.
5484 // RETURNS: %TRUE if a key file could be loaded, %FALSE otherwise
5485 // <data>: key file loaded in memory
5486 // <length>: the length of @data in bytes (or -1 if data is nul-terminated)
5487 // <flags>: flags from #GKeyFileFlags
5488 int load_from_data(AT0, AT1)(AT0 /*char*/ data, size_t length, KeyFileFlags flags, AT1 /*GLib2.Error**/ error=null) nothrow {
5489 return g_key_file_load_from_data(&this, toCString!(char*)(data), length, flags, UpCast!(GLib2.Error**)(error));
5492 // VERSION: 2.6
5493 // This function looks for a key file named @file in the paths
5494 // returned from g_get_user_data_dir() and g_get_system_data_dirs(),
5495 // loads the file into @key_file and returns the file's full path in
5496 // @full_path. If the file could not be loaded then an %error is
5497 // set to either a #GFileError or #GKeyFileError.
5498 // RETURNS: %TRUE if a key file could be loaded, %FALSE othewise
5499 // <file>: a relative path to a filename to open and parse
5500 // <full_path>: return location for a string containing the full path of the file, or %NULL
5501 // <flags>: flags from #GKeyFileFlags
5502 int load_from_data_dirs(AT0, AT1, AT2)(AT0 /*char*/ file, /*out*/ AT1 /*char**/ full_path, KeyFileFlags flags, AT2 /*GLib2.Error**/ error=null) nothrow {
5503 return g_key_file_load_from_data_dirs(&this, toCString!(char*)(file), toCString!(char**)(full_path), flags, UpCast!(GLib2.Error**)(error));
5506 // VERSION: 2.14
5507 // This function looks for a key file named @file in the paths
5508 // specified in @search_dirs, loads the file into @key_file and
5509 // returns the file's full path in @full_path. If the file could not
5510 // be loaded then an %error is set to either a #GFileError or
5511 // #GKeyFileError.
5512 // RETURNS: %TRUE if a key file could be loaded, %FALSE otherwise
5513 // <file>: a relative path to a filename to open and parse
5514 // <search_dirs>: %NULL-terminated array of directories to search
5515 // <full_path>: return location for a string containing the full path of the file, or %NULL
5516 // <flags>: flags from #GKeyFileFlags
5517 int load_from_dirs(AT0, AT1, AT2, AT3)(AT0 /*char*/ file, AT1 /*char**/ search_dirs, /*out*/ AT2 /*char**/ full_path, KeyFileFlags flags, AT3 /*GLib2.Error**/ error=null) nothrow {
5518 return g_key_file_load_from_dirs(&this, toCString!(char*)(file), toCString!(char**)(search_dirs), toCString!(char**)(full_path), flags, UpCast!(GLib2.Error**)(error));
5521 // VERSION: 2.6
5522 // Loads a key file into an empty #GKeyFile structure.
5523 // If the file could not be loaded then @error is set to
5524 // either a #GFileError or #GKeyFileError.
5525 // RETURNS: %TRUE if a key file could be loaded, %FALSE otherwise
5526 // <file>: the path of a filename to load, in the GLib filename encoding
5527 // <flags>: flags from #GKeyFileFlags
5528 int load_from_file(AT0, AT1)(AT0 /*char*/ file, KeyFileFlags flags, AT1 /*GLib2.Error**/ error=null) nothrow {
5529 return g_key_file_load_from_file(&this, toCString!(char*)(file), flags, UpCast!(GLib2.Error**)(error));
5532 // Unintrospectable method: ref() / g_key_file_ref()
5533 // VERSION: 2.32
5534 // Increases the reference count of @key_file.
5535 // RETURNS: the same @key_file.
5536 KeyFile* /*new*/ ref_()() nothrow {
5537 return g_key_file_ref(&this);
5540 // VERSION: 2.6
5541 // Removes a comment above @key from @group_name.
5542 // If @key is %NULL then @comment will be removed above @group_name.
5543 // If both @key and @group_name are %NULL, then @comment will
5544 // be removed above the first group in the file.
5545 // RETURNS: %TRUE if the comment was removed, %FALSE otherwise
5546 // <group_name>: a group name, or %NULL
5547 // <key>: a key
5548 int remove_comment(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5549 return g_key_file_remove_comment(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5552 // VERSION: 2.6
5553 // Removes the specified group, @group_name,
5554 // from the key file.
5555 // RETURNS: %TRUE if the group was removed, %FALSE otherwise
5556 // <group_name>: a group name
5557 int remove_group(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*GLib2.Error**/ error=null) nothrow {
5558 return g_key_file_remove_group(&this, toCString!(char*)(group_name), UpCast!(GLib2.Error**)(error));
5561 // VERSION: 2.6
5562 // Removes @key in @group_name from the key file.
5563 // RETURNS: %TRUE if the key was removed, %FALSE otherwise
5564 // <group_name>: a group name
5565 // <key>: a key name to remove
5566 int remove_key(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*GLib2.Error**/ error=null) nothrow {
5567 return g_key_file_remove_key(&this, toCString!(char*)(group_name), toCString!(char*)(key), UpCast!(GLib2.Error**)(error));
5570 // VERSION: 2.6
5571 // Associates a new boolean value with @key under @group_name.
5572 // If @key cannot be found then it is created.
5573 // <group_name>: a group name
5574 // <key>: a key
5575 // <value>: %TRUE or %FALSE
5576 void set_boolean(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, int value) nothrow {
5577 g_key_file_set_boolean(&this, toCString!(char*)(group_name), toCString!(char*)(key), value);
5580 // VERSION: 2.6
5581 // Associates a list of boolean values with @key under @group_name.
5582 // If @key cannot be found then it is created.
5583 // If @group_name is %NULL, the start_group is used.
5584 // <group_name>: a group name
5585 // <key>: a key
5586 // <list>: an array of boolean values
5587 // <length>: length of @list
5588 void set_boolean_list(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, int list, size_t length) nothrow {
5589 g_key_file_set_boolean_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), list, length);
5592 // VERSION: 2.6
5593 // Places a comment above @key from @group_name.
5594 // If @key is %NULL then @comment will be written above @group_name.
5595 // If both @key and @group_name are %NULL, then @comment will be
5596 // written above the first group in the file.
5597 // RETURNS: %TRUE if the comment was written, %FALSE otherwise
5598 // <group_name>: a group name, or %NULL
5599 // <key>: a key
5600 // <comment>: a comment
5601 int set_comment(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ comment, AT3 /*GLib2.Error**/ error=null) nothrow {
5602 return g_key_file_set_comment(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(comment), UpCast!(GLib2.Error**)(error));
5605 // VERSION: 2.12
5606 // Associates a new double value with @key under @group_name.
5607 // If @key cannot be found then it is created.
5608 // <group_name>: a group name
5609 // <key>: a key
5610 // <value>: an double value
5611 void set_double(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, double value) nothrow {
5612 g_key_file_set_double(&this, toCString!(char*)(group_name), toCString!(char*)(key), value);
5615 // VERSION: 2.12
5616 // Associates a list of double values with @key under
5617 // @group_name. If @key cannot be found then it is created.
5618 // <group_name>: a group name
5619 // <key>: a key
5620 // <list>: an array of double values
5621 // <length>: number of double values in @list
5622 void set_double_list(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, double list, size_t length) nothrow {
5623 g_key_file_set_double_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), list, length);
5626 // VERSION: 2.26
5627 // Associates a new integer value with @key under @group_name.
5628 // If @key cannot be found then it is created.
5629 // <group_name>: a group name
5630 // <key>: a key
5631 // <value>: an integer value
5632 void set_int64(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, long value) nothrow {
5633 g_key_file_set_int64(&this, toCString!(char*)(group_name), toCString!(char*)(key), value);
5636 // VERSION: 2.6
5637 // Associates a new integer value with @key under @group_name.
5638 // If @key cannot be found then it is created.
5639 // <group_name>: a group name
5640 // <key>: a key
5641 // <value>: an integer value
5642 void set_integer(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, int value) nothrow {
5643 g_key_file_set_integer(&this, toCString!(char*)(group_name), toCString!(char*)(key), value);
5646 // VERSION: 2.6
5647 // Associates a list of integer values with @key under @group_name.
5648 // If @key cannot be found then it is created.
5649 // <group_name>: a group name
5650 // <key>: a key
5651 // <list>: an array of integer values
5652 // <length>: number of integer values in @list
5653 void set_integer_list(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, int list, size_t length) nothrow {
5654 g_key_file_set_integer_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), list, length);
5657 // VERSION: 2.6
5658 // Sets the character which is used to separate
5659 // values in lists. Typically ';' or ',' are used
5660 // as separators. The default list separator is ';'.
5661 // <separator>: the separator
5662 void set_list_separator()(char separator) nothrow {
5663 g_key_file_set_list_separator(&this, separator);
5666 // VERSION: 2.6
5667 // Associates a string value for @key and @locale under @group_name.
5668 // If the translation for @key cannot be found then it is created.
5669 // <group_name>: a group name
5670 // <key>: a key
5671 // <locale>: a locale identifier
5672 // <string>: a string
5673 void set_locale_string(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ locale, AT3 /*char*/ string_) nothrow {
5674 g_key_file_set_locale_string(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(locale), toCString!(char*)(string_));
5677 // VERSION: 2.6
5678 // Associates a list of string values for @key and @locale under
5679 // @group_name. If the translation for @key cannot be found then
5680 // it is created.
5681 // <group_name>: a group name
5682 // <key>: a key
5683 // <locale>: a locale identifier
5684 // <list>: a %NULL-terminated array of locale string values
5685 // <length>: the length of @list
5686 void set_locale_string_list(AT0, AT1, AT2, AT3)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ locale, AT3 /*char*/ list, size_t length) nothrow {
5687 g_key_file_set_locale_string_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(locale), toCString!(char*)(list), length);
5690 // VERSION: 2.6
5691 // Associates a new string value with @key under @group_name.
5692 // If @key cannot be found then it is created.
5693 // If @group_name cannot be found then it is created.
5694 // Unlike g_key_file_set_value(), this function handles characters
5695 // that need escaping, such as newlines.
5696 // <group_name>: a group name
5697 // <key>: a key
5698 // <string>: a string
5699 void set_string(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ string_) nothrow {
5700 g_key_file_set_string(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(string_));
5703 // VERSION: 2.6
5704 // Associates a list of string values for @key under @group_name.
5705 // If @key cannot be found then it is created.
5706 // If @group_name cannot be found then it is created.
5707 // <group_name>: a group name
5708 // <key>: a key
5709 // <list>: an array of string values
5710 // <length>: number of string values in @list
5711 void set_string_list(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ list, size_t length) nothrow {
5712 g_key_file_set_string_list(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(list), length);
5715 // VERSION: 2.26
5716 // Associates a new integer value with @key under @group_name.
5717 // If @key cannot be found then it is created.
5718 // <group_name>: a group name
5719 // <key>: a key
5720 // <value>: an integer value
5721 void set_uint64(AT0, AT1)(AT0 /*char*/ group_name, AT1 /*char*/ key, ulong value) nothrow {
5722 g_key_file_set_uint64(&this, toCString!(char*)(group_name), toCString!(char*)(key), value);
5725 // VERSION: 2.6
5726 // Associates a new value with @key under @group_name.
5728 // If @key cannot be found then it is created. If @group_name cannot
5729 // be found then it is created. To set an UTF-8 string which may contain
5730 // characters that need escaping (such as newlines or spaces), use
5731 // g_key_file_set_string().
5732 // <group_name>: a group name
5733 // <key>: a key
5734 // <value>: a string
5735 void set_value(AT0, AT1, AT2)(AT0 /*char*/ group_name, AT1 /*char*/ key, AT2 /*char*/ value) nothrow {
5736 g_key_file_set_value(&this, toCString!(char*)(group_name), toCString!(char*)(key), toCString!(char*)(value));
5739 // VERSION: 2.6
5740 // This function outputs @key_file as a string.
5742 // Note that this function never reports an error,
5743 // so it is safe to pass %NULL as @error.
5745 // the contents of the #GKeyFile
5746 // RETURNS: a newly allocated string holding
5747 // <length>: return location for the length of the returned string, or %NULL
5748 char* /*new*/ to_data(AT0, AT1)(/*out*/ AT0 /*size_t*/ length, AT1 /*GLib2.Error**/ error=null) nothrow {
5749 return g_key_file_to_data(&this, UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
5752 // VERSION: 2.32
5753 // Decreases the reference count of @key_file by 1. If the reference count
5754 // reaches zero, frees the key file and all its allocated memory.
5755 void unref()() nothrow {
5756 g_key_file_unref(&this);
5758 static Quark error_quark()() nothrow {
5759 return g_key_file_error_quark();
5763 // Error codes returned by key file parsing.
5764 enum KeyFileError {
5765 UNKNOWN_ENCODING = 0,
5766 PARSE = 1,
5767 NOT_FOUND = 2,
5768 KEY_NOT_FOUND = 3,
5769 GROUP_NOT_FOUND = 4,
5770 INVALID_VALUE = 5
5772 // Flags which influence the parsing.
5773 enum KeyFileFlags {
5774 NONE = 0,
5775 KEEP_COMMENTS = 1,
5776 KEEP_TRANSLATIONS = 2
5778 enum int LITTLE_ENDIAN = 1234;
5779 enum double LN10 = 2.302585;
5780 enum double LN2 = 0.693147;
5781 enum double LOG_2_BASE_10 = 0.301030;
5782 enum int LOG_FATAL_MASK = 0;
5783 enum int LOG_LEVEL_USER_SHIFT = 8;
5784 // The #GList struct is used for each element in a doubly-linked list.
5785 struct List {
5786 void* data;
5787 GLib2.List* next, prev;
5790 // Unintrospectable function: alloc() / g_list_alloc()
5791 // Allocates space for one #GList element. It is called by
5792 // g_list_append(), g_list_prepend(), g_list_insert() and
5793 // g_list_insert_sorted() and so is rarely used on its own.
5794 static GLib2.List* alloc()() nothrow {
5795 return g_list_alloc();
5798 // Unintrospectable function: append() / g_list_append()
5799 // Adds a new element on to the end of the list.
5801 // <note><para>
5802 // The return value is the new start of the list, which
5803 // may have changed, so make sure you store the new value.
5804 // </para></note>
5806 // <note><para>
5807 // Note that g_list_append() has to traverse the entire list
5808 // to find the end, which is inefficient when adding multiple
5809 // elements. A common idiom to avoid the inefficiency is to prepend
5810 // the elements and reverse the list when all elements have been added.
5811 // </para></note>
5813 // |[
5814 // /&ast; Notice that these are initialized to the empty list. &ast;/
5815 // GList *list = NULL, *number_list = NULL;
5817 // /&ast; This is a list of strings. &ast;/
5818 // list = g_list_append (list, "first");
5819 // list = g_list_append (list, "second");
5821 // /&ast; This is a list of integers. &ast;/
5822 // number_list = g_list_append (number_list, GINT_TO_POINTER (27));
5823 // number_list = g_list_append (number_list, GINT_TO_POINTER (14));
5824 // ]|
5825 // RETURNS: the new start of the #GList
5826 // <list>: a pointer to a #GList
5827 // <data>: the data for the new element
5828 static GLib2.List* append(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*void*/ data) nothrow {
5829 return g_list_append(UpCast!(GLib2.List*)(list), UpCast!(void*)(data));
5832 // Unintrospectable function: concat() / g_list_concat()
5833 // Adds the second #GList onto the end of the first #GList.
5834 // Note that the elements of the second #GList are not copied.
5835 // They are used directly.
5836 // RETURNS: the start of the new #GList
5837 // <list1>: a #GList
5838 // <list2>: the #GList to add to the end of the first #GList
5839 static GLib2.List* concat(AT0, AT1)(AT0 /*GLib2.List*/ list1, AT1 /*GLib2.List*/ list2) nothrow {
5840 return g_list_concat(UpCast!(GLib2.List*)(list1), UpCast!(GLib2.List*)(list2));
5843 // Unintrospectable function: copy() / g_list_copy()
5844 // Copies a #GList.
5846 // <note><para>
5847 // Note that this is a "shallow" copy. If the list elements
5848 // consist of pointers to data, the pointers are copied but
5849 // the actual data is not.
5850 // </para></note>
5851 // RETURNS: a copy of @list
5852 // <list>: a #GList
5853 static GLib2.List* copy(AT0)(AT0 /*GLib2.List*/ list) nothrow {
5854 return g_list_copy(UpCast!(GLib2.List*)(list));
5857 // Unintrospectable function: delete_link() / g_list_delete_link()
5858 // Removes the node link_ from the list and frees it.
5859 // Compare this to g_list_remove_link() which removes the node
5860 // without freeing it.
5861 // RETURNS: the new head of @list
5862 // <list>: a #GList
5863 // <link_>: node to delete from @list
5864 static GLib2.List* delete_link(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*GLib2.List*/ link_) nothrow {
5865 return g_list_delete_link(UpCast!(GLib2.List*)(list), UpCast!(GLib2.List*)(link_));
5868 // Unintrospectable function: find() / g_list_find()
5869 // Finds the element in a #GList which
5870 // contains the given data.
5872 // or %NULL if it is not found
5873 // RETURNS: the found #GList element,
5874 // <list>: a #GList
5875 // <data>: the element data to find
5876 static GLib2.List* find(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*const(void)*/ data) nothrow {
5877 return g_list_find(UpCast!(GLib2.List*)(list), UpCast!(const(void)*)(data));
5880 // Unintrospectable function: find_custom() / g_list_find_custom()
5881 // Finds an element in a #GList, using a supplied function to
5882 // find the desired element. It iterates over the list, calling
5883 // the given function which should return 0 when the desired
5884 // element is found. The function takes two #gconstpointer arguments,
5885 // the #GList element's data as the first argument and the
5886 // given user data.
5887 // RETURNS: the found #GList element, or %NULL if it is not found
5888 // <list>: a #GList
5889 // <data>: user data passed to the function
5890 // <func>: the function to call for each element. It should return 0 when the desired element is found
5891 static GLib2.List* find_custom(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*const(void)*/ data, CompareFunc func) nothrow {
5892 return g_list_find_custom(UpCast!(GLib2.List*)(list), UpCast!(const(void)*)(data), func);
5895 // Unintrospectable function: first() / g_list_first()
5896 // Gets the first element in a #GList.
5898 // or %NULL if the #GList has no elements
5899 // RETURNS: the first element in the #GList,
5900 // <list>: a #GList
5901 static GLib2.List* first(AT0)(AT0 /*GLib2.List*/ list) nothrow {
5902 return g_list_first(UpCast!(GLib2.List*)(list));
5905 // Unintrospectable function: foreach() / g_list_foreach()
5906 // Calls a function for each element of a #GList.
5907 // <list>: a #GList
5908 // <func>: the function to call with each element's data
5909 // <user_data>: user data to pass to the function
5910 static void foreach_(AT0, AT1)(AT0 /*GLib2.List*/ list, Func func, AT1 /*void*/ user_data) nothrow {
5911 g_list_foreach(UpCast!(GLib2.List*)(list), func, UpCast!(void*)(user_data));
5914 // Unintrospectable function: free() / g_list_free()
5915 // Frees all of the memory used by a #GList.
5916 // The freed elements are returned to the slice allocator.
5918 // <note><para>
5919 // If list elements contain dynamically-allocated memory,
5920 // you should either use g_list_free_full() or free them manually
5921 // first.
5922 // </para></note>
5923 // <list>: a #GList
5924 static void free(AT0)(AT0 /*GLib2.List*/ list) nothrow {
5925 g_list_free(UpCast!(GLib2.List*)(list));
5928 // Unintrospectable function: free_1() / g_list_free_1()
5929 // Frees one #GList element.
5930 // It is usually used after g_list_remove_link().
5931 // <list>: a #GList element
5932 static void free_1(AT0)(AT0 /*GLib2.List*/ list) nothrow {
5933 g_list_free_1(UpCast!(GLib2.List*)(list));
5936 // Unintrospectable function: free_full() / g_list_free_full()
5937 // VERSION: 2.28
5938 // Convenience method, which frees all the memory used by a #GList, and
5939 // calls the specified destroy function on every element's data.
5940 // <list>: a pointer to a #GList
5941 // <free_func>: the function to be called to free each element's data
5942 static void free_full(AT0)(AT0 /*GLib2.List*/ list, DestroyNotify free_func) nothrow {
5943 g_list_free_full(UpCast!(GLib2.List*)(list), free_func);
5946 // Unintrospectable function: index() / g_list_index()
5947 // Gets the position of the element containing
5948 // the given data (starting from 0).
5950 // or -1 if the data is not found
5951 // RETURNS: the index of the element containing the data,
5952 // <list>: a #GList
5953 // <data>: the data to find
5954 static int index(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*const(void)*/ data) nothrow {
5955 return g_list_index(UpCast!(GLib2.List*)(list), UpCast!(const(void)*)(data));
5958 // Unintrospectable function: insert() / g_list_insert()
5959 // Inserts a new element into the list at the given position.
5960 // RETURNS: the new start of the #GList
5961 // <list>: a pointer to a #GList
5962 // <data>: the data for the new element
5963 // <position>: the position to insert the element. If this is negative, or is larger than the number of elements in the list, the new element is added on to the end of the list.
5964 static GLib2.List* insert(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*void*/ data, int position) nothrow {
5965 return g_list_insert(UpCast!(GLib2.List*)(list), UpCast!(void*)(data), position);
5968 // Unintrospectable function: insert_before() / g_list_insert_before()
5969 // Inserts a new element into the list before the given position.
5970 // RETURNS: the new start of the #GList
5971 // <list>: a pointer to a #GList
5972 // <sibling>: the list element before which the new element is inserted or %NULL to insert at the end of the list
5973 // <data>: the data for the new element
5974 static GLib2.List* insert_before(AT0, AT1, AT2)(AT0 /*GLib2.List*/ list, AT1 /*GLib2.List*/ sibling, AT2 /*void*/ data) nothrow {
5975 return g_list_insert_before(UpCast!(GLib2.List*)(list), UpCast!(GLib2.List*)(sibling), UpCast!(void*)(data));
5978 // Unintrospectable function: insert_sorted() / g_list_insert_sorted()
5979 // Inserts a new element into the list, using the given comparison
5980 // function to determine its position.
5981 // RETURNS: the new start of the #GList
5982 // <list>: a pointer to a #GList
5983 // <data>: the data for the new element
5984 // <func>: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
5985 static GLib2.List* insert_sorted(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*void*/ data, CompareFunc func) nothrow {
5986 return g_list_insert_sorted(UpCast!(GLib2.List*)(list), UpCast!(void*)(data), func);
5989 // Unintrospectable function: insert_sorted_with_data() / g_list_insert_sorted_with_data()
5990 // VERSION: 2.10
5991 // Inserts a new element into the list, using the given comparison
5992 // function to determine its position.
5993 // RETURNS: the new start of the #GList
5994 // <list>: a pointer to a #GList
5995 // <data>: the data for the new element
5996 // <func>: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
5997 // <user_data>: user data to pass to comparison function.
5998 static GLib2.List* insert_sorted_with_data(AT0, AT1, AT2)(AT0 /*GLib2.List*/ list, AT1 /*void*/ data, CompareDataFunc func, AT2 /*void*/ user_data) nothrow {
5999 return g_list_insert_sorted_with_data(UpCast!(GLib2.List*)(list), UpCast!(void*)(data), func, UpCast!(void*)(user_data));
6002 // Unintrospectable function: last() / g_list_last()
6003 // Gets the last element in a #GList.
6005 // or %NULL if the #GList has no elements
6006 // RETURNS: the last element in the #GList,
6007 // <list>: a #GList
6008 static GLib2.List* last(AT0)(AT0 /*GLib2.List*/ list) nothrow {
6009 return g_list_last(UpCast!(GLib2.List*)(list));
6012 // Unintrospectable function: length() / g_list_length()
6013 // Gets the number of elements in a #GList.
6015 // <note><para>
6016 // This function iterates over the whole list to
6017 // count its elements.
6018 // </para></note>
6019 // RETURNS: the number of elements in the #GList
6020 // <list>: a #GList
6021 static uint length(AT0)(AT0 /*GLib2.List*/ list) nothrow {
6022 return g_list_length(UpCast!(GLib2.List*)(list));
6025 // Unintrospectable function: nth() / g_list_nth()
6026 // Gets the element at the given position in a #GList.
6028 // the end of the #GList
6029 // RETURNS: the element, or %NULL if the position is off
6030 // <list>: a #GList
6031 // <n>: the position of the element, counting from 0
6032 static GLib2.List* nth(AT0)(AT0 /*GLib2.List*/ list, uint n) nothrow {
6033 return g_list_nth(UpCast!(GLib2.List*)(list), n);
6036 // Unintrospectable function: nth_data() / g_list_nth_data()
6037 // Gets the data of the element at the given position.
6039 // is off the end of the #GList
6040 // RETURNS: the element's data, or %NULL if the position
6041 // <list>: a #GList
6042 // <n>: the position of the element
6043 static void* nth_data(AT0)(AT0 /*GLib2.List*/ list, uint n) nothrow {
6044 return g_list_nth_data(UpCast!(GLib2.List*)(list), n);
6047 // Unintrospectable function: nth_prev() / g_list_nth_prev()
6048 // Gets the element @n places before @list.
6050 // off the end of the #GList
6051 // RETURNS: the element, or %NULL if the position is
6052 // <list>: a #GList
6053 // <n>: the position of the element, counting from 0
6054 static GLib2.List* nth_prev(AT0)(AT0 /*GLib2.List*/ list, uint n) nothrow {
6055 return g_list_nth_prev(UpCast!(GLib2.List*)(list), n);
6058 // Unintrospectable function: position() / g_list_position()
6059 // Gets the position of the given element
6060 // in the #GList (starting from 0).
6062 // or -1 if the element is not found
6063 // RETURNS: the position of the element in the #GList,
6064 // <list>: a #GList
6065 // <llink>: an element in the #GList
6066 static int position(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*GLib2.List*/ llink) nothrow {
6067 return g_list_position(UpCast!(GLib2.List*)(list), UpCast!(GLib2.List*)(llink));
6070 // Unintrospectable function: prepend() / g_list_prepend()
6071 // Adds a new element on to the start of the list.
6073 // <note><para>
6074 // The return value is the new start of the list, which
6075 // may have changed, so make sure you store the new value.
6076 // </para></note>
6078 // |[
6079 // /&ast; Notice that it is initialized to the empty list. &ast;/
6080 // GList *list = NULL;
6081 // list = g_list_prepend (list, "last");
6082 // list = g_list_prepend (list, "first");
6083 // ]|
6084 // RETURNS: the new start of the #GList
6085 // <list>: a pointer to a #GList
6086 // <data>: the data for the new element
6087 static GLib2.List* prepend(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*void*/ data) nothrow {
6088 return g_list_prepend(UpCast!(GLib2.List*)(list), UpCast!(void*)(data));
6091 // Unintrospectable function: remove() / g_list_remove()
6092 // Removes an element from a #GList.
6093 // If two elements contain the same data, only the first is removed.
6094 // If none of the elements contain the data, the #GList is unchanged.
6095 // RETURNS: the new start of the #GList
6096 // <list>: a #GList
6097 // <data>: the data of the element to remove
6098 static GLib2.List* remove(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*const(void)*/ data) nothrow {
6099 return g_list_remove(UpCast!(GLib2.List*)(list), UpCast!(const(void)*)(data));
6102 // Unintrospectable function: remove_all() / g_list_remove_all()
6103 // Removes all list nodes with data equal to @data.
6104 // Returns the new head of the list. Contrast with
6105 // g_list_remove() which removes only the first node
6106 // matching the given data.
6107 // RETURNS: new head of @list
6108 // <list>: a #GList
6109 // <data>: data to remove
6110 static GLib2.List* remove_all(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*const(void)*/ data) nothrow {
6111 return g_list_remove_all(UpCast!(GLib2.List*)(list), UpCast!(const(void)*)(data));
6114 // Unintrospectable function: remove_link() / g_list_remove_link()
6115 // Removes an element from a #GList, without freeing the element.
6116 // The removed element's prev and next links are set to %NULL, so
6117 // that it becomes a self-contained list with one element.
6118 // RETURNS: the new start of the #GList, without the element
6119 // <list>: a #GList
6120 // <llink>: an element in the #GList
6121 static GLib2.List* remove_link(AT0, AT1)(AT0 /*GLib2.List*/ list, AT1 /*GLib2.List*/ llink) nothrow {
6122 return g_list_remove_link(UpCast!(GLib2.List*)(list), UpCast!(GLib2.List*)(llink));
6125 // Unintrospectable function: reverse() / g_list_reverse()
6126 // Reverses a #GList.
6127 // It simply switches the next and prev pointers of each element.
6128 // RETURNS: the start of the reversed #GList
6129 // <list>: a #GList
6130 static GLib2.List* reverse(AT0)(AT0 /*GLib2.List*/ list) nothrow {
6131 return g_list_reverse(UpCast!(GLib2.List*)(list));
6134 // Unintrospectable function: sort() / g_list_sort()
6135 // Sorts a #GList using the given comparison function. The algorithm
6136 // used is a stable sort.
6137 // RETURNS: the start of the sorted #GList
6138 // <list>: a #GList
6139 // <compare_func>: the comparison function used to sort the #GList. This function is passed the data from 2 elements of the #GList and should return 0 if they are equal, a negative value if the first element comes before the second, or a positive value if the first element comes after the second.
6140 static GLib2.List* sort(AT0)(AT0 /*GLib2.List*/ list, CompareFunc compare_func) nothrow {
6141 return g_list_sort(UpCast!(GLib2.List*)(list), compare_func);
6144 // Unintrospectable function: sort_with_data() / g_list_sort_with_data()
6145 // Like g_list_sort(), but the comparison function accepts
6146 // a user data argument.
6147 // RETURNS: the new head of @list
6148 // <list>: a #GList
6149 // <compare_func>: comparison function
6150 // <user_data>: user data to pass to comparison function
6151 static GLib2.List* sort_with_data(AT0, AT1)(AT0 /*GLib2.List*/ list, CompareDataFunc compare_func, AT1 /*void*/ user_data) nothrow {
6152 return g_list_sort_with_data(UpCast!(GLib2.List*)(list), compare_func, UpCast!(void*)(user_data));
6157 // Specifies the prototype of log handler functions.
6158 // <log_domain>: the log domain of the message
6159 // <log_level>: the log level of the message (including the fatal and recursion flags)
6160 // <message>: the message to process
6161 // <user_data>: user data, set in g_log_set_handler()
6162 extern (C) alias void function (char* log_domain, LogLevelFlags log_level, char* message, void* user_data) nothrow LogFunc;
6165 // Flags specifying the level of log messages.
6167 // It is possible to change how GLib treats messages of the various
6168 // levels using g_log_set_handler() and g_log_set_fatal_mask().
6169 enum LogLevelFlags {
6170 FLAG_RECURSION = 1,
6171 FLAG_FATAL = 2,
6172 LEVEL_ERROR = 4,
6173 LEVEL_CRITICAL = 8,
6174 LEVEL_WARNING = 16,
6175 LEVEL_MESSAGE = 32,
6176 LEVEL_INFO = 64,
6177 LEVEL_DEBUG = 128,
6178 LEVEL_MASK = -4
6180 enum int MAJOR_VERSION = 2;
6181 enum int MICRO_VERSION = 0;
6182 enum int MINOR_VERSION = 32;
6183 enum MODULE_SUFFIX = "so";
6185 // The <structname>GMainContext</structname> struct is an opaque data
6186 // type representing a set of sources to be handled in a main loop.
6187 struct MainContext {
6189 // Creates a new #GMainContext structure.
6190 // RETURNS: the new #GMainContext
6191 static MainContext* /*new*/ new_()() nothrow {
6192 return g_main_context_new();
6194 static auto opCall()() {
6195 return g_main_context_new();
6198 // Tries to become the owner of the specified context.
6199 // If some other thread is the owner of the context,
6200 // returns %FALSE immediately. Ownership is properly
6201 // recursive: the owner can require ownership again
6202 // and will release ownership when g_main_context_release()
6203 // is called as many times as g_main_context_acquire().
6205 // You must be the owner of a context before you
6206 // can call g_main_context_prepare(), g_main_context_query(),
6207 // g_main_context_check(), g_main_context_dispatch().
6209 // this thread is now the owner of @context.
6210 // RETURNS: %TRUE if the operation succeeded, and
6211 int acquire()() nothrow {
6212 return g_main_context_acquire(&this);
6215 // Adds a file descriptor to the set of file descriptors polled for
6216 // this context. This will very seldom be used directly. Instead
6217 // a typical event source will use g_source_add_poll() instead.
6218 // <fd>: a #GPollFD structure holding information about a file descriptor to watch.
6219 // <priority>: the priority for this file descriptor which should be the same as the priority used for g_source_attach() to ensure that the file descriptor is polled whenever the results may be needed.
6220 void add_poll(AT0)(AT0 /*PollFD*/ fd, int priority) nothrow {
6221 g_main_context_add_poll(&this, UpCast!(PollFD*)(fd), priority);
6224 // Passes the results of polling back to the main loop.
6225 // RETURNS: %TRUE if some sources are ready to be dispatched.
6226 // <max_priority>: the maximum numerical priority of sources to check
6227 // <fds>: array of #GPollFD's that was passed to the last call to g_main_context_query()
6228 // <n_fds>: return value of g_main_context_query()
6229 int check(AT0)(int max_priority, AT0 /*PollFD*/ fds, int n_fds) nothrow {
6230 return g_main_context_check(&this, max_priority, UpCast!(PollFD*)(fds), n_fds);
6232 // Dispatches all pending sources.
6233 void dispatch()() nothrow {
6234 g_main_context_dispatch(&this);
6237 // Finds a source with the given source functions and user data. If
6238 // multiple sources exist with the same source function and user data,
6239 // the first one found will be returned.
6240 // RETURNS: the source, if one was found, otherwise %NULL
6241 // <funcs>: the @source_funcs passed to g_source_new().
6242 // <user_data>: the user data from the callback.
6243 Source* find_source_by_funcs_user_data(AT0, AT1)(AT0 /*SourceFuncs*/ funcs, AT1 /*void*/ user_data) nothrow {
6244 return g_main_context_find_source_by_funcs_user_data(&this, UpCast!(SourceFuncs*)(funcs), UpCast!(void*)(user_data));
6247 // Finds a #GSource given a pair of context and ID.
6248 // RETURNS: the #GSource if found, otherwise, %NULL
6249 // <source_id>: the source ID, as returned by g_source_get_id().
6250 Source* find_source_by_id()(uint source_id) nothrow {
6251 return g_main_context_find_source_by_id(&this, source_id);
6254 // Finds a source with the given user data for the callback. If
6255 // multiple sources exist with the same user data, the first
6256 // one found will be returned.
6257 // RETURNS: the source, if one was found, otherwise %NULL
6258 // <user_data>: the user_data for the callback.
6259 Source* find_source_by_user_data(AT0)(AT0 /*void*/ user_data) nothrow {
6260 return g_main_context_find_source_by_user_data(&this, UpCast!(void*)(user_data));
6263 // Unintrospectable method: get_poll_func() / g_main_context_get_poll_func()
6264 // Gets the poll function set by g_main_context_set_poll_func().
6265 // RETURNS: the poll function
6266 PollFunc get_poll_func()() nothrow {
6267 return g_main_context_get_poll_func(&this);
6270 // Unintrospectable method: invoke() / g_main_context_invoke()
6271 // VERSION: 2.28
6272 // Invokes a function in such a way that @context is owned during the
6273 // invocation of @function.
6275 // If @context is %NULL then the global default main context — as
6276 // returned by g_main_context_default() — is used.
6278 // If @context is owned by the current thread, @function is called
6279 // directly. Otherwise, if @context is the thread-default main context
6280 // of the current thread and g_main_context_acquire() succeeds, then
6281 // @function is called and g_main_context_release() is called
6282 // afterwards.
6284 // In any other case, an idle source is created to call @function and
6285 // that source is attached to @context (presumably to be run in another
6286 // thread). The idle source is attached with #G_PRIORITY_DEFAULT
6287 // priority. If you want a different priority, use
6288 // g_main_context_invoke_full().
6290 // Note that, as with normal idle functions, @function should probably
6291 // return %FALSE. If it returns %TRUE, it will be continuously run in a
6292 // loop (and may prevent this call from returning).
6293 // <function>: function to call
6294 // <data>: data to pass to @function
6295 void invoke(AT0)(SourceFunc function_, AT0 /*void*/ data) nothrow {
6296 g_main_context_invoke(&this, function_, UpCast!(void*)(data));
6299 // VERSION: 2.28
6300 // Invokes a function in such a way that @context is owned during the
6301 // invocation of @function.
6303 // This function is the same as g_main_context_invoke() except that it
6304 // lets you specify the priority incase @function ends up being
6305 // scheduled as an idle and also lets you give a #GDestroyNotify for @data.
6307 // @notify should not assume that it is called from any particular
6308 // thread or with any particular context acquired.
6309 // <priority>: the priority at which to run @function
6310 // <function>: function to call
6311 // <data>: data to pass to @function
6312 // <notify>: a function to call when @data is no longer in use, or %NULL.
6313 void invoke_full(AT0)(int priority, SourceFunc function_, AT0 /*void*/ data, DestroyNotify notify) nothrow {
6314 g_main_context_invoke_full(&this, priority, function_, UpCast!(void*)(data), notify);
6317 // VERSION: 2.10
6318 // Determines whether this thread holds the (recursive)
6319 // ownership of this #GMainContext. This is useful to
6320 // know before waiting on another thread that may be
6321 // blocking to get ownership of @context.
6322 // RETURNS: %TRUE if current thread is owner of @context.
6323 int is_owner()() nothrow {
6324 return g_main_context_is_owner(&this);
6327 // Runs a single iteration for the given main loop. This involves
6328 // checking to see if any event sources are ready to be processed,
6329 // then if no events sources are ready and @may_block is %TRUE, waiting
6330 // for a source to become ready, then dispatching the highest priority
6331 // events sources that are ready. Otherwise, if @may_block is %FALSE
6332 // sources are not waited to become ready, only those highest priority
6333 // events sources will be dispatched (if any), that are ready at this
6334 // given moment without further waiting.
6336 // Note that even when @may_block is %TRUE, it is still possible for
6337 // g_main_context_iteration() to return %FALSE, since the the wait may
6338 // be interrupted for other reasons than an event source becoming ready.
6339 // RETURNS: %TRUE if events were dispatched.
6340 // <may_block>: whether the call may block.
6341 int iteration()(int may_block) nothrow {
6342 return g_main_context_iteration(&this, may_block);
6345 // Checks if any sources have pending events for the given context.
6346 // RETURNS: %TRUE if events are pending.
6347 int pending()() nothrow {
6348 return g_main_context_pending(&this);
6351 // VERSION: 2.22
6352 // Pops @context off the thread-default context stack (verifying that
6353 // it was on the top of the stack).
6354 void pop_thread_default()() nothrow {
6355 g_main_context_pop_thread_default(&this);
6358 // Prepares to poll sources within a main loop. The resulting information
6359 // for polling is determined by calling g_main_context_query ().
6361 // prior to polling.
6362 // RETURNS: %TRUE if some source is ready to be dispatched
6363 // <priority>: location to store priority of highest priority source already ready.
6364 int prepare()(int* priority) nothrow {
6365 return g_main_context_prepare(&this, priority);
6368 // VERSION: 2.22
6369 // Acquires @context and sets it as the thread-default context for the
6370 // current thread. This will cause certain asynchronous operations
6371 // (such as most <link linkend="gio">gio</link>-based I/O) which are
6372 // started in this thread to run under @context and deliver their
6373 // results to its main loop, rather than running under the global
6374 // default context in the main thread. Note that calling this function
6375 // changes the context returned by
6376 // g_main_context_get_thread_default(), <emphasis>not</emphasis> the
6377 // one returned by g_main_context_default(), so it does not affect the
6378 // context used by functions like g_idle_add().
6380 // Normally you would call this function shortly after creating a new
6381 // thread, passing it a #GMainContext which will be run by a
6382 // #GMainLoop in that thread, to set a new default context for all
6383 // async operations in that thread. (In this case, you don't need to
6384 // ever call g_main_context_pop_thread_default().) In some cases
6385 // however, you may want to schedule a single operation in a
6386 // non-default context, or temporarily use a non-default context in
6387 // the main thread. In that case, you can wrap the call to the
6388 // asynchronous operation inside a
6389 // g_main_context_push_thread_default() /
6390 // g_main_context_pop_thread_default() pair, but it is up to you to
6391 // ensure that no other asynchronous operations accidentally get
6392 // started while the non-default context is active.
6394 // Beware that libraries that predate this function may not correctly
6395 // handle being used from a thread with a thread-default context. Eg,
6396 // see g_file_supports_thread_contexts().
6397 void push_thread_default()() nothrow {
6398 g_main_context_push_thread_default(&this);
6401 // Determines information necessary to poll this main loop.
6403 // or, if more than @n_fds records need to be stored, the number
6404 // of records that need to be stored.
6405 // RETURNS: the number of records actually stored in @fds,
6406 // <max_priority>: maximum priority source to check
6407 // <timeout_>: location to store timeout to be used in polling
6408 // <fds>: location to store #GPollFD records that need to be polled.
6409 // <n_fds>: length of @fds.
6410 int query(AT0)(int max_priority, /*out*/ int* timeout_, /*out*/ AT0 /*PollFD*/ fds, /*out*/ int n_fds) nothrow {
6411 return g_main_context_query(&this, max_priority, timeout_, UpCast!(PollFD*)(fds), n_fds);
6414 // Increases the reference count on a #GMainContext object by one.
6415 // RETURNS: the @context that was passed in (since 2.6)
6416 MainContext* /*new*/ ref_()() nothrow {
6417 return g_main_context_ref(&this);
6420 // Releases ownership of a context previously acquired by this thread
6421 // with g_main_context_acquire(). If the context was acquired multiple
6422 // times, the ownership will be released only when g_main_context_release()
6423 // is called as many times as it was acquired.
6424 void release()() nothrow {
6425 g_main_context_release(&this);
6428 // Removes file descriptor from the set of file descriptors to be
6429 // polled for a particular context.
6430 // <fd>: a #GPollFD descriptor previously added with g_main_context_add_poll()
6431 void remove_poll(AT0)(AT0 /*PollFD*/ fd) nothrow {
6432 g_main_context_remove_poll(&this, UpCast!(PollFD*)(fd));
6435 // Unintrospectable method: set_poll_func() / g_main_context_set_poll_func()
6436 // Sets the function to use to handle polling of file descriptors. It
6437 // will be used instead of the poll() system call
6438 // (or GLib's replacement function, which is used where
6439 // poll() isn't available).
6441 // This function could possibly be used to integrate the GLib event
6442 // loop with an external event loop.
6443 // <func>: the function to call to poll all file descriptors
6444 void set_poll_func()(PollFunc func) nothrow {
6445 g_main_context_set_poll_func(&this, func);
6448 // Decreases the reference count on a #GMainContext object by one. If
6449 // the result is zero, free the context and free all associated memory.
6450 void unref()() nothrow {
6451 g_main_context_unref(&this);
6454 // Tries to become the owner of the specified context,
6455 // as with g_main_context_acquire(). But if another thread
6456 // is the owner, atomically drop @mutex and wait on @cond until
6457 // that owner releases ownership or until @cond is signaled, then
6458 // try again (once) to become the owner.
6460 // this thread is now the owner of @context.
6461 // RETURNS: %TRUE if the operation succeeded, and
6462 // <cond>: a condition variable
6463 // <mutex>: a mutex, currently held
6464 int wait(AT0, AT1)(AT0 /*Cond*/ cond, AT1 /*Mutex*/ mutex) nothrow {
6465 return g_main_context_wait(&this, UpCast!(Cond*)(cond), UpCast!(Mutex*)(mutex));
6468 // If @context is currently waiting in a poll(), interrupt
6469 // the poll(), and continue the iteration process.
6470 void wakeup()() nothrow {
6471 g_main_context_wakeup(&this);
6474 // Returns the global default main context. This is the main context
6475 // used for main loop functions when a main loop is not explicitly
6476 // specified, and corresponds to the "main" main loop. See also
6477 // g_main_context_get_thread_default().
6478 // RETURNS: the global default main context.
6479 static MainContext* default_()() nothrow {
6480 return g_main_context_default();
6483 // VERSION: 2.22
6484 // Gets the thread-default #GMainContext for this thread. Asynchronous
6485 // operations that want to be able to be run in contexts other than
6486 // the default one should call this method or
6487 // g_main_context_ref_thread_default() to get a #GMainContext to add
6488 // their #GSource<!-- -->s to. (Note that even in single-threaded
6489 // programs applications may sometimes want to temporarily push a
6490 // non-default context, so it is not safe to assume that this will
6491 // always return %NULL if you are running in the default thread.)
6493 // If you need to hold a reference on the context, use
6494 // g_main_context_ref_thread_default() instead.
6496 // %NULL if the thread-default context is the global default context.
6497 // RETURNS: the thread-default #GMainContext, or
6498 static MainContext* get_thread_default()() nothrow {
6499 return g_main_context_get_thread_default();
6502 // VERSION: 2.32
6503 // Gets the thread-default #GMainContext for this thread, as with
6504 // g_main_context_get_thread_default(), but also adds a reference to
6505 // it with g_main_context_ref(). In addition, unlike
6506 // g_main_context_get_thread_default(), if the thread-default context
6507 // is the global default context, this will return that #GMainContext
6508 // (with a ref added to it) rather than returning %NULL.
6510 // with g_main_context_unref() when you are done with it.
6511 // RETURNS: the thread-default #GMainContext. Unref
6512 static MainContext* /*new*/ ref_thread_default()() nothrow {
6513 return g_main_context_ref_thread_default();
6518 // The <structname>GMainLoop</structname> struct is an opaque data type
6519 // representing the main event loop of a GLib or GTK+ application.
6520 struct MainLoop {
6522 // Creates a new #GMainLoop structure.
6523 // RETURNS: a new #GMainLoop.
6524 // <context>: a #GMainContext (if %NULL, the default context will be used).
6525 // <is_running>: set to %TRUE to indicate that the loop is running. This is not very important since calling g_main_loop_run() will set this to %TRUE anyway.
6526 static MainLoop* /*new*/ new_(AT0)(AT0 /*MainContext*/ context, int is_running) nothrow {
6527 return g_main_loop_new(UpCast!(MainContext*)(context), is_running);
6529 static auto opCall(AT0)(AT0 /*MainContext*/ context, int is_running) {
6530 return g_main_loop_new(UpCast!(MainContext*)(context), is_running);
6533 // Returns the #GMainContext of @loop.
6534 // RETURNS: the #GMainContext of @loop
6535 MainContext* get_context()() nothrow {
6536 return g_main_loop_get_context(&this);
6539 // Checks to see if the main loop is currently being run via g_main_loop_run().
6540 // RETURNS: %TRUE if the mainloop is currently being run.
6541 int is_running()() nothrow {
6542 return g_main_loop_is_running(&this);
6545 // Stops a #GMainLoop from running. Any calls to g_main_loop_run()
6546 // for the loop will return.
6548 // Note that sources that have already been dispatched when
6549 // g_main_loop_quit() is called will still be executed.
6550 void quit()() nothrow {
6551 g_main_loop_quit(&this);
6554 // Increases the reference count on a #GMainLoop object by one.
6555 // RETURNS: @loop
6556 MainLoop* /*new*/ ref_()() nothrow {
6557 return g_main_loop_ref(&this);
6560 // Runs a main loop until g_main_loop_quit() is called on the loop.
6561 // If this is called for the thread of the loop's #GMainContext,
6562 // it will process events from the loop, otherwise it will
6563 // simply wait.
6564 void run()() nothrow {
6565 g_main_loop_run(&this);
6568 // Decreases the reference count on a #GMainLoop object by one. If
6569 // the result is zero, free the loop and free all associated memory.
6570 void unref()() nothrow {
6571 g_main_loop_unref(&this);
6576 // The #GMappedFile represents a file mapping created with
6577 // g_mapped_file_new(). It has only private members and should
6578 // not be accessed directly.
6579 struct MappedFile {
6581 // VERSION: 2.8
6582 // This call existed before #GMappedFile had refcounting and is currently
6583 // exactly the same as g_mapped_file_unref().
6585 // Deprecated:2.22: Use g_mapped_file_unref() instead.
6586 void free()() nothrow {
6587 g_mapped_file_free(&this);
6590 // VERSION: 2.8
6591 // Returns the contents of a #GMappedFile.
6593 // Note that the contents may not be zero-terminated,
6594 // even if the #GMappedFile is backed by a text file.
6596 // If the file is empty then %NULL is returned.
6597 // RETURNS: the contents of @file, or %NULL.
6598 char* /*new*/ get_contents()() nothrow {
6599 return g_mapped_file_get_contents(&this);
6602 // VERSION: 2.8
6603 // Returns the length of the contents of a #GMappedFile.
6604 // RETURNS: the length of the contents of @file.
6605 size_t get_length()() nothrow {
6606 return g_mapped_file_get_length(&this);
6609 // Unintrospectable method: ref() / g_mapped_file_ref()
6610 // VERSION: 2.22
6611 // Increments the reference count of @file by one. It is safe to call
6612 // this function from any thread.
6613 // RETURNS: the passed in #GMappedFile.
6614 MappedFile* ref_()() nothrow {
6615 return g_mapped_file_ref(&this);
6618 // Decrements the reference count of @file by one. If the reference count
6619 // drops to 0, unmaps the buffer of @file and frees it.
6621 // It is safe to call this function from any thread.
6623 // Since 2.22
6624 void unref()() nothrow {
6625 g_mapped_file_unref(&this);
6628 // Unintrospectable function: new() / g_mapped_file_new()
6629 // VERSION: 2.8
6630 // Maps a file into memory. On UNIX, this is using the mmap() function.
6632 // If @writable is %TRUE, the mapped buffer may be modified, otherwise
6633 // it is an error to modify the mapped buffer. Modifications to the buffer
6634 // are not visible to other processes mapping the same file, and are not
6635 // written back to the file.
6637 // Note that modifications of the underlying file might affect the contents
6638 // of the #GMappedFile. Therefore, mapping should only be used if the file
6639 // will not be modified, or if all modifications of the file are done
6640 // atomically (e.g. using g_file_set_contents()).
6642 // If @filename is the name of an empty, regular file, the function
6643 // will successfully return an empty #GMappedFile. In other cases of
6644 // size 0 (e.g. device files such as /dev/null), @error will be set
6645 // to the #GFileError value #G_FILE_ERROR_INVAL.
6647 // with g_mapped_file_unref(), or %NULL if the mapping failed.
6648 // RETURNS: a newly allocated #GMappedFile which must be unref'd
6649 // <filename>: The path of the file to load, in the GLib filename encoding
6650 // <writable>: whether the mapping should be writable
6651 static MappedFile* new_(AT0, AT1)(AT0 /*char*/ filename, int writable, AT1 /*GLib2.Error**/ error=null) nothrow {
6652 return g_mapped_file_new(toCString!(char*)(filename), writable, UpCast!(GLib2.Error**)(error));
6655 // Unintrospectable function: new_from_fd() / g_mapped_file_new_from_fd()
6656 // VERSION: 2.32
6657 // Maps a file into memory. On UNIX, this is using the mmap() function.
6659 // If @writable is %TRUE, the mapped buffer may be modified, otherwise
6660 // it is an error to modify the mapped buffer. Modifications to the buffer
6661 // are not visible to other processes mapping the same file, and are not
6662 // written back to the file.
6664 // Note that modifications of the underlying file might affect the contents
6665 // of the #GMappedFile. Therefore, mapping should only be used if the file
6666 // will not be modified, or if all modifications of the file are done
6667 // atomically (e.g. using g_file_set_contents()).
6669 // with g_mapped_file_unref(), or %NULL if the mapping failed.
6670 // RETURNS: a newly allocated #GMappedFile which must be unref'd
6671 // <fd>: The file descriptor of the file to load
6672 // <writable>: whether the mapping should be writable
6673 static MappedFile* new_from_fd(AT0)(int fd, int writable, AT0 /*GLib2.Error**/ error=null) nothrow {
6674 return g_mapped_file_new_from_fd(fd, writable, UpCast!(GLib2.Error**)(error));
6679 // A mixed enumerated type and flags field. You must specify one type
6680 // (string, strdup, boolean, tristate). Additionally, you may optionally
6681 // bitwise OR the type with the flag %G_MARKUP_COLLECT_OPTIONAL.
6683 // It is likely that this enum will be extended in the future to
6684 // support other types.
6685 enum MarkupCollectType {
6686 INVALID = 0,
6687 STRING = 1,
6688 STRDUP = 2,
6689 BOOLEAN = 3,
6690 TRISTATE = 4,
6691 OPTIONAL = 65536
6693 // Error codes returned by markup parsing.
6694 enum MarkupError {
6695 BAD_UTF8 = 0,
6696 EMPTY = 1,
6697 PARSE = 2,
6698 UNKNOWN_ELEMENT = 3,
6699 UNKNOWN_ATTRIBUTE = 4,
6700 INVALID_CONTENT = 5,
6701 MISSING_ATTRIBUTE = 6
6704 // A parse context is used to parse a stream of bytes that
6705 // you expect to contain marked-up text.
6707 // See g_markup_parse_context_new(), #GMarkupParser, and so
6708 // on for more details.
6709 struct MarkupParseContext {
6711 // Signals to the #GMarkupParseContext that all data has been
6712 // fed into the parse context with g_markup_parse_context_parse().
6714 // This function reports an error if the document isn't complete,
6715 // for example if elements are still open.
6716 // RETURNS: %TRUE on success, %FALSE if an error was set
6717 int end_parse(AT0)(AT0 /*GLib2.Error**/ error=null) nothrow {
6718 return g_markup_parse_context_end_parse(&this, UpCast!(GLib2.Error**)(error));
6721 // Frees a #GMarkupParseContext.
6723 // This function can't be called from inside one of the
6724 // #GMarkupParser functions or while a subparser is pushed.
6725 void free()() nothrow {
6726 g_markup_parse_context_free(&this);
6729 // VERSION: 2.2
6730 // Retrieves the name of the currently open element.
6732 // If called from the start_element or end_element handlers this will
6733 // give the element_name as passed to those functions. For the parent
6734 // elements, see g_markup_parse_context_get_element_stack().
6735 // RETURNS: the name of the currently open element, or %NULL
6736 char* get_element()() nothrow {
6737 return g_markup_parse_context_get_element(&this);
6740 // Unintrospectable method: get_element_stack() / g_markup_parse_context_get_element_stack()
6741 // VERSION: 2.16
6742 // Retrieves the element stack from the internal state of the parser.
6744 // The returned #GSList is a list of strings where the first item is
6745 // the currently open tag (as would be returned by
6746 // g_markup_parse_context_get_element()) and the next item is its
6747 // immediate parent.
6749 // This function is intended to be used in the start_element and
6750 // end_element handlers where g_markup_parse_context_get_element()
6751 // would merely return the name of the element that is being
6752 // processed.
6753 // RETURNS: the element stack, which must not be modified
6754 GLib2.SList* get_element_stack()() nothrow {
6755 return g_markup_parse_context_get_element_stack(&this);
6758 // Retrieves the current line number and the number of the character on
6759 // that line. Intended for use in error messages; there are no strict
6760 // semantics for what constitutes the "current" line number other than
6761 // "the best number we could come up with for error messages."
6762 // <line_number>: return location for a line number, or %NULL
6763 // <char_number>: return location for a char-on-line number, or %NULL
6764 void get_position()(int* line_number=null, int* char_number=null) nothrow {
6765 g_markup_parse_context_get_position(&this, line_number, char_number);
6768 // Unintrospectable method: get_user_data() / g_markup_parse_context_get_user_data()
6769 // VERSION: 2.18
6770 // Returns the user_data associated with @context.
6772 // This will either be the user_data that was provided to
6773 // g_markup_parse_context_new() or to the most recent call
6774 // of g_markup_parse_context_push().
6776 // the markup context and will be freed when
6777 // g_markup_parse_context_free() is called.
6778 // RETURNS: the provided user_data. The returned data belongs to
6779 void* get_user_data()() nothrow {
6780 return g_markup_parse_context_get_user_data(&this);
6783 // Feed some data to the #GMarkupParseContext.
6785 // The data need not be valid UTF-8; an error will be signaled if
6786 // it's invalid. The data need not be an entire document; you can
6787 // feed a document into the parser incrementally, via multiple calls
6788 // to this function. Typically, as you receive data from a network
6789 // connection or file, you feed each received chunk of data into this
6790 // function, aborting the process if an error occurs. Once an error
6791 // is reported, no further data may be fed to the #GMarkupParseContext;
6792 // all errors are fatal.
6793 // RETURNS: %FALSE if an error occurred, %TRUE on success
6794 // <text>: chunk of text to parse
6795 // <text_len>: length of @text in bytes
6796 int parse(AT0, AT1)(AT0 /*char*/ text, ssize_t text_len, AT1 /*GLib2.Error**/ error=null) nothrow {
6797 return g_markup_parse_context_parse(&this, toCString!(char*)(text), text_len, UpCast!(GLib2.Error**)(error));
6800 // Unintrospectable method: pop() / g_markup_parse_context_pop()
6801 // VERSION: 2.18
6802 // Completes the process of a temporary sub-parser redirection.
6804 // This function exists to collect the user_data allocated by a
6805 // matching call to g_markup_parse_context_push(). It must be called
6806 // in the end_element handler corresponding to the start_element
6807 // handler during which g_markup_parse_context_push() was called.
6808 // You must not call this function from the error callback -- the
6809 // @user_data is provided directly to the callback in that case.
6811 // This function is not intended to be directly called by users
6812 // interested in invoking subparsers. Instead, it is intended to
6813 // be used by the subparsers themselves to implement a higher-level
6814 // interface.
6815 // RETURNS: the user data passed to g_markup_parse_context_push()
6816 void* pop()() nothrow {
6817 return g_markup_parse_context_pop(&this);
6820 // VERSION: 2.18
6821 // Temporarily redirects markup data to a sub-parser.
6823 // This function may only be called from the start_element handler of
6824 // a #GMarkupParser. It must be matched with a corresponding call to
6825 // g_markup_parse_context_pop() in the matching end_element handler
6826 // (except in the case that the parser aborts due to an error).
6828 // All tags, text and other data between the matching tags is
6829 // redirected to the subparser given by @parser. @user_data is used
6830 // as the user_data for that parser. @user_data is also passed to the
6831 // error callback in the event that an error occurs. This includes
6832 // errors that occur in subparsers of the subparser.
6834 // The end tag matching the start tag for which this call was made is
6835 // handled by the previous parser (which is given its own user_data)
6836 // which is why g_markup_parse_context_pop() is provided to allow "one
6837 // last access" to the @user_data provided to this function. In the
6838 // case of error, the @user_data provided here is passed directly to
6839 // the error callback of the subparser and g_markup_parse_context_pop()
6840 // should not be called. In either case, if @user_data was allocated
6841 // then it ought to be freed from both of these locations.
6843 // This function is not intended to be directly called by users
6844 // interested in invoking subparsers. Instead, it is intended to be
6845 // used by the subparsers themselves to implement a higher-level
6846 // interface.
6848 // As an example, see the following implementation of a simple
6849 // parser that counts the number of tags encountered.
6851 // |[
6852 // typedef struct
6853 // {
6854 // gint tag_count;
6855 // } CounterData;
6857 // static void
6858 // counter_start_element (GMarkupParseContext *context,
6859 // const gchar *element_name,
6860 // const gchar **attribute_names,
6861 // const gchar **attribute_values,
6862 // gpointer user_data,
6863 // GError **error)
6864 // {
6865 // CounterData *data = user_data;
6867 // data->tag_count++;
6868 // }
6870 // static void
6871 // counter_error (GMarkupParseContext *context,
6872 // GError *error,
6873 // gpointer user_data)
6874 // {
6875 // CounterData *data = user_data;
6877 // g_slice_free (CounterData, data);
6878 // }
6880 // static GMarkupParser counter_subparser =
6881 // {
6882 // counter_start_element,
6883 // NULL,
6884 // NULL,
6885 // NULL,
6886 // counter_error
6887 // };
6888 // ]|
6890 // In order to allow this parser to be easily used as a subparser, the
6891 // following interface is provided:
6893 // |[
6894 // void
6895 // start_counting (GMarkupParseContext *context)
6896 // {
6897 // CounterData *data = g_slice_new (CounterData);
6899 // data->tag_count = 0;
6900 // g_markup_parse_context_push (context, &counter_subparser, data);
6901 // }
6903 // gint
6904 // end_counting (GMarkupParseContext *context)
6905 // {
6906 // CounterData *data = g_markup_parse_context_pop (context);
6907 // int result;
6909 // result = data->tag_count;
6910 // g_slice_free (CounterData, data);
6912 // return result;
6913 // }
6914 // ]|
6916 // The subparser would then be used as follows:
6918 // |[
6919 // static void start_element (context, element_name, ...)
6920 // {
6921 // if (strcmp (element_name, "count-these") == 0)
6922 // start_counting (context);
6924 // /&ast; else, handle other tags... &ast;/
6925 // }
6927 // static void end_element (context, element_name, ...)
6928 // {
6929 // if (strcmp (element_name, "count-these") == 0)
6930 // g_print ("Counted %d tags\n", end_counting (context));
6932 // /&ast; else, handle other tags... &ast;/
6933 // }
6934 // ]|
6935 // <parser>: a #GMarkupParser
6936 // <user_data>: user data to pass to #GMarkupParser functions
6937 void push(AT0, AT1)(AT0 /*MarkupParser*/ parser, AT1 /*void*/ user_data) nothrow {
6938 g_markup_parse_context_push(&this, UpCast!(MarkupParser*)(parser), UpCast!(void*)(user_data));
6941 // Unintrospectable function: new() / g_markup_parse_context_new()
6942 // Creates a new parse context. A parse context is used to parse
6943 // marked-up documents. You can feed any number of documents into
6944 // a context, as long as no errors occur; once an error occurs,
6945 // the parse context can't continue to parse text (you have to
6946 // free it and create a new parse context).
6947 // RETURNS: a new #GMarkupParseContext
6948 // <parser>: a #GMarkupParser
6949 // <flags>: one or more #GMarkupParseFlags
6950 // <user_data>: user data to pass to #GMarkupParser functions
6951 // <user_data_dnotify>: user data destroy notifier called when the parse context is freed
6952 static MarkupParseContext* new_(AT0, AT1)(AT0 /*MarkupParser*/ parser, MarkupParseFlags flags, AT1 /*void*/ user_data, DestroyNotify user_data_dnotify) nothrow {
6953 return g_markup_parse_context_new(UpCast!(MarkupParser*)(parser), flags, UpCast!(void*)(user_data), user_data_dnotify);
6957 // Flags that affect the behaviour of the parser.
6958 enum MarkupParseFlags {
6959 DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1,
6960 TREAT_CDATA_AS_TEXT = 2,
6961 PREFIX_ERROR_POSITION = 4
6964 // Any of the fields in #GMarkupParser can be %NULL, in which case they
6965 // will be ignored. Except for the @error function, any of these callbacks
6966 // can set an error; in particular the %G_MARKUP_ERROR_UNKNOWN_ELEMENT,
6967 // %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and %G_MARKUP_ERROR_INVALID_CONTENT
6968 // errors are intended to be set from these callbacks. If you set an error
6969 // from a callback, g_markup_parse_context_parse() will report that error
6970 // back to its caller.
6971 struct MarkupParser {
6972 extern (C) void function (MarkupParseContext* context, char* element_name, char** attribute_names, char** attribute_values, void* user_data, GLib2.Error** error=null) nothrow start_element;
6973 extern (C) void function (MarkupParseContext* context, char* element_name, void* user_data, GLib2.Error** error=null) nothrow end_element;
6974 extern (C) void function (MarkupParseContext* context, char* text, size_t text_len, void* user_data, GLib2.Error** error=null) nothrow text;
6975 extern (C) void function (MarkupParseContext* context, char* passthrough_text, size_t text_len, void* user_data, GLib2.Error** error=null) nothrow passthrough;
6976 extern (C) void function (MarkupParseContext* context, Error* error, void* user_data) nothrow error;
6979 struct MatchInfo {
6981 // VERSION: 2.14
6982 // Returns a new string containing the text in @string_to_expand with
6983 // references and escape sequences expanded. References refer to the last
6984 // match done with @string against @regex and have the same syntax used by
6985 // g_regex_replace().
6987 // The @string_to_expand must be UTF-8 encoded even if #G_REGEX_RAW was
6988 // passed to g_regex_new().
6990 // The backreferences are extracted from the string passed to the match
6991 // function, so you cannot call this function after freeing the string.
6993 // @match_info may be %NULL in which case @string_to_expand must not
6994 // contain references. For instance "foo\n" does not refer to an actual
6995 // pattern and '\n' merely will be replaced with \n character,
6996 // while to expand "\0" (whole match) one needs the result of a match.
6997 // Use g_regex_check_replacement() to find out whether @string_to_expand
6998 // contains references.
6999 // RETURNS: the expanded string, or %NULL if an error occurred
7000 // <string_to_expand>: the string to expand
7001 char* /*new*/ expand_references(AT0, AT1)(AT0 /*char*/ string_to_expand, AT1 /*GLib2.Error**/ error=null) nothrow {
7002 return g_match_info_expand_references(&this, toCString!(char*)(string_to_expand), UpCast!(GLib2.Error**)(error));
7005 // VERSION: 2.14
7006 // Retrieves the text matching the @match_num<!-- -->'th capturing
7007 // parentheses. 0 is the full text of the match, 1 is the first paren
7008 // set, 2 the second, and so on.
7010 // If @match_num is a valid sub pattern but it didn't match anything
7011 // (e.g. sub pattern 1, matching "b" against "(a)?b") then an empty
7012 // string is returned.
7014 // If the match was obtained using the DFA algorithm, that is using
7015 // g_regex_match_all() or g_regex_match_all_full(), the retrieved
7016 // string is not that of a set of parentheses but that of a matched
7017 // substring. Substrings are matched in reverse order of length, so
7018 // 0 is the longest match.
7020 // The string is fetched from the string passed to the match function,
7021 // so you cannot call this function after freeing the string.
7023 // occurred. You have to free the string yourself
7024 // RETURNS: The matched substring, or %NULL if an error
7025 // <match_num>: number of the sub expression
7026 char* /*new*/ fetch()(int match_num) nothrow {
7027 return g_match_info_fetch(&this, match_num);
7030 // Unintrospectable method: fetch_all() / g_match_info_fetch_all()
7031 // VERSION: 2.14
7032 // Bundles up pointers to each of the matching substrings from a match
7033 // and stores them in an array of gchar pointers. The first element in
7034 // the returned array is the match number 0, i.e. the entire matched
7035 // text.
7037 // If a sub pattern didn't match anything (e.g. sub pattern 1, matching
7038 // "b" against "(a)?b") then an empty string is inserted.
7040 // If the last match was obtained using the DFA algorithm, that is using
7041 // g_regex_match_all() or g_regex_match_all_full(), the retrieved
7042 // strings are not that matched by sets of parentheses but that of the
7043 // matched substring. Substrings are matched in reverse order of length,
7044 // so the first one is the longest match.
7046 // The strings are fetched from the string passed to the match function,
7047 // so you cannot call this function after freeing the string.
7049 // It must be freed using g_strfreev(). If the previous match failed
7050 // %NULL is returned
7051 // RETURNS: a %NULL-terminated array of gchar * pointers.
7052 char** fetch_all()() nothrow {
7053 return g_match_info_fetch_all(&this);
7056 // VERSION: 2.14
7057 // Retrieves the text matching the capturing parentheses named @name.
7059 // If @name is a valid sub pattern name but it didn't match anything
7060 // (e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
7061 // then an empty string is returned.
7063 // The string is fetched from the string passed to the match function,
7064 // so you cannot call this function after freeing the string.
7066 // occurred. You have to free the string yourself
7067 // RETURNS: The matched substring, or %NULL if an error
7068 // <name>: name of the subexpression
7069 char* /*new*/ fetch_named(AT0)(AT0 /*char*/ name) nothrow {
7070 return g_match_info_fetch_named(&this, toCString!(char*)(name));
7073 // VERSION: 2.14
7074 // Retrieves the position in bytes of the capturing parentheses named @name.
7076 // If @name is a valid sub pattern name but it didn't match anything
7077 // (e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
7078 // then @start_pos and @end_pos are set to -1 and %TRUE is returned.
7080 // If the position cannot be fetched, @start_pos and @end_pos
7081 // are left unchanged.
7082 // RETURNS: %TRUE if the position was fetched, %FALSE otherwise.
7083 // <name>: name of the subexpression
7084 // <start_pos>: pointer to location where to store the start position, or %NULL
7085 // <end_pos>: pointer to location where to store the end position, or %NULL
7086 int fetch_named_pos(AT0)(AT0 /*char*/ name, /*out*/ int* start_pos=null, /*out*/ int* end_pos=null) nothrow {
7087 return g_match_info_fetch_named_pos(&this, toCString!(char*)(name), start_pos, end_pos);
7090 // VERSION: 2.14
7091 // Retrieves the position in bytes of the @match_num<!-- -->'th capturing
7092 // parentheses. 0 is the full text of the match, 1 is the first
7093 // paren set, 2 the second, and so on.
7095 // If @match_num is a valid sub pattern but it didn't match anything
7096 // (e.g. sub pattern 1, matching "b" against "(a)?b") then @start_pos
7097 // and @end_pos are set to -1 and %TRUE is returned.
7099 // If the match was obtained using the DFA algorithm, that is using
7100 // g_regex_match_all() or g_regex_match_all_full(), the retrieved
7101 // position is not that of a set of parentheses but that of a matched
7102 // substring. Substrings are matched in reverse order of length, so
7103 // 0 is the longest match.
7105 // the position cannot be fetched, @start_pos and @end_pos are left
7106 // unchanged
7107 // RETURNS: %TRUE if the position was fetched, %FALSE otherwise. If
7108 // <match_num>: number of the sub expression
7109 // <start_pos>: pointer to location where to store the start position, or %NULL
7110 // <end_pos>: pointer to location where to store the end position, or %NULL
7111 int fetch_pos()(int match_num, /*out*/ int* start_pos=null, /*out*/ int* end_pos=null) nothrow {
7112 return g_match_info_fetch_pos(&this, match_num, start_pos, end_pos);
7115 // VERSION: 2.14
7116 // If @match_info is not %NULL, calls g_match_info_unref(); otherwise does
7117 // nothing.
7118 void free()() nothrow {
7119 g_match_info_free(&this);
7122 // VERSION: 2.14
7123 // Retrieves the number of matched substrings (including substring 0,
7124 // that is the whole matched text), so 1 is returned if the pattern
7125 // has no substrings in it and 0 is returned if the match failed.
7127 // If the last match was obtained using the DFA algorithm, that is
7128 // using g_regex_match_all() or g_regex_match_all_full(), the retrieved
7129 // count is not that of the number of capturing parentheses but that of
7130 // the number of matched substrings.
7131 // RETURNS: Number of matched substrings, or -1 if an error occurred
7132 int get_match_count()() nothrow {
7133 return g_match_info_get_match_count(&this);
7136 // VERSION: 2.14
7137 // Returns #GRegex object used in @match_info. It belongs to Glib
7138 // and must not be freed. Use g_regex_ref() if you need to keep it
7139 // after you free @match_info object.
7140 // RETURNS: #GRegex object used in @match_info
7141 Regex* /*new*/ get_regex()() nothrow {
7142 return g_match_info_get_regex(&this);
7145 // VERSION: 2.14
7146 // Returns the string searched with @match_info. This is the
7147 // string passed to g_regex_match() or g_regex_replace() so
7148 // you may not free it before calling this function.
7149 // RETURNS: the string searched with @match_info
7150 char* get_string()() nothrow {
7151 return g_match_info_get_string(&this);
7154 // VERSION: 2.14
7155 // Usually if the string passed to g_regex_match*() matches as far as
7156 // it goes, but is too short to match the entire pattern, %FALSE is
7157 // returned. There are circumstances where it might be helpful to
7158 // distinguish this case from other cases in which there is no match.
7160 // Consider, for example, an application where a human is required to
7161 // type in data for a field with specific formatting requirements. An
7162 // example might be a date in the form ddmmmyy, defined by the pattern
7163 // "^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$".
7164 // If the application sees the user’s keystrokes one by one, and can
7165 // check that what has been typed so far is potentially valid, it is
7166 // able to raise an error as soon as a mistake is made.
7168 // GRegex supports the concept of partial matching by means of the
7169 // #G_REGEX_MATCH_PARTIAL flag. When this is set the return code for
7170 // g_regex_match() or g_regex_match_full() is, as usual, %TRUE
7171 // for a complete match, %FALSE otherwise. But, when these functions
7172 // return %FALSE, you can check if the match was partial calling
7173 // g_match_info_is_partial_match().
7175 // When using partial matching you cannot use g_match_info_fetch*().
7177 // Because of the way certain internal optimizations are implemented
7178 // the partial matching algorithm cannot be used with all patterns.
7179 // So repeated single characters such as "a{2,4}" and repeated single
7180 // meta-sequences such as "\d+" are not permitted if the maximum number
7181 // of occurrences is greater than one. Optional items such as "\d?"
7182 // (where the maximum is one) are permitted. Quantifiers with any values
7183 // are permitted after parentheses, so the invalid examples above can be
7184 // coded thus "(a){2,4}" and "(\d)+". If #G_REGEX_MATCH_PARTIAL is set
7185 // for a pattern that does not conform to the restrictions, matching
7186 // functions return an error.
7187 // RETURNS: %TRUE if the match was partial, %FALSE otherwise
7188 int is_partial_match()() nothrow {
7189 return g_match_info_is_partial_match(&this);
7192 // VERSION: 2.14
7193 // Returns whether the previous match operation succeeded.
7195 // %FALSE otherwise
7196 // RETURNS: %TRUE if the previous match operation succeeded,
7197 int matches()() nothrow {
7198 return g_match_info_matches(&this);
7201 // VERSION: 2.14
7202 // Scans for the next match using the same parameters of the previous
7203 // call to g_regex_match_full() or g_regex_match() that returned
7204 // @match_info.
7206 // The match is done on the string passed to the match function, so you
7207 // cannot free it before calling this function.
7208 // RETURNS: %TRUE is the string matched, %FALSE otherwise
7209 int next(AT0)(AT0 /*GLib2.Error**/ error=null) nothrow {
7210 return g_match_info_next(&this, UpCast!(GLib2.Error**)(error));
7213 // VERSION: 2.30
7214 // Increases reference count of @match_info by 1.
7215 // RETURNS: @match_info
7216 MatchInfo* /*new*/ ref_()() nothrow {
7217 return g_match_info_ref(&this);
7220 // VERSION: 2.30
7221 // Decreases reference count of @match_info by 1. When reference count drops
7222 // to zero, it frees all the memory associated with the match_info structure.
7223 void unref()() nothrow {
7224 g_match_info_unref(&this);
7229 // A set of functions used to perform memory allocation. The same #GMemVTable must
7230 // be used for all allocations in the same program; a call to g_mem_set_vtable(),
7231 // if it exists, should be prior to any use of GLib.
7232 struct MemVTable {
7233 // Unintrospectable functionp: malloc() / ()
7234 extern (C) void* function (size_t n_bytes) nothrow malloc;
7235 // Unintrospectable functionp: realloc() / ()
7236 extern (C) void* function (void* mem, size_t n_bytes) nothrow realloc;
7237 extern (C) void function (void* mem) nothrow free;
7238 // Unintrospectable functionp: calloc() / ()
7239 extern (C) void* function (size_t n_blocks, size_t n_block_bytes) nothrow calloc;
7240 // Unintrospectable functionp: try_malloc() / ()
7241 extern (C) void* function (size_t n_bytes) nothrow try_malloc;
7242 // Unintrospectable functionp: try_realloc() / ()
7243 extern (C) void* function (void* mem, size_t n_bytes) nothrow try_realloc;
7247 // The #GMutex struct is an opaque data structure to represent a mutex
7248 // (mutual exclusion). It can be used to protect data against shared
7249 // access. Take for example the following function:
7251 // <example>
7252 // <title>A function which will not work in a threaded environment</title>
7253 // <programlisting>
7254 // int
7255 // give_me_next_number (void)
7256 // {
7257 // static int current_number = 0;
7259 // /<!-- -->* now do a very complicated calculation to calculate the new
7260 // * number, this might for example be a random number generator
7261 // *<!-- -->/
7262 // current_number = calc_next_number (current_number);
7264 // return current_number;
7265 // }
7266 // </programlisting>
7267 // </example>
7269 // It is easy to see that this won't work in a multi-threaded
7270 // application. There current_number must be protected against shared
7271 // access. A #GMutex can be used as a solution to this problem:
7273 // <example>
7274 // <title>Using GMutex to protected a shared variable</title>
7275 // <programlisting>
7276 // int
7277 // give_me_next_number (void)
7278 // {
7279 // static GMutex mutex;
7280 // static int current_number = 0;
7281 // int ret_val;
7283 // g_mutex_lock (&amp;mutex);
7284 // ret_val = current_number = calc_next_number (current_number);
7285 // g_mutex_unlock (&amp;mutex);
7287 // return ret_val;
7288 // }
7289 // </programlisting>
7290 // </example>
7292 // Notice that the #GMutex is not initialised to any particular value.
7293 // Its placement in static storage ensures that it will be initialised
7294 // to all-zeros, which is appropriate.
7296 // If a #GMutex is placed in other contexts (eg: embedded in a struct)
7297 // then it must be explicitly initialised using g_mutex_init().
7299 // A #GMutex should only be accessed via <function>g_mutex_</function>
7300 // functions.
7301 union Mutex {
7302 private void* p;
7303 private uint[2] i;
7306 // Frees the resources allocated to a mutex with g_mutex_init().
7308 // This function should not be used with a #GMutex that has been
7309 // statically allocated.
7311 // Calling g_mutex_clear() on a locked mutex leads to undefined
7312 // behaviour.
7314 // Sine: 2.32
7315 void clear()() nothrow {
7316 g_mutex_clear(&this);
7319 // VERSION: 2.32
7320 // Initializes a #GMutex so that it can be used.
7322 // This function is useful to initialize a mutex that has been
7323 // allocated on the stack, or as part of a larger structure.
7324 // It is not necessary to initialize a mutex that has been
7325 // created that has been statically allocated.
7327 // |[
7328 // typedef struct {
7329 // GMutex m;
7330 // ...
7331 // } Blob;
7333 // Blob *b;
7335 // b = g_new (Blob, 1);
7336 // g_mutex_init (&b->m);
7337 // ]|
7339 // To undo the effect of g_mutex_init() when a mutex is no longer
7340 // needed, use g_mutex_clear().
7342 // Calling g_mutex_init() on an already initialized #GMutex leads
7343 // to undefined behaviour.
7344 void init()() nothrow {
7345 g_mutex_init(&this);
7348 // Locks @mutex. If @mutex is already locked by another thread, the
7349 // current thread will block until @mutex is unlocked by the other
7350 // thread.
7352 // <note>#GMutex is neither guaranteed to be recursive nor to be
7353 // non-recursive. As such, calling g_mutex_lock() on a #GMutex that has
7354 // already been locked by the same thread results in undefined behaviour
7355 // (including but not limited to deadlocks).</note>
7356 void lock()() nothrow {
7357 g_mutex_lock(&this);
7360 // Tries to lock @mutex. If @mutex is already locked by another thread,
7361 // it immediately returns %FALSE. Otherwise it locks @mutex and returns
7362 // %TRUE.
7364 // <note>#GMutex is neither guaranteed to be recursive nor to be
7365 // non-recursive. As such, calling g_mutex_lock() on a #GMutex that has
7366 // already been locked by the same thread results in undefined behaviour
7367 // (including but not limited to deadlocks or arbitrary return values).
7368 // </note>
7369 // RETURNS: %TRUE if @mutex could be locked
7370 int trylock()() nothrow {
7371 return g_mutex_trylock(&this);
7374 // Unlocks @mutex. If another thread is blocked in a g_mutex_lock()
7375 // call for @mutex, it will become unblocked and can lock @mutex itself.
7377 // Calling g_mutex_unlock() on a mutex that is not locked by the
7378 // current thread leads to undefined behaviour.
7379 void unlock()() nothrow {
7380 g_mutex_unlock(&this);
7385 // The #GNode struct represents one node in a
7386 // <link linkend="glib-N-ary-Trees">N-ary Tree</link>. fields
7387 struct Node {
7388 void* data;
7389 Node* next, prev, parent, children;
7392 // Gets the position of the first child of a #GNode
7393 // which contains the given data.
7395 // @data, or -1 if the data is not found
7396 // RETURNS: the index of the child of @node which contains
7397 // <data>: the data to find
7398 int child_index(AT0)(AT0 /*void*/ data) nothrow {
7399 return g_node_child_index(&this, UpCast!(void*)(data));
7402 // Gets the position of a #GNode with respect to its siblings.
7403 // @child must be a child of @node. The first child is numbered 0,
7404 // the second 1, and so on.
7405 // RETURNS: the position of @child with respect to its siblings
7406 // <child>: a child of @node
7407 int child_position(AT0)(AT0 /*Node*/ child) nothrow {
7408 return g_node_child_position(&this, UpCast!(Node*)(child));
7411 // Unintrospectable method: children_foreach() / g_node_children_foreach()
7412 // Calls a function for each of the children of a #GNode.
7413 // Note that it doesn't descend beneath the child nodes.
7414 // <flags>: which types of children are to be visited, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
7415 // <func>: the function to call for each visited node
7416 // <data>: user data to pass to the function
7417 void children_foreach(AT0)(TraverseFlags flags, NodeForeachFunc func, AT0 /*void*/ data) nothrow {
7418 g_node_children_foreach(&this, flags, func, UpCast!(void*)(data));
7421 // Unintrospectable method: copy() / g_node_copy()
7422 // Recursively copies a #GNode (but does not deep-copy the data inside the
7423 // nodes, see g_node_copy_deep() if you need that).
7424 // RETURNS: a new #GNode containing the same data pointers
7425 Node* copy()() nothrow {
7426 return g_node_copy(&this);
7429 // Unintrospectable method: copy_deep() / g_node_copy_deep()
7430 // VERSION: 2.4
7431 // Recursively copies a #GNode and its data.
7432 // RETURNS: a new #GNode containing copies of the data in @node.
7433 // <copy_func>: the function which is called to copy the data inside each node, or %NULL to use the original data.
7434 // <data>: data to pass to @copy_func
7435 Node* copy_deep(AT0)(CopyFunc copy_func, AT0 /*void*/ data) nothrow {
7436 return g_node_copy_deep(&this, copy_func, UpCast!(void*)(data));
7439 // Gets the depth of a #GNode.
7441 // If @node is %NULL the depth is 0. The root node has a depth of 1.
7442 // For the children of the root node the depth is 2. And so on.
7443 // RETURNS: the depth of the #GNode
7444 uint depth()() nothrow {
7445 return g_node_depth(&this);
7448 // Removes @root and its children from the tree, freeing any memory
7449 // allocated.
7450 void destroy()() nothrow {
7451 g_node_destroy(&this);
7454 // Unintrospectable method: find() / g_node_find()
7455 // Finds a #GNode in a tree.
7456 // RETURNS: the found #GNode, or %NULL if the data is not found
7457 // <order>: the order in which nodes are visited - %G_IN_ORDER, %G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER
7458 // <flags>: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
7459 // <data>: the data to find
7460 Node* find(AT0)(TraverseType order, TraverseFlags flags, AT0 /*void*/ data) nothrow {
7461 return g_node_find(&this, order, flags, UpCast!(void*)(data));
7464 // Unintrospectable method: find_child() / g_node_find_child()
7465 // Finds the first child of a #GNode with the given data.
7466 // RETURNS: the found child #GNode, or %NULL if the data is not found
7467 // <flags>: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
7468 // <data>: the data to find
7469 Node* find_child(AT0)(TraverseFlags flags, AT0 /*void*/ data) nothrow {
7470 return g_node_find_child(&this, flags, UpCast!(void*)(data));
7473 // Unintrospectable method: first_sibling() / g_node_first_sibling()
7474 // Gets the first sibling of a #GNode.
7475 // This could possibly be the node itself.
7476 // RETURNS: the first sibling of @node
7477 Node* first_sibling()() nothrow {
7478 return g_node_first_sibling(&this);
7481 // Unintrospectable method: get_root() / g_node_get_root()
7482 // Gets the root of a tree.
7483 // RETURNS: the root of the tree
7484 Node* get_root()() nothrow {
7485 return g_node_get_root(&this);
7488 // Unintrospectable method: insert() / g_node_insert()
7489 // Inserts a #GNode beneath the parent at the given position.
7490 // RETURNS: the inserted #GNode
7491 // <position>: the position to place @node at, with respect to its siblings If position is -1, @node is inserted as the last child of @parent
7492 // <node>: the #GNode to insert
7493 Node* insert(AT0)(int position, AT0 /*Node*/ node) nothrow {
7494 return g_node_insert(&this, position, UpCast!(Node*)(node));
7497 // Unintrospectable method: insert_after() / g_node_insert_after()
7498 // Inserts a #GNode beneath the parent after the given sibling.
7499 // RETURNS: the inserted #GNode
7500 // <sibling>: the sibling #GNode to place @node after. If sibling is %NULL, the node is inserted as the first child of @parent.
7501 // <node>: the #GNode to insert
7502 Node* insert_after(AT0, AT1)(AT0 /*Node*/ sibling, AT1 /*Node*/ node) nothrow {
7503 return g_node_insert_after(&this, UpCast!(Node*)(sibling), UpCast!(Node*)(node));
7506 // Unintrospectable method: insert_before() / g_node_insert_before()
7507 // Inserts a #GNode beneath the parent before the given sibling.
7508 // RETURNS: the inserted #GNode
7509 // <sibling>: the sibling #GNode to place @node before. If sibling is %NULL, the node is inserted as the last child of @parent.
7510 // <node>: the #GNode to insert
7511 Node* insert_before(AT0, AT1)(AT0 /*Node*/ sibling, AT1 /*Node*/ node) nothrow {
7512 return g_node_insert_before(&this, UpCast!(Node*)(sibling), UpCast!(Node*)(node));
7515 // Returns %TRUE if @node is an ancestor of @descendant.
7516 // This is true if node is the parent of @descendant,
7517 // or if node is the grandparent of @descendant etc.
7518 // RETURNS: %TRUE if @node is an ancestor of @descendant
7519 // <descendant>: a #GNode
7520 int is_ancestor(AT0)(AT0 /*Node*/ descendant) nothrow {
7521 return g_node_is_ancestor(&this, UpCast!(Node*)(descendant));
7524 // Unintrospectable method: last_child() / g_node_last_child()
7525 // Gets the last child of a #GNode.
7526 // RETURNS: the last child of @node, or %NULL if @node has no children
7527 Node* last_child()() nothrow {
7528 return g_node_last_child(&this);
7531 // Unintrospectable method: last_sibling() / g_node_last_sibling()
7532 // Gets the last sibling of a #GNode.
7533 // This could possibly be the node itself.
7534 // RETURNS: the last sibling of @node
7535 Node* last_sibling()() nothrow {
7536 return g_node_last_sibling(&this);
7539 // Gets the maximum height of all branches beneath a #GNode.
7540 // This is the maximum distance from the #GNode to all leaf nodes.
7542 // If @root is %NULL, 0 is returned. If @root has no children,
7543 // 1 is returned. If @root has children, 2 is returned. And so on.
7544 // RETURNS: the maximum height of the tree beneath @root
7545 uint max_height()() nothrow {
7546 return g_node_max_height(&this);
7549 // Gets the number of children of a #GNode.
7550 // RETURNS: the number of children of @node
7551 uint n_children()() nothrow {
7552 return g_node_n_children(&this);
7555 // Gets the number of nodes in a tree.
7556 // RETURNS: the number of nodes in the tree
7557 // <flags>: which types of children are to be counted, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
7558 uint n_nodes()(TraverseFlags flags) nothrow {
7559 return g_node_n_nodes(&this, flags);
7562 // Unintrospectable method: nth_child() / g_node_nth_child()
7563 // Gets a child of a #GNode, using the given index.
7564 // The first child is at index 0. If the index is
7565 // too big, %NULL is returned.
7566 // RETURNS: the child of @node at index @n
7567 // <n>: the index of the desired child
7568 Node* nth_child()(uint n) nothrow {
7569 return g_node_nth_child(&this, n);
7572 // Unintrospectable method: prepend() / g_node_prepend()
7573 // Inserts a #GNode as the first child of the given parent.
7574 // RETURNS: the inserted #GNode
7575 // <node>: the #GNode to insert
7576 Node* prepend(AT0)(AT0 /*Node*/ node) nothrow {
7577 return g_node_prepend(&this, UpCast!(Node*)(node));
7580 // Reverses the order of the children of a #GNode.
7581 // (It doesn't change the order of the grandchildren.)
7582 void reverse_children()() nothrow {
7583 g_node_reverse_children(&this);
7586 // Unintrospectable method: traverse() / g_node_traverse()
7587 // Traverses a tree starting at the given root #GNode.
7588 // It calls the given function for each node visited.
7589 // The traversal can be halted at any point by returning %TRUE from @func.
7590 // <order>: the order in which nodes are visited - %G_IN_ORDER, %G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER.
7591 // <flags>: which types of children are to be visited, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
7592 // <max_depth>: the maximum depth of the traversal. Nodes below this depth will not be visited. If max_depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on.
7593 // <func>: the function to call for each visited #GNode
7594 // <data>: user data to pass to the function
7595 void traverse(AT0)(TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func, AT0 /*void*/ data) nothrow {
7596 g_node_traverse(&this, order, flags, max_depth, func, UpCast!(void*)(data));
7598 // Unlinks a #GNode from a tree, resulting in two separate trees.
7599 void unlink()() nothrow {
7600 g_node_unlink(&this);
7603 // Unintrospectable function: new() / g_node_new()
7604 // Creates a new #GNode containing the given data.
7605 // Used to create the first node in a tree.
7606 // RETURNS: a new #GNode
7607 // <data>: the data of the new node
7608 static Node* new_(AT0)(AT0 /*void*/ data) nothrow {
7609 return g_node_new(UpCast!(void*)(data));
7614 // Specifies the type of function passed to g_node_children_foreach().
7615 // The function is called with each child node, together with the user
7616 // data passed to g_node_children_foreach().
7617 // <node>: a #GNode.
7618 // <data>: user data passed to g_node_children_foreach().
7619 extern (C) alias void function (Node* node, void* data) nothrow NodeForeachFunc;
7622 // Specifies the type of function passed to g_node_traverse(). The
7623 // function is called with each of the nodes visited, together with the
7624 // user data passed to g_node_traverse(). If the function returns
7625 // %TRUE, then the traversal is stopped.
7626 // <node>: a #GNode.
7627 // <data>: user data passed to g_node_traverse().
7628 extern (C) alias int function (Node* node, void* data) nothrow NodeTraverseFunc;
7631 // Defines how a Unicode string is transformed in a canonical
7632 // form, standardizing such issues as whether a character with
7633 // an accent is represented as a base character and combining
7634 // accent or as a single precomposed character. Unicode strings
7635 // should generally be normalized before comparing them.
7636 enum NormalizeMode {
7637 DEFAULT = 0,
7638 NFD = 0,
7639 DEFAULT_COMPOSE = 1,
7640 NFC = 1,
7641 ALL = 2,
7642 NFKD = 2,
7643 ALL_COMPOSE = 3,
7644 NFKC = 3
7646 enum OPTION_REMAINING = "";
7648 // A #GOnce struct controls a one-time initialization function. Any
7649 // one-time initialization function must have its own unique #GOnce
7650 // struct.
7651 struct Once /* Version 2.4 */ {
7652 OnceStatus status;
7653 void* retval;
7655 // Unintrospectable method: impl() / g_once_impl()
7656 void* impl(AT0)(ThreadFunc func, AT0 /*void*/ arg) nothrow {
7657 return g_once_impl(&this, func, UpCast!(void*)(arg));
7660 // VERSION: 2.14
7661 // Function to be called when starting a critical initialization
7662 // section. The argument @location must point to a static
7663 // 0-initialized variable that will be set to a value other than 0 at
7664 // the end of the initialization section. In combination with
7665 // g_once_init_leave() and the unique address @value_location, it can
7666 // be ensured that an initialization section will be executed only once
7667 // during a program's life time, and that concurrent threads are
7668 // blocked until initialization completed. To be used in constructs
7669 // like this:
7671 // |[
7672 // static gsize initialization_value = 0;
7674 // if (g_once_init_enter (&amp;initialization_value))
7675 // {
7676 // gsize setup_value = 42; /&ast;* initialization code here *&ast;/
7678 // g_once_init_leave (&amp;initialization_value, setup_value);
7679 // }
7681 // /&ast;* use initialization_value here *&ast;/
7682 // ]|
7684 // %FALSE and blocks otherwise
7685 // RETURNS: %TRUE if the initialization section should be entered,
7686 // <location>: location of a static initializable variable containing 0
7687 static int init_enter(AT0)(AT0 /*void*/ location) nothrow {
7688 return g_once_init_enter(UpCast!(void*)(location));
7691 // VERSION: 2.14
7692 // Counterpart to g_once_init_enter(). Expects a location of a static
7693 // 0-initialized initialization variable, and an initialization value
7694 // other than 0. Sets the variable to the initialization value, and
7695 // releases concurrent threads blocking in g_once_init_enter() on this
7696 // initialization variable.
7697 // <location>: location of a static initializable variable containing 0
7698 // <result>: new non-0 value for *@value_location
7699 static void init_leave(AT0)(AT0 /*void*/ location, size_t result) nothrow {
7700 g_once_init_leave(UpCast!(void*)(location), result);
7705 // The possible statuses of a one-time initialization function
7706 // controlled by a #GOnce struct.
7707 enum OnceStatus /* Version 2.4 */ {
7708 NOTCALLED = 0,
7709 PROGRESS = 1,
7710 READY = 2
7713 // The #GOptionArg enum values determine which type of extra argument the
7714 // options expect to find. If an option expects an extra argument, it
7715 // can be specified in several ways; with a short option:
7716 // <option>-x arg</option>, with a long option: <option>--name arg</option>
7717 // or combined in a single argument: <option>--name=arg</option>.
7718 enum OptionArg {
7719 NONE = 0,
7720 STRING = 1,
7721 INT = 2,
7722 CALLBACK = 3,
7723 FILENAME = 4,
7724 STRING_ARRAY = 5,
7725 FILENAME_ARRAY = 6,
7726 DOUBLE = 7,
7727 INT64 = 8
7730 // The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK
7731 // options.
7733 // occurred, in which case @error should be set with g_set_error()
7734 // RETURNS: %TRUE if the option was successfully parsed, %FALSE if an error
7735 // <option_name>: The name of the option being parsed. This will be either a single dash followed by a single letter (for a short name) or two dashes followed by a long option name.
7736 // <value>: The value to be parsed.
7737 // <data>: User data added to the #GOptionGroup containing the option when it was created with g_option_group_new()
7738 extern (C) alias int function (char* option_name, char* value, void* data, GLib2.Error** error=null) nothrow OptionArgFunc;
7741 // A <structname>GOptionContext</structname> struct defines which options
7742 // are accepted by the commandline option parser. The struct has only private
7743 // fields and should not be directly accessed.
7744 struct OptionContext {
7746 // VERSION: 2.6
7747 // Adds a #GOptionGroup to the @context, so that parsing with @context
7748 // will recognize the options in the group. Note that the group will
7749 // be freed together with the context when g_option_context_free() is
7750 // called, so you must not free the group yourself after adding it
7751 // to a context.
7752 // <group>: the group to add
7753 void add_group(AT0)(AT0 /*OptionGroup*/ group) nothrow {
7754 g_option_context_add_group(&this, UpCast!(OptionGroup*)(group));
7757 // VERSION: 2.6
7758 // A convenience function which creates a main group if it doesn't
7759 // exist, adds the @entries to it and sets the translation domain.
7760 // <entries>: a %NULL-terminated array of #GOptionEntry<!-- -->s
7761 // <translation_domain>: a translation domain to use for translating the <option>--help</option> output for the options in @entries with gettext(), or %NULL
7762 void add_main_entries(AT0, AT1)(AT0 /*OptionEntry*/ entries, AT1 /*char*/ translation_domain) nothrow {
7763 g_option_context_add_main_entries(&this, UpCast!(OptionEntry*)(entries), toCString!(char*)(translation_domain));
7766 // VERSION: 2.6
7767 // Frees context and all the groups which have been
7768 // added to it.
7770 // Please note that parsed arguments need to be freed separately (see
7771 // #GOptionEntry).
7772 void free()() nothrow {
7773 g_option_context_free(&this);
7776 // VERSION: 2.12
7777 // Returns the description. See g_option_context_set_description().
7778 // RETURNS: the description
7779 char* get_description()() nothrow {
7780 return g_option_context_get_description(&this);
7783 // VERSION: 2.14
7784 // Returns a formatted, translated help text for the given context.
7785 // To obtain the text produced by <option>--help</option>, call
7786 // <literal>g_option_context_get_help (context, TRUE, NULL)</literal>.
7787 // To obtain the text produced by <option>--help-all</option>, call
7788 // <literal>g_option_context_get_help (context, FALSE, NULL)</literal>.
7789 // To obtain the help text for an option group, call
7790 // <literal>g_option_context_get_help (context, FALSE, group)</literal>.
7791 // RETURNS: A newly allocated string containing the help text
7792 // <main_help>: if %TRUE, only include the main group
7793 // <group>: the #GOptionGroup to create help for, or %NULL
7794 char* /*new*/ get_help(AT0)(int main_help, AT0 /*OptionGroup*/ group) nothrow {
7795 return g_option_context_get_help(&this, main_help, UpCast!(OptionGroup*)(group));
7798 // VERSION: 2.6
7799 // Returns whether automatic <option>--help</option> generation
7800 // is turned on for @context. See g_option_context_set_help_enabled().
7801 // RETURNS: %TRUE if automatic help generation is turned on.
7802 int get_help_enabled()() nothrow {
7803 return g_option_context_get_help_enabled(&this);
7806 // VERSION: 2.6
7807 // Returns whether unknown options are ignored or not. See
7808 // g_option_context_set_ignore_unknown_options().
7809 // RETURNS: %TRUE if unknown options are ignored.
7810 int get_ignore_unknown_options()() nothrow {
7811 return g_option_context_get_ignore_unknown_options(&this);
7814 // Unintrospectable method: get_main_group() / g_option_context_get_main_group()
7815 // VERSION: 2.6
7816 // Returns a pointer to the main group of @context.
7818 // have a main group. Note that group belongs to @context and should
7819 // not be modified or freed.
7820 // RETURNS: the main group of @context, or %NULL if @context doesn't
7821 OptionGroup* get_main_group()() nothrow {
7822 return g_option_context_get_main_group(&this);
7825 // VERSION: 2.12
7826 // Returns the summary. See g_option_context_set_summary().
7827 // RETURNS: the summary
7828 char* get_summary()() nothrow {
7829 return g_option_context_get_summary(&this);
7832 // VERSION: 2.6
7833 // Parses the command line arguments, recognizing options
7834 // which have been added to @context. A side-effect of
7835 // calling this function is that g_set_prgname() will be
7836 // called.
7838 // If the parsing is successful, any parsed arguments are
7839 // removed from the array and @argc and @argv are updated
7840 // accordingly. A '--' option is stripped from @argv
7841 // unless there are unparsed options before and after it,
7842 // or some of the options after it start with '-'. In case
7843 // of an error, @argc and @argv are left unmodified.
7845 // If automatic <option>--help</option> support is enabled
7846 // (see g_option_context_set_help_enabled()), and the
7847 // @argv array contains one of the recognized help options,
7848 // this function will produce help output to stdout and
7849 // call <literal>exit (0)</literal>.
7851 // Note that function depends on the
7852 // <link linkend="setlocale">current locale</link> for
7853 // automatic character set conversion of string and filename
7854 // arguments.
7856 // %FALSE if an error occurred
7857 // RETURNS: %TRUE if the parsing was successful,
7858 // <argc>: a pointer to the number of command line arguments
7859 // <argv>: a pointer to the array of command line arguments
7860 int parse(AT0, AT1)(/*inout*/ int* argc, /*inout*/ AT0 /*char***/ argv, AT1 /*GLib2.Error**/ error=null) nothrow {
7861 return g_option_context_parse(&this, argc, toCString!(char***)(argv), UpCast!(GLib2.Error**)(error));
7864 // VERSION: 2.12
7865 // Adds a string to be displayed in <option>--help</option> output
7866 // after the list of options. This text often includes a bug reporting
7867 // address.
7869 // Note that the summary is translated (see
7870 // g_option_context_set_translate_func()).
7871 // <description>: a string to be shown in <option>--help</option> output after the list of options, or %NULL
7872 void set_description(AT0)(AT0 /*char*/ description) nothrow {
7873 g_option_context_set_description(&this, toCString!(char*)(description));
7876 // VERSION: 2.6
7877 // Enables or disables automatic generation of <option>--help</option>
7878 // output. By default, g_option_context_parse() recognizes
7879 // <option>--help</option>, <option>-h</option>,
7880 // <option>-?</option>, <option>--help-all</option>
7881 // and <option>--help-</option><replaceable>groupname</replaceable> and creates
7882 // suitable output to stdout.
7883 // <help_enabled>: %TRUE to enable <option>--help</option>, %FALSE to disable it
7884 void set_help_enabled()(int help_enabled) nothrow {
7885 g_option_context_set_help_enabled(&this, help_enabled);
7888 // VERSION: 2.6
7889 // Sets whether to ignore unknown options or not. If an argument is
7890 // ignored, it is left in the @argv array after parsing. By default,
7891 // g_option_context_parse() treats unknown options as error.
7893 // This setting does not affect non-option arguments (i.e. arguments
7894 // which don't start with a dash). But note that GOption cannot reliably
7895 // determine whether a non-option belongs to a preceding unknown option.
7896 // <ignore_unknown>: %TRUE to ignore unknown options, %FALSE to produce an error when unknown options are met
7897 void set_ignore_unknown_options()(int ignore_unknown) nothrow {
7898 g_option_context_set_ignore_unknown_options(&this, ignore_unknown);
7901 // VERSION: 2.6
7902 // Sets a #GOptionGroup as main group of the @context.
7903 // This has the same effect as calling g_option_context_add_group(),
7904 // the only difference is that the options in the main group are
7905 // treated differently when generating <option>--help</option> output.
7906 // <group>: the group to set as main group
7907 void set_main_group(AT0)(AT0 /*OptionGroup*/ group) nothrow {
7908 g_option_context_set_main_group(&this, UpCast!(OptionGroup*)(group));
7911 // VERSION: 2.12
7912 // Adds a string to be displayed in <option>--help</option> output
7913 // before the list of options. This is typically a summary of the
7914 // program functionality.
7916 // Note that the summary is translated (see
7917 // g_option_context_set_translate_func() and
7918 // g_option_context_set_translation_domain()).
7919 // <summary>: a string to be shown in <option>--help</option> output before the list of options, or %NULL
7920 void set_summary(AT0)(AT0 /*char*/ summary) nothrow {
7921 g_option_context_set_summary(&this, toCString!(char*)(summary));
7924 // VERSION: 2.12
7925 // Sets the function which is used to translate the contexts
7926 // user-visible strings, for <option>--help</option> output.
7927 // If @func is %NULL, strings are not translated.
7929 // Note that option groups have their own translation functions,
7930 // this function only affects the @parameter_string (see g_option_context_new()),
7931 // the summary (see g_option_context_set_summary()) and the description
7932 // (see g_option_context_set_description()).
7934 // If you are using gettext(), you only need to set the translation
7935 // domain, see g_option_context_set_translation_domain().
7936 // <func>: the #GTranslateFunc, or %NULL
7937 // <data>: user data to pass to @func, or %NULL
7938 // <destroy_notify>: a function which gets called to free @data, or %NULL
7939 void set_translate_func(AT0)(TranslateFunc func, AT0 /*void*/ data, DestroyNotify destroy_notify) nothrow {
7940 g_option_context_set_translate_func(&this, func, UpCast!(void*)(data), destroy_notify);
7943 // VERSION: 2.12
7944 // A convenience function to use gettext() for translating
7945 // user-visible strings.
7946 // <domain>: the domain to use
7947 void set_translation_domain(AT0)(AT0 /*char*/ domain) nothrow {
7948 g_option_context_set_translation_domain(&this, toCString!(char*)(domain));
7951 // Unintrospectable function: new() / g_option_context_new()
7952 // VERSION: 2.6
7953 // Creates a new option context.
7955 // The @parameter_string can serve multiple purposes. It can be used
7956 // to add descriptions for "rest" arguments, which are not parsed by
7957 // the #GOptionContext, typically something like "FILES" or
7958 // "FILE1 FILE2...". If you are using #G_OPTION_REMAINING for
7959 // collecting "rest" arguments, GLib handles this automatically by
7960 // using the @arg_description of the corresponding #GOptionEntry in
7961 // the usage summary.
7963 // Another usage is to give a short summary of the program
7964 // functionality, like " - frob the strings", which will be displayed
7965 // in the same line as the usage. For a longer description of the
7966 // program functionality that should be displayed as a paragraph
7967 // below the usage line, use g_option_context_set_summary().
7969 // Note that the @parameter_string is translated using the
7970 // function set with g_option_context_set_translate_func(), so
7971 // it should normally be passed untranslated.
7973 // freed with g_option_context_free() after use.
7974 // RETURNS: a newly created #GOptionContext, which must be
7975 // <parameter_string>: a string which is displayed in the first line of <option>--help</option> output, after the usage summary <literal><replaceable>programname</replaceable> [OPTION...]</literal>
7976 static OptionContext* new_(AT0)(AT0 /*char*/ parameter_string) nothrow {
7977 return g_option_context_new(toCString!(char*)(parameter_string));
7982 // A <structname>GOptionEntry</structname> defines a single option.
7983 // To have an effect, they must be added to a #GOptionGroup with
7984 // g_option_context_add_main_entries() or g_option_group_add_entries().
7985 struct OptionEntry {
7986 char* long_name;
7987 char short_name;
7988 int flags;
7989 OptionArg arg;
7990 void* arg_data;
7991 char* description, arg_description;
7994 // Error codes returned by option parsing.
7995 enum OptionError {
7996 UNKNOWN_OPTION = 0,
7997 BAD_VALUE = 1,
7998 FAILED = 2
8001 // The type of function to be used as callback when a parse error occurs.
8002 // <context>: The active #GOptionContext
8003 // <group>: The group to which the function belongs
8004 // <data>: User data added to the #GOptionGroup containing the option when it was created with g_option_group_new()
8005 extern (C) alias void function (OptionContext* context, OptionGroup* group, void* data, GLib2.Error** error=null) nothrow OptionErrorFunc;
8007 // Flags which modify individual options.
8008 enum OptionFlags {
8009 HIDDEN = 1,
8010 IN_MAIN = 2,
8011 REVERSE = 4,
8012 NO_ARG = 8,
8013 FILENAME = 16,
8014 OPTIONAL_ARG = 32,
8015 NOALIAS = 64
8018 // A <structname>GOptionGroup</structname> struct defines the options in a single
8019 // group. The struct has only private fields and should not be directly accessed.
8021 // All options in a group share the same translation function. Libraries which
8022 // need to parse commandline options are expected to provide a function for
8023 // getting a <structname>GOptionGroup</structname> holding their options, which
8024 // the application can then add to its #GOptionContext.
8025 struct OptionGroup {
8027 // VERSION: 2.6
8028 // Adds the options specified in @entries to @group.
8029 // <entries>: a %NULL-terminated array of #GOptionEntry<!-- -->s
8030 void add_entries(AT0)(AT0 /*OptionEntry*/ entries) nothrow {
8031 g_option_group_add_entries(&this, UpCast!(OptionEntry*)(entries));
8034 // VERSION: 2.6
8035 // Frees a #GOptionGroup. Note that you must <emphasis>not</emphasis>
8036 // free groups which have been added to a #GOptionContext.
8037 void free()() nothrow {
8038 g_option_group_free(&this);
8041 // Unintrospectable method: set_error_hook() / g_option_group_set_error_hook()
8042 // VERSION: 2.6
8043 // Associates a function with @group which will be called
8044 // from g_option_context_parse() when an error occurs.
8046 // Note that the user data to be passed to @error_func can be
8047 // specified when constructing the group with g_option_group_new().
8048 // <error_func>: a function to call when an error occurs
8049 void set_error_hook()(OptionErrorFunc error_func) nothrow {
8050 g_option_group_set_error_hook(&this, error_func);
8053 // Unintrospectable method: set_parse_hooks() / g_option_group_set_parse_hooks()
8054 // VERSION: 2.6
8055 // Associates two functions with @group which will be called
8056 // from g_option_context_parse() before the first option is parsed
8057 // and after the last option has been parsed, respectively.
8059 // Note that the user data to be passed to @pre_parse_func and
8060 // @post_parse_func can be specified when constructing the group
8061 // with g_option_group_new().
8062 // <pre_parse_func>: a function to call before parsing, or %NULL
8063 // <post_parse_func>: a function to call after parsing, or %NULL
8064 void set_parse_hooks()(OptionParseFunc pre_parse_func, OptionParseFunc post_parse_func) nothrow {
8065 g_option_group_set_parse_hooks(&this, pre_parse_func, post_parse_func);
8068 // VERSION: 2.6
8069 // Sets the function which is used to translate user-visible
8070 // strings, for <option>--help</option> output. Different
8071 // groups can use different #GTranslateFunc<!-- -->s. If @func
8072 // is %NULL, strings are not translated.
8074 // If you are using gettext(), you only need to set the translation
8075 // domain, see g_option_group_set_translation_domain().
8076 // <func>: the #GTranslateFunc, or %NULL
8077 // <data>: user data to pass to @func, or %NULL
8078 // <destroy_notify>: a function which gets called to free @data, or %NULL
8079 void set_translate_func(AT0)(TranslateFunc func, AT0 /*void*/ data, DestroyNotify destroy_notify) nothrow {
8080 g_option_group_set_translate_func(&this, func, UpCast!(void*)(data), destroy_notify);
8083 // VERSION: 2.6
8084 // A convenience function to use gettext() for translating
8085 // user-visible strings.
8086 // <domain>: the domain to use
8087 void set_translation_domain(AT0)(AT0 /*char*/ domain) nothrow {
8088 g_option_group_set_translation_domain(&this, toCString!(char*)(domain));
8091 // Unintrospectable function: new() / g_option_group_new()
8092 // VERSION: 2.6
8093 // Creates a new #GOptionGroup.
8095 // to a #GOptionContext or freed with g_option_group_free().
8096 // RETURNS: a newly created option group. It should be added
8097 // <name>: the name for the option group, this is used to provide help for the options in this group with <option>--help-</option>@name
8098 // <description>: a description for this group to be shown in <option>--help</option>. This string is translated using the translation domain or translation function of the group
8099 // <help_description>: a description for the <option>--help-</option>@name option. This string is translated using the translation domain or translation function of the group
8100 // <user_data>: user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULL
8101 // <destroy>: a function that will be called to free @user_data, or %NULL
8102 static OptionGroup* new_(AT0, AT1, AT2, AT3)(AT0 /*char*/ name, AT1 /*char*/ description, AT2 /*char*/ help_description, AT3 /*void*/ user_data, DestroyNotify destroy) nothrow {
8103 return g_option_group_new(toCString!(char*)(name), toCString!(char*)(description), toCString!(char*)(help_description), UpCast!(void*)(user_data), destroy);
8108 // The type of function that can be called before and after parsing.
8110 // occurred, in which case @error should be set with g_set_error()
8111 // RETURNS: %TRUE if the function completed successfully, %FALSE if an error
8112 // <context>: The active #GOptionContext
8113 // <group>: The group to which the function belongs
8114 // <data>: User data added to the #GOptionGroup containing the option when it was created with g_option_group_new()
8115 extern (C) alias int function (OptionContext* context, OptionGroup* group, void* data, GLib2.Error** error=null) nothrow OptionParseFunc;
8117 enum int PDP_ENDIAN = 3412;
8118 enum double PI = 3.141593;
8119 enum double PI_2 = 1.570796;
8120 enum double PI_4 = 0.785398;
8121 enum POLLFD_FORMAT = "%#I64x";
8122 enum int PRIORITY_DEFAULT = 0;
8123 enum int PRIORITY_DEFAULT_IDLE = 200;
8124 enum int PRIORITY_HIGH = -100;
8125 enum int PRIORITY_HIGH_IDLE = 100;
8126 enum int PRIORITY_LOW = 300;
8128 // A <structname>GPatternSpec</structname> is the 'compiled' form of a
8129 // pattern. This structure is opaque and its fields cannot be accessed
8130 // directly.
8131 struct PatternSpec {
8133 // Compares two compiled pattern specs and returns whether they will
8134 // match the same set of strings.
8135 // <pspec2>: another #GPatternSpec
8136 int equal(AT0)(AT0 /*PatternSpec*/ pspec2) nothrow {
8137 return g_pattern_spec_equal(&this, UpCast!(PatternSpec*)(pspec2));
8139 // Frees the memory allocated for the #GPatternSpec.
8140 void free()() nothrow {
8141 g_pattern_spec_free(&this);
8144 // Unintrospectable function: new() / g_pattern_spec_new()
8145 // Compiles a pattern to a #GPatternSpec.
8146 // <pattern>: a zero-terminated UTF-8 encoded string
8147 static PatternSpec* new_(AT0)(AT0 /*char*/ pattern) nothrow {
8148 return g_pattern_spec_new(toCString!(char*)(pattern));
8153 // Represents a file descriptor, which events to poll for, and which events
8154 // occurred.
8155 struct PollFD {
8156 int fd;
8157 ushort events, revents;
8161 // Specifies the type of function passed to g_main_context_set_poll_func().
8162 // The semantics of the function should match those of the poll() system call.
8164 // reported, or -1 if an error occurred.
8165 // RETURNS: the number of #GPollFD elements which have events or errors
8166 // <ufds>: an array of #GPollFD elements
8167 // <nfsd>: the number of elements in @ufds
8168 // <timeout_>: the maximum time to wait for an event of the file descriptors. A negative value indicates an infinite timeout.
8169 extern (C) alias int function (PollFD* ufds, uint nfsd, int timeout_) nothrow PollFunc;
8172 // Specifies the type of the print handler functions.
8173 // These are called with the complete formatted string to output.
8174 // <string>: the message to output
8175 extern (C) alias void function (char* string_) nothrow PrintFunc;
8178 // The #GPrivate struct is an opaque data structure to represent a
8179 // thread-local data key. It is approximately equivalent to the
8180 // pthread_setspecific()/pthread_getspecific() APIs on POSIX and to
8181 // TlsSetValue()/TlsGetValue() on Windows.
8183 // If you don't already know why you might want this functionality,
8184 // then you probably don't need it.
8186 // #GPrivate is a very limited resource (as far as 128 per program,
8187 // shared between all libraries). It is also not possible to destroy a
8188 // #GPrivate after it has been used. As such, it is only ever acceptable
8189 // to use #GPrivate in static scope, and even then sparingly so.
8191 // See G_PRIVATE_INIT() for a couple of examples.
8193 // The #GPrivate structure should be considered opaque. It should only
8194 // be accessed via the <function>g_private_</function> functions.
8195 struct Private {
8196 private void* p;
8197 private DestroyNotify notify;
8198 private void*[2] future;
8201 // Unintrospectable method: get() / g_private_get()
8202 // Returns the current value of the thread local variable @key.
8204 // If the value has not yet been set in this thread, %NULL is returned.
8205 // Values are never copied between threads (when a new thread is
8206 // created, for example).
8207 // RETURNS: the thread-local value
8208 void* get()() nothrow {
8209 return g_private_get(&this);
8212 // VERSION: 2.32
8213 // Sets the thread local variable @key to have the value @value in the
8214 // current thread.
8216 // This function differs from g_private_set() in the following way: if
8217 // the previous value was non-%NULL then the #GDestroyNotify handler for
8218 // @key is run on it.
8219 // <value>: the new value
8220 void replace(AT0)(AT0 /*void*/ value) nothrow {
8221 g_private_replace(&this, UpCast!(void*)(value));
8224 // Sets the thread local variable @key to have the value @value in the
8225 // current thread.
8227 // This function differs from g_private_replace() in the following way:
8228 // the #GDestroyNotify for @key is not called on the old value.
8229 // <value>: the new value
8230 void set(AT0)(AT0 /*void*/ value) nothrow {
8231 g_private_set(&this, UpCast!(void*)(value));
8235 // Contains the public fields of a pointer array.
8236 struct PtrArray {
8237 void** pdata;
8238 uint len;
8241 // Adds a pointer to the end of the pointer array. The array will grow
8242 // in size automatically if necessary.
8243 // <array>: a #GPtrArray.
8244 // <data>: the pointer to add.
8245 static void add(AT0, AT1)(AT0 /*PtrArray*/ array, AT1 /*void*/ data) nothrow {
8246 g_ptr_array_add(UpCast!(PtrArray*)(array), UpCast!(void*)(data));
8249 // Unintrospectable function: foreach() / g_ptr_array_foreach()
8250 // VERSION: 2.4
8251 // Calls a function for each element of a #GPtrArray.
8252 // <array>: a #GPtrArray
8253 // <func>: the function to call for each array element
8254 // <user_data>: user data to pass to the function
8255 static void foreach_(AT0, AT1)(AT0 /*PtrArray*/ array, Func func, AT1 /*void*/ user_data) nothrow {
8256 g_ptr_array_foreach(UpCast!(PtrArray*)(array), func, UpCast!(void*)(user_data));
8259 // Unintrospectable function: free() / g_ptr_array_free()
8260 // Frees the memory allocated for the #GPtrArray. If @free_seg is %TRUE
8261 // it frees the memory block holding the elements as well. Pass %FALSE
8262 // if you want to free the #GPtrArray wrapper but preserve the
8263 // underlying array for use elsewhere. If the reference count of @array
8264 // is greater than one, the #GPtrArray wrapper is preserved but the
8265 // size of @array will be set to zero.
8267 // <note><para>If array contents point to dynamically-allocated
8268 // memory, they should be freed separately if @free_seg is %TRUE and no
8269 // #GDestroyNotify function has been set for @array.</para></note>
8270 // <array>: a #GPtrArray.
8271 // <free_seg>: if %TRUE the actual pointer array is freed as well.
8272 static void** free(AT0)(AT0 /*PtrArray*/ array, int free_seg) nothrow {
8273 return g_ptr_array_free(UpCast!(PtrArray*)(array), free_seg);
8276 // Unintrospectable function: new() / g_ptr_array_new()
8277 // Creates a new #GPtrArray with a reference count of 1.
8278 static PtrArray* new_()() nothrow {
8279 return g_ptr_array_new();
8282 // Unintrospectable function: new_full() / g_ptr_array_new_full()
8283 // VERSION: 2.30
8284 // Creates a new #GPtrArray with @reserved_size pointers preallocated
8285 // and a reference count of 1. This avoids frequent reallocation, if
8286 // you are going to add many pointers to the array. Note however that
8287 // the size of the array is still 0. It also set @element_free_func
8288 // for freeing each element when the array is destroyed either via
8289 // g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
8290 // set to %TRUE or when removing elements.
8291 // RETURNS: A new #GPtrArray.
8292 // <reserved_size>: number of pointers preallocated.
8293 // <element_free_func>: A function to free elements with destroy @array or %NULL.
8294 static PtrArray* new_full()(uint reserved_size, DestroyNotify element_free_func) nothrow {
8295 return g_ptr_array_new_full(reserved_size, element_free_func);
8298 // Unintrospectable function: new_with_free_func() / g_ptr_array_new_with_free_func()
8299 // VERSION: 2.22
8300 // Creates a new #GPtrArray with a reference count of 1 and use @element_free_func
8301 // for freeing each element when the array is destroyed either via
8302 // g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
8303 // set to %TRUE or when removing elements.
8304 // RETURNS: A new #GPtrArray.
8305 // <element_free_func>: A function to free elements with destroy @array or %NULL.
8306 static PtrArray* new_with_free_func()(DestroyNotify element_free_func) nothrow {
8307 return g_ptr_array_new_with_free_func(element_free_func);
8310 // Unintrospectable function: ref() / g_ptr_array_ref()
8311 // VERSION: 2.22
8312 // Atomically increments the reference count of @array by one. This
8313 // function is MT-safe and may be called from any thread.
8314 // RETURNS: The passed in #GPtrArray.
8315 // <array>: A #GArray.
8316 static PtrArray* ref_(AT0)(AT0 /*PtrArray*/ array) nothrow {
8317 return g_ptr_array_ref(UpCast!(PtrArray*)(array));
8320 // Removes the first occurrence of the given pointer from the pointer
8321 // array. The following elements are moved down one place. If @array
8322 // has a non-%NULL #GDestroyNotify function it is called for the
8323 // removed element.
8325 // It returns %TRUE if the pointer was removed, or %FALSE if the
8326 // pointer was not found.
8327 // <array>: a #GPtrArray.
8328 // <data>: the pointer to remove.
8329 static int remove(AT0, AT1)(AT0 /*PtrArray*/ array, AT1 /*void*/ data) nothrow {
8330 return g_ptr_array_remove(UpCast!(PtrArray*)(array), UpCast!(void*)(data));
8333 // Removes the first occurrence of the given pointer from the pointer
8334 // array. The last element in the array is used to fill in the space,
8335 // so this function does not preserve the order of the array. But it is
8336 // faster than g_ptr_array_remove(). If @array has a non-%NULL
8337 // #GDestroyNotify function it is called for the removed element.
8339 // It returns %TRUE if the pointer was removed, or %FALSE if the
8340 // pointer was not found.
8341 // <array>: a #GPtrArray.
8342 // <data>: the pointer to remove.
8343 static int remove_fast(AT0, AT1)(AT0 /*PtrArray*/ array, AT1 /*void*/ data) nothrow {
8344 return g_ptr_array_remove_fast(UpCast!(PtrArray*)(array), UpCast!(void*)(data));
8347 // Unintrospectable function: remove_index() / g_ptr_array_remove_index()
8348 // Removes the pointer at the given index from the pointer array. The
8349 // following elements are moved down one place. If @array has a
8350 // non-%NULL #GDestroyNotify function it is called for the removed
8351 // element.
8352 // <array>: a #GPtrArray.
8353 // <index_>: the index of the pointer to remove.
8354 static void* remove_index(AT0)(AT0 /*PtrArray*/ array, uint index_) nothrow {
8355 return g_ptr_array_remove_index(UpCast!(PtrArray*)(array), index_);
8358 // Unintrospectable function: remove_index_fast() / g_ptr_array_remove_index_fast()
8359 // Removes the pointer at the given index from the pointer array. The
8360 // last element in the array is used to fill in the space, so this
8361 // function does not preserve the order of the array. But it is faster
8362 // than g_ptr_array_remove_index(). If @array has a non-%NULL
8363 // #GDestroyNotify function it is called for the removed element.
8364 // <array>: a #GPtrArray.
8365 // <index_>: the index of the pointer to remove.
8366 static void* remove_index_fast(AT0)(AT0 /*PtrArray*/ array, uint index_) nothrow {
8367 return g_ptr_array_remove_index_fast(UpCast!(PtrArray*)(array), index_);
8370 // VERSION: 2.4
8371 // Removes the given number of pointers starting at the given index
8372 // from a #GPtrArray. The following elements are moved to close the
8373 // gap. If @array has a non-%NULL #GDestroyNotify function it is called
8374 // for the removed elements.
8375 // <array>: a @GPtrArray.
8376 // <index_>: the index of the first pointer to remove.
8377 // <length>: the number of pointers to remove.
8378 static void remove_range(AT0)(AT0 /*PtrArray*/ array, uint index_, uint length) nothrow {
8379 g_ptr_array_remove_range(UpCast!(PtrArray*)(array), index_, length);
8382 // VERSION: 2.22
8383 // Sets a function for freeing each element when @array is destroyed
8384 // either via g_ptr_array_unref(), when g_ptr_array_free() is called
8385 // with @free_segment set to %TRUE or when removing elements.
8386 // <array>: A #GPtrArray.
8387 // <element_free_func>: A function to free elements with destroy @array or %NULL.
8388 static void set_free_func(AT0)(AT0 /*PtrArray*/ array, DestroyNotify element_free_func) nothrow {
8389 g_ptr_array_set_free_func(UpCast!(PtrArray*)(array), element_free_func);
8392 // Sets the size of the array. When making the array larger,
8393 // newly-added elements will be set to %NULL. When making it smaller,
8394 // if @array has a non-%NULL #GDestroyNotify function then it will be
8395 // called for the removed elements.
8396 // <array>: a #GPtrArray.
8397 // <length>: the new length of the pointer array.
8398 static void set_size(AT0)(AT0 /*PtrArray*/ array, int length) nothrow {
8399 g_ptr_array_set_size(UpCast!(PtrArray*)(array), length);
8402 // Unintrospectable function: sized_new() / g_ptr_array_sized_new()
8403 // Creates a new #GPtrArray with @reserved_size pointers preallocated
8404 // and a reference count of 1. This avoids frequent reallocation, if
8405 // you are going to add many pointers to the array. Note however that
8406 // the size of the array is still 0.
8407 // <reserved_size>: number of pointers preallocated.
8408 static PtrArray* sized_new()(uint reserved_size) nothrow {
8409 return g_ptr_array_sized_new(reserved_size);
8412 // Unintrospectable function: sort() / g_ptr_array_sort()
8413 // Sorts the array, using @compare_func which should be a qsort()-style
8414 // comparison function (returns less than zero for first arg is less
8415 // than second arg, zero for equal, greater than zero if irst arg is
8416 // greater than second arg).
8418 // <note><para>The comparison function for g_ptr_array_sort() doesn't
8419 // take the pointers from the array as arguments, it takes pointers to
8420 // the pointers in the array.</para></note>
8422 // This is guaranteed to be a stable sort since version 2.32.
8423 // <array>: a #GPtrArray.
8424 // <compare_func>: comparison function.
8425 static void sort(AT0)(AT0 /*PtrArray*/ array, CompareFunc compare_func) nothrow {
8426 g_ptr_array_sort(UpCast!(PtrArray*)(array), compare_func);
8429 // Unintrospectable function: sort_with_data() / g_ptr_array_sort_with_data()
8430 // Like g_ptr_array_sort(), but the comparison function has an extra
8431 // user data argument.
8433 // <note><para>The comparison function for g_ptr_array_sort_with_data()
8434 // doesn't take the pointers from the array as arguments, it takes
8435 // pointers to the pointers in the array.</para></note>
8437 // This is guaranteed to be a stable sort since version 2.32.
8438 // <array>: a #GPtrArray.
8439 // <compare_func>: comparison function.
8440 // <user_data>: data to pass to @compare_func.
8441 static void sort_with_data(AT0, AT1)(AT0 /*PtrArray*/ array, CompareDataFunc compare_func, AT1 /*void*/ user_data) nothrow {
8442 g_ptr_array_sort_with_data(UpCast!(PtrArray*)(array), compare_func, UpCast!(void*)(user_data));
8445 // VERSION: 2.22
8446 // Atomically decrements the reference count of @array by one. If the
8447 // reference count drops to 0, the effect is the same as calling
8448 // g_ptr_array_free() with @free_segment set to %TRUE. This function
8449 // is MT-safe and may be called from any thread.
8450 // <array>: A #GPtrArray.
8451 static void unref(AT0)(AT0 /*PtrArray*/ array) nothrow {
8452 g_ptr_array_unref(UpCast!(PtrArray*)(array));
8457 // Contains the public fields of a
8458 // <link linkend="glib-Double-ended-Queues">Queue</link>.
8459 struct Queue {
8460 GLib2.List* head, tail;
8461 uint length;
8464 // VERSION: 2.14
8465 // Removes all the elements in @queue. If queue elements contain
8466 // dynamically-allocated memory, they should be freed first.
8467 void clear()() nothrow {
8468 g_queue_clear(&this);
8471 // Unintrospectable method: copy() / g_queue_copy()
8472 // VERSION: 2.4
8473 // Copies a @queue. Note that is a shallow copy. If the elements in the
8474 // queue consist of pointers to data, the pointers are copied, but the
8475 // actual data is not.
8476 // RETURNS: A copy of @queue
8477 Queue* copy()() nothrow {
8478 return g_queue_copy(&this);
8481 // Unintrospectable method: delete_link() / g_queue_delete_link()
8482 // VERSION: 2.4
8483 // Removes @link_ from @queue and frees it.
8485 // @link_ must be part of @queue.
8486 // <link_>: a #GList link that <emphasis>must</emphasis> be part of @queue
8487 void delete_link(AT0)(AT0 /*GLib2.List*/ link_) nothrow {
8488 g_queue_delete_link(&this, UpCast!(GLib2.List*)(link_));
8491 // Unintrospectable method: find() / g_queue_find()
8492 // VERSION: 2.4
8493 // Finds the first link in @queue which contains @data.
8494 // RETURNS: The first link in @queue which contains @data.
8495 // <data>: data to find
8496 GLib2.List* find(AT0)(AT0 /*const(void)*/ data) nothrow {
8497 return g_queue_find(&this, UpCast!(const(void)*)(data));
8500 // Unintrospectable method: find_custom() / g_queue_find_custom()
8501 // VERSION: 2.4
8502 // Finds an element in a #GQueue, using a supplied function to find the
8503 // desired element. It iterates over the queue, calling the given function
8504 // which should return 0 when the desired element is found. The function
8505 // takes two gconstpointer arguments, the #GQueue element's data as the
8506 // first argument and the given user data as the second argument.
8507 // RETURNS: The found link, or %NULL if it wasn't found
8508 // <data>: user data passed to @func
8509 // <func>: a #GCompareFunc to call for each element. It should return 0 when the desired element is found
8510 GLib2.List* find_custom(AT0)(AT0 /*const(void)*/ data, CompareFunc func) nothrow {
8511 return g_queue_find_custom(&this, UpCast!(const(void)*)(data), func);
8514 // Unintrospectable method: foreach() / g_queue_foreach()
8515 // VERSION: 2.4
8516 // Calls @func for each element in the queue passing @user_data to the
8517 // function.
8518 // <func>: the function to call for each element's data
8519 // <user_data>: user data to pass to @func
8520 void foreach_(AT0)(Func func, AT0 /*void*/ user_data) nothrow {
8521 g_queue_foreach(&this, func, UpCast!(void*)(user_data));
8524 // Frees the memory allocated for the #GQueue. Only call this function if
8525 // @queue was created with g_queue_new(). If queue elements contain
8526 // dynamically-allocated memory, they should be freed first.
8528 // <note><para>
8529 // If queue elements contain dynamically-allocated memory,
8530 // you should either use g_queue_free_full() or free them manually
8531 // first.
8532 // </para></note>
8533 void free()() nothrow {
8534 g_queue_free(&this);
8537 // VERSION: 2.32
8538 // Convenience method, which frees all the memory used by a #GQueue, and
8539 // calls the specified destroy function on every element's data.
8540 // <free_func>: the function to be called to free each element's data
8541 void free_full()(DestroyNotify free_func) nothrow {
8542 g_queue_free_full(&this, free_func);
8545 // VERSION: 2.4
8546 // Returns the number of items in @queue.
8547 // RETURNS: The number of items in @queue.
8548 uint get_length()() nothrow {
8549 return g_queue_get_length(&this);
8552 // VERSION: 2.4
8553 // Returns the position of the first element in @queue which contains @data.
8554 // RETURNS: The position of the first element in @queue which contains @data, or -1 if no element in @queue contains @data.
8555 // <data>: the data to find.
8556 int index(AT0)(AT0 /*const(void)*/ data) nothrow {
8557 return g_queue_index(&this, UpCast!(const(void)*)(data));
8560 // VERSION: 2.14
8561 // A statically-allocated #GQueue must be initialized with this function
8562 // before it can be used. Alternatively you can initialize it with
8563 // #G_QUEUE_INIT. It is not necessary to initialize queues created with
8564 // g_queue_new().
8565 void init()() nothrow {
8566 g_queue_init(&this);
8569 // Unintrospectable method: insert_after() / g_queue_insert_after()
8570 // VERSION: 2.4
8571 // Inserts @data into @queue after @sibling
8573 // @sibling must be part of @queue
8574 // <sibling>: a #GList link that <emphasis>must</emphasis> be part of @queue
8575 // <data>: the data to insert
8576 void insert_after(AT0, AT1)(AT0 /*GLib2.List*/ sibling, AT1 /*void*/ data) nothrow {
8577 g_queue_insert_after(&this, UpCast!(GLib2.List*)(sibling), UpCast!(void*)(data));
8580 // Unintrospectable method: insert_before() / g_queue_insert_before()
8581 // VERSION: 2.4
8582 // Inserts @data into @queue before @sibling.
8584 // @sibling must be part of @queue.
8585 // <sibling>: a #GList link that <emphasis>must</emphasis> be part of @queue
8586 // <data>: the data to insert
8587 void insert_before(AT0, AT1)(AT0 /*GLib2.List*/ sibling, AT1 /*void*/ data) nothrow {
8588 g_queue_insert_before(&this, UpCast!(GLib2.List*)(sibling), UpCast!(void*)(data));
8591 // Unintrospectable method: insert_sorted() / g_queue_insert_sorted()
8592 // VERSION: 2.4
8593 // Inserts @data into @queue using @func to determine the new position.
8594 // <data>: the data to insert
8595 // <func>: the #GCompareDataFunc used to compare elements in the queue. It is called with two elements of the @queue and @user_data. It should return 0 if the elements are equal, a negative value if the first element comes before the second, and a positive value if the second element comes before the first.
8596 // <user_data>: user data passed to @func.
8597 void insert_sorted(AT0, AT1)(AT0 /*void*/ data, CompareDataFunc func, AT1 /*void*/ user_data) nothrow {
8598 g_queue_insert_sorted(&this, UpCast!(void*)(data), func, UpCast!(void*)(user_data));
8601 // Returns %TRUE if the queue is empty.
8602 // RETURNS: %TRUE if the queue is empty.
8603 int is_empty()() nothrow {
8604 return g_queue_is_empty(&this);
8607 // Unintrospectable method: link_index() / g_queue_link_index()
8608 // VERSION: 2.4
8609 // Returns the position of @link_ in @queue.
8611 // not part of @queue
8612 // RETURNS: The position of @link_, or -1 if the link is
8613 // <link_>: A #GList link
8614 int link_index(AT0)(AT0 /*GLib2.List*/ link_) nothrow {
8615 return g_queue_link_index(&this, UpCast!(GLib2.List*)(link_));
8618 // Unintrospectable method: peek_head() / g_queue_peek_head()
8619 // Returns the first element of the queue.
8621 // is empty.
8622 // RETURNS: the data of the first element in the queue, or %NULL if the queue
8623 void* peek_head()() nothrow {
8624 return g_queue_peek_head(&this);
8627 // Unintrospectable method: peek_head_link() / g_queue_peek_head_link()
8628 // VERSION: 2.4
8629 // Returns the first link in @queue
8630 // RETURNS: the first link in @queue, or %NULL if @queue is empty
8631 GLib2.List* peek_head_link()() nothrow {
8632 return g_queue_peek_head_link(&this);
8635 // Unintrospectable method: peek_nth() / g_queue_peek_nth()
8636 // VERSION: 2.4
8637 // Returns the @n'th element of @queue.
8639 // off the end of @queue.
8640 // RETURNS: The data for the @n'th element of @queue, or %NULL if @n is
8641 // <n>: the position of the element.
8642 void* peek_nth()(uint n) nothrow {
8643 return g_queue_peek_nth(&this, n);
8646 // Unintrospectable method: peek_nth_link() / g_queue_peek_nth_link()
8647 // VERSION: 2.4
8648 // Returns the link at the given position
8650 // end of the list
8651 // RETURNS: The link at the @n'th position, or %NULL if @n is off the
8652 // <n>: the position of the link
8653 GLib2.List* peek_nth_link()(uint n) nothrow {
8654 return g_queue_peek_nth_link(&this, n);
8657 // Unintrospectable method: peek_tail() / g_queue_peek_tail()
8658 // Returns the last element of the queue.
8660 // is empty.
8661 // RETURNS: the data of the last element in the queue, or %NULL if the queue
8662 void* peek_tail()() nothrow {
8663 return g_queue_peek_tail(&this);
8666 // Unintrospectable method: peek_tail_link() / g_queue_peek_tail_link()
8667 // VERSION: 2.4
8668 // Returns the last link @queue.
8669 // RETURNS: the last link in @queue, or %NULL if @queue is empty
8670 GLib2.List* peek_tail_link()() nothrow {
8671 return g_queue_peek_tail_link(&this);
8674 // Unintrospectable method: pop_head() / g_queue_pop_head()
8675 // Removes the first element of the queue.
8677 // is empty.
8678 // RETURNS: the data of the first element in the queue, or %NULL if the queue
8679 void* pop_head()() nothrow {
8680 return g_queue_pop_head(&this);
8683 // Unintrospectable method: pop_head_link() / g_queue_pop_head_link()
8684 // Removes the first element of the queue.
8686 // is empty.
8687 // RETURNS: the #GList element at the head of the queue, or %NULL if the queue
8688 GLib2.List* pop_head_link()() nothrow {
8689 return g_queue_pop_head_link(&this);
8692 // Unintrospectable method: pop_nth() / g_queue_pop_nth()
8693 // VERSION: 2.4
8694 // Removes the @n'th element of @queue.
8695 // RETURNS: the element's data, or %NULL if @n is off the end of @queue.
8696 // <n>: the position of the element.
8697 void* pop_nth()(uint n) nothrow {
8698 return g_queue_pop_nth(&this, n);
8701 // Unintrospectable method: pop_nth_link() / g_queue_pop_nth_link()
8702 // VERSION: 2.4
8703 // Removes and returns the link at the given position.
8704 // RETURNS: The @n'th link, or %NULL if @n is off the end of @queue.
8705 // <n>: the link's position
8706 GLib2.List* pop_nth_link()(uint n) nothrow {
8707 return g_queue_pop_nth_link(&this, n);
8710 // Unintrospectable method: pop_tail() / g_queue_pop_tail()
8711 // Removes the last element of the queue.
8713 // is empty.
8714 // RETURNS: the data of the last element in the queue, or %NULL if the queue
8715 void* pop_tail()() nothrow {
8716 return g_queue_pop_tail(&this);
8719 // Unintrospectable method: pop_tail_link() / g_queue_pop_tail_link()
8720 // Removes the last element of the queue.
8722 // is empty.
8723 // RETURNS: the #GList element at the tail of the queue, or %NULL if the queue
8724 GLib2.List* pop_tail_link()() nothrow {
8725 return g_queue_pop_tail_link(&this);
8728 // Adds a new element at the head of the queue.
8729 // <data>: the data for the new element.
8730 void push_head(AT0)(AT0 /*void*/ data) nothrow {
8731 g_queue_push_head(&this, UpCast!(void*)(data));
8734 // Unintrospectable method: push_head_link() / g_queue_push_head_link()
8735 // Adds a new element at the head of the queue.
8736 // <link_>: a single #GList element, <emphasis>not</emphasis> a list with more than one element.
8737 void push_head_link(AT0)(AT0 /*GLib2.List*/ link_) nothrow {
8738 g_queue_push_head_link(&this, UpCast!(GLib2.List*)(link_));
8741 // VERSION: 2.4
8742 // Inserts a new element into @queue at the given position
8743 // <data>: the data for the new element
8744 // <n>: the position to insert the new element. If @n is negative or larger than the number of elements in the @queue, the element is added to the end of the queue.
8745 void push_nth(AT0)(AT0 /*void*/ data, int n) nothrow {
8746 g_queue_push_nth(&this, UpCast!(void*)(data), n);
8749 // Unintrospectable method: push_nth_link() / g_queue_push_nth_link()
8750 // VERSION: 2.4
8751 // Inserts @link into @queue at the given position.
8752 // <n>: the position to insert the link. If this is negative or larger than the number of elements in @queue, the link is added to the end of @queue.
8753 // <link_>: the link to add to @queue
8754 void push_nth_link(AT0)(int n, AT0 /*GLib2.List*/ link_) nothrow {
8755 g_queue_push_nth_link(&this, n, UpCast!(GLib2.List*)(link_));
8758 // Adds a new element at the tail of the queue.
8759 // <data>: the data for the new element.
8760 void push_tail(AT0)(AT0 /*void*/ data) nothrow {
8761 g_queue_push_tail(&this, UpCast!(void*)(data));
8764 // Unintrospectable method: push_tail_link() / g_queue_push_tail_link()
8765 // Adds a new element at the tail of the queue.
8766 // <link_>: a single #GList element, <emphasis>not</emphasis> a list with more than one element.
8767 void push_tail_link(AT0)(AT0 /*GLib2.List*/ link_) nothrow {
8768 g_queue_push_tail_link(&this, UpCast!(GLib2.List*)(link_));
8771 // VERSION: 2.4
8772 // Removes the first element in @queue that contains @data.
8773 // RETURNS: %TRUE if @data was found and removed from @queue
8774 // <data>: data to remove.
8775 int remove(AT0)(AT0 /*const(void)*/ data) nothrow {
8776 return g_queue_remove(&this, UpCast!(const(void)*)(data));
8779 // VERSION: 2.4
8780 // Remove all elements whose data equals @data from @queue.
8781 // RETURNS: the number of elements removed from @queue
8782 // <data>: data to remove
8783 uint remove_all(AT0)(AT0 /*const(void)*/ data) nothrow {
8784 return g_queue_remove_all(&this, UpCast!(const(void)*)(data));
8787 // VERSION: 2.4
8788 // Reverses the order of the items in @queue.
8789 void reverse()() nothrow {
8790 g_queue_reverse(&this);
8793 // Unintrospectable method: sort() / g_queue_sort()
8794 // VERSION: 2.4
8795 // Sorts @queue using @compare_func.
8796 // <compare_func>: the #GCompareDataFunc used to sort @queue. This function is passed two elements of the queue and should return 0 if they are equal, a negative value if the first comes before the second, and a positive value if the second comes before the first.
8797 // <user_data>: user data passed to @compare_func
8798 void sort(AT0)(CompareDataFunc compare_func, AT0 /*void*/ user_data) nothrow {
8799 g_queue_sort(&this, compare_func, UpCast!(void*)(user_data));
8802 // Unintrospectable method: unlink() / g_queue_unlink()
8803 // VERSION: 2.4
8804 // Unlinks @link_ so that it will no longer be part of @queue. The link is
8805 // not freed.
8807 // @link_ must be part of @queue,
8808 // <link_>: a #GList link that <emphasis>must</emphasis> be part of @queue
8809 void unlink(AT0)(AT0 /*GLib2.List*/ link_) nothrow {
8810 g_queue_unlink(&this, UpCast!(GLib2.List*)(link_));
8813 // Unintrospectable function: new() / g_queue_new()
8814 // Creates a new #GQueue.
8815 // RETURNS: a new #GQueue.
8816 static Queue* new_()() nothrow {
8817 return g_queue_new();
8822 // The GRWLock struct is an opaque data structure to represent a
8823 // reader-writer lock. It is similar to a #GMutex in that it allows
8824 // multiple threads to coordinate access to a shared resource.
8826 // The difference to a mutex is that a reader-writer lock discriminates
8827 // between read-only ('reader') and full ('writer') access. While only
8828 // one thread at a time is allowed write access (by holding the 'writer'
8829 // lock via g_rw_lock_writer_lock()), multiple threads can gain
8830 // simultaneous read-only access (by holding the 'reader' lock via
8831 // g_rw_lock_reader_lock()).
8833 // <example>
8834 // <title>An array with access functions</title>
8835 // <programlisting>
8836 // GRWLock lock;
8837 // GPtrArray *array;
8839 // gpointer
8840 // my_array_get (guint index)
8841 // {
8842 // gpointer retval = NULL;
8844 // if (!array)
8845 // return NULL;
8847 // g_rw_lock_reader_lock (&amp;lock);
8848 // if (index &lt; array->len)
8849 // retval = g_ptr_array_index (array, index);
8850 // g_rw_lock_reader_unlock (&amp;lock);
8852 // return retval;
8853 // }
8855 // void
8856 // my_array_set (guint index, gpointer data)
8857 // {
8858 // g_rw_lock_writer_lock (&amp;lock);
8860 // if (!array)
8861 // array = g_ptr_array_new (<!-- -->);
8863 // if (index >= array->len)
8864 // g_ptr_array_set_size (array, index+1);
8865 // g_ptr_array_index (array, index) = data;
8867 // g_rw_lock_writer_unlock (&amp;lock);
8868 // }
8869 // </programlisting>
8870 // <para>
8871 // This example shows an array which can be accessed by many readers
8872 // (the <function>my_array_get()</function> function) simultaneously,
8873 // whereas the writers (the <function>my_array_set()</function>
8874 // function) will only be allowed once at a time and only if no readers
8875 // currently access the array. This is because of the potentially
8876 // dangerous resizing of the array. Using these functions is fully
8877 // multi-thread safe now.
8878 // </para>
8879 // </example>
8881 // If a #GRWLock is allocated in static storage then it can be used
8882 // without initialisation. Otherwise, you should call
8883 // g_rw_lock_init() on it and g_rw_lock_clear() when done.
8885 // A GRWLock should only be accessed with the
8886 // <function>g_rw_lock_</function> functions.
8887 struct RWLock /* Version 2.32 */ {
8888 private void* p;
8889 private uint[2] i;
8892 // Frees the resources allocated to a lock with g_rw_lock_init().
8894 // This function should not be used with a #GRWLock that has been
8895 // statically allocated.
8897 // Calling g_rw_lock_clear() when any thread holds the lock
8898 // leads to undefined behaviour.
8900 // Sine: 2.32
8901 void clear()() nothrow {
8902 g_rw_lock_clear(&this);
8905 // VERSION: 2.32
8906 // Initializes a #GRWLock so that it can be used.
8908 // This function is useful to initialize a lock that has been
8909 // allocated on the stack, or as part of a larger structure. It is not
8910 // necessary to initialise a reader-writer lock that has been statically
8911 // allocated.
8913 // |[
8914 // typedef struct {
8915 // GRWLock l;
8916 // ...
8917 // } Blob;
8919 // Blob *b;
8921 // b = g_new (Blob, 1);
8922 // g_rw_lock_init (&b->l);
8923 // ]|
8925 // To undo the effect of g_rw_lock_init() when a lock is no longer
8926 // needed, use g_rw_lock_clear().
8928 // Calling g_rw_lock_init() on an already initialized #GRWLock leads
8929 // to undefined behaviour.
8930 void init()() nothrow {
8931 g_rw_lock_init(&this);
8934 // VERSION: 2.32
8935 // Obtain a read lock on @rw_lock. If another thread currently holds
8936 // the write lock on @rw_lock or blocks waiting for it, the current
8937 // thread will block. Read locks can be taken recursively.
8939 // It is implementation-defined how many threads are allowed to
8940 // hold read locks on the same lock simultaneously.
8941 void reader_lock()() nothrow {
8942 g_rw_lock_reader_lock(&this);
8945 // VERSION: 2.32
8946 // Tries to obtain a read lock on @rw_lock and returns %TRUE if
8947 // the read lock was successfully obtained. Otherwise it
8948 // returns %FALSE.
8949 // RETURNS: %TRUE if @rw_lock could be locked
8950 int reader_trylock()() nothrow {
8951 return g_rw_lock_reader_trylock(&this);
8954 // VERSION: 2.32
8955 // Release a read lock on @rw_lock.
8957 // Calling g_rw_lock_reader_unlock() on a lock that is not held
8958 // by the current thread leads to undefined behaviour.
8959 void reader_unlock()() nothrow {
8960 g_rw_lock_reader_unlock(&this);
8963 // VERSION: 2.32
8964 // Obtain a write lock on @rw_lock. If any thread already holds
8965 // a read or write lock on @rw_lock, the current thread will block
8966 // until all other threads have dropped their locks on @rw_lock.
8967 void writer_lock()() nothrow {
8968 g_rw_lock_writer_lock(&this);
8971 // VERSION: 2.32
8972 // Tries to obtain a write lock on @rw_lock. If any other thread holds
8973 // a read or write lock on @rw_lock, it immediately returns %FALSE.
8974 // Otherwise it locks @rw_lock and returns %TRUE.
8975 // RETURNS: %TRUE if @rw_lock could be locked
8976 int writer_trylock()() nothrow {
8977 return g_rw_lock_writer_trylock(&this);
8980 // VERSION: 2.32
8981 // Release a write lock on @rw_lock.
8983 // Calling g_rw_lock_writer_unlock() on a lock that is not held
8984 // by the current thread leads to undefined behaviour.
8985 void writer_unlock()() nothrow {
8986 g_rw_lock_writer_unlock(&this);
8991 // The #GRand struct is an opaque data structure. It should only be
8992 // accessed through the <function>g_rand_*</function> functions.
8993 struct Rand {
8995 // Unintrospectable method: copy() / g_rand_copy()
8996 // VERSION: 2.4
8997 // Copies a #GRand into a new one with the same exact state as before.
8998 // This way you can take a snapshot of the random number generator for
8999 // replaying later.
9000 // RETURNS: the new #GRand.
9001 Rand* copy()() nothrow {
9002 return g_rand_copy(&this);
9005 // Returns the next random #gdouble from @rand_ equally distributed over
9006 // the range [0..1).
9007 // RETURNS: A random number.
9008 double double_()() nothrow {
9009 return g_rand_double(&this);
9012 // Returns the next random #gdouble from @rand_ equally distributed over
9013 // the range [@begin..@end).
9014 // RETURNS: A random number.
9015 // <begin>: lower closed bound of the interval.
9016 // <end>: upper open bound of the interval.
9017 double double_range()(double begin, double end) nothrow {
9018 return g_rand_double_range(&this, begin, end);
9020 // Frees the memory allocated for the #GRand.
9021 void free()() nothrow {
9022 g_rand_free(&this);
9025 // Returns the next random #guint32 from @rand_ equally distributed over
9026 // the range [0..2^32-1].
9027 // RETURNS: A random number.
9028 uint int_()() nothrow {
9029 return g_rand_int(&this);
9032 // Returns the next random #gint32 from @rand_ equally distributed over
9033 // the range [@begin..@end-1].
9034 // RETURNS: A random number.
9035 // <begin>: lower closed bound of the interval.
9036 // <end>: upper open bound of the interval.
9037 int int_range()(int begin, int end) nothrow {
9038 return g_rand_int_range(&this, begin, end);
9041 // Sets the seed for the random number generator #GRand to @seed.
9042 // <seed>: a value to reinitialize the random number generator.
9043 void set_seed()(uint seed) nothrow {
9044 g_rand_set_seed(&this, seed);
9047 // VERSION: 2.4
9048 // Initializes the random number generator by an array of
9049 // longs. Array can be of arbitrary size, though only the
9050 // first 624 values are taken. This function is useful
9051 // if you have many low entropy seeds, or if you require more then
9052 // 32bits of actual entropy for your application.
9053 // <seed>: array to initialize with
9054 // <seed_length>: length of array
9055 void set_seed_array(AT0)(AT0 /*uint*/ seed, uint seed_length) nothrow {
9056 g_rand_set_seed_array(&this, UpCast!(uint*)(seed), seed_length);
9059 // Unintrospectable function: new() / g_rand_new()
9060 // Creates a new random number generator initialized with a seed taken
9061 // either from <filename>/dev/urandom</filename> (if existing) or from
9062 // the current time (as a fallback).
9063 // RETURNS: the new #GRand.
9064 static Rand* new_()() nothrow {
9065 return g_rand_new();
9068 // Unintrospectable function: new_with_seed() / g_rand_new_with_seed()
9069 // Creates a new random number generator initialized with @seed.
9070 // RETURNS: the new #GRand.
9071 // <seed>: a value to initialize the random number generator.
9072 static Rand* new_with_seed()(uint seed) nothrow {
9073 return g_rand_new_with_seed(seed);
9076 // Unintrospectable function: new_with_seed_array() / g_rand_new_with_seed_array()
9077 // VERSION: 2.4
9078 // Creates a new random number generator initialized with @seed.
9079 // RETURNS: the new #GRand.
9080 // <seed>: an array of seeds to initialize the random number generator.
9081 // <seed_length>: an array of seeds to initialize the random number generator.
9082 static Rand* new_with_seed_array(AT0)(AT0 /*uint*/ seed, uint seed_length) nothrow {
9083 return g_rand_new_with_seed_array(UpCast!(uint*)(seed), seed_length);
9088 // The GRecMutex struct is an opaque data structure to represent a
9089 // recursive mutex. It is similar to a #GMutex with the difference
9090 // that it is possible to lock a GRecMutex multiple times in the same
9091 // thread without deadlock. When doing so, care has to be taken to
9092 // unlock the recursive mutex as often as it has been locked.
9094 // If a #GRecMutex is allocated in static storage then it can be used
9095 // without initialisation. Otherwise, you should call
9096 // g_rec_mutex_init() on it and g_rec_mutex_clear() when done.
9098 // A GRecMutex should only be accessed with the
9099 // <function>g_rec_mutex_</function> functions.
9100 struct RecMutex /* Version 2.32 */ {
9101 private void* p;
9102 private uint[2] i;
9105 // Frees the resources allocated to a recursive mutex with
9106 // g_rec_mutex_init().
9108 // This function should not be used with a #GRecMutex that has been
9109 // statically allocated.
9111 // Calling g_rec_mutex_clear() on a locked recursive mutex leads
9112 // to undefined behaviour.
9114 // Sine: 2.32
9115 void clear()() nothrow {
9116 g_rec_mutex_clear(&this);
9119 // VERSION: 2.32
9120 // Initializes a #GRecMutex so that it can be used.
9122 // This function is useful to initialize a recursive mutex
9123 // that has been allocated on the stack, or as part of a larger
9124 // structure.
9126 // It is not necessary to initialise a recursive mutex that has been
9127 // statically allocated.
9129 // |[
9130 // typedef struct {
9131 // GRecMutex m;
9132 // ...
9133 // } Blob;
9135 // Blob *b;
9137 // b = g_new (Blob, 1);
9138 // g_rec_mutex_init (&b->m);
9139 // ]|
9141 // Calling g_rec_mutex_init() on an already initialized #GRecMutex
9142 // leads to undefined behaviour.
9144 // To undo the effect of g_rec_mutex_init() when a recursive mutex
9145 // is no longer needed, use g_rec_mutex_clear().
9146 void init()() nothrow {
9147 g_rec_mutex_init(&this);
9150 // VERSION: 2.32
9151 // Locks @rec_mutex. If @rec_mutex is already locked by another
9152 // thread, the current thread will block until @rec_mutex is
9153 // unlocked by the other thread. If @rec_mutex is already locked
9154 // by the current thread, the 'lock count' of @rec_mutex is increased.
9155 // The mutex will only become available again when it is unlocked
9156 // as many times as it has been locked.
9157 void lock()() nothrow {
9158 g_rec_mutex_lock(&this);
9161 // VERSION: 2.32
9162 // Tries to lock @rec_mutex. If @rec_mutex is already locked
9163 // by another thread, it immediately returns %FALSE. Otherwise
9164 // it locks @rec_mutex and returns %TRUE.
9165 // RETURNS: %TRUE if @rec_mutex could be locked
9166 int trylock()() nothrow {
9167 return g_rec_mutex_trylock(&this);
9170 // VERSION: 2.32
9171 // Unlocks @rec_mutex. If another thread is blocked in a
9172 // g_rec_mutex_lock() call for @rec_mutex, it will become unblocked
9173 // and can lock @rec_mutex itself.
9175 // Calling g_rec_mutex_unlock() on a recursive mutex that is not
9176 // locked by the current thread leads to undefined behaviour.
9177 void unlock()() nothrow {
9178 g_rec_mutex_unlock(&this);
9183 // The <function>g_regex_*()</function> functions implement regular
9184 // expression pattern matching using syntax and semantics similar to
9185 // Perl regular expression.
9187 // Some functions accept a @start_position argument, setting it differs
9188 // from just passing over a shortened string and setting #G_REGEX_MATCH_NOTBOL
9189 // in the case of a pattern that begins with any kind of lookbehind assertion.
9190 // For example, consider the pattern "\Biss\B" which finds occurrences of "iss"
9191 // in the middle of words. ("\B" matches only if the current position in the
9192 // subject is not a word boundary.) When applied to the string "Mississipi"
9193 // from the fourth byte, namely "issipi", it does not match, because "\B" is
9194 // always false at the start of the subject, which is deemed to be a word
9195 // boundary. However, if the entire string is passed , but with
9196 // @start_position set to 4, it finds the second occurrence of "iss" because
9197 // it is able to look behind the starting point to discover that it is
9198 // preceded by a letter.
9200 // Note that, unless you set the #G_REGEX_RAW flag, all the strings passed
9201 // to these functions must be encoded in UTF-8. The lengths and the positions
9202 // inside the strings are in bytes and not in characters, so, for instance,
9203 // "\xc3\xa0" (i.e. "&agrave;") is two bytes long but it is treated as a
9204 // single character. If you set #G_REGEX_RAW the strings can be non-valid
9205 // UTF-8 strings and a byte is treated as a character, so "\xc3\xa0" is two
9206 // bytes and two characters long.
9208 // When matching a pattern, "\n" matches only against a "\n" character in
9209 // the string, and "\r" matches only a "\r" character. To match any newline
9210 // sequence use "\R". This particular group matches either the two-character
9211 // sequence CR + LF ("\r\n"), or one of the single characters LF (linefeed,
9212 // U+000A, "\n"), VT vertical tab, U+000B, "\v"), FF (formfeed, U+000C, "\f"),
9213 // CR (carriage return, U+000D, "\r"), NEL (next line, U+0085), LS (line
9214 // separator, U+2028), or PS (paragraph separator, U+2029).
9216 // The behaviour of the dot, circumflex, and dollar metacharacters are
9217 // affected by newline characters, the default is to recognize any newline
9218 // character (the same characters recognized by "\R"). This can be changed
9219 // with #G_REGEX_NEWLINE_CR, #G_REGEX_NEWLINE_LF and #G_REGEX_NEWLINE_CRLF
9220 // compile options, and with #G_REGEX_MATCH_NEWLINE_ANY,
9221 // #G_REGEX_MATCH_NEWLINE_CR, #G_REGEX_MATCH_NEWLINE_LF and
9222 // #G_REGEX_MATCH_NEWLINE_CRLF match options. These settings are also
9223 // relevant when compiling a pattern if #G_REGEX_EXTENDED is set, and an
9224 // unescaped "#" outside a character class is encountered. This indicates
9225 // a comment that lasts until after the next newline.
9227 // Creating and manipulating the same #GRegex structure from different
9228 // threads is not a problem as #GRegex does not modify its internal
9229 // state between creation and destruction, on the other hand #GMatchInfo
9230 // is not threadsafe.
9232 // The regular expressions low-level functionalities are obtained through
9233 // the excellent <ulink url="http://www.pcre.org/">PCRE</ulink> library
9234 // written by Philip Hazel.
9235 struct Regex /* Version 2.14 */ {
9237 // VERSION: 2.14
9238 // Compiles the regular expression to an internal form, and does
9239 // the initial setup of the #GRegex structure.
9241 // are done with it
9242 // RETURNS: a #GRegex structure. Call g_regex_unref() when you
9243 // <pattern>: the regular expression
9244 // <compile_options>: compile options for the regular expression, or 0
9245 // <match_options>: match options for the regular expression, or 0
9246 static Regex* /*new*/ new_(AT0, AT1)(AT0 /*char*/ pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options, AT1 /*GLib2.Error**/ error=null) nothrow {
9247 return g_regex_new(toCString!(char*)(pattern), compile_options, match_options, UpCast!(GLib2.Error**)(error));
9249 static auto opCall(AT0, AT1)(AT0 /*char*/ pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options, AT1 /*GLib2.Error**/ error=null) {
9250 return g_regex_new(toCString!(char*)(pattern), compile_options, match_options, UpCast!(GLib2.Error**)(error));
9253 // VERSION: 2.14
9254 // Returns the number of capturing subpatterns in the pattern.
9255 // RETURNS: the number of capturing subpatterns
9256 int get_capture_count()() nothrow {
9257 return g_regex_get_capture_count(&this);
9260 // VERSION: 2.26
9261 // Returns the compile options that @regex was created with.
9262 // RETURNS: flags from #GRegexCompileFlags
9263 RegexCompileFlags get_compile_flags()() nothrow {
9264 return g_regex_get_compile_flags(&this);
9267 // VERSION: 2.26
9268 // Returns the match options that @regex was created with.
9269 // RETURNS: flags from #GRegexMatchFlags
9270 RegexMatchFlags get_match_flags()() nothrow {
9271 return g_regex_get_match_flags(&this);
9274 // VERSION: 2.14
9275 // Returns the number of the highest back reference
9276 // in the pattern, or 0 if the pattern does not contain
9277 // back references.
9278 // RETURNS: the number of the highest back reference
9279 int get_max_backref()() nothrow {
9280 return g_regex_get_max_backref(&this);
9283 // VERSION: 2.14
9284 // Gets the pattern string associated with @regex, i.e. a copy of
9285 // the string passed to g_regex_new().
9286 // RETURNS: the pattern of @regex
9287 char* get_pattern()() nothrow {
9288 return g_regex_get_pattern(&this);
9291 // VERSION: 2.14
9292 // Retrieves the number of the subexpression named @name.
9294 // does not exists
9295 // RETURNS: The number of the subexpression or -1 if @name
9296 // <name>: name of the subexpression
9297 int get_string_number(AT0)(AT0 /*char*/ name) nothrow {
9298 return g_regex_get_string_number(&this, toCString!(char*)(name));
9301 // VERSION: 2.14
9302 // Scans for a match in string for the pattern in @regex.
9303 // The @match_options are combined with the match options specified
9304 // when the @regex structure was created, letting you have more
9305 // flexibility in reusing #GRegex structures.
9307 // A #GMatchInfo structure, used to get information on the match,
9308 // is stored in @match_info if not %NULL. Note that if @match_info
9309 // is not %NULL then it is created even if the function returns %FALSE,
9310 // i.e. you must free it regardless if regular expression actually matched.
9312 // To retrieve all the non-overlapping matches of the pattern in
9313 // string you can use g_match_info_next().
9315 // |[
9316 // static void
9317 // print_uppercase_words (const gchar *string)
9318 // {
9319 // /&ast; Print all uppercase-only words. &ast;/
9320 // GRegex *regex;
9321 // GMatchInfo *match_info;
9322 // &nbsp;
9323 // regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
9324 // g_regex_match (regex, string, 0, &amp;match_info);
9325 // while (g_match_info_matches (match_info))
9326 // {
9327 // gchar *word = g_match_info_fetch (match_info, 0);
9328 // g_print ("Found: %s\n", word);
9329 // g_free (word);
9330 // g_match_info_next (match_info, NULL);
9331 // }
9332 // g_match_info_free (match_info);
9333 // g_regex_unref (regex);
9334 // }
9335 // ]|
9337 // @string is not copied and is used in #GMatchInfo internally. If
9338 // you use any #GMatchInfo method (except g_match_info_free()) after
9339 // freeing or modifying @string then the behaviour is undefined.
9340 // RETURNS: %TRUE is the string matched, %FALSE otherwise
9341 // <string>: the string to scan for matches
9342 // <match_options>: match options
9343 // <match_info>: pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
9344 int match(AT0, AT1)(AT0 /*char*/ string_, RegexMatchFlags match_options, /*out*/ AT1 /*MatchInfo**/ match_info=null) nothrow {
9345 return g_regex_match(&this, toCString!(char*)(string_), match_options, UpCast!(MatchInfo**)(match_info));
9348 // VERSION: 2.14
9349 // Using the standard algorithm for regular expression matching only
9350 // the longest match in the string is retrieved. This function uses
9351 // a different algorithm so it can retrieve all the possible matches.
9352 // For more documentation see g_regex_match_all_full().
9354 // A #GMatchInfo structure, used to get information on the match, is
9355 // stored in @match_info if not %NULL. Note that if @match_info is
9356 // not %NULL then it is created even if the function returns %FALSE,
9357 // i.e. you must free it regardless if regular expression actually
9358 // matched.
9360 // @string is not copied and is used in #GMatchInfo internally. If
9361 // you use any #GMatchInfo method (except g_match_info_free()) after
9362 // freeing or modifying @string then the behaviour is undefined.
9363 // RETURNS: %TRUE is the string matched, %FALSE otherwise
9364 // <string>: the string to scan for matches
9365 // <match_options>: match options
9366 // <match_info>: pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
9367 int match_all(AT0, AT1)(AT0 /*char*/ string_, RegexMatchFlags match_options, /*out*/ AT1 /*MatchInfo**/ match_info=null) nothrow {
9368 return g_regex_match_all(&this, toCString!(char*)(string_), match_options, UpCast!(MatchInfo**)(match_info));
9371 // VERSION: 2.14
9372 // Using the standard algorithm for regular expression matching only
9373 // the longest match in the string is retrieved, it is not possible
9374 // to obtain all the available matches. For instance matching
9375 // "&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
9376 // you get "&lt;a&gt; &lt;b&gt; &lt;c&gt;".
9378 // This function uses a different algorithm (called DFA, i.e. deterministic
9379 // finite automaton), so it can retrieve all the possible matches, all
9380 // starting at the same point in the string. For instance matching
9381 // "&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
9382 // you would obtain three matches: "&lt;a&gt; &lt;b&gt; &lt;c&gt;",
9383 // "&lt;a&gt; &lt;b&gt;" and "&lt;a&gt;".
9385 // The number of matched strings is retrieved using
9386 // g_match_info_get_match_count(). To obtain the matched strings and
9387 // their position you can use, respectively, g_match_info_fetch() and
9388 // g_match_info_fetch_pos(). Note that the strings are returned in
9389 // reverse order of length; that is, the longest matching string is
9390 // given first.
9392 // Note that the DFA algorithm is slower than the standard one and it
9393 // is not able to capture substrings, so backreferences do not work.
9395 // Setting @start_position differs from just passing over a shortened
9396 // string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
9397 // that begins with any kind of lookbehind assertion, such as "\b".
9399 // A #GMatchInfo structure, used to get information on the match, is
9400 // stored in @match_info if not %NULL. Note that if @match_info is
9401 // not %NULL then it is created even if the function returns %FALSE,
9402 // i.e. you must free it regardless if regular expression actually
9403 // matched.
9405 // @string is not copied and is used in #GMatchInfo internally. If
9406 // you use any #GMatchInfo method (except g_match_info_free()) after
9407 // freeing or modifying @string then the behaviour is undefined.
9408 // RETURNS: %TRUE is the string matched, %FALSE otherwise
9409 // <string>: the string to scan for matches
9410 // <string_len>: the length of @string, or -1 if @string is nul-terminated
9411 // <start_position>: starting index of the string to match
9412 // <match_options>: match options
9413 // <match_info>: pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
9414 int match_all_full(AT0, AT1, AT2)(AT0 /*char*/ string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, /*out*/ AT1 /*MatchInfo**/ match_info, AT2 /*GLib2.Error**/ error=null) nothrow {
9415 return g_regex_match_all_full(&this, toCString!(char*)(string_), string_len, start_position, match_options, UpCast!(MatchInfo**)(match_info), UpCast!(GLib2.Error**)(error));
9418 // VERSION: 2.14
9419 // Scans for a match in string for the pattern in @regex.
9420 // The @match_options are combined with the match options specified
9421 // when the @regex structure was created, letting you have more
9422 // flexibility in reusing #GRegex structures.
9424 // Setting @start_position differs from just passing over a shortened
9425 // string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
9426 // that begins with any kind of lookbehind assertion, such as "\b".
9428 // A #GMatchInfo structure, used to get information on the match, is
9429 // stored in @match_info if not %NULL. Note that if @match_info is
9430 // not %NULL then it is created even if the function returns %FALSE,
9431 // i.e. you must free it regardless if regular expression actually
9432 // matched.
9434 // @string is not copied and is used in #GMatchInfo internally. If
9435 // you use any #GMatchInfo method (except g_match_info_free()) after
9436 // freeing or modifying @string then the behaviour is undefined.
9438 // To retrieve all the non-overlapping matches of the pattern in
9439 // string you can use g_match_info_next().
9441 // |[
9442 // static void
9443 // print_uppercase_words (const gchar *string)
9444 // {
9445 // /&ast; Print all uppercase-only words. &ast;/
9446 // GRegex *regex;
9447 // GMatchInfo *match_info;
9448 // GError *error = NULL;
9449 // &nbsp;
9450 // regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
9451 // g_regex_match_full (regex, string, -1, 0, 0, &amp;match_info, &amp;error);
9452 // while (g_match_info_matches (match_info))
9453 // {
9454 // gchar *word = g_match_info_fetch (match_info, 0);
9455 // g_print ("Found: %s\n", word);
9456 // g_free (word);
9457 // g_match_info_next (match_info, &amp;error);
9458 // }
9459 // g_match_info_free (match_info);
9460 // g_regex_unref (regex);
9461 // if (error != NULL)
9462 // {
9463 // g_printerr ("Error while matching: %s\n", error->message);
9464 // g_error_free (error);
9465 // }
9466 // }
9467 // ]|
9468 // RETURNS: %TRUE is the string matched, %FALSE otherwise
9469 // <string>: the string to scan for matches
9470 // <string_len>: the length of @string, or -1 if @string is nul-terminated
9471 // <start_position>: starting index of the string to match
9472 // <match_options>: match options
9473 // <match_info>: pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
9474 int match_full(AT0, AT1, AT2)(AT0 /*char*/ string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, /*out*/ AT1 /*MatchInfo**/ match_info, AT2 /*GLib2.Error**/ error=null) nothrow {
9475 return g_regex_match_full(&this, toCString!(char*)(string_), string_len, start_position, match_options, UpCast!(MatchInfo**)(match_info), UpCast!(GLib2.Error**)(error));
9478 // VERSION: 2.14
9479 // Increases reference count of @regex by 1.
9480 // RETURNS: @regex
9481 Regex* /*new*/ ref_()() nothrow {
9482 return g_regex_ref(&this);
9485 // VERSION: 2.14
9486 // Replaces all occurrences of the pattern in @regex with the
9487 // replacement text. Backreferences of the form '\number' or
9488 // '\g&lt;number&gt;' in the replacement text are interpolated by the
9489 // number-th captured subexpression of the match, '\g&lt;name&gt;' refers
9490 // to the captured subexpression with the given name. '\0' refers to the
9491 // complete match, but '\0' followed by a number is the octal representation
9492 // of a character. To include a literal '\' in the replacement, write '\\'.
9493 // There are also escapes that changes the case of the following text:
9495 // <variablelist>
9496 // <varlistentry><term>\l</term>
9497 // <listitem>
9498 // <para>Convert to lower case the next character</para>
9499 // </listitem>
9500 // </varlistentry>
9501 // <varlistentry><term>\u</term>
9502 // <listitem>
9503 // <para>Convert to upper case the next character</para>
9504 // </listitem>
9505 // </varlistentry>
9506 // <varlistentry><term>\L</term>
9507 // <listitem>
9508 // <para>Convert to lower case till \E</para>
9509 // </listitem>
9510 // </varlistentry>
9511 // <varlistentry><term>\U</term>
9512 // <listitem>
9513 // <para>Convert to upper case till \E</para>
9514 // </listitem>
9515 // </varlistentry>
9516 // <varlistentry><term>\E</term>
9517 // <listitem>
9518 // <para>End case modification</para>
9519 // </listitem>
9520 // </varlistentry>
9521 // </variablelist>
9523 // If you do not need to use backreferences use g_regex_replace_literal().
9525 // The @replacement string must be UTF-8 encoded even if #G_REGEX_RAW was
9526 // passed to g_regex_new(). If you want to use not UTF-8 encoded stings
9527 // you can use g_regex_replace_literal().
9529 // Setting @start_position differs from just passing over a shortened
9530 // string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern that
9531 // begins with any kind of lookbehind assertion, such as "\b".
9532 // RETURNS: a newly allocated string containing the replacements
9533 // <string>: the string to perform matches against
9534 // <string_len>: the length of @string, or -1 if @string is nul-terminated
9535 // <start_position>: starting index of the string to match
9536 // <replacement>: text to replace each match with
9537 // <match_options>: options for the match
9538 char* /*new*/ replace(AT0, AT1, AT2)(AT0 /*char*/ string_, ssize_t string_len, int start_position, AT1 /*char*/ replacement, RegexMatchFlags match_options, AT2 /*GLib2.Error**/ error=null) nothrow {
9539 return g_regex_replace(&this, toCString!(char*)(string_), string_len, start_position, toCString!(char*)(replacement), match_options, UpCast!(GLib2.Error**)(error));
9542 // Unintrospectable method: replace_eval() / g_regex_replace_eval()
9543 // VERSION: 2.14
9544 // Replaces occurrences of the pattern in regex with the output of
9545 // @eval for that occurrence.
9547 // Setting @start_position differs from just passing over a shortened
9548 // string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
9549 // that begins with any kind of lookbehind assertion, such as "\b".
9551 // The following example uses g_regex_replace_eval() to replace multiple
9552 // strings at once:
9553 // |[
9554 // static gboolean
9555 // eval_cb (const GMatchInfo *info,
9556 // GString *res,
9557 // gpointer data)
9558 // {
9559 // gchar *match;
9560 // gchar *r;
9562 // match = g_match_info_fetch (info, 0);
9563 // r = g_hash_table_lookup ((GHashTable *)data, match);
9564 // g_string_append (res, r);
9565 // g_free (match);
9567 // return FALSE;
9568 // }
9570 // /&ast; ... &ast;/
9572 // GRegex *reg;
9573 // GHashTable *h;
9574 // gchar *res;
9576 // h = g_hash_table_new (g_str_hash, g_str_equal);
9578 // g_hash_table_insert (h, "1", "ONE");
9579 // g_hash_table_insert (h, "2", "TWO");
9580 // g_hash_table_insert (h, "3", "THREE");
9581 // g_hash_table_insert (h, "4", "FOUR");
9583 // reg = g_regex_new ("1|2|3|4", 0, 0, NULL);
9584 // res = g_regex_replace_eval (reg, text, -1, 0, 0, eval_cb, h, NULL);
9585 // g_hash_table_destroy (h);
9587 // /&ast; ... &ast;/
9588 // ]|
9589 // RETURNS: a newly allocated string containing the replacements
9590 // <string>: string to perform matches against
9591 // <string_len>: the length of @string, or -1 if @string is nul-terminated
9592 // <start_position>: starting index of the string to match
9593 // <match_options>: options for the match
9594 // <eval>: a function to call for each match
9595 // <user_data>: user data to pass to the function
9596 char* /*new*/ replace_eval(AT0, AT1, AT2)(AT0 /*char*/ string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, RegexEvalCallback eval, AT1 /*void*/ user_data, AT2 /*GLib2.Error**/ error=null) nothrow {
9597 return g_regex_replace_eval(&this, toCString!(char*)(string_), string_len, start_position, match_options, eval, UpCast!(void*)(user_data), UpCast!(GLib2.Error**)(error));
9600 // VERSION: 2.14
9601 // Replaces all occurrences of the pattern in @regex with the
9602 // replacement text. @replacement is replaced literally, to
9603 // include backreferences use g_regex_replace().
9605 // Setting @start_position differs from just passing over a
9606 // shortened string and setting #G_REGEX_MATCH_NOTBOL in the
9607 // case of a pattern that begins with any kind of lookbehind
9608 // assertion, such as "\b".
9609 // RETURNS: a newly allocated string containing the replacements
9610 // <string>: the string to perform matches against
9611 // <string_len>: the length of @string, or -1 if @string is nul-terminated
9612 // <start_position>: starting index of the string to match
9613 // <replacement>: text to replace each match with
9614 // <match_options>: options for the match
9615 char* /*new*/ replace_literal(AT0, AT1, AT2)(AT0 /*char*/ string_, ssize_t string_len, int start_position, AT1 /*char*/ replacement, RegexMatchFlags match_options, AT2 /*GLib2.Error**/ error=null) nothrow {
9616 return g_regex_replace_literal(&this, toCString!(char*)(string_), string_len, start_position, toCString!(char*)(replacement), match_options, UpCast!(GLib2.Error**)(error));
9619 // Unintrospectable method: split() / g_regex_split()
9620 // VERSION: 2.14
9621 // Breaks the string on the pattern, and returns an array of the tokens.
9622 // If the pattern contains capturing parentheses, then the text for each
9623 // of the substrings will also be returned. If the pattern does not match
9624 // anywhere in the string, then the whole string is returned as the first
9625 // token.
9627 // As a special case, the result of splitting the empty string "" is an
9628 // empty vector, not a vector containing a single string. The reason for
9629 // this special case is that being able to represent a empty vector is
9630 // typically more useful than consistent handling of empty elements. If
9631 // you do need to represent empty elements, you'll need to check for the
9632 // empty string before calling this function.
9634 // A pattern that can match empty strings splits @string into separate
9635 // characters wherever it matches the empty string between characters.
9636 // For example splitting "ab c" using as a separator "\s*", you will get
9637 // "a", "b" and "c".
9638 // RETURNS: a %NULL-terminated gchar ** array. Free it using g_strfreev()
9639 // <string>: the string to split with the pattern
9640 // <match_options>: match time option flags
9641 char** split(AT0)(AT0 /*char*/ string_, RegexMatchFlags match_options) nothrow {
9642 return g_regex_split(&this, toCString!(char*)(string_), match_options);
9645 // Unintrospectable method: split_full() / g_regex_split_full()
9646 // VERSION: 2.14
9647 // Breaks the string on the pattern, and returns an array of the tokens.
9648 // If the pattern contains capturing parentheses, then the text for each
9649 // of the substrings will also be returned. If the pattern does not match
9650 // anywhere in the string, then the whole string is returned as the first
9651 // token.
9653 // As a special case, the result of splitting the empty string "" is an
9654 // empty vector, not a vector containing a single string. The reason for
9655 // this special case is that being able to represent a empty vector is
9656 // typically more useful than consistent handling of empty elements. If
9657 // you do need to represent empty elements, you'll need to check for the
9658 // empty string before calling this function.
9660 // A pattern that can match empty strings splits @string into separate
9661 // characters wherever it matches the empty string between characters.
9662 // For example splitting "ab c" using as a separator "\s*", you will get
9663 // "a", "b" and "c".
9665 // Setting @start_position differs from just passing over a shortened
9666 // string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
9667 // that begins with any kind of lookbehind assertion, such as "\b".
9668 // RETURNS: a %NULL-terminated gchar ** array. Free it using g_strfreev()
9669 // <string>: the string to split with the pattern
9670 // <string_len>: the length of @string, or -1 if @string is nul-terminated
9671 // <start_position>: starting index of the string to match
9672 // <match_options>: match time option flags
9673 // <max_tokens>: the maximum number of tokens to split @string into. If this is less than 1, the string is split completely
9674 char** split_full(AT0, AT1)(AT0 /*char*/ string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, int max_tokens, AT1 /*GLib2.Error**/ error=null) nothrow {
9675 return g_regex_split_full(&this, toCString!(char*)(string_), string_len, start_position, match_options, max_tokens, UpCast!(GLib2.Error**)(error));
9678 // VERSION: 2.14
9679 // Decreases reference count of @regex by 1. When reference count drops
9680 // to zero, it frees all the memory associated with the regex structure.
9681 void unref()() nothrow {
9682 g_regex_unref(&this);
9685 // VERSION: 2.14
9686 // Checks whether @replacement is a valid replacement string
9687 // (see g_regex_replace()), i.e. that all escape sequences in
9688 // it are valid.
9690 // If @has_references is not %NULL then @replacement is checked
9691 // for pattern references. For instance, replacement text 'foo\n'
9692 // does not contain references and may be evaluated without information
9693 // about actual match, but '\0\1' (whole match followed by first
9694 // subpattern) requires valid #GMatchInfo object.
9695 // RETURNS: whether @replacement is a valid replacement string
9696 // <replacement>: the replacement string
9697 // <has_references>: location to store information about references in @replacement or %NULL
9698 static int check_replacement(AT0, AT1)(AT0 /*char*/ replacement, /*out*/ int* has_references, AT1 /*GLib2.Error**/ error=null) nothrow {
9699 return g_regex_check_replacement(toCString!(char*)(replacement), has_references, UpCast!(GLib2.Error**)(error));
9701 static Quark error_quark()() nothrow {
9702 return g_regex_error_quark();
9705 // VERSION: 2.30
9706 // Escapes the nul characters in @string to "\x00". It can be used
9707 // to compile a regex with embedded nul characters.
9709 // For completeness, @length can be -1 for a nul-terminated string.
9710 // In this case the output string will be of course equal to @string.
9711 // RETURNS: a newly-allocated escaped string
9712 // <string>: the string to escape
9713 // <length>: the length of @string
9714 static char* /*new*/ escape_nul(AT0)(AT0 /*char*/ string_, int length) nothrow {
9715 return g_regex_escape_nul(toCString!(char*)(string_), length);
9718 // VERSION: 2.14
9719 // Escapes the special characters used for regular expressions
9720 // in @string, for instance "a.b*c" becomes "a\.b\*c". This
9721 // function is useful to dynamically generate regular expressions.
9723 // @string can contain nul characters that are replaced with "\0",
9724 // in this case remember to specify the correct length of @string
9725 // in @length.
9726 // RETURNS: a newly-allocated escaped string
9727 // <string>: the string to escape
9728 // <length>: the length of @string, or -1 if @string is nul-terminated
9729 static char* /*new*/ escape_string(AT0)(AT0 /*char*/ string_, int length) nothrow {
9730 return g_regex_escape_string(toCString!(char*)(string_), length);
9733 // VERSION: 2.14
9734 // Scans for a match in @string for @pattern.
9736 // This function is equivalent to g_regex_match() but it does not
9737 // require to compile the pattern with g_regex_new(), avoiding some
9738 // lines of code when you need just to do a match without extracting
9739 // substrings, capture counts, and so on.
9741 // If this function is to be called on the same @pattern more than
9742 // once, it's more efficient to compile the pattern once with
9743 // g_regex_new() and then use g_regex_match().
9744 // RETURNS: %TRUE if the string matched, %FALSE otherwise
9745 // <pattern>: the regular expression
9746 // <string>: the string to scan for matches
9747 // <compile_options>: compile options for the regular expression, or 0
9748 // <match_options>: match options, or 0
9749 static int match_simple(AT0, AT1)(AT0 /*char*/ pattern, AT1 /*char*/ string_, RegexCompileFlags compile_options, RegexMatchFlags match_options) nothrow {
9750 return g_regex_match_simple(toCString!(char*)(pattern), toCString!(char*)(string_), compile_options, match_options);
9753 // Unintrospectable function: split_simple() / g_regex_split_simple()
9754 // VERSION: 2.14
9755 // Breaks the string on the pattern, and returns an array of
9756 // the tokens. If the pattern contains capturing parentheses,
9757 // then the text for each of the substrings will also be returned.
9758 // If the pattern does not match anywhere in the string, then the
9759 // whole string is returned as the first token.
9761 // This function is equivalent to g_regex_split() but it does
9762 // not require to compile the pattern with g_regex_new(), avoiding
9763 // some lines of code when you need just to do a split without
9764 // extracting substrings, capture counts, and so on.
9766 // If this function is to be called on the same @pattern more than
9767 // once, it's more efficient to compile the pattern once with
9768 // g_regex_new() and then use g_regex_split().
9770 // As a special case, the result of splitting the empty string ""
9771 // is an empty vector, not a vector containing a single string.
9772 // The reason for this special case is that being able to represent
9773 // a empty vector is typically more useful than consistent handling
9774 // of empty elements. If you do need to represent empty elements,
9775 // you'll need to check for the empty string before calling this
9776 // function.
9778 // A pattern that can match empty strings splits @string into
9779 // separate characters wherever it matches the empty string between
9780 // characters. For example splitting "ab c" using as a separator
9781 // "\s*", you will get "a", "b" and "c".
9782 // RETURNS: a %NULL-terminated array of strings. Free it using g_strfreev()
9783 // <pattern>: the regular expression
9784 // <string>: the string to scan for matches
9785 // <compile_options>: compile options for the regular expression, or 0
9786 // <match_options>: match options, or 0
9787 static char** split_simple(AT0, AT1)(AT0 /*char*/ pattern, AT1 /*char*/ string_, RegexCompileFlags compile_options, RegexMatchFlags match_options) nothrow {
9788 return g_regex_split_simple(toCString!(char*)(pattern), toCString!(char*)(string_), compile_options, match_options);
9792 // Flags specifying compile-time options.
9793 enum RegexCompileFlags /* Version 2.14 */ {
9794 CASELESS = 1,
9795 MULTILINE = 2,
9796 DOTALL = 4,
9797 EXTENDED = 8,
9798 ANCHORED = 16,
9799 DOLLAR_ENDONLY = 32,
9800 UNGREEDY = 512,
9801 RAW = 2048,
9802 NO_AUTO_CAPTURE = 4096,
9803 OPTIMIZE = 8192,
9804 DUPNAMES = 524288,
9805 NEWLINE_CR = 1048576,
9806 NEWLINE_LF = 2097152,
9807 NEWLINE_CRLF = 3145728
9809 // Error codes returned by regular expressions functions.
9810 enum RegexError /* Version 2.14 */ {
9811 COMPILE = 0,
9812 OPTIMIZE = 1,
9813 REPLACE = 2,
9814 MATCH = 3,
9815 INTERNAL = 4,
9816 STRAY_BACKSLASH = 101,
9817 MISSING_CONTROL_CHAR = 102,
9818 UNRECOGNIZED_ESCAPE = 103,
9819 QUANTIFIERS_OUT_OF_ORDER = 104,
9820 QUANTIFIER_TOO_BIG = 105,
9821 UNTERMINATED_CHARACTER_CLASS = 106,
9822 INVALID_ESCAPE_IN_CHARACTER_CLASS = 107,
9823 RANGE_OUT_OF_ORDER = 108,
9824 NOTHING_TO_REPEAT = 109,
9825 UNRECOGNIZED_CHARACTER = 112,
9826 POSIX_NAMED_CLASS_OUTSIDE_CLASS = 113,
9827 UNMATCHED_PARENTHESIS = 114,
9828 INEXISTENT_SUBPATTERN_REFERENCE = 115,
9829 UNTERMINATED_COMMENT = 118,
9830 EXPRESSION_TOO_LARGE = 120,
9831 MEMORY_ERROR = 121,
9832 VARIABLE_LENGTH_LOOKBEHIND = 125,
9833 MALFORMED_CONDITION = 126,
9834 TOO_MANY_CONDITIONAL_BRANCHES = 127,
9835 ASSERTION_EXPECTED = 128,
9836 UNKNOWN_POSIX_CLASS_NAME = 130,
9837 POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED = 131,
9838 HEX_CODE_TOO_LARGE = 134,
9839 INVALID_CONDITION = 135,
9840 SINGLE_BYTE_MATCH_IN_LOOKBEHIND = 136,
9841 INFINITE_LOOP = 140,
9842 MISSING_SUBPATTERN_NAME_TERMINATOR = 142,
9843 DUPLICATE_SUBPATTERN_NAME = 143,
9844 MALFORMED_PROPERTY = 146,
9845 UNKNOWN_PROPERTY = 147,
9846 SUBPATTERN_NAME_TOO_LONG = 148,
9847 TOO_MANY_SUBPATTERNS = 149,
9848 INVALID_OCTAL_VALUE = 151,
9849 TOO_MANY_BRANCHES_IN_DEFINE = 154,
9850 DEFINE_REPETION = 155,
9851 INCONSISTENT_NEWLINE_OPTIONS = 156,
9852 MISSING_BACK_REFERENCE = 157
9855 // VERSION: 2.14
9856 // Specifies the type of the function passed to g_regex_replace_eval().
9857 // It is called for each occurrence of the pattern in the string passed
9858 // to g_regex_replace_eval(), and it should append the replacement to
9859 // @result.
9860 // RETURNS: %FALSE to continue the replacement process, %TRUE to stop it
9861 // <match_info>: the #GMatchInfo generated by the match. Use g_match_info_get_regex() and g_match_info_get_string() if you need the #GRegex or the matched string.
9862 // <result>: a #GString containing the new string
9863 // <user_data>: user data passed to g_regex_replace_eval()
9864 extern (C) alias int function (MatchInfo* match_info, String* result, void* user_data) nothrow RegexEvalCallback;
9866 // Flags specifying match-time options.
9867 enum RegexMatchFlags /* Version 2.14 */ {
9868 ANCHORED = 16,
9869 NOTBOL = 128,
9870 NOTEOL = 256,
9871 NOTEMPTY = 1024,
9872 PARTIAL = 32768,
9873 NEWLINE_CR = 1048576,
9874 NEWLINE_LF = 2097152,
9875 NEWLINE_CRLF = 3145728,
9876 NEWLINE_ANY = 4194304
9878 enum int SEARCHPATH_SEPARATOR = 59;
9879 enum SEARCHPATH_SEPARATOR_S = ";";
9880 enum int SIZEOF_LONG = 4;
9881 enum int SIZEOF_SIZE_T = 4;
9882 enum int SIZEOF_VOID_P = 4;
9884 // The #GSList struct is used for each element in the singly-linked
9885 // list.
9886 struct SList {
9887 void* data;
9888 GLib2.SList* next;
9891 // Unintrospectable function: alloc() / g_slist_alloc()
9892 // Allocates space for one #GSList element. It is called by the
9893 // g_slist_append(), g_slist_prepend(), g_slist_insert() and
9894 // g_slist_insert_sorted() functions and so is rarely used on its own.
9895 static GLib2.SList* alloc()() nothrow {
9896 return g_slist_alloc();
9899 // Unintrospectable function: append() / g_slist_append()
9900 // Adds a new element on to the end of the list.
9902 // <note><para>
9903 // The return value is the new start of the list, which may
9904 // have changed, so make sure you store the new value.
9905 // </para></note>
9907 // <note><para>
9908 // Note that g_slist_append() has to traverse the entire list
9909 // to find the end, which is inefficient when adding multiple
9910 // elements. A common idiom to avoid the inefficiency is to prepend
9911 // the elements and reverse the list when all elements have been added.
9912 // </para></note>
9914 // |[
9915 // /&ast; Notice that these are initialized to the empty list. &ast;/
9916 // GSList *list = NULL, *number_list = NULL;
9918 // /&ast; This is a list of strings. &ast;/
9919 // list = g_slist_append (list, "first");
9920 // list = g_slist_append (list, "second");
9922 // /&ast; This is a list of integers. &ast;/
9923 // number_list = g_slist_append (number_list, GINT_TO_POINTER (27));
9924 // number_list = g_slist_append (number_list, GINT_TO_POINTER (14));
9925 // ]|
9926 // RETURNS: the new start of the #GSList
9927 // <list>: a #GSList
9928 // <data>: the data for the new element
9929 static GLib2.SList* append(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*void*/ data) nothrow {
9930 return g_slist_append(UpCast!(GLib2.SList*)(list), UpCast!(void*)(data));
9933 // Unintrospectable function: concat() / g_slist_concat()
9934 // Adds the second #GSList onto the end of the first #GSList.
9935 // Note that the elements of the second #GSList are not copied.
9936 // They are used directly.
9937 // RETURNS: the start of the new #GSList
9938 // <list1>: a #GSList
9939 // <list2>: the #GSList to add to the end of the first #GSList
9940 static GLib2.SList* concat(AT0, AT1)(AT0 /*GLib2.SList*/ list1, AT1 /*GLib2.SList*/ list2) nothrow {
9941 return g_slist_concat(UpCast!(GLib2.SList*)(list1), UpCast!(GLib2.SList*)(list2));
9944 // Unintrospectable function: copy() / g_slist_copy()
9945 // Copies a #GSList.
9947 // <note><para>
9948 // Note that this is a "shallow" copy. If the list elements
9949 // consist of pointers to data, the pointers are copied but
9950 // the actual data isn't.
9951 // </para></note>
9952 // RETURNS: a copy of @list
9953 // <list>: a #GSList
9954 static GLib2.SList* copy(AT0)(AT0 /*GLib2.SList*/ list) nothrow {
9955 return g_slist_copy(UpCast!(GLib2.SList*)(list));
9958 // Unintrospectable function: delete_link() / g_slist_delete_link()
9959 // Removes the node link_ from the list and frees it.
9960 // Compare this to g_slist_remove_link() which removes the node
9961 // without freeing it.
9962 // RETURNS: the new head of @list
9963 // <list>: a #GSList
9964 // <link_>: node to delete
9965 static GLib2.SList* delete_link(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*GLib2.SList*/ link_) nothrow {
9966 return g_slist_delete_link(UpCast!(GLib2.SList*)(list), UpCast!(GLib2.SList*)(link_));
9969 // Unintrospectable function: find() / g_slist_find()
9970 // Finds the element in a #GSList which
9971 // contains the given data.
9973 // or %NULL if it is not found
9974 // RETURNS: the found #GSList element,
9975 // <list>: a #GSList
9976 // <data>: the element data to find
9977 static GLib2.SList* find(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*const(void)*/ data) nothrow {
9978 return g_slist_find(UpCast!(GLib2.SList*)(list), UpCast!(const(void)*)(data));
9981 // Unintrospectable function: find_custom() / g_slist_find_custom()
9982 // Finds an element in a #GSList, using a supplied function to
9983 // find the desired element. It iterates over the list, calling
9984 // the given function which should return 0 when the desired
9985 // element is found. The function takes two #gconstpointer arguments,
9986 // the #GSList element's data as the first argument and the
9987 // given user data.
9988 // RETURNS: the found #GSList element, or %NULL if it is not found
9989 // <list>: a #GSList
9990 // <data>: user data passed to the function
9991 // <func>: the function to call for each element. It should return 0 when the desired element is found
9992 static GLib2.SList* find_custom(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*const(void)*/ data, CompareFunc func) nothrow {
9993 return g_slist_find_custom(UpCast!(GLib2.SList*)(list), UpCast!(const(void)*)(data), func);
9996 // Unintrospectable function: foreach() / g_slist_foreach()
9997 // Calls a function for each element of a #GSList.
9998 // <list>: a #GSList
9999 // <func>: the function to call with each element's data
10000 // <user_data>: user data to pass to the function
10001 static void foreach_(AT0, AT1)(AT0 /*GLib2.SList*/ list, Func func, AT1 /*void*/ user_data) nothrow {
10002 g_slist_foreach(UpCast!(GLib2.SList*)(list), func, UpCast!(void*)(user_data));
10005 // Unintrospectable function: free() / g_slist_free()
10006 // Frees all of the memory used by a #GSList.
10007 // The freed elements are returned to the slice allocator.
10009 // <note><para>
10010 // If list elements contain dynamically-allocated memory,
10011 // you should either use g_slist_free_full() or free them manually
10012 // first.
10013 // </para></note>
10014 // <list>: a #GSList
10015 static void free(AT0)(AT0 /*GLib2.SList*/ list) nothrow {
10016 g_slist_free(UpCast!(GLib2.SList*)(list));
10019 // Unintrospectable function: free_1() / g_slist_free_1()
10020 // Frees one #GSList element.
10021 // It is usually used after g_slist_remove_link().
10022 // <list>: a #GSList element
10023 static void free_1(AT0)(AT0 /*GLib2.SList*/ list) nothrow {
10024 g_slist_free_1(UpCast!(GLib2.SList*)(list));
10027 // Unintrospectable function: free_full() / g_slist_free_full()
10028 // VERSION: 2.28
10029 // Convenience method, which frees all the memory used by a #GSList, and
10030 // calls the specified destroy function on every element's data.
10031 // <list>: a pointer to a #GSList
10032 // <free_func>: the function to be called to free each element's data
10033 static void free_full(AT0)(AT0 /*GLib2.SList*/ list, DestroyNotify free_func) nothrow {
10034 g_slist_free_full(UpCast!(GLib2.SList*)(list), free_func);
10037 // Unintrospectable function: index() / g_slist_index()
10038 // Gets the position of the element containing
10039 // the given data (starting from 0).
10041 // or -1 if the data is not found
10042 // RETURNS: the index of the element containing the data,
10043 // <list>: a #GSList
10044 // <data>: the data to find
10045 static int index(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*const(void)*/ data) nothrow {
10046 return g_slist_index(UpCast!(GLib2.SList*)(list), UpCast!(const(void)*)(data));
10049 // Unintrospectable function: insert() / g_slist_insert()
10050 // Inserts a new element into the list at the given position.
10051 // RETURNS: the new start of the #GSList
10052 // <list>: a #GSList
10053 // <data>: the data for the new element
10054 // <position>: the position to insert the element. If this is negative, or is larger than the number of elements in the list, the new element is added on to the end of the list.
10055 static GLib2.SList* insert(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*void*/ data, int position) nothrow {
10056 return g_slist_insert(UpCast!(GLib2.SList*)(list), UpCast!(void*)(data), position);
10059 // Unintrospectable function: insert_before() / g_slist_insert_before()
10060 // Inserts a node before @sibling containing @data.
10061 // RETURNS: the new head of the list.
10062 // <slist>: a #GSList
10063 // <sibling>: node to insert @data before
10064 // <data>: data to put in the newly-inserted node
10065 static GLib2.SList* insert_before(AT0, AT1, AT2)(AT0 /*GLib2.SList*/ slist, AT1 /*GLib2.SList*/ sibling, AT2 /*void*/ data) nothrow {
10066 return g_slist_insert_before(UpCast!(GLib2.SList*)(slist), UpCast!(GLib2.SList*)(sibling), UpCast!(void*)(data));
10069 // Unintrospectable function: insert_sorted() / g_slist_insert_sorted()
10070 // Inserts a new element into the list, using the given
10071 // comparison function to determine its position.
10072 // RETURNS: the new start of the #GSList
10073 // <list>: a #GSList
10074 // <data>: the data for the new element
10075 // <func>: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
10076 static GLib2.SList* insert_sorted(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*void*/ data, CompareFunc func) nothrow {
10077 return g_slist_insert_sorted(UpCast!(GLib2.SList*)(list), UpCast!(void*)(data), func);
10080 // Unintrospectable function: insert_sorted_with_data() / g_slist_insert_sorted_with_data()
10081 // VERSION: 2.10
10082 // Inserts a new element into the list, using the given
10083 // comparison function to determine its position.
10084 // RETURNS: the new start of the #GSList
10085 // <list>: a #GSList
10086 // <data>: the data for the new element
10087 // <func>: the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.
10088 // <user_data>: data to pass to comparison function
10089 static GLib2.SList* insert_sorted_with_data(AT0, AT1, AT2)(AT0 /*GLib2.SList*/ list, AT1 /*void*/ data, CompareDataFunc func, AT2 /*void*/ user_data) nothrow {
10090 return g_slist_insert_sorted_with_data(UpCast!(GLib2.SList*)(list), UpCast!(void*)(data), func, UpCast!(void*)(user_data));
10093 // Unintrospectable function: last() / g_slist_last()
10094 // Gets the last element in a #GSList.
10096 // <note><para>
10097 // This function iterates over the whole list.
10098 // </para></note>
10100 // or %NULL if the #GSList has no elements
10101 // RETURNS: the last element in the #GSList,
10102 // <list>: a #GSList
10103 static GLib2.SList* last(AT0)(AT0 /*GLib2.SList*/ list) nothrow {
10104 return g_slist_last(UpCast!(GLib2.SList*)(list));
10107 // Unintrospectable function: length() / g_slist_length()
10108 // Gets the number of elements in a #GSList.
10110 // <note><para>
10111 // This function iterates over the whole list to
10112 // count its elements.
10113 // </para></note>
10114 // RETURNS: the number of elements in the #GSList
10115 // <list>: a #GSList
10116 static uint length(AT0)(AT0 /*GLib2.SList*/ list) nothrow {
10117 return g_slist_length(UpCast!(GLib2.SList*)(list));
10120 // Unintrospectable function: nth() / g_slist_nth()
10121 // Gets the element at the given position in a #GSList.
10123 // the end of the #GSList
10124 // RETURNS: the element, or %NULL if the position is off
10125 // <list>: a #GSList
10126 // <n>: the position of the element, counting from 0
10127 static GLib2.SList* nth(AT0)(AT0 /*GLib2.SList*/ list, uint n) nothrow {
10128 return g_slist_nth(UpCast!(GLib2.SList*)(list), n);
10131 // Unintrospectable function: nth_data() / g_slist_nth_data()
10132 // Gets the data of the element at the given position.
10134 // is off the end of the #GSList
10135 // RETURNS: the element's data, or %NULL if the position
10136 // <list>: a #GSList
10137 // <n>: the position of the element
10138 static void* nth_data(AT0)(AT0 /*GLib2.SList*/ list, uint n) nothrow {
10139 return g_slist_nth_data(UpCast!(GLib2.SList*)(list), n);
10142 // Unintrospectable function: position() / g_slist_position()
10143 // Gets the position of the given element
10144 // in the #GSList (starting from 0).
10146 // or -1 if the element is not found
10147 // RETURNS: the position of the element in the #GSList,
10148 // <list>: a #GSList
10149 // <llink>: an element in the #GSList
10150 static int position(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*GLib2.SList*/ llink) nothrow {
10151 return g_slist_position(UpCast!(GLib2.SList*)(list), UpCast!(GLib2.SList*)(llink));
10154 // Unintrospectable function: prepend() / g_slist_prepend()
10155 // Adds a new element on to the start of the list.
10157 // <note><para>
10158 // The return value is the new start of the list, which
10159 // may have changed, so make sure you store the new value.
10160 // </para></note>
10162 // |[
10163 // /&ast; Notice that it is initialized to the empty list. &ast;/
10164 // GSList *list = NULL;
10165 // list = g_slist_prepend (list, "last");
10166 // list = g_slist_prepend (list, "first");
10167 // ]|
10168 // RETURNS: the new start of the #GSList
10169 // <list>: a #GSList
10170 // <data>: the data for the new element
10171 static GLib2.SList* prepend(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*void*/ data) nothrow {
10172 return g_slist_prepend(UpCast!(GLib2.SList*)(list), UpCast!(void*)(data));
10175 // Unintrospectable function: remove() / g_slist_remove()
10176 // Removes an element from a #GSList.
10177 // If two elements contain the same data, only the first is removed.
10178 // If none of the elements contain the data, the #GSList is unchanged.
10179 // RETURNS: the new start of the #GSList
10180 // <list>: a #GSList
10181 // <data>: the data of the element to remove
10182 static GLib2.SList* remove(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*const(void)*/ data) nothrow {
10183 return g_slist_remove(UpCast!(GLib2.SList*)(list), UpCast!(const(void)*)(data));
10186 // Unintrospectable function: remove_all() / g_slist_remove_all()
10187 // Removes all list nodes with data equal to @data.
10188 // Returns the new head of the list. Contrast with
10189 // g_slist_remove() which removes only the first node
10190 // matching the given data.
10191 // RETURNS: new head of @list
10192 // <list>: a #GSList
10193 // <data>: data to remove
10194 static GLib2.SList* remove_all(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*const(void)*/ data) nothrow {
10195 return g_slist_remove_all(UpCast!(GLib2.SList*)(list), UpCast!(const(void)*)(data));
10198 // Unintrospectable function: remove_link() / g_slist_remove_link()
10199 // Removes an element from a #GSList, without
10200 // freeing the element. The removed element's next
10201 // link is set to %NULL, so that it becomes a
10202 // self-contained list with one element.
10203 // RETURNS: the new start of the #GSList, without the element
10204 // <list>: a #GSList
10205 // <link_>: an element in the #GSList
10206 static GLib2.SList* remove_link(AT0, AT1)(AT0 /*GLib2.SList*/ list, AT1 /*GLib2.SList*/ link_) nothrow {
10207 return g_slist_remove_link(UpCast!(GLib2.SList*)(list), UpCast!(GLib2.SList*)(link_));
10210 // Unintrospectable function: reverse() / g_slist_reverse()
10211 // Reverses a #GSList.
10212 // RETURNS: the start of the reversed #GSList
10213 // <list>: a #GSList
10214 static GLib2.SList* reverse(AT0)(AT0 /*GLib2.SList*/ list) nothrow {
10215 return g_slist_reverse(UpCast!(GLib2.SList*)(list));
10218 // Unintrospectable function: sort() / g_slist_sort()
10219 // Sorts a #GSList using the given comparison function.
10220 // RETURNS: the start of the sorted #GSList
10221 // <list>: a #GSList
10222 // <compare_func>: the comparison function used to sort the #GSList. This function is passed the data from 2 elements of the #GSList and should return 0 if they are equal, a negative value if the first element comes before the second, or a positive value if the first element comes after the second.
10223 static GLib2.SList* sort(AT0)(AT0 /*GLib2.SList*/ list, CompareFunc compare_func) nothrow {
10224 return g_slist_sort(UpCast!(GLib2.SList*)(list), compare_func);
10227 // Unintrospectable function: sort_with_data() / g_slist_sort_with_data()
10228 // Like g_slist_sort(), but the sort function accepts a user data argument.
10229 // RETURNS: new head of the list
10230 // <list>: a #GSList
10231 // <compare_func>: comparison function
10232 // <user_data>: data to pass to comparison function
10233 static GLib2.SList* sort_with_data(AT0, AT1)(AT0 /*GLib2.SList*/ list, CompareDataFunc compare_func, AT1 /*void*/ user_data) nothrow {
10234 return g_slist_sort_with_data(UpCast!(GLib2.SList*)(list), compare_func, UpCast!(void*)(user_data));
10238 enum double SQRT2 = 1.414214;
10239 enum STR_DELIMITERS = "_-|> <.";
10240 enum int SYSDEF_AF_INET = 2;
10241 enum int SYSDEF_AF_INET6 = 10;
10242 enum int SYSDEF_AF_UNIX = 1;
10243 enum int SYSDEF_MSG_DONTROUTE = 4;
10244 enum int SYSDEF_MSG_OOB = 1;
10245 enum int SYSDEF_MSG_PEEK = 2;
10247 // The data structure representing a lexical scanner.
10249 // You should set @input_name after creating the scanner, since
10250 // it is used by the default message handler when displaying
10251 // warnings and errors. If you are scanning a file, the filename
10252 // would be a good choice.
10254 // The @user_data and @max_parse_errors fields are not used.
10255 // If you need to associate extra data with the scanner you
10256 // can place them here.
10258 // If you want to use your own message handler you can set the
10259 // @msg_handler field. The type of the message handler function
10260 // is declared by #GScannerMsgFunc.
10261 struct Scanner {
10262 void* user_data;
10263 uint max_parse_errors, parse_errors;
10264 char* input_name;
10265 Data* qdata;
10266 ScannerConfig* config;
10267 TokenType token;
10268 TokenValue value;
10269 uint line, position;
10270 TokenType next_token;
10271 TokenValue next_value;
10272 uint next_line, next_position;
10273 private GLib2.HashTable* symbol_table;
10274 private int input_fd;
10275 private char* text, text_end, buffer;
10276 private uint scope_id;
10277 ScannerMsgFunc msg_handler;
10280 // Returns the current line in the input stream (counting
10281 // from 1). This is the line of the last token parsed via
10282 // g_scanner_get_next_token().
10283 // RETURNS: the current line
10284 uint cur_line()() nothrow {
10285 return g_scanner_cur_line(&this);
10288 // Returns the current position in the current line (counting
10289 // from 0). This is the position of the last token parsed via
10290 // g_scanner_get_next_token().
10291 // RETURNS: the current position on the line
10292 uint cur_position()() nothrow {
10293 return g_scanner_cur_position(&this);
10296 // Gets the current token type. This is simply the @token
10297 // field in the #GScanner structure.
10298 // RETURNS: the current token type
10299 TokenType cur_token()() nothrow {
10300 return g_scanner_cur_token(&this);
10303 // Unintrospectable method: cur_value() / g_scanner_cur_value()
10304 // Gets the current token value. This is simply the @value
10305 // field in the #GScanner structure.
10306 // RETURNS: the current token value
10307 TokenValue cur_value()() nothrow {
10308 return g_scanner_cur_value(&this);
10310 // Frees all memory used by the #GScanner.
10311 void destroy()() nothrow {
10312 g_scanner_destroy(&this);
10315 // Returns %TRUE if the scanner has reached the end of
10316 // the file or text buffer.
10318 // the file or text buffer
10319 // RETURNS: %TRUE if the scanner has reached the end of
10320 int eof()() nothrow {
10321 return g_scanner_eof(&this);
10324 // Unintrospectable method: error() / g_scanner_error()
10325 // Outputs an error message, via the #GScanner message handler.
10326 // <format>: the message format. See the printf() documentation
10327 /+ Not available -- variadic methods unsupported - use the C function directly.
10328 alias g_scanner_error error; // Variadic
10331 // Parses the next token just like g_scanner_peek_next_token()
10332 // and also removes it from the input stream. The token data is
10333 // placed in the @token, @value, @line, and @position fields of
10334 // the #GScanner structure.
10335 // RETURNS: the type of the token
10336 TokenType get_next_token()() nothrow {
10337 return g_scanner_get_next_token(&this);
10340 // Prepares to scan a file.
10341 // <input_fd>: a file descriptor
10342 void input_file()(int input_fd) nothrow {
10343 g_scanner_input_file(&this, input_fd);
10346 // Prepares to scan a text buffer.
10347 // <text>: the text buffer to scan
10348 // <text_len>: the length of the text buffer
10349 void input_text(AT0)(AT0 /*char*/ text, uint text_len) nothrow {
10350 g_scanner_input_text(&this, toCString!(char*)(text), text_len);
10353 // Unintrospectable method: lookup_symbol() / g_scanner_lookup_symbol()
10354 // Looks up a symbol in the current scope and return its value.
10355 // If the symbol is not bound in the current scope, %NULL is
10356 // returned.
10358 // if @symbol is not bound in the current scope
10359 // RETURNS: the value of @symbol in the current scope, or %NULL
10360 // <symbol>: the symbol to look up
10361 void* lookup_symbol(AT0)(AT0 /*char*/ symbol) nothrow {
10362 return g_scanner_lookup_symbol(&this, toCString!(char*)(symbol));
10365 // Parses the next token, without removing it from the input stream.
10366 // The token data is placed in the @next_token, @next_value, @next_line,
10367 // and @next_position fields of the #GScanner structure.
10369 // Note that, while the token is not removed from the input stream
10370 // (i.e. the next call to g_scanner_get_next_token() will return the
10371 // same token), it will not be reevaluated. This can lead to surprising
10372 // results when changing scope or the scanner configuration after peeking
10373 // the next token. Getting the next token after switching the scope or
10374 // configuration will return whatever was peeked before, regardless of
10375 // any symbols that may have been added or removed in the new scope.
10376 // RETURNS: the type of the token
10377 TokenType peek_next_token()() nothrow {
10378 return g_scanner_peek_next_token(&this);
10381 // Adds a symbol to the given scope.
10382 // <scope_id>: the scope id
10383 // <symbol>: the symbol to add
10384 // <value>: the value of the symbol
10385 void scope_add_symbol(AT0, AT1)(uint scope_id, AT0 /*char*/ symbol, AT1 /*void*/ value) nothrow {
10386 g_scanner_scope_add_symbol(&this, scope_id, toCString!(char*)(symbol), UpCast!(void*)(value));
10389 // Unintrospectable method: scope_foreach_symbol() / g_scanner_scope_foreach_symbol()
10390 // Calls the given function for each of the symbol/value pairs
10391 // in the given scope of the #GScanner. The function is passed
10392 // the symbol and value of each pair, and the given @user_data
10393 // parameter.
10394 // <scope_id>: the scope id
10395 // <func>: the function to call for each symbol/value pair
10396 // <user_data>: user data to pass to the function
10397 void scope_foreach_symbol(AT0)(uint scope_id, HFunc func, AT0 /*void*/ user_data) nothrow {
10398 g_scanner_scope_foreach_symbol(&this, scope_id, func, UpCast!(void*)(user_data));
10401 // Unintrospectable method: scope_lookup_symbol() / g_scanner_scope_lookup_symbol()
10402 // Looks up a symbol in a scope and return its value. If the
10403 // symbol is not bound in the scope, %NULL is returned.
10405 // if @symbol is not bound in the given scope.
10406 // RETURNS: the value of @symbol in the given scope, or %NULL
10407 // <scope_id>: the scope id
10408 // <symbol>: the symbol to look up
10409 void* scope_lookup_symbol(AT0)(uint scope_id, AT0 /*char*/ symbol) nothrow {
10410 return g_scanner_scope_lookup_symbol(&this, scope_id, toCString!(char*)(symbol));
10413 // Removes a symbol from a scope.
10414 // <scope_id>: the scope id
10415 // <symbol>: the symbol to remove
10416 void scope_remove_symbol(AT0)(uint scope_id, AT0 /*char*/ symbol) nothrow {
10417 g_scanner_scope_remove_symbol(&this, scope_id, toCString!(char*)(symbol));
10420 // Sets the current scope.
10421 // RETURNS: the old scope id
10422 // <scope_id>: the new scope id
10423 uint set_scope()(uint scope_id) nothrow {
10424 return g_scanner_set_scope(&this, scope_id);
10427 // Rewinds the filedescriptor to the current buffer position
10428 // and blows the file read ahead buffer. This is useful for
10429 // third party uses of the scanners filedescriptor, which hooks
10430 // onto the current scanning position.
10431 void sync_file_offset()() nothrow {
10432 g_scanner_sync_file_offset(&this);
10435 // Outputs a message through the scanner's msg_handler,
10436 // resulting from an unexpected token in the input stream.
10437 // Note that you should not call g_scanner_peek_next_token()
10438 // followed by g_scanner_unexp_token() without an intermediate
10439 // call to g_scanner_get_next_token(), as g_scanner_unexp_token()
10440 // evaluates the scanner's current token (not the peeked token)
10441 // to construct part of the message.
10442 // <expected_token>: the expected token
10443 // <identifier_spec>: a string describing how the scanner's user refers to identifiers (%NULL defaults to "identifier"). This is used if @expected_token is %G_TOKEN_IDENTIFIER or %G_TOKEN_IDENTIFIER_NULL.
10444 // <symbol_spec>: a string describing how the scanner's user refers to symbols (%NULL defaults to "symbol"). This is used if @expected_token is %G_TOKEN_SYMBOL or any token value greater than %G_TOKEN_LAST.
10445 // <symbol_name>: the name of the symbol, if the scanner's current token is a symbol.
10446 // <message>: a message string to output at the end of the warning/error, or %NULL.
10447 // <is_error>: if %TRUE it is output as an error. If %FALSE it is output as a warning.
10448 void unexp_token(AT0, AT1, AT2, AT3)(TokenType expected_token, AT0 /*char*/ identifier_spec, AT1 /*char*/ symbol_spec, AT2 /*char*/ symbol_name, AT3 /*char*/ message, int is_error) nothrow {
10449 g_scanner_unexp_token(&this, expected_token, toCString!(char*)(identifier_spec), toCString!(char*)(symbol_spec), toCString!(char*)(symbol_name), toCString!(char*)(message), is_error);
10452 // Unintrospectable method: warn() / g_scanner_warn()
10453 // Outputs a warning message, via the #GScanner message handler.
10454 // <format>: the message format. See the printf() documentation
10455 /+ Not available -- variadic methods unsupported - use the C function directly.
10456 alias g_scanner_warn warn; // Variadic
10459 // Unintrospectable function: new() / g_scanner_new()
10460 // Creates a new #GScanner.
10462 // The @config_templ structure specifies the initial settings
10463 // of the scanner, which are copied into the #GScanner
10464 // @config field. If you pass %NULL then the default settings
10465 // are used.
10466 // RETURNS: the new #GScanner
10467 // <config_templ>: the initial scanner settings
10468 static Scanner* new_(AT0)(AT0 /*ScannerConfig*/ config_templ) nothrow {
10469 return g_scanner_new(UpCast!(ScannerConfig*)(config_templ));
10474 // Specifies the #GScanner parser configuration. Most settings can
10475 // be changed during the parsing phase and will affect the lexical
10476 // parsing of the next unpeeked token.
10477 struct ScannerConfig {
10478 char* cset_skip_characters, cset_identifier_first, cset_identifier_nth, cpair_comment_single;
10479 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
10480 uint, "case_sensitive", 1,
10481 uint, "skip_comment_multi", 1,
10482 uint, "skip_comment_single", 1,
10483 uint, "scan_comment_multi", 1,
10484 uint, "scan_identifier", 1,
10485 uint, "scan_identifier_1char", 1,
10486 uint, "scan_identifier_NULL", 1,
10487 uint, "scan_symbols", 1,
10488 uint, "scan_binary", 1,
10489 uint, "scan_octal", 1,
10490 uint, "scan_float", 1,
10491 uint, "scan_hex", 1,
10492 uint, "scan_hex_dollar", 1,
10493 uint, "scan_string_sq", 1,
10494 uint, "scan_string_dq", 1,
10495 uint, "numbers_2_int", 1,
10496 uint, "int_2_float", 1,
10497 uint, "identifier_2_string", 1,
10498 uint, "char_2_token", 1,
10499 uint, "symbol_2_token", 1,
10500 uint, "scope_0_fallback", 1,
10501 uint, "store_int64", 1,
10502 uint, "__dummy32A", 10));
10503 private uint padding_dummy;
10507 // Specifies the type of the message handler function.
10508 // <scanner>: a #GScanner
10509 // <message>: the message
10510 // <error>: %TRUE if the message signals an error, %FALSE if it signals a warning.
10511 extern (C) alias void function (Scanner* scanner, char* message, int error) nothrow ScannerMsgFunc;
10514 // An enumeration specifying the base position for a
10515 // g_io_channel_seek_position() operation.
10516 enum SeekType {
10517 CUR = 0,
10518 SET = 1,
10519 END = 2
10522 // The #GSequence struct is an opaque data type representing a
10523 // <link linkend="glib-Sequences">Sequence</link> data type.
10524 struct Sequence {
10526 // Unintrospectable method: append() / g_sequence_append()
10527 // VERSION: 2.14
10528 // Adds a new item to the end of @seq.
10529 // RETURNS: an iterator pointing to the new item
10530 // <data>: the data for the new item
10531 SequenceIter* append(AT0)(AT0 /*void*/ data) nothrow {
10532 return g_sequence_append(&this, UpCast!(void*)(data));
10535 // Unintrospectable method: foreach() / g_sequence_foreach()
10536 // VERSION: 2.14
10537 // Calls @func for each item in the sequence passing @user_data
10538 // to the function.
10539 // <func>: the function to call for each item in @seq
10540 // <user_data>: user data passed to @func
10541 void foreach_(AT0)(Func func, AT0 /*void*/ user_data) nothrow {
10542 g_sequence_foreach(&this, func, UpCast!(void*)(user_data));
10545 // VERSION: 2.14
10546 // Frees the memory allocated for @seq. If @seq has a data destroy
10547 // function associated with it, that function is called on all items in
10548 // @seq.
10549 void free()() nothrow {
10550 g_sequence_free(&this);
10553 // Unintrospectable method: get_begin_iter() / g_sequence_get_begin_iter()
10554 // VERSION: 2.14
10555 // Returns the begin iterator for @seq.
10556 // RETURNS: the begin iterator for @seq.
10557 SequenceIter* get_begin_iter()() nothrow {
10558 return g_sequence_get_begin_iter(&this);
10561 // Unintrospectable method: get_end_iter() / g_sequence_get_end_iter()
10562 // VERSION: 2.14
10563 // Returns the end iterator for @seg
10564 // RETURNS: the end iterator for @seq
10565 SequenceIter* get_end_iter()() nothrow {
10566 return g_sequence_get_end_iter(&this);
10569 // Unintrospectable method: get_iter_at_pos() / g_sequence_get_iter_at_pos()
10570 // VERSION: 2.14
10571 // Returns the iterator at position @pos. If @pos is negative or larger
10572 // than the number of items in @seq, the end iterator is returned.
10573 // RETURNS: The #GSequenceIter at position @pos
10574 // <pos>: a position in @seq, or -1 for the end.
10575 SequenceIter* get_iter_at_pos()(int pos) nothrow {
10576 return g_sequence_get_iter_at_pos(&this, pos);
10579 // VERSION: 2.14
10580 // Returns the length of @seq
10581 // RETURNS: the length of @seq
10582 int get_length()() nothrow {
10583 return g_sequence_get_length(&this);
10586 // Unintrospectable method: insert_sorted() / g_sequence_insert_sorted()
10587 // VERSION: 2.14
10588 // Inserts @data into @sequence using @func to determine the new
10589 // position. The sequence must already be sorted according to @cmp_func;
10590 // otherwise the new position of @data is undefined.
10592 // @cmp_func is called with two items of the @seq and @user_data.
10593 // It should return 0 if the items are equal, a negative value
10594 // if the first item comes before the second, and a positive value
10595 // if the second item comes before the first.
10596 // RETURNS: a #GSequenceIter pointing to the new item.
10597 // <data>: the data to insert
10598 // <cmp_func>: the function used to compare items in the sequence
10599 // <cmp_data>: user data passed to @cmp_func.
10600 SequenceIter* insert_sorted(AT0, AT1)(AT0 /*void*/ data, CompareDataFunc cmp_func, AT1 /*void*/ cmp_data) nothrow {
10601 return g_sequence_insert_sorted(&this, UpCast!(void*)(data), cmp_func, UpCast!(void*)(cmp_data));
10604 // Unintrospectable method: insert_sorted_iter() / g_sequence_insert_sorted_iter()
10605 // VERSION: 2.14
10606 // Like g_sequence_insert_sorted(), but uses
10607 // a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
10608 // the compare function.
10610 // @iter_cmp is called with two iterators pointing into @seq.
10611 // It should return 0 if the iterators are equal, a negative
10612 // value if the first iterator comes before the second, and a
10613 // positive value if the second iterator comes before the first.
10615 // It is called with two iterators pointing into @seq. It should
10616 // return 0 if the iterators are equal, a negative value if the
10617 // first iterator comes before the second, and a positive value
10618 // if the second iterator comes before the first.
10619 // RETURNS: a #GSequenceIter pointing to the new item
10620 // <data>: data for the new item
10621 // <iter_cmp>: the function used to compare iterators in the sequence
10622 // <cmp_data>: user data passed to @cmp_func
10623 SequenceIter* insert_sorted_iter(AT0, AT1)(AT0 /*void*/ data, SequenceIterCompareFunc iter_cmp, AT1 /*void*/ cmp_data) nothrow {
10624 return g_sequence_insert_sorted_iter(&this, UpCast!(void*)(data), iter_cmp, UpCast!(void*)(cmp_data));
10627 // Unintrospectable method: lookup() / g_sequence_lookup()
10628 // VERSION: 2.28
10629 // Returns an iterator pointing to the position of the first item found
10630 // equal to @data according to @cmp_func and @cmp_data. If more than one
10631 // item is equal, it is not guaranteed that it is the first which is
10632 // returned. In that case, you can use g_sequence_iter_next() and
10633 // g_sequence_iter_prev() to get others.
10635 // @cmp_func is called with two items of the @seq and @user_data.
10636 // It should return 0 if the items are equal, a negative value if
10637 // the first item comes before the second, and a positive value if
10638 // the second item comes before the first.
10640 // <note><para>
10641 // This function will fail if the data contained in the sequence is
10642 // unsorted. Use g_sequence_insert_sorted() or
10643 // g_sequence_insert_sorted_iter() to add data to your sequence or, if
10644 // you want to add a large amount of data, call g_sequence_sort() after
10645 // doing unsorted insertions.
10646 // </para></note>
10648 // first item found equal to @data according to @cmp_func and @cmp_data.
10649 // RETURNS: an #GSequenceIter pointing to the position of the
10650 // <data>: data to lookup
10651 // <cmp_func>: the function used to compare items in the sequence
10652 // <cmp_data>: user data passed to @cmp_func.
10653 SequenceIter* lookup(AT0, AT1)(AT0 /*void*/ data, CompareDataFunc cmp_func, AT1 /*void*/ cmp_data) nothrow {
10654 return g_sequence_lookup(&this, UpCast!(void*)(data), cmp_func, UpCast!(void*)(cmp_data));
10657 // Unintrospectable method: lookup_iter() / g_sequence_lookup_iter()
10658 // VERSION: 2.28
10659 // Like g_sequence_lookup(), but uses a #GSequenceIterCompareFunc
10660 // instead of a #GCompareDataFunc as the compare function.
10662 // @iter_cmp is called with two iterators pointing into @seq.
10663 // It should return 0 if the iterators are equal, a negative value
10664 // if the first iterator comes before the second, and a positive
10665 // value if the second iterator comes before the first.
10667 // <note><para>
10668 // This function will fail if the data contained in the sequence is
10669 // unsorted. Use g_sequence_insert_sorted() or
10670 // g_sequence_insert_sorted_iter() to add data to your sequence or, if
10671 // you want to add a large amount of data, call g_sequence_sort() after
10672 // doing unsorted insertions.
10673 // </para></note>
10675 // the first item found equal to @data according to @cmp_func
10676 // and @cmp_data.
10677 // RETURNS: an #GSequenceIter pointing to the position of
10678 // <data>: data to lookup
10679 // <iter_cmp>: the function used to compare iterators in the sequence
10680 // <cmp_data>: user data passed to @iter_cmp
10681 SequenceIter* lookup_iter(AT0, AT1)(AT0 /*void*/ data, SequenceIterCompareFunc iter_cmp, AT1 /*void*/ cmp_data) nothrow {
10682 return g_sequence_lookup_iter(&this, UpCast!(void*)(data), iter_cmp, UpCast!(void*)(cmp_data));
10685 // Unintrospectable method: prepend() / g_sequence_prepend()
10686 // VERSION: 2.14
10687 // Adds a new item to the front of @seq
10688 // RETURNS: an iterator pointing to the new item
10689 // <data>: the data for the new item
10690 SequenceIter* prepend(AT0)(AT0 /*void*/ data) nothrow {
10691 return g_sequence_prepend(&this, UpCast!(void*)(data));
10694 // Unintrospectable method: search() / g_sequence_search()
10695 // VERSION: 2.14
10696 // Returns an iterator pointing to the position where @data would
10697 // be inserted according to @cmp_func and @cmp_data.
10699 // @cmp_func is called with two items of the @seq and @user_data.
10700 // It should return 0 if the items are equal, a negative value if
10701 // the first item comes before the second, and a positive value if
10702 // the second item comes before the first.
10704 // If you are simply searching for an existing element of the sequence,
10705 // consider using g_sequence_lookup().
10707 // <note><para>
10708 // This function will fail if the data contained in the sequence is
10709 // unsorted. Use g_sequence_insert_sorted() or
10710 // g_sequence_insert_sorted_iter() to add data to your sequence or, if
10711 // you want to add a large amount of data, call g_sequence_sort() after
10712 // doing unsorted insertions.
10713 // </para></note>
10715 // would have been inserted according to @cmp_func and @cmp_data.
10716 // RETURNS: an #GSequenceIter pointing to the position where @data
10717 // <data>: data for the new item
10718 // <cmp_func>: the function used to compare items in the sequence
10719 // <cmp_data>: user data passed to @cmp_func.
10720 SequenceIter* search(AT0, AT1)(AT0 /*void*/ data, CompareDataFunc cmp_func, AT1 /*void*/ cmp_data) nothrow {
10721 return g_sequence_search(&this, UpCast!(void*)(data), cmp_func, UpCast!(void*)(cmp_data));
10724 // Unintrospectable method: search_iter() / g_sequence_search_iter()
10725 // VERSION: 2.14
10726 // Like g_sequence_search(), but uses a #GSequenceIterCompareFunc
10727 // instead of a #GCompareDataFunc as the compare function.
10729 // @iter_cmp is called with two iterators pointing into @seq.
10730 // It should return 0 if the iterators are equal, a negative value
10731 // if the first iterator comes before the second, and a positive
10732 // value if the second iterator comes before the first.
10734 // If you are simply searching for an existing element of the sequence,
10735 // consider using g_sequence_lookup_iter().
10737 // <note><para>
10738 // This function will fail if the data contained in the sequence is
10739 // unsorted. Use g_sequence_insert_sorted() or
10740 // g_sequence_insert_sorted_iter() to add data to your sequence or, if
10741 // you want to add a large amount of data, call g_sequence_sort() after
10742 // doing unsorted insertions.
10743 // </para></note>
10745 // where @data would have been inserted according to @iter_cmp
10746 // and @cmp_data.
10747 // RETURNS: a #GSequenceIter pointing to the position in @seq
10748 // <data>: data for the new item
10749 // <iter_cmp>: the function used to compare iterators in the sequence
10750 // <cmp_data>: user data passed to @iter_cmp
10751 SequenceIter* search_iter(AT0, AT1)(AT0 /*void*/ data, SequenceIterCompareFunc iter_cmp, AT1 /*void*/ cmp_data) nothrow {
10752 return g_sequence_search_iter(&this, UpCast!(void*)(data), iter_cmp, UpCast!(void*)(cmp_data));
10755 // Unintrospectable method: sort() / g_sequence_sort()
10756 // VERSION: 2.14
10757 // Sorts @seq using @cmp_func.
10759 // @cmp_func is passed two items of @seq and should
10760 // return 0 if they are equal, a negative value if the
10761 // first comes before the second, and a positive value
10762 // if the second comes before the first.
10763 // <cmp_func>: the function used to sort the sequence
10764 // <cmp_data>: user data passed to @cmp_func
10765 void sort(AT0)(CompareDataFunc cmp_func, AT0 /*void*/ cmp_data) nothrow {
10766 g_sequence_sort(&this, cmp_func, UpCast!(void*)(cmp_data));
10769 // Unintrospectable method: sort_iter() / g_sequence_sort_iter()
10770 // VERSION: 2.14
10771 // Like g_sequence_sort(), but uses a #GSequenceIterCompareFunc instead
10772 // of a GCompareDataFunc as the compare function
10774 // @cmp_func is called with two iterators pointing into @seq. It should
10775 // return 0 if the iterators are equal, a negative value if the first
10776 // iterator comes before the second, and a positive value if the second
10777 // iterator comes before the first.
10778 // <cmp_func>: the function used to compare iterators in the sequence
10779 // <cmp_data>: user data passed to @cmp_func
10780 void sort_iter(AT0)(SequenceIterCompareFunc cmp_func, AT0 /*void*/ cmp_data) nothrow {
10781 g_sequence_sort_iter(&this, cmp_func, UpCast!(void*)(cmp_data));
10784 // Unintrospectable function: foreach_range() / g_sequence_foreach_range()
10785 // VERSION: 2.14
10786 // Calls @func for each item in the range (@begin, @end) passing
10787 // @user_data to the function.
10788 // <begin>: a #GSequenceIter
10789 // <end>: a #GSequenceIter
10790 // <func>: a #GFunc
10791 // <user_data>: user data passed to @func
10792 static void foreach_range(AT0, AT1, AT2)(AT0 /*SequenceIter*/ begin, AT1 /*SequenceIter*/ end, Func func, AT2 /*void*/ user_data) nothrow {
10793 g_sequence_foreach_range(UpCast!(SequenceIter*)(begin), UpCast!(SequenceIter*)(end), func, UpCast!(void*)(user_data));
10796 // Unintrospectable function: get() / g_sequence_get()
10797 // VERSION: 2.14
10798 // Returns the data that @iter points to.
10799 // RETURNS: the data that @iter points to
10800 // <iter>: a #GSequenceIter
10801 static void* get(AT0)(AT0 /*SequenceIter*/ iter) nothrow {
10802 return g_sequence_get(UpCast!(SequenceIter*)(iter));
10805 // Unintrospectable function: insert_before() / g_sequence_insert_before()
10806 // VERSION: 2.14
10807 // Inserts a new item just before the item pointed to by @iter.
10808 // RETURNS: an iterator pointing to the new item
10809 // <iter>: a #GSequenceIter
10810 // <data>: the data for the new item
10811 static SequenceIter* insert_before(AT0, AT1)(AT0 /*SequenceIter*/ iter, AT1 /*void*/ data) nothrow {
10812 return g_sequence_insert_before(UpCast!(SequenceIter*)(iter), UpCast!(void*)(data));
10815 // VERSION: 2.14
10816 // Moves the item pointed to by @src to the position indicated by @dest.
10817 // After calling this function @dest will point to the position immediately
10818 // after @src. It is allowed for @src and @dest to point into different
10819 // sequences.
10820 // <src>: a #GSequenceIter pointing to the item to move
10821 // <dest>: a #GSequenceIter pointing to the position to which the item is moved.
10822 static void move(AT0, AT1)(AT0 /*SequenceIter*/ src, AT1 /*SequenceIter*/ dest) nothrow {
10823 g_sequence_move(UpCast!(SequenceIter*)(src), UpCast!(SequenceIter*)(dest));
10826 // VERSION: 2.14
10827 // Inserts the (@begin, @end) range at the destination pointed to by ptr.
10828 // The @begin and @end iters must point into the same sequence. It is
10829 // allowed for @dest to point to a different sequence than the one pointed
10830 // into by @begin and @end.
10832 // If @dest is NULL, the range indicated by @begin and @end is
10833 // removed from the sequence. If @dest iter points to a place within
10834 // the (@begin, @end) range, the range does not move.
10835 // <dest>: a #GSequenceIter
10836 // <begin>: a #GSequenceIter
10837 // <end>: a #GSequenceIter
10838 static void move_range(AT0, AT1, AT2)(AT0 /*SequenceIter*/ dest, AT1 /*SequenceIter*/ begin, AT2 /*SequenceIter*/ end) nothrow {
10839 g_sequence_move_range(UpCast!(SequenceIter*)(dest), UpCast!(SequenceIter*)(begin), UpCast!(SequenceIter*)(end));
10842 // Unintrospectable function: new() / g_sequence_new()
10843 // VERSION: 2.14
10844 // Creates a new GSequence. The @data_destroy function, if non-%NULL will
10845 // be called on all items when the sequence is destroyed and on items that
10846 // are removed from the sequence.
10847 // RETURNS: a new #GSequence
10848 // <data_destroy>: a #GDestroyNotify function, or %NULL
10849 static Sequence* new_()(DestroyNotify data_destroy) nothrow {
10850 return g_sequence_new(data_destroy);
10853 // Unintrospectable function: range_get_midpoint() / g_sequence_range_get_midpoint()
10854 // VERSION: 2.14
10855 // Finds an iterator somewhere in the range (@begin, @end). This
10856 // iterator will be close to the middle of the range, but is not
10857 // guaranteed to be <emphasis>exactly</emphasis> in the middle.
10859 // The @begin and @end iterators must both point to the same sequence and
10860 // @begin must come before or be equal to @end in the sequence.
10862 // (@begin, @end) range.
10863 // RETURNS: A #GSequenceIter pointing somewhere in the
10864 // <begin>: a #GSequenceIter
10865 // <end>: a #GSequenceIter
10866 static SequenceIter* range_get_midpoint(AT0, AT1)(AT0 /*SequenceIter*/ begin, AT1 /*SequenceIter*/ end) nothrow {
10867 return g_sequence_range_get_midpoint(UpCast!(SequenceIter*)(begin), UpCast!(SequenceIter*)(end));
10870 // VERSION: 2.14
10871 // Removes the item pointed to by @iter. It is an error to pass the
10872 // end iterator to this function.
10874 // If the sequence has a data destroy function associated with it, this
10875 // function is called on the data for the removed item.
10876 // <iter>: a #GSequenceIter
10877 static void remove(AT0)(AT0 /*SequenceIter*/ iter) nothrow {
10878 g_sequence_remove(UpCast!(SequenceIter*)(iter));
10881 // VERSION: 2.14
10882 // Removes all items in the (@begin, @end) range.
10884 // If the sequence has a data destroy function associated with it, this
10885 // function is called on the data for the removed items.
10886 // <begin>: a #GSequenceIter
10887 // <end>: a #GSequenceIter
10888 static void remove_range(AT0, AT1)(AT0 /*SequenceIter*/ begin, AT1 /*SequenceIter*/ end) nothrow {
10889 g_sequence_remove_range(UpCast!(SequenceIter*)(begin), UpCast!(SequenceIter*)(end));
10892 // VERSION: 2.14
10893 // Changes the data for the item pointed to by @iter to be @data. If
10894 // the sequence has a data destroy function associated with it, that
10895 // function is called on the existing data that @iter pointed to.
10896 // <iter>: a #GSequenceIter
10897 // <data>: new data for the item
10898 static void set(AT0, AT1)(AT0 /*SequenceIter*/ iter, AT1 /*void*/ data) nothrow {
10899 g_sequence_set(UpCast!(SequenceIter*)(iter), UpCast!(void*)(data));
10902 // Unintrospectable function: sort_changed() / g_sequence_sort_changed()
10903 // VERSION: 2.14
10904 // Moves the data pointed to a new position as indicated by @cmp_func. This
10905 // function should be called for items in a sequence already sorted according
10906 // to @cmp_func whenever some aspect of an item changes so that @cmp_func
10907 // may return different values for that item.
10909 // @cmp_func is called with two items of the @seq and @user_data.
10910 // It should return 0 if the items are equal, a negative value if
10911 // the first item comes before the second, and a positive value if
10912 // the second item comes before the first.
10913 // <iter>: A #GSequenceIter
10914 // <cmp_func>: the function used to compare items in the sequence
10915 // <cmp_data>: user data passed to @cmp_func.
10916 static void sort_changed(AT0, AT1)(AT0 /*SequenceIter*/ iter, CompareDataFunc cmp_func, AT1 /*void*/ cmp_data) nothrow {
10917 g_sequence_sort_changed(UpCast!(SequenceIter*)(iter), cmp_func, UpCast!(void*)(cmp_data));
10920 // Unintrospectable function: sort_changed_iter() / g_sequence_sort_changed_iter()
10921 // VERSION: 2.14
10922 // Like g_sequence_sort_changed(), but uses
10923 // a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
10924 // the compare function.
10926 // @iter_cmp is called with two iterators pointing into @seq. It should
10927 // return 0 if the iterators are equal, a negative value if the first
10928 // iterator comes before the second, and a positive value if the second
10929 // iterator comes before the first.
10930 // <iter>: a #GSequenceIter
10931 // <iter_cmp>: the function used to compare iterators in the sequence
10932 // <cmp_data>: user data passed to @cmp_func
10933 static void sort_changed_iter(AT0, AT1)(AT0 /*SequenceIter*/ iter, SequenceIterCompareFunc iter_cmp, AT1 /*void*/ cmp_data) nothrow {
10934 g_sequence_sort_changed_iter(UpCast!(SequenceIter*)(iter), iter_cmp, UpCast!(void*)(cmp_data));
10937 // VERSION: 2.14
10938 // Swaps the items pointed to by @a and @b. It is allowed for @a and @b
10939 // to point into difference sequences.
10940 // <a>: a #GSequenceIter
10941 // <b>: a #GSequenceIter
10942 static void swap(AT0, AT1)(AT0 /*SequenceIter*/ a, AT1 /*SequenceIter*/ b) nothrow {
10943 g_sequence_swap(UpCast!(SequenceIter*)(a), UpCast!(SequenceIter*)(b));
10948 // The #GSequenceIter struct is an opaque data type representing an
10949 // iterator pointing into a #GSequence.
10950 struct SequenceIter {
10952 // VERSION: 2.14
10953 // Returns a negative number if @a comes before @b, 0 if they are equal,
10954 // and a positive number if @a comes after @b.
10956 // The @a and @b iterators must point into the same sequence.
10958 // equal, and a positive number if @a comes after @b.
10959 // RETURNS: A negative number if @a comes before @b, 0 if they are
10960 // <b>: a #GSequenceIter
10961 int compare(AT0)(AT0 /*SequenceIter*/ b) nothrow {
10962 return g_sequence_iter_compare(&this, UpCast!(SequenceIter*)(b));
10965 // VERSION: 2.14
10966 // Returns the position of @iter
10967 // RETURNS: the position of @iter
10968 int get_position()() nothrow {
10969 return g_sequence_iter_get_position(&this);
10972 // Unintrospectable method: get_sequence() / g_sequence_iter_get_sequence()
10973 // VERSION: 2.14
10974 // Returns the #GSequence that @iter points into.
10975 // RETURNS: the #GSequence that @iter points into.
10976 Sequence* get_sequence()() nothrow {
10977 return g_sequence_iter_get_sequence(&this);
10980 // VERSION: 2.14
10981 // Returns whether @iter is the begin iterator
10982 // RETURNS: whether @iter is the begin iterator
10983 int is_begin()() nothrow {
10984 return g_sequence_iter_is_begin(&this);
10987 // VERSION: 2.14
10988 // Returns whether @iter is the end iterator
10989 // RETURNS: Whether @iter is the end iterator.
10990 int is_end()() nothrow {
10991 return g_sequence_iter_is_end(&this);
10994 // Unintrospectable method: move() / g_sequence_iter_move()
10995 // VERSION: 2.14
10996 // Returns the #GSequenceIter which is @delta positions away from @iter.
10997 // If @iter is closer than -@delta positions to the beginning of the sequence,
10998 // the begin iterator is returned. If @iter is closer than @delta positions
10999 // to the end of the sequence, the end iterator is returned.
11000 // RETURNS: a #GSequenceIter which is @delta positions away from @iter.
11001 // <delta>: A positive or negative number indicating how many positions away from @iter the returned #GSequenceIter will be.
11002 SequenceIter* move()(int delta) nothrow {
11003 return g_sequence_iter_move(&this, delta);
11006 // Unintrospectable method: next() / g_sequence_iter_next()
11007 // VERSION: 2.14
11008 // Returns an iterator pointing to the next position after @iter. If
11009 // @iter is the end iterator, the end iterator is returned.
11010 // RETURNS: a #GSequenceIter pointing to the next position after @iter.
11011 SequenceIter* next()() nothrow {
11012 return g_sequence_iter_next(&this);
11015 // Unintrospectable method: prev() / g_sequence_iter_prev()
11016 // VERSION: 2.14
11017 // Returns an iterator pointing to the previous position before @iter. If
11018 // @iter is the begin iterator, the begin iterator is returned.
11020 // @iter.
11021 // RETURNS: a #GSequenceIter pointing to the previous position before
11022 SequenceIter* prev()() nothrow {
11023 return g_sequence_iter_prev(&this);
11028 // A #GSequenceIterCompareFunc is a function used to compare iterators.
11029 // It must return zero if the iterators compare equal, a negative value
11030 // if @a comes before @b, and a positive value if @b comes before @a.
11031 // <a>: a #GSequenceIter
11032 // <b>: a #GSequenceIter
11033 // <data>: user data
11034 extern (C) alias int function (SequenceIter* a, SequenceIter* b, void* data) nothrow SequenceIterCompareFunc;
11036 // Error codes returned by shell functions.
11037 enum ShellError {
11038 BAD_QUOTING = 0,
11039 EMPTY_STRING = 1,
11040 FAILED = 2
11042 enum SliceConfig {
11043 ALWAYS_MALLOC = 1,
11044 BYPASS_MAGAZINES = 2,
11045 WORKING_SET_MSECS = 3,
11046 COLOR_INCREMENT = 4,
11047 CHUNK_SIZES = 5,
11048 CONTENTION_COUNTER = 6
11051 // The <structname>GSource</structname> struct is an opaque data type
11052 // representing an event source.
11053 struct Source {
11054 private void* callback_data;
11055 private SourceCallbackFuncs* callback_funcs;
11056 private SourceFuncs* source_funcs;
11057 private uint ref_count;
11058 private MainContext* context;
11059 private int priority;
11060 private uint flags, source_id;
11061 private GLib2.SList* poll_fds;
11062 private Source* prev, next;
11063 private char* name;
11064 private SourcePrivate* priv;
11067 // Creates a new #GSource structure. The size is specified to
11068 // allow creating structures derived from #GSource that contain
11069 // additional data. The size passed in must be at least
11070 // <literal>sizeof (GSource)</literal>.
11072 // The source will not initially be associated with any #GMainContext
11073 // and must be added to one with g_source_attach() before it will be
11074 // executed.
11075 // RETURNS: the newly-created #GSource.
11076 // <source_funcs>: structure containing functions that implement the sources behavior.
11077 // <struct_size>: size of the #GSource structure to create.
11078 static Source* /*new*/ new_(AT0)(AT0 /*SourceFuncs*/ source_funcs, uint struct_size) nothrow {
11079 return g_source_new(UpCast!(SourceFuncs*)(source_funcs), struct_size);
11081 static auto opCall(AT0)(AT0 /*SourceFuncs*/ source_funcs, uint struct_size) {
11082 return g_source_new(UpCast!(SourceFuncs*)(source_funcs), struct_size);
11085 // VERSION: 2.28
11086 // Adds @child_source to @source as a "polled" source; when @source is
11087 // added to a #GMainContext, @child_source will be automatically added
11088 // with the same priority, when @child_source is triggered, it will
11089 // cause @source to dispatch (in addition to calling its own
11090 // callback), and when @source is destroyed, it will destroy
11091 // @child_source as well. (@source will also still be dispatched if
11092 // its own prepare/check functions indicate that it is ready.)
11094 // If you don't need @child_source to do anything on its own when it
11095 // triggers, you can call g_source_set_dummy_callback() on it to set a
11096 // callback that does nothing (except return %TRUE if appropriate).
11098 // @source will hold a reference on @child_source while @child_source
11099 // is attached to it.
11100 // <child_source>: a second #GSource that @source should "poll"
11101 void add_child_source(AT0)(AT0 /*Source*/ child_source) nothrow {
11102 g_source_add_child_source(&this, UpCast!(Source*)(child_source));
11105 // Adds a file descriptor to the set of file descriptors polled for
11106 // this source. This is usually combined with g_source_new() to add an
11107 // event source. The event source's check function will typically test
11108 // the @revents field in the #GPollFD struct and return %TRUE if events need
11109 // to be processed.
11110 // <fd>: a #GPollFD structure holding information about a file descriptor to watch.
11111 void add_poll(AT0)(AT0 /*PollFD*/ fd) nothrow {
11112 g_source_add_poll(&this, UpCast!(PollFD*)(fd));
11115 // Adds a #GSource to a @context so that it will be executed within
11116 // that context. Remove it by calling g_source_destroy().
11118 // #GMainContext.
11119 // RETURNS: the ID (greater than 0) for the source within the
11120 // <context>: a #GMainContext (if %NULL, the default context will be used)
11121 uint attach(AT0)(AT0 /*MainContext*/ context=null) nothrow {
11122 return g_source_attach(&this, UpCast!(MainContext*)(context));
11125 // Removes a source from its #GMainContext, if any, and mark it as
11126 // destroyed. The source cannot be subsequently added to another
11127 // context.
11128 void destroy()() nothrow {
11129 g_source_destroy(&this);
11132 // Checks whether a source is allowed to be called recursively.
11133 // see g_source_set_can_recurse().
11134 // RETURNS: whether recursion is allowed.
11135 int get_can_recurse()() nothrow {
11136 return g_source_get_can_recurse(&this);
11139 // Gets the #GMainContext with which the source is associated.
11140 // Calling this function on a destroyed source is an error.
11142 // source is associated, or %NULL if the context has not
11143 // yet been added to a source.
11144 // RETURNS: the #GMainContext with which the
11145 MainContext* get_context()() nothrow {
11146 return g_source_get_context(&this);
11149 // DEPRECATED (v2.28) method: get_current_time - use g_source_get_time() instead
11150 // This function ignores @source and is otherwise the same as
11151 // g_get_current_time().
11152 // <timeval>: #GTimeVal structure in which to store current time.
11153 void get_current_time(AT0)(AT0 /*TimeVal*/ timeval) nothrow {
11154 g_source_get_current_time(&this, UpCast!(TimeVal*)(timeval));
11157 // Returns the numeric ID for a particular source. The ID of a source
11158 // is a positive integer which is unique within a particular main loop
11159 // context. The reverse
11160 // mapping from ID to source is done by g_main_context_find_source_by_id().
11161 // RETURNS: the ID (greater than 0) for the source
11162 uint get_id()() nothrow {
11163 return g_source_get_id(&this);
11166 // VERSION: 2.26
11167 // Gets a name for the source, used in debugging and profiling.
11168 // The name may be #NULL if it has never been set with
11169 // g_source_set_name().
11170 // RETURNS: the name of the source
11171 char* get_name()() nothrow {
11172 return g_source_get_name(&this);
11175 // Gets the priority of a source.
11176 // RETURNS: the priority of the source
11177 int get_priority()() nothrow {
11178 return g_source_get_priority(&this);
11181 // VERSION: 2.28
11182 // Gets the time to be used when checking this source. The advantage of
11183 // calling this function over calling g_get_monotonic_time() directly is
11184 // that when checking multiple sources, GLib can cache a single value
11185 // instead of having to repeatedly get the system monotonic time.
11187 // The time here is the system monotonic time, if available, or some
11188 // other reasonable alternative otherwise. See g_get_monotonic_time().
11189 // RETURNS: the monotonic time in microseconds
11190 long get_time()() nothrow {
11191 return g_source_get_time(&this);
11194 // VERSION: 2.12
11195 // Returns whether @source has been destroyed.
11197 // This is important when you operate upon your objects
11198 // from within idle handlers, but may have freed the object
11199 // before the dispatch of your idle handler.
11201 // |[
11202 // static gboolean
11203 // idle_callback (gpointer data)
11204 // {
11205 // SomeWidget *self = data;
11207 // GDK_THREADS_ENTER (<!-- -->);
11208 // /<!-- -->* do stuff with self *<!-- -->/
11209 // self->idle_id = 0;
11210 // GDK_THREADS_LEAVE (<!-- -->);
11212 // return G_SOURCE_REMOVE;
11213 // }
11215 // static void
11216 // some_widget_do_stuff_later (SomeWidget *self)
11217 // {
11218 // self->idle_id = g_idle_add (idle_callback, self);
11219 // }
11221 // static void
11222 // some_widget_finalize (GObject *object)
11223 // {
11224 // SomeWidget *self = SOME_WIDGET (object);
11226 // if (self->idle_id)
11227 // g_source_remove (self->idle_id);
11229 // G_OBJECT_CLASS (parent_class)->finalize (object);
11230 // }
11231 // ]|
11233 // This will fail in a multi-threaded application if the
11234 // widget is destroyed before the idle handler fires due
11235 // to the use after free in the callback. A solution, to
11236 // this particular problem, is to check to if the source
11237 // has already been destroy within the callback.
11239 // |[
11240 // static gboolean
11241 // idle_callback (gpointer data)
11242 // {
11243 // SomeWidget *self = data;
11245 // GDK_THREADS_ENTER ();
11246 // if (!g_source_is_destroyed (g_main_current_source ()))
11247 // {
11248 // /<!-- -->* do stuff with self *<!-- -->/
11249 // }
11250 // GDK_THREADS_LEAVE ();
11252 // return FALSE;
11253 // }
11254 // ]|
11255 // RETURNS: %TRUE if the source has been destroyed
11256 int is_destroyed()() nothrow {
11257 return g_source_is_destroyed(&this);
11260 // Increases the reference count on a source by one.
11261 // RETURNS: @source
11262 Source* /*new*/ ref_()() nothrow {
11263 return g_source_ref(&this);
11266 // VERSION: 2.28
11267 // Detaches @child_source from @source and destroys it.
11268 // <child_source>: a #GSource previously passed to g_source_add_child_source().
11269 void remove_child_source(AT0)(AT0 /*Source*/ child_source) nothrow {
11270 g_source_remove_child_source(&this, UpCast!(Source*)(child_source));
11273 // Removes a file descriptor from the set of file descriptors polled for
11274 // this source.
11275 // <fd>: a #GPollFD structure previously passed to g_source_add_poll().
11276 void remove_poll(AT0)(AT0 /*PollFD*/ fd) nothrow {
11277 g_source_remove_poll(&this, UpCast!(PollFD*)(fd));
11280 // Sets the callback function for a source. The callback for a source is
11281 // called from the source's dispatch function.
11283 // The exact type of @func depends on the type of source; ie. you
11284 // should not count on @func being called with @data as its first
11285 // parameter.
11287 // Typically, you won't use this function. Instead use functions specific
11288 // to the type of source you are using.
11289 // <func>: a callback function
11290 // <data>: the data to pass to callback function
11291 // <notify>: a function to call when @data is no longer in use, or %NULL.
11292 void set_callback(AT0)(SourceFunc func, AT0 /*void*/ data, DestroyNotify notify) nothrow {
11293 g_source_set_callback(&this, func, UpCast!(void*)(data), notify);
11296 // Sets the callback function storing the data as a refcounted callback
11297 // "object". This is used internally. Note that calling
11298 // g_source_set_callback_indirect() assumes
11299 // an initial reference count on @callback_data, and thus
11300 // @callback_funcs->unref will eventually be called once more
11301 // than @callback_funcs->ref.
11302 // <callback_data>: pointer to callback data "object"
11303 // <callback_funcs>: functions for reference counting @callback_data and getting the callback and data
11304 void set_callback_indirect(AT0, AT1)(AT0 /*void*/ callback_data, AT1 /*SourceCallbackFuncs*/ callback_funcs) nothrow {
11305 g_source_set_callback_indirect(&this, UpCast!(void*)(callback_data), UpCast!(SourceCallbackFuncs*)(callback_funcs));
11308 // Sets whether a source can be called recursively. If @can_recurse is
11309 // %TRUE, then while the source is being dispatched then this source
11310 // will be processed normally. Otherwise, all processing of this
11311 // source is blocked until the dispatch function returns.
11312 // <can_recurse>: whether recursion is allowed for this source
11313 void set_can_recurse()(int can_recurse) nothrow {
11314 g_source_set_can_recurse(&this, can_recurse);
11317 // VERSION: 2.12
11318 // Sets the source functions (can be used to override
11319 // default implementations) of an unattached source.
11320 // <funcs>: the new #GSourceFuncs
11321 void set_funcs(AT0)(AT0 /*SourceFuncs*/ funcs) nothrow {
11322 g_source_set_funcs(&this, UpCast!(SourceFuncs*)(funcs));
11325 // VERSION: 2.26
11326 // Sets a name for the source, used in debugging and profiling.
11327 // The name defaults to #NULL.
11329 // The source name should describe in a human-readable way
11330 // what the source does. For example, "X11 event queue"
11331 // or "GTK+ repaint idle handler" or whatever it is.
11333 // It is permitted to call this function multiple times, but is not
11334 // recommended due to the potential performance impact. For example,
11335 // one could change the name in the "check" function of a #GSourceFuncs
11336 // to include details like the event type in the source name.
11337 // <name>: debug name for the source
11338 void set_name(AT0)(AT0 /*char*/ name) nothrow {
11339 g_source_set_name(&this, toCString!(char*)(name));
11342 // Sets the priority of a source. While the main loop is being run, a
11343 // source will be dispatched if it is ready to be dispatched and no
11344 // sources at a higher (numerically smaller) priority are ready to be
11345 // dispatched.
11346 // <priority>: the new priority.
11347 void set_priority()(int priority) nothrow {
11348 g_source_set_priority(&this, priority);
11351 // Decreases the reference count of a source by one. If the
11352 // resulting reference count is zero the source and associated
11353 // memory will be destroyed.
11354 void unref()() nothrow {
11355 g_source_unref(&this);
11358 // Removes the source with the given id from the default main context.
11359 // The id of
11360 // a #GSource is given by g_source_get_id(), or will be returned by the
11361 // functions g_source_attach(), g_idle_add(), g_idle_add_full(),
11362 // g_timeout_add(), g_timeout_add_full(), g_child_watch_add(),
11363 // g_child_watch_add_full(), g_io_add_watch(), and g_io_add_watch_full().
11365 // See also g_source_destroy(). You must use g_source_destroy() for sources
11366 // added to a non-default main context.
11367 // RETURNS: %TRUE if the source was found and removed.
11368 // <tag>: the ID of the source to remove.
11369 static int remove()(uint tag) nothrow {
11370 return g_source_remove(tag);
11373 // Removes a source from the default main loop context given the
11374 // source functions and user data. If multiple sources exist with the
11375 // same source functions and user data, only one will be destroyed.
11376 // RETURNS: %TRUE if a source was found and removed.
11377 // <funcs>: The @source_funcs passed to g_source_new()
11378 // <user_data>: the user data for the callback
11379 static int remove_by_funcs_user_data(AT0, AT1)(AT0 /*SourceFuncs*/ funcs, AT1 /*void*/ user_data) nothrow {
11380 return g_source_remove_by_funcs_user_data(UpCast!(SourceFuncs*)(funcs), UpCast!(void*)(user_data));
11383 // Removes a source from the default main loop context given the user
11384 // data for the callback. If multiple sources exist with the same user
11385 // data, only one will be destroyed.
11386 // RETURNS: %TRUE if a source was found and removed.
11387 // <user_data>: the user_data for the callback.
11388 static int remove_by_user_data(AT0)(AT0 /*void*/ user_data) nothrow {
11389 return g_source_remove_by_user_data(UpCast!(void*)(user_data));
11392 // VERSION: 2.26
11393 // Sets the name of a source using its ID.
11395 // This is a convenience utility to set source names from the return
11396 // value of g_idle_add(), g_timeout_add(), etc.
11397 // <tag>: a #GSource ID
11398 // <name>: debug name for the source
11399 static void set_name_by_id(AT0)(uint tag, AT0 /*char*/ name) nothrow {
11400 g_source_set_name_by_id(tag, toCString!(char*)(name));
11404 struct SourceCallbackFuncs {
11405 extern (C) void function (void* cb_data) nothrow ref_;
11406 extern (C) void function (void* cb_data) nothrow unref;
11407 // Unintrospectable functionp: get() / ()
11408 extern (C) void function (void* cb_data, Source* source, SourceFunc* func, void** data) nothrow get;
11412 // This is just a placeholder for #GClosureMarshal,
11413 // which cannot be used here for dependency reasons.
11414 extern (C) alias void function () nothrow SourceDummyMarshal;
11417 // Specifies the type of function passed to g_timeout_add(),
11418 // g_timeout_add_full(), g_idle_add(), and g_idle_add_full().
11419 // RETURNS: %FALSE if the source should be removed
11420 // <user_data>: data passed to the function, set when the source was created with one of the above functions
11421 extern (C) alias int function (void* user_data) nothrow SourceFunc;
11424 // The <structname>GSourceFuncs</structname> struct contains a table of
11425 // functions used to handle event sources in a generic manner.
11427 // For idle sources, the prepare and check functions always return %TRUE
11428 // to indicate that the source is always ready to be processed. The prepare
11429 // function also returns a timeout value of 0 to ensure that the poll() call
11430 // doesn't block (since that would be time wasted which could have been spent
11431 // running the idle function).
11433 // For timeout sources, the prepare and check functions both return %TRUE
11434 // if the timeout interval has expired. The prepare function also returns
11435 // a timeout value to ensure that the poll() call doesn't block too long
11436 // and miss the next timeout.
11438 // For file descriptor sources, the prepare function typically returns %FALSE,
11439 // since it must wait until poll() has been called before it knows whether
11440 // any events need to be processed. It sets the returned timeout to -1 to
11441 // indicate that it doesn't mind how long the poll() call blocks. In the
11442 // check function, it tests the results of the poll() call to see if the
11443 // required condition has been met, and returns %TRUE if so.
11444 struct SourceFuncs {
11445 extern (C) int function (Source* source, int* timeout_) nothrow prepare;
11446 extern (C) int function (Source* source) nothrow check;
11447 // Unintrospectable functionp: dispatch() / ()
11448 extern (C) int function (Source* source, SourceFunc callback, void* user_data) nothrow dispatch;
11449 extern (C) void function (Source* source) nothrow finalize;
11450 private SourceFunc closure_callback;
11451 private SourceDummyMarshal closure_marshal;
11454 struct SourcePrivate {
11458 // Specifies the type of the setup function passed to g_spawn_async(),
11459 // g_spawn_sync() and g_spawn_async_with_pipes(), which can, in very
11460 // limited ways, be used to affect the child's execution.
11462 // On POSIX platforms, the function is called in the child after GLib
11463 // has performed all the setup it plans to perform, but before calling
11464 // exec(). Actions taken in this function will only affect the child,
11465 // not the parent.
11467 // On Windows, the function is called in the parent. Its usefulness on
11468 // Windows is thus questionable. In many cases executing the child setup
11469 // function in the parent can have ill effects, and you should be very
11470 // careful when porting software to Windows that uses child setup
11471 // functions.
11473 // However, even on POSIX, you are extremely limited in what you can
11474 // safely do from a #GSpawnChildSetupFunc, because any mutexes that
11475 // were held by other threads in the parent process at the time of the
11476 // fork() will still be locked in the child process, and they will
11477 // never be unlocked (since the threads that held them don't exist in
11478 // the child). POSIX allows only async-signal-safe functions (see
11479 // <citerefentry><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry>)
11480 // to be called in the child between fork() and exec(), which
11481 // drastically limits the usefulness of child setup functions.
11483 // In particular, it is not safe to call any function which may
11484 // call malloc(), which includes POSIX functions such as setenv().
11485 // If you need to set up the child environment differently from
11486 // the parent, you should use g_get_environ(), g_environ_setenv(),
11487 // and g_environ_unsetenv(), and then pass the complete environment
11488 // list to the <literal>g_spawn...</literal> function.
11489 // <user_data>: user data to pass to the function.
11490 extern (C) alias void function (void* user_data) nothrow SpawnChildSetupFunc;
11492 // Error codes returned by spawning processes.
11493 enum SpawnError {
11494 FORK = 0,
11495 READ = 1,
11496 CHDIR = 2,
11497 ACCES = 3,
11498 PERM = 4,
11499 TOO_BIG = 5,
11500 _2BIG = 5,
11501 NOEXEC = 6,
11502 NAMETOOLONG = 7,
11503 NOENT = 8,
11504 NOMEM = 9,
11505 NOTDIR = 10,
11506 LOOP = 11,
11507 TXTBUSY = 12,
11508 IO = 13,
11509 NFILE = 14,
11510 MFILE = 15,
11511 INVAL = 16,
11512 ISDIR = 17,
11513 LIBBAD = 18,
11514 FAILED = 19
11516 // Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().
11517 enum SpawnFlags {
11518 LEAVE_DESCRIPTORS_OPEN = 1,
11519 DO_NOT_REAP_CHILD = 2,
11520 SEARCH_PATH = 4,
11521 STDOUT_TO_DEV_NULL = 8,
11522 STDERR_TO_DEV_NULL = 16,
11523 CHILD_INHERITS_STDIN = 32,
11524 FILE_AND_ARGV_ZERO = 64
11527 // A type corresponding to the appropriate struct type for the stat
11528 // system call, depending on the platform and/or compiler being used.
11530 // See g_stat() for more information.
11531 struct StatBuf {
11534 // The GString struct contains the public fields of a GString.
11535 struct String {
11536 char* str;
11537 size_t len, allocated_len;
11540 // Adds a string onto the end of a #GString, expanding
11541 // it if necessary.
11542 // RETURNS: @string
11543 // <val>: the string to append onto the end of @string
11544 String* /*new*/ append(AT0)(AT0 /*char*/ val) nothrow {
11545 return g_string_append(&this, toCString!(char*)(val));
11548 // Adds a byte onto the end of a #GString, expanding
11549 // it if necessary.
11550 // RETURNS: @string
11551 // <c>: the byte to append onto the end of @string
11552 String* /*new*/ append_c()(char c) nothrow {
11553 return g_string_append_c(&this, c);
11556 // Appends @len bytes of @val to @string. Because @len is
11557 // provided, @val may contain embedded nuls and need not
11558 // be nul-terminated.
11560 // Since this function does not stop at nul bytes, it is
11561 // the caller's responsibility to ensure that @val has at
11562 // least @len addressable bytes.
11563 // RETURNS: @string
11564 // <val>: bytes to append
11565 // <len>: number of bytes of @val to use
11566 String* /*new*/ append_len(AT0)(AT0 /*char*/ val, ssize_t len) nothrow {
11567 return g_string_append_len(&this, toCString!(char*)(val), len);
11570 // Unintrospectable method: append_printf() / g_string_append_printf()
11571 // Appends a formatted string onto the end of a #GString.
11572 // This function is similar to g_string_printf() except
11573 // that the text is appended to the #GString.
11574 // <format>: the string format. See the printf() documentation
11575 /+ Not available -- variadic methods unsupported - use the C function directly.
11576 alias g_string_append_printf append_printf; // Variadic
11579 // Converts a Unicode character into UTF-8, and appends it
11580 // to the string.
11581 // RETURNS: @string
11582 // <wc>: a Unicode character
11583 String* /*new*/ append_unichar()(dchar wc) nothrow {
11584 return g_string_append_unichar(&this, wc);
11587 // VERSION: 2.16
11588 // Appends @unescaped to @string, escaped any characters that
11589 // are reserved in URIs using URI-style escape sequences.
11590 // RETURNS: @string
11591 // <unescaped>: a string
11592 // <reserved_chars_allowed>: a string of reserved characters allowed to be used, or %NULL
11593 // <allow_utf8>: set %TRUE if the escaped string may include UTF8 characters
11594 String* /*new*/ append_uri_escaped(AT0, AT1)(AT0 /*char*/ unescaped, AT1 /*char*/ reserved_chars_allowed, int allow_utf8) nothrow {
11595 return g_string_append_uri_escaped(&this, toCString!(char*)(unescaped), toCString!(char*)(reserved_chars_allowed), allow_utf8);
11598 // Unintrospectable method: append_vprintf() / g_string_append_vprintf()
11599 // VERSION: 2.14
11600 // Appends a formatted string onto the end of a #GString.
11601 // This function is similar to g_string_append_printf()
11602 // except that the arguments to the format string are passed
11603 // as a va_list.
11604 // <format>: the string format. See the printf() documentation
11605 // <args>: the list of arguments to insert in the output
11606 void append_vprintf(AT0)(AT0 /*char*/ format, va_list args) nothrow {
11607 g_string_append_vprintf(&this, toCString!(char*)(format), args);
11610 // Converts all uppercase ASCII letters to lowercase ASCII letters.
11612 // uppercase characters converted to lowercase in place,
11613 // with semantics that exactly match g_ascii_tolower().
11614 // RETURNS: passed-in @string pointer, with all the
11615 String* /*new*/ ascii_down()() nothrow {
11616 return g_string_ascii_down(&this);
11619 // Converts all lowercase ASCII letters to uppercase ASCII letters.
11621 // lowercase characters converted to uppercase in place,
11622 // with semantics that exactly match g_ascii_toupper().
11623 // RETURNS: passed-in @string pointer, with all the
11624 String* /*new*/ ascii_up()() nothrow {
11625 return g_string_ascii_up(&this);
11628 // Copies the bytes from a string into a #GString,
11629 // destroying any previous contents. It is rather like
11630 // the standard strcpy() function, except that you do not
11631 // have to worry about having enough space to copy the string.
11632 // RETURNS: @string
11633 // <rval>: the string to copy into @string
11634 String* /*new*/ assign(AT0)(AT0 /*char*/ rval) nothrow {
11635 return g_string_assign(&this, toCString!(char*)(rval));
11638 // Converts a #GString to lowercase.
11641 // Deprecated:2.2: This function uses the locale-specific
11642 // tolower() function, which is almost never the right thing.
11643 // Use g_string_ascii_down() or g_utf8_strdown() instead.
11644 // RETURNS: the #GString
11645 String* /*new*/ down()() nothrow {
11646 return g_string_down(&this);
11649 // Compares two strings for equality, returning %TRUE if they are equal.
11650 // For use with #GHashTable.
11652 // same bytes
11653 // RETURNS: %TRUE if they strings are the same length and contain the
11654 // <v2>: another #GString
11655 int equal(AT0)(AT0 /*String*/ v2) nothrow {
11656 return g_string_equal(&this, UpCast!(String*)(v2));
11659 // Removes @len bytes from a #GString, starting at position @pos.
11660 // The rest of the #GString is shifted down to fill the gap.
11661 // RETURNS: @string
11662 // <pos>: the position of the content to remove
11663 // <len>: the number of bytes to remove, or -1 to remove all following bytes
11664 String* /*new*/ erase()(ssize_t pos, ssize_t len) nothrow {
11665 return g_string_erase(&this, pos, len);
11668 // Frees the memory allocated for the #GString.
11669 // If @free_segment is %TRUE it also frees the character data. If
11670 // it's %FALSE, the caller gains ownership of the buffer and must
11671 // free it after use with g_free().
11673 // (i.e. %NULL if @free_segment is %TRUE)
11674 // RETURNS: the character data of @string
11675 // <free_segment>: if %TRUE, the actual character data is freed as well
11676 char* /*new*/ free()(int free_segment) nothrow {
11677 return g_string_free(&this, free_segment);
11680 // Creates a hash code for @str; for use with #GHashTable.
11681 // RETURNS: hash code for @str
11682 uint hash()() nothrow {
11683 return g_string_hash(&this);
11686 // Inserts a copy of a string into a #GString,
11687 // expanding it if necessary.
11688 // RETURNS: @string
11689 // <pos>: the position to insert the copy of the string
11690 // <val>: the string to insert
11691 String* /*new*/ insert(AT0)(ssize_t pos, AT0 /*char*/ val) nothrow {
11692 return g_string_insert(&this, pos, toCString!(char*)(val));
11695 // Inserts a byte into a #GString, expanding it if necessary.
11696 // RETURNS: @string
11697 // <pos>: the position to insert the byte
11698 // <c>: the byte to insert
11699 String* /*new*/ insert_c()(ssize_t pos, char c) nothrow {
11700 return g_string_insert_c(&this, pos, c);
11703 // Inserts @len bytes of @val into @string at @pos.
11704 // Because @len is provided, @val may contain embedded
11705 // nuls and need not be nul-terminated. If @pos is -1,
11706 // bytes are inserted at the end of the string.
11708 // Since this function does not stop at nul bytes, it is
11709 // the caller's responsibility to ensure that @val has at
11710 // least @len addressable bytes.
11711 // RETURNS: @string
11712 // <pos>: position in @string where insertion should happen, or -1 for at the end
11713 // <val>: bytes to insert
11714 // <len>: number of bytes of @val to insert
11715 String* /*new*/ insert_len(AT0)(ssize_t pos, AT0 /*char*/ val, ssize_t len) nothrow {
11716 return g_string_insert_len(&this, pos, toCString!(char*)(val), len);
11719 // Converts a Unicode character into UTF-8, and insert it
11720 // into the string at the given position.
11721 // RETURNS: @string
11722 // <pos>: the position at which to insert character, or -1 to append at the end of the string
11723 // <wc>: a Unicode character
11724 String* /*new*/ insert_unichar()(ssize_t pos, dchar wc) nothrow {
11725 return g_string_insert_unichar(&this, pos, wc);
11728 // VERSION: 2.14
11729 // Overwrites part of a string, lengthening it if necessary.
11730 // RETURNS: @string
11731 // <pos>: the position at which to start overwriting
11732 // <val>: the string that will overwrite the @string starting at @pos
11733 String* /*new*/ overwrite(AT0)(size_t pos, AT0 /*char*/ val) nothrow {
11734 return g_string_overwrite(&this, pos, toCString!(char*)(val));
11737 // VERSION: 2.14
11738 // Overwrites part of a string, lengthening it if necessary.
11739 // This function will work with embedded nuls.
11740 // RETURNS: @string
11741 // <pos>: the position at which to start overwriting
11742 // <val>: the string that will overwrite the @string starting at @pos
11743 // <len>: the number of bytes to write from @val
11744 String* /*new*/ overwrite_len(AT0)(size_t pos, AT0 /*char*/ val, ssize_t len) nothrow {
11745 return g_string_overwrite_len(&this, pos, toCString!(char*)(val), len);
11748 // Adds a string on to the start of a #GString,
11749 // expanding it if necessary.
11750 // RETURNS: @string
11751 // <val>: the string to prepend on the start of @string
11752 String* /*new*/ prepend(AT0)(AT0 /*char*/ val) nothrow {
11753 return g_string_prepend(&this, toCString!(char*)(val));
11756 // Adds a byte onto the start of a #GString,
11757 // expanding it if necessary.
11758 // RETURNS: @string
11759 // <c>: the byte to prepend on the start of the #GString
11760 String* /*new*/ prepend_c()(char c) nothrow {
11761 return g_string_prepend_c(&this, c);
11764 // Prepends @len bytes of @val to @string.
11765 // Because @len is provided, @val may contain
11766 // embedded nuls and need not be nul-terminated.
11768 // Since this function does not stop at nul bytes,
11769 // it is the caller's responsibility to ensure that
11770 // @val has at least @len addressable bytes.
11771 // RETURNS: @string
11772 // <val>: bytes to prepend
11773 // <len>: number of bytes in @val to prepend
11774 String* /*new*/ prepend_len(AT0)(AT0 /*char*/ val, ssize_t len) nothrow {
11775 return g_string_prepend_len(&this, toCString!(char*)(val), len);
11778 // Converts a Unicode character into UTF-8, and prepends it
11779 // to the string.
11780 // RETURNS: @string
11781 // <wc>: a Unicode character
11782 String* /*new*/ prepend_unichar()(dchar wc) nothrow {
11783 return g_string_prepend_unichar(&this, wc);
11786 // Unintrospectable method: printf() / g_string_printf()
11787 // Writes a formatted string into a #GString.
11788 // This is similar to the standard sprintf() function,
11789 // except that the #GString buffer automatically expands
11790 // to contain the results. The previous contents of the
11791 // #GString are destroyed.
11792 // <format>: the string format. See the printf() documentation
11793 /+ Not available -- variadic methods unsupported - use the C function directly.
11794 alias g_string_printf printf; // Variadic
11797 // Sets the length of a #GString. If the length is less than
11798 // the current length, the string will be truncated. If the
11799 // length is greater than the current length, the contents
11800 // of the newly added area are undefined. (However, as
11801 // always, string->str[string->len] will be a nul byte.)
11802 // RETURNS: @string
11803 // <len>: the new length
11804 String* /*new*/ set_size()(size_t len) nothrow {
11805 return g_string_set_size(&this, len);
11808 // Cuts off the end of the GString, leaving the first @len bytes.
11809 // RETURNS: @string
11810 // <len>: the new size of @string
11811 String* /*new*/ truncate()(size_t len) nothrow {
11812 return g_string_truncate(&this, len);
11815 // Converts a #GString to uppercase.
11818 // Deprecated:2.2: This function uses the locale-specific
11819 // toupper() function, which is almost never the right thing.
11820 // Use g_string_ascii_up() or g_utf8_strup() instead.
11821 // RETURNS: @string
11822 String* /*new*/ up()() nothrow {
11823 return g_string_up(&this);
11826 // Unintrospectable method: vprintf() / g_string_vprintf()
11827 // VERSION: 2.14
11828 // Writes a formatted string into a #GString.
11829 // This function is similar to g_string_printf() except that
11830 // the arguments to the format string are passed as a va_list.
11831 // <format>: the string format. See the printf() documentation
11832 // <args>: the parameters to insert into the format string
11833 void vprintf(AT0)(AT0 /*char*/ format, va_list args) nothrow {
11834 g_string_vprintf(&this, toCString!(char*)(format), args);
11839 // An opaque data structure representing String Chunks.
11840 // It should only be accessed by using the following functions.
11841 struct StringChunk {
11843 // VERSION: 2.14
11844 // Frees all strings contained within the #GStringChunk.
11845 // After calling g_string_chunk_clear() it is not safe to
11846 // access any of the strings which were contained within it.
11847 void clear()() nothrow {
11848 g_string_chunk_clear(&this);
11851 // Frees all memory allocated by the #GStringChunk.
11852 // After calling g_string_chunk_free() it is not safe to
11853 // access any of the strings which were contained within it.
11854 void free()() nothrow {
11855 g_string_chunk_free(&this);
11858 // Adds a copy of @string to the #GStringChunk.
11859 // It returns a pointer to the new copy of the string
11860 // in the #GStringChunk. The characters in the string
11861 // can be changed, if necessary, though you should not
11862 // change anything after the end of the string.
11864 // Unlike g_string_chunk_insert_const(), this function
11865 // does not check for duplicates. Also strings added
11866 // with g_string_chunk_insert() will not be searched
11867 // by g_string_chunk_insert_const() when looking for
11868 // duplicates.
11870 // the #GStringChunk
11871 // RETURNS: a pointer to the copy of @string within
11872 // <string>: the string to add
11873 char* /*new*/ insert(AT0)(AT0 /*char*/ string_) nothrow {
11874 return g_string_chunk_insert(&this, toCString!(char*)(string_));
11877 // Adds a copy of @string to the #GStringChunk, unless the same
11878 // string has already been added to the #GStringChunk with
11879 // g_string_chunk_insert_const().
11881 // This function is useful if you need to copy a large number
11882 // of strings but do not want to waste space storing duplicates.
11883 // But you must remember that there may be several pointers to
11884 // the same string, and so any changes made to the strings
11885 // should be done very carefully.
11887 // Note that g_string_chunk_insert_const() will not return a
11888 // pointer to a string added with g_string_chunk_insert(), even
11889 // if they do match.
11891 // within the #GStringChunk
11892 // RETURNS: a pointer to the new or existing copy of @string
11893 // <string>: the string to add
11894 char* /*new*/ insert_const(AT0)(AT0 /*char*/ string_) nothrow {
11895 return g_string_chunk_insert_const(&this, toCString!(char*)(string_));
11898 // VERSION: 2.4
11899 // Adds a copy of the first @len bytes of @string to the #GStringChunk.
11900 // The copy is nul-terminated.
11902 // Since this function does not stop at nul bytes, it is the caller's
11903 // responsibility to ensure that @string has at least @len addressable
11904 // bytes.
11906 // The characters in the returned string can be changed, if necessary,
11907 // though you should not change anything after the end of the string.
11908 // RETURNS: a pointer to the copy of @string within the #GStringChunk
11909 // <string>: bytes to insert
11910 // <len>: number of bytes of @string to insert, or -1 to insert a nul-terminated string
11911 char* /*new*/ insert_len(AT0)(AT0 /*char*/ string_, ssize_t len) nothrow {
11912 return g_string_chunk_insert_len(&this, toCString!(char*)(string_), len);
11915 // Unintrospectable function: new() / g_string_chunk_new()
11916 // Creates a new #GStringChunk.
11917 // RETURNS: a new #GStringChunk
11918 // <size>: the default size of the blocks of memory which are allocated to store the strings. If a particular string is larger than this default size, a larger block of memory will be allocated for it.
11919 static StringChunk* new_()(size_t size) nothrow {
11920 return g_string_chunk_new(size);
11924 // An opaque structure representing a test case.
11925 struct TestCase {
11928 struct TestConfig {
11929 int test_initialized, test_quick, test_perf, test_verbose, test_quiet, test_undefined;
11933 // VERSION: 2.28
11934 // The type used for test case functions that take an extra pointer
11935 // argument.
11936 // <user_data>: the data provided when registering the test
11937 extern (C) alias void function (const(void)* user_data) nothrow TestDataFunc;
11940 // VERSION: 2.28
11941 // The type used for functions that operate on test fixtures. This is
11942 // used for the fixture setup and teardown functions as well as for the
11943 // testcases themselves.
11945 // @user_data is a pointer to the data that was given when registering
11946 // the test case.
11948 // @fixture will be a pointer to the area of memory allocated by the
11949 // test framework, of the size requested. If the requested size was
11950 // zero then @fixture will be equal to @user_data.
11951 // <fixture>: the test fixture
11952 // <user_data>: the data provided when registering the test
11953 extern (C) alias void function (void* fixture, const(void)* user_data) nothrow TestFixtureFunc;
11956 // VERSION: 2.28
11957 // The type used for test case functions.
11958 extern (C) alias void function () nothrow TestFunc;
11960 struct TestLogBuffer {
11961 private String* data;
11962 private GLib2.SList* msgs;
11964 // Internal function for gtester to free test log messages, no ABI guarantees provided.
11965 void free()() nothrow {
11966 g_test_log_buffer_free(&this);
11969 // Unintrospectable method: pop() / g_test_log_buffer_pop()
11970 // Internal function for gtester to retrieve test log messages, no ABI guarantees provided.
11971 TestLogMsg* pop()() nothrow {
11972 return g_test_log_buffer_pop(&this);
11974 // Internal function for gtester to decode test log messages, no ABI guarantees provided.
11975 void push(AT0)(uint n_bytes, AT0 /*ubyte*/ bytes) nothrow {
11976 g_test_log_buffer_push(&this, n_bytes, UpCast!(ubyte*)(bytes));
11979 // Unintrospectable function: new() / g_test_log_buffer_new()
11980 // Internal function for gtester to decode test log messages, no ABI guarantees provided.
11981 static TestLogBuffer* new_()() nothrow {
11982 return g_test_log_buffer_new();
11987 // VERSION: 2.22
11988 // Specifies the prototype of fatal log handler functions.
11989 // RETURNS: %TRUE if the program should abort, %FALSE otherwise
11990 // <log_domain>: the log domain of the message
11991 // <log_level>: the log level of the message (including the fatal and recursion flags)
11992 // <message>: the message to process
11993 // <user_data>: user data, set in g_test_log_set_fatal_handler()
11994 extern (C) alias int function (char* log_domain, LogLevelFlags log_level, char* message, void* user_data) nothrow TestLogFatalFunc;
11996 struct TestLogMsg {
11997 TestLogType log_type;
11998 uint n_strings;
11999 char** strings;
12000 uint n_nums;
12001 c_long* nums;
12003 // Internal function for gtester to free test log messages, no ABI guarantees provided.
12004 void free()() nothrow {
12005 g_test_log_msg_free(&this);
12009 enum TestLogType {
12010 NONE = 0,
12011 ERROR = 1,
12012 START_BINARY = 2,
12013 LIST_CASE = 3,
12014 SKIP_CASE = 4,
12015 START_CASE = 5,
12016 STOP_CASE = 6,
12017 MIN_RESULT = 7,
12018 MAX_RESULT = 8,
12019 MESSAGE = 9
12021 // An opaque structure representing a test suite.
12022 struct TestSuite {
12024 // VERSION: 2.16
12025 // Adds @test_case to @suite.
12026 // <test_case>: a #GTestCase
12027 void add(AT0)(AT0 /*TestCase*/ test_case) nothrow {
12028 g_test_suite_add(&this, UpCast!(TestCase*)(test_case));
12031 // VERSION: 2.16
12032 // Adds @nestedsuite to @suite.
12033 // <nestedsuite>: another #GTestSuite
12034 void add_suite(AT0)(AT0 /*TestSuite*/ nestedsuite) nothrow {
12035 g_test_suite_add_suite(&this, UpCast!(TestSuite*)(nestedsuite));
12040 // Test traps are guards around forked tests.
12041 // These flags determine what traps to set.
12042 enum TestTrapFlags {
12043 SILENCE_STDOUT = 128,
12044 SILENCE_STDERR = 256,
12045 INHERIT_STDIN = 512
12048 // The #GThread struct represents a running thread. This struct
12049 // is returned by g_thread_new() or g_thread_try_new(). You can
12050 // obtain the #GThread struct representing the current thead by
12051 // calling g_thread_self().
12053 // GThread is refcounted, see g_thread_ref() and g_thread_unref().
12054 // The thread represented by it holds a reference while it is running,
12055 // and g_thread_join() consumes the reference that it is given, so
12056 // it is normally not necessary to manage GThread references
12057 // explicitly.
12059 // The structure is opaque -- none of its fields may be directly
12060 // accessed.
12061 struct Thread {
12063 // Unintrospectable method: join() / g_thread_join()
12064 // Waits until @thread finishes, i.e. the function @func, as
12065 // given to g_thread_new(), returns or g_thread_exit() is called.
12066 // If @thread has already terminated, then g_thread_join()
12067 // returns immediately.
12069 // Any thread can wait for any other thread by calling g_thread_join(),
12070 // not just its 'creator'. Calling g_thread_join() from multiple threads
12071 // for the same @thread leads to undefined behaviour.
12073 // The value returned by @func or given to g_thread_exit() is
12074 // returned by this function.
12076 // g_thread_join() consumes the reference to the passed-in @thread.
12077 // This will usually cause the #GThread struct and associated resources
12078 // to be freed. Use g_thread_ref() to obtain an extra reference if you
12079 // want to keep the GThread alive beyond the g_thread_join() call.
12080 // RETURNS: the return value of the thread
12081 void* join()() nothrow {
12082 return g_thread_join(&this);
12085 // Unintrospectable method: ref() / g_thread_ref()
12086 // VERSION: 2.32
12087 // Increase the reference count on @thread.
12088 // RETURNS: a new reference to @thread
12089 Thread* ref_()() nothrow {
12090 return g_thread_ref(&this);
12093 // VERSION: 2.32
12094 // Decrease the reference count on @thread, possibly freeing all
12095 // resources associated with it.
12097 // Note that each thread holds a reference to its #GThread while
12098 // it is running, so it is safe to drop your own reference to it
12099 // if you don't need it anymore.
12100 void unref()() nothrow {
12101 g_thread_unref(&this);
12103 static Quark error_quark()() nothrow {
12104 return g_thread_error_quark();
12107 // Terminates the current thread.
12109 // If another thread is waiting for us using g_thread_join() then the
12110 // waiting thread will be woken up and get @retval as the return value
12111 // of g_thread_join().
12113 // Calling <literal>g_thread_exit (retval)</literal> is equivalent to
12114 // returning @retval from the function @func, as given to g_thread_new().
12116 // <note><para>
12117 // You must only call g_thread_exit() from a thread that you created
12118 // yourself with g_thread_new() or related APIs. You must not call
12119 // this function from a thread created with another threading library
12120 // or or from within a #GThreadPool.
12121 // </para></note>
12122 // <retval>: the return value of this thread
12123 static void exit(AT0)(AT0 /*void*/ retval) nothrow {
12124 g_thread_exit(UpCast!(void*)(retval));
12127 // Unintrospectable function: new() / g_thread_new()
12128 // VERSION: 2.32
12129 // This function creates a new thread. The new thread starts by invoking
12130 // @func with the argument data. The thread will run until @func returns
12131 // or until g_thread_exit() is called from the new thread. The return value
12132 // of @func becomes the return value of the thread, which can be obtained
12133 // with g_thread_join().
12135 // The @name can be useful for discriminating threads in a debugger.
12136 // Some systems restrict the length of @name to 16 bytes.
12138 // If the thread can not be created the program aborts. See
12139 // g_thread_try_new() if you want to attempt to deal with failures.
12141 // To free the struct returned by this function, use g_thread_unref().
12142 // Note that g_thread_join() implicitly unrefs the #GThread as well.
12143 // RETURNS: the new #GThread
12144 // <name>: a name for the new thread
12145 // <func>: a function to execute in the new thread
12146 // <data>: an argument to supply to the new thread
12147 static Thread* new_(AT0, AT1)(AT0 /*char*/ name, ThreadFunc func, AT1 /*void*/ data) nothrow {
12148 return g_thread_new(toCString!(char*)(name), func, UpCast!(void*)(data));
12151 // Unintrospectable function: self() / g_thread_self()
12152 // This functions returns the #GThread corresponding to the
12153 // current thread. Note that this function does not increase
12154 // the reference count of the returned struct.
12156 // This function will return a #GThread even for threads that
12157 // were not created by GLib (i.e. those created by other threading
12158 // APIs). This may be useful for thread identification purposes
12159 // (i.e. comparisons) but you must not use GLib functions (such
12160 // as g_thread_join()) on these threads.
12161 // RETURNS: the #GThread representing the current thread
12162 static Thread* self()() nothrow {
12163 return g_thread_self();
12166 // Unintrospectable function: try_new() / g_thread_try_new()
12167 // VERSION: 2.32
12168 // This function is the same as g_thread_new() except that
12169 // it allows for the possibility of failure.
12171 // If a thread can not be created (due to resource limits),
12172 // @error is set and %NULL is returned.
12173 // RETURNS: the new #GThread, or %NULL if an error occurred
12174 // <name>: a name for the new thread
12175 // <func>: a function to execute in the new thread
12176 // <data>: an argument to supply to the new thread
12177 static Thread* try_new(AT0, AT1, AT2)(AT0 /*char*/ name, ThreadFunc func, AT1 /*void*/ data, AT2 /*GLib2.Error**/ error=null) nothrow {
12178 return g_thread_try_new(toCString!(char*)(name), func, UpCast!(void*)(data), UpCast!(GLib2.Error**)(error));
12181 // Causes the calling thread to voluntarily relinquish the CPU, so
12182 // that other threads can run.
12184 // This function is often used as a method to make busy wait less evil.
12185 static void yield()() nothrow {
12186 g_thread_yield();
12190 // Possible errors of thread related functions.
12191 enum ThreadError {
12192 THREAD_ERROR_AGAIN = 0
12195 // Unintrospectable callback: ThreadFunc() / ()
12196 // Specifies the type of the @func functions passed to g_thread_new()
12197 // or g_thread_try_new().
12198 // RETURNS: the return value of the thread
12199 // <data>: data passed to the thread
12200 extern (C) alias void* function (void* data) nothrow ThreadFunc;
12203 // The #GThreadPool struct represents a thread pool. It has three
12204 // public read-only members, but the underlying struct is bigger,
12205 // so you must not copy this struct.
12206 struct ThreadPool {
12207 Func func;
12208 void* user_data;
12209 int exclusive;
12212 // Frees all resources allocated for @pool.
12214 // If @immediate is %TRUE, no new task is processed for @pool.
12215 // Otherwise @pool is not freed before the last task is processed.
12216 // Note however, that no thread of this pool is interrupted while
12217 // processing a task. Instead at least all still running threads
12218 // can finish their tasks before the @pool is freed.
12220 // If @wait_ is %TRUE, the functions does not return before all
12221 // tasks to be processed (dependent on @immediate, whether all
12222 // or only the currently running) are ready.
12223 // Otherwise the function returns immediately.
12225 // After calling this function @pool must not be used anymore.
12226 // <immediate>: should @pool shut down immediately?
12227 // <wait_>: should the function wait for all tasks to be finished?
12228 void free()(int immediate, int wait_) nothrow {
12229 g_thread_pool_free(&this, immediate, wait_);
12232 // Returns the maximal number of threads for @pool.
12233 // RETURNS: the maximal number of threads
12234 int get_max_threads()() nothrow {
12235 return g_thread_pool_get_max_threads(&this);
12238 // Returns the number of threads currently running in @pool.
12239 // RETURNS: the number of threads currently running
12240 uint get_num_threads()() nothrow {
12241 return g_thread_pool_get_num_threads(&this);
12244 // Inserts @data into the list of tasks to be executed by @pool.
12246 // When the number of currently running threads is lower than the
12247 // maximal allowed number of threads, a new thread is started (or
12248 // reused) with the properties given to g_thread_pool_new().
12249 // Otherwise, @data stays in the queue until a thread in this pool
12250 // finishes its previous task and processes @data.
12252 // @error can be %NULL to ignore errors, or non-%NULL to report
12253 // errors. An error can only occur when a new thread couldn't be
12254 // created. In that case @data is simply appended to the queue of
12255 // work to do.
12257 // Before version 2.32, this function did not return a success status.
12258 // RETURNS: %TRUE on success, %FALSE if an error occurred
12259 // <data>: a new task for @pool
12260 int push(AT0, AT1)(AT0 /*void*/ data, AT1 /*GLib2.Error**/ error=null) nothrow {
12261 return g_thread_pool_push(&this, UpCast!(void*)(data), UpCast!(GLib2.Error**)(error));
12264 // Sets the maximal allowed number of threads for @pool.
12265 // A value of -1 means that the maximal number of threads
12266 // is unlimited. If @pool is an exclusive thread pool, setting
12267 // the maximal number of threads to -1 is not allowed.
12269 // Setting @max_threads to 0 means stopping all work for @pool.
12270 // It is effectively frozen until @max_threads is set to a non-zero
12271 // value again.
12273 // A thread is never terminated while calling @func, as supplied by
12274 // g_thread_pool_new(). Instead the maximal number of threads only
12275 // has effect for the allocation of new threads in g_thread_pool_push().
12276 // A new thread is allocated, whenever the number of currently
12277 // running threads in @pool is smaller than the maximal number.
12279 // @error can be %NULL to ignore errors, or non-%NULL to report
12280 // errors. An error can only occur when a new thread couldn't be
12281 // created.
12283 // Before version 2.32, this function did not return a success status.
12284 // RETURNS: %TRUE on success, %FALSE if an error occurred
12285 // <max_threads>: a new maximal number of threads for @pool, or -1 for unlimited
12286 int set_max_threads(AT0)(int max_threads, AT0 /*GLib2.Error**/ error=null) nothrow {
12287 return g_thread_pool_set_max_threads(&this, max_threads, UpCast!(GLib2.Error**)(error));
12290 // Unintrospectable method: set_sort_function() / g_thread_pool_set_sort_function()
12291 // VERSION: 2.10
12292 // Sets the function used to sort the list of tasks. This allows the
12293 // tasks to be processed by a priority determined by @func, and not
12294 // just in the order in which they were added to the pool.
12296 // Note, if the maximum number of threads is more than 1, the order
12297 // that threads are executed cannot be guaranteed 100%. Threads are
12298 // scheduled by the operating system and are executed at random. It
12299 // cannot be assumed that threads are executed in the order they are
12300 // created.
12301 // <func>: the #GCompareDataFunc used to sort the list of tasks. This function is passed two tasks. It should return 0 if the order in which they are handled does not matter, a negative value if the first task should be processed before the second or a positive value if the second task should be processed first.
12302 // <user_data>: user data passed to @func
12303 void set_sort_function(AT0)(CompareDataFunc func, AT0 /*void*/ user_data) nothrow {
12304 g_thread_pool_set_sort_function(&this, func, UpCast!(void*)(user_data));
12307 // Returns the number of tasks still unprocessed in @pool.
12308 // RETURNS: the number of unprocessed tasks
12309 uint unprocessed()() nothrow {
12310 return g_thread_pool_unprocessed(&this);
12313 // VERSION: 2.10
12314 // This function will return the maximum @interval that a
12315 // thread will wait in the thread pool for new tasks before
12316 // being stopped.
12318 // If this function returns 0, threads waiting in the thread
12319 // pool for new work are not stopped.
12321 // for new tasks in the thread pool before stopping the
12322 // thread
12323 // RETURNS: the maximum @interval (milliseconds) to wait
12324 static uint get_max_idle_time()() nothrow {
12325 return g_thread_pool_get_max_idle_time();
12328 // Returns the maximal allowed number of unused threads.
12329 // RETURNS: the maximal number of unused threads
12330 static int get_max_unused_threads()() nothrow {
12331 return g_thread_pool_get_max_unused_threads();
12334 // Returns the number of currently unused threads.
12335 // RETURNS: the number of currently unused threads
12336 static uint get_num_unused_threads()() nothrow {
12337 return g_thread_pool_get_num_unused_threads();
12340 // Unintrospectable function: new() / g_thread_pool_new()
12341 // This function creates a new thread pool.
12343 // Whenever you call g_thread_pool_push(), either a new thread is
12344 // created or an unused one is reused. At most @max_threads threads
12345 // are running concurrently for this thread pool. @max_threads = -1
12346 // allows unlimited threads to be created for this thread pool. The
12347 // newly created or reused thread now executes the function @func
12348 // with the two arguments. The first one is the parameter to
12349 // g_thread_pool_push() and the second one is @user_data.
12351 // The parameter @exclusive determines whether the thread pool owns
12352 // all threads exclusive or shares them with other thread pools.
12353 // If @exclusive is %TRUE, @max_threads threads are started
12354 // immediately and they will run exclusively for this thread pool
12355 // until it is destroyed by g_thread_pool_free(). If @exclusive is
12356 // %FALSE, threads are created when needed and shared between all
12357 // non-exclusive thread pools. This implies that @max_threads may
12358 // not be -1 for exclusive thread pools.
12360 // @error can be %NULL to ignore errors, or non-%NULL to report
12361 // errors. An error can only occur when @exclusive is set to %TRUE
12362 // and not all @max_threads threads could be created.
12363 // RETURNS: the new #GThreadPool
12364 // <func>: a function to execute in the threads of the new thread pool
12365 // <user_data>: user data that is handed over to @func every time it is called
12366 // <max_threads>: the maximal number of threads to execute concurrently in the new thread pool, -1 means no limit
12367 // <exclusive>: should this thread pool be exclusive?
12368 static ThreadPool* new_(AT0, AT1)(Func func, AT0 /*void*/ user_data, int max_threads, int exclusive, AT1 /*GLib2.Error**/ error=null) nothrow {
12369 return g_thread_pool_new(func, UpCast!(void*)(user_data), max_threads, exclusive, UpCast!(GLib2.Error**)(error));
12372 // VERSION: 2.10
12373 // This function will set the maximum @interval that a thread
12374 // waiting in the pool for new tasks can be idle for before
12375 // being stopped. This function is similar to calling
12376 // g_thread_pool_stop_unused_threads() on a regular timeout,
12377 // except this is done on a per thread basis.
12379 // By setting @interval to 0, idle threads will not be stopped.
12381 // This function makes use of g_async_queue_timed_pop () using
12382 // @interval.
12383 // <interval>: the maximum @interval (in milliseconds) a thread can be idle
12384 static void set_max_idle_time()(uint interval) nothrow {
12385 g_thread_pool_set_max_idle_time(interval);
12388 // Sets the maximal number of unused threads to @max_threads.
12389 // If @max_threads is -1, no limit is imposed on the number
12390 // of unused threads.
12391 // <max_threads>: maximal number of unused threads
12392 static void set_max_unused_threads()(int max_threads) nothrow {
12393 g_thread_pool_set_max_unused_threads(max_threads);
12396 // Stops all currently unused threads. This does not change the
12397 // maximal number of unused threads. This function can be used to
12398 // regularly stop all unused threads e.g. from g_timeout_add().
12399 static void stop_unused_threads()() nothrow {
12400 g_thread_pool_stop_unused_threads();
12405 // Disambiguates a given time in two ways.
12407 // First, specifies if the given time is in universal or local time.
12409 // Second, if the time is in local time, specifies if it is local
12410 // standard time or local daylight time. This is important for the case
12411 // where the same local time occurs twice (during daylight savings time
12412 // transitions, for example).
12413 enum TimeType {
12414 STANDARD = 0,
12415 DAYLIGHT = 1,
12416 UNIVERSAL = 2
12419 // Represents a precise time, with seconds and microseconds.
12420 // Similar to the <structname>struct timeval</structname> returned by
12421 // the gettimeofday() UNIX system call.
12423 // GLib is attempting to unify around the use of 64bit integers to
12424 // represent microsecond-precision time. As such, this type will be
12425 // removed from a future version of GLib.
12426 struct TimeVal {
12427 c_long tv_sec, tv_usec;
12430 // Adds the given number of microseconds to @time_. @microseconds can
12431 // also be negative to decrease the value of @time_.
12432 // <microseconds>: number of microseconds to add to @time
12433 void add()(c_long microseconds) nothrow {
12434 g_time_val_add(&this, microseconds);
12437 // VERSION: 2.12
12438 // Converts @time_ into an RFC 3339 encoded string, relative to the
12439 // Coordinated Universal Time (UTC). This is one of the many formats
12440 // allowed by ISO 8601.
12442 // ISO 8601 allows a large number of date/time formats, with or without
12443 // punctuation and optional elements. The format returned by this function
12444 // is a complete date and time, with optional punctuation included, the
12445 // UTC time zone represented as "Z", and the @tv_usec part included if
12446 // and only if it is nonzero, i.e. either
12447 // "YYYY-MM-DDTHH:MM:SSZ" or "YYYY-MM-DDTHH:MM:SS.fffffZ".
12449 // This corresponds to the Internet date/time format defined by
12450 // <ulink url="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</ulink>, and
12451 // to either of the two most-precise formats defined by
12452 // <ulink url="http://www.w3.org/TR/NOTE-datetime-19980827">the W3C Note
12453 // "Date and Time Formats"</ulink>. Both of these documents are profiles of
12454 // ISO 8601.
12456 // Use g_date_time_format() or g_strdup_printf() if a different
12457 // variation of ISO 8601 format is required.
12458 // RETURNS: a newly allocated string containing an ISO 8601 date
12459 char* /*new*/ to_iso8601()() nothrow {
12460 return g_time_val_to_iso8601(&this);
12463 // VERSION: 2.12
12464 // Converts a string containing an ISO 8601 encoded date and time
12465 // to a #GTimeVal and puts it into @time_.
12467 // @iso_date must include year, month, day, hours, minutes, and
12468 // seconds. It can optionally include fractions of a second and a time
12469 // zone indicator. (In the absence of any time zone indication, the
12470 // timestamp is assumed to be in local time.)
12471 // RETURNS: %TRUE if the conversion was successful.
12472 // <iso_date>: an ISO 8601 encoded date string
12473 // <time_>: a #GTimeVal
12474 static int from_iso8601(AT0, AT1)(AT0 /*char*/ iso_date, /*out*/ AT1 /*TimeVal*/ time_) nothrow {
12475 return g_time_val_from_iso8601(toCString!(char*)(iso_date), UpCast!(TimeVal*)(time_));
12480 // #GDateTime is an opaque structure whose members cannot be accessed
12481 // directly.
12482 struct TimeZone /* Version 2.26 */ {
12484 // VERSION: 2.26
12485 // Finds an interval within @tz that corresponds to the given @time_,
12486 // possibly adjusting @time_ if required to fit into an interval.
12487 // The meaning of @time_ depends on @type.
12489 // This function is similar to g_time_zone_find_interval(), with the
12490 // difference that it always succeeds (by making the adjustments
12491 // described below).
12493 // In any of the cases where g_time_zone_find_interval() succeeds then
12494 // this function returns the same value, without modifying @time_.
12496 // This function may, however, modify @time_ in order to deal with
12497 // non-existent times. If the non-existent local @time_ of 02:30 were
12498 // requested on March 13th 2010 in Toronto then this function would
12499 // adjust @time_ to be 03:00 and return the interval containing the
12500 // adjusted time.
12501 // RETURNS: the interval containing @time_, never -1
12502 // <type>: the #GTimeType of @time_
12503 // <time_>: a pointer to a number of seconds since January 1, 1970
12504 int adjust_time(AT0)(TimeType type, AT0 /*long*/ time_) nothrow {
12505 return g_time_zone_adjust_time(&this, type, UpCast!(long*)(time_));
12508 // VERSION: 2.26
12509 // Finds an the interval within @tz that corresponds to the given @time_.
12510 // The meaning of @time_ depends on @type.
12512 // If @type is %G_TIME_TYPE_UNIVERSAL then this function will always
12513 // succeed (since universal time is monotonic and continuous).
12515 // Otherwise @time_ is treated is local time. The distinction between
12516 // %G_TIME_TYPE_STANDARD and %G_TIME_TYPE_DAYLIGHT is ignored except in
12517 // the case that the given @time_ is ambiguous. In Toronto, for example,
12518 // 01:30 on November 7th 2010 occurred twice (once inside of daylight
12519 // savings time and the next, an hour later, outside of daylight savings
12520 // time). In this case, the different value of @type would result in a
12521 // different interval being returned.
12523 // It is still possible for this function to fail. In Toronto, for
12524 // example, 02:00 on March 14th 2010 does not exist (due to the leap
12525 // forward to begin daylight savings time). -1 is returned in that
12526 // case.
12527 // RETURNS: the interval containing @time_, or -1 in case of failure
12528 // <type>: the #GTimeType of @time_
12529 // <time_>: a number of seconds since January 1, 1970
12530 int find_interval()(TimeType type, long time_) nothrow {
12531 return g_time_zone_find_interval(&this, type, time_);
12534 // VERSION: 2.26
12535 // Determines the time zone abbreviation to be used during a particular
12536 // @interval of time in the time zone @tz.
12538 // For example, in Toronto this is currently "EST" during the winter
12539 // months and "EDT" during the summer months when daylight savings time
12540 // is in effect.
12541 // RETURNS: the time zone abbreviation, which belongs to @tz
12542 // <interval>: an interval within the timezone
12543 char* get_abbreviation()(int interval) nothrow {
12544 return g_time_zone_get_abbreviation(&this, interval);
12547 // VERSION: 2.26
12548 // Determines the offset to UTC in effect during a particular @interval
12549 // of time in the time zone @tz.
12551 // The offset is the number of seconds that you add to UTC time to
12552 // arrive at local time for @tz (ie: negative numbers for time zones
12553 // west of GMT, positive numbers for east).
12555 // local time in @tz
12556 // RETURNS: the number of seconds that should be added to UTC to get the
12557 // <interval>: an interval within the timezone
12558 int get_offset()(int interval) nothrow {
12559 return g_time_zone_get_offset(&this, interval);
12562 // VERSION: 2.26
12563 // Determines if daylight savings time is in effect during a particular
12564 // @interval of time in the time zone @tz.
12565 // RETURNS: %TRUE if daylight savings time is in effect
12566 // <interval>: an interval within the timezone
12567 int is_dst()(int interval) nothrow {
12568 return g_time_zone_is_dst(&this, interval);
12571 // Unintrospectable method: ref() / g_time_zone_ref()
12572 // VERSION: 2.26
12573 // Increases the reference count on @tz.
12574 // RETURNS: a new reference to @tz.
12575 TimeZone* ref_()() nothrow {
12576 return g_time_zone_ref(&this);
12579 // VERSION: 2.26
12580 // Decreases the reference count on @tz.
12581 void unref()() nothrow {
12582 g_time_zone_unref(&this);
12585 // Unintrospectable function: new() / g_time_zone_new()
12586 // VERSION: 2.26
12587 // Creates a #GTimeZone corresponding to @identifier.
12589 // @identifier can either be an RFC3339/ISO 8601 time offset or
12590 // something that would pass as a valid value for the
12591 // <varname>TZ</varname> environment variable (including %NULL).
12593 // Valid RFC3339 time offsets are <literal>"Z"</literal> (for UTC) or
12594 // <literal>"±hh:mm"</literal>. ISO 8601 additionally specifies
12595 // <literal>"±hhmm"</literal> and <literal>"±hh"</literal>.
12597 // The <varname>TZ</varname> environment variable typically corresponds
12598 // to the name of a file in the zoneinfo database, but there are many
12599 // other possibilities. Note that those other possibilities are not
12600 // currently implemented, but are planned.
12602 // g_time_zone_new_local() calls this function with the value of the
12603 // <varname>TZ</varname> environment variable. This function itself is
12604 // independent of the value of <varname>TZ</varname>, but if @identifier
12605 // is %NULL then <filename>/etc/localtime</filename> will be consulted
12606 // to discover the correct timezone.
12608 // See <ulink
12609 // url='http://tools.ietf.org/html/rfc3339#section-5.6'>RFC3339
12610 // §5.6</ulink> for a precise definition of valid RFC3339 time offsets
12611 // (the <varname>time-offset</varname> expansion) and ISO 8601 for the
12612 // full list of valid time offsets. See <ulink
12613 // url='http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html'>The
12614 // GNU C Library manual</ulink> for an explanation of the possible
12615 // values of the <varname>TZ</varname> environment variable.
12617 // You should release the return value by calling g_time_zone_unref()
12618 // when you are done with it.
12619 // RETURNS: the requested timezone
12620 // <identifier>: a timezone identifier
12621 static TimeZone* new_(AT0)(AT0 /*char*/ identifier=null) nothrow {
12622 return g_time_zone_new(toCString!(char*)(identifier));
12625 // Unintrospectable function: new_local() / g_time_zone_new_local()
12626 // VERSION: 2.26
12627 // Creates a #GTimeZone corresponding to local time. The local time
12628 // zone may change between invocations to this function; for example,
12629 // if the system administrator changes it.
12631 // This is equivalent to calling g_time_zone_new() with the value of the
12632 // <varname>TZ</varname> environment variable (including the possibility
12633 // of %NULL).
12635 // You should release the return value by calling g_time_zone_unref()
12636 // when you are done with it.
12637 // RETURNS: the local timezone
12638 static TimeZone* new_local()() nothrow {
12639 return g_time_zone_new_local();
12642 // Unintrospectable function: new_utc() / g_time_zone_new_utc()
12643 // VERSION: 2.26
12644 // Creates a #GTimeZone corresponding to UTC.
12646 // This is equivalent to calling g_time_zone_new() with a value like
12647 // "Z", "UTC", "+00", etc.
12649 // You should release the return value by calling g_time_zone_unref()
12650 // when you are done with it.
12651 // RETURNS: the universal timezone
12652 static TimeZone* new_utc()() nothrow {
12653 return g_time_zone_new_utc();
12657 // Opaque datatype that records a start time.
12658 struct Timer {
12660 // VERSION: 2.4
12661 // Resumes a timer that has previously been stopped with
12662 // g_timer_stop(). g_timer_stop() must be called before using this
12663 // function.
12664 void continue_()() nothrow {
12665 g_timer_continue(&this);
12667 // Destroys a timer, freeing associated resources.
12668 void destroy()() nothrow {
12669 g_timer_destroy(&this);
12672 // If @timer has been started but not stopped, obtains the time since
12673 // the timer was started. If @timer has been stopped, obtains the
12674 // elapsed time between the time it was started and the time it was
12675 // stopped. The return value is the number of seconds elapsed,
12676 // including any fractional part. The @microseconds out parameter is
12677 // essentially useless.
12678 // <microseconds>: return location for the fractional part of seconds elapsed, in microseconds (that is, the total number of microseconds elapsed, modulo 1000000), or %NULL
12679 double elapsed(AT0)(AT0 /*c_ulong*/ microseconds) nothrow {
12680 return g_timer_elapsed(&this, UpCast!(c_ulong*)(microseconds));
12683 // This function is useless; it's fine to call g_timer_start() on an
12684 // already-started timer to reset the start time, so g_timer_reset()
12685 // serves no purpose.
12686 void reset()() nothrow {
12687 g_timer_reset(&this);
12690 // Marks a start time, so that future calls to g_timer_elapsed() will
12691 // report the time since g_timer_start() was called. g_timer_new()
12692 // automatically marks the start time, so no need to call
12693 // g_timer_start() immediately after creating the timer.
12694 void start()() nothrow {
12695 g_timer_start(&this);
12698 // Marks an end time, so calls to g_timer_elapsed() will return the
12699 // difference between this end time and the start time.
12700 void stop()() nothrow {
12701 g_timer_stop(&this);
12704 // Unintrospectable function: new() / g_timer_new()
12705 // Creates a new timer, and starts timing (i.e. g_timer_start() is
12706 // implicitly called for you).
12707 static Timer* new_()() nothrow {
12708 return g_timer_new();
12713 // The possible types of token returned from each
12714 // g_scanner_get_next_token() call.
12715 enum TokenType {
12716 EOF = 0,
12717 LEFT_PAREN = 40,
12718 RIGHT_PAREN = 41,
12719 LEFT_CURLY = 123,
12720 RIGHT_CURLY = 125,
12721 LEFT_BRACE = 91,
12722 RIGHT_BRACE = 93,
12723 EQUAL_SIGN = 61,
12724 COMMA = 44,
12725 NONE = 256,
12726 ERROR = 257,
12727 CHAR = 258,
12728 BINARY = 259,
12729 OCTAL = 260,
12730 INT = 261,
12731 HEX = 262,
12732 FLOAT = 263,
12733 STRING = 264,
12734 SYMBOL = 265,
12735 IDENTIFIER = 266,
12736 IDENTIFIER_NULL = 267,
12737 COMMENT_SINGLE = 268,
12738 COMMENT_MULTI = 269
12740 // A union holding the value of the token.
12741 union TokenValue {
12742 void* v_symbol;
12743 char* v_identifier;
12744 c_ulong v_binary, v_octal, v_int;
12745 ulong v_int64;
12746 double v_float;
12747 c_ulong v_hex;
12748 char* v_string, v_comment;
12749 ubyte v_char;
12750 uint v_error;
12754 // The type of functions which are used to translate user-visible
12755 // strings, for <option>--help</option> output.
12757 // The returned string is owned by GLib and must not be freed.
12758 // RETURNS: a translation of the string for the current locale.
12759 // <str>: the untranslated string
12760 // <data>: user data specified when installing the function, e.g. in g_option_group_set_translate_func()
12761 extern (C) alias char* function (char* str, void* data) nothrow TranslateFunc;
12764 // Each piece of memory that is pushed onto the stack
12765 // is cast to a <structname>GTrashStack*</structname>.
12766 struct TrashStack {
12767 TrashStack* next;
12770 // Returns the height of a #GTrashStack.
12772 // Note that execution of this function is of O(N) complexity
12773 // where N denotes the number of items on the stack.
12774 // RETURNS: the height of the stack
12775 // <stack_p>: a #GTrashStack
12776 static uint height(AT0)(AT0 /*TrashStack**/ stack_p) nothrow {
12777 return g_trash_stack_height(UpCast!(TrashStack**)(stack_p));
12780 // Unintrospectable function: peek() / g_trash_stack_peek()
12781 // Returns the element at the top of a #GTrashStack
12782 // which may be %NULL.
12783 // RETURNS: the element at the top of the stack
12784 // <stack_p>: a #GTrashStack
12785 static void* peek(AT0)(AT0 /*TrashStack**/ stack_p) nothrow {
12786 return g_trash_stack_peek(UpCast!(TrashStack**)(stack_p));
12789 // Unintrospectable function: pop() / g_trash_stack_pop()
12790 // Pops a piece of memory off a #GTrashStack.
12791 // RETURNS: the element at the top of the stack
12792 // <stack_p>: a #GTrashStack
12793 static void* pop(AT0)(AT0 /*TrashStack**/ stack_p) nothrow {
12794 return g_trash_stack_pop(UpCast!(TrashStack**)(stack_p));
12797 // Pushes a piece of memory onto a #GTrashStack.
12798 // <stack_p>: a #GTrashStack
12799 // <data_p>: the piece of memory to push on the stack
12800 static void push(AT0, AT1)(AT0 /*TrashStack**/ stack_p, AT1 /*void*/ data_p) nothrow {
12801 g_trash_stack_push(UpCast!(TrashStack**)(stack_p), UpCast!(void*)(data_p));
12806 // Specifies which nodes are visited during several of the tree
12807 // functions, including g_node_traverse() and g_node_find().
12808 enum TraverseFlags {
12809 LEAVES = 1,
12810 NON_LEAVES = 2,
12811 ALL = 3,
12812 MASK = 3,
12813 LEAFS = 1,
12814 NON_LEAFS = 2
12817 // Specifies the type of function passed to g_tree_traverse(). It is
12818 // passed the key and value of each node, together with the @user_data
12819 // parameter passed to g_tree_traverse(). If the function returns
12820 // %TRUE, the traversal is stopped.
12821 // <key>: a key of a #GTree node.
12822 // <value>: the value corresponding to the key.
12823 // <data>: user data passed to g_tree_traverse().
12824 extern (C) alias int function (void* key, void* value, void* data) nothrow TraverseFunc;
12827 // Specifies the type of traveral performed by g_tree_traverse(),
12828 // g_node_traverse() and g_node_find().
12829 enum TraverseType {
12830 IN_ORDER = 0,
12831 PRE_ORDER = 1,
12832 POST_ORDER = 2,
12833 LEVEL_ORDER = 3
12836 // The <structname>GTree</structname> struct is an opaque data
12837 // structure representing a <link
12838 // linkend="glib-Balanced-Binary-Trees">Balanced Binary Tree</link>. It
12839 // should be accessed only by using the following functions.
12840 struct Tree {
12842 // Removes all keys and values from the #GTree and decreases its
12843 // reference count by one. If keys and/or values are dynamically
12844 // allocated, you should either free them first or create the #GTree
12845 // using g_tree_new_full(). In the latter case the destroy functions
12846 // you supplied will be called on all keys and values before destroying
12847 // the #GTree.
12848 void destroy()() nothrow {
12849 g_tree_destroy(&this);
12852 // Unintrospectable method: foreach() / g_tree_foreach()
12853 // Calls the given function for each of the key/value pairs in the #GTree.
12854 // The function is passed the key and value of each pair, and the given
12855 // @data parameter. The tree is traversed in sorted order.
12857 // The tree may not be modified while iterating over it (you can't
12858 // add/remove items). To remove all items matching a predicate, you need
12859 // to add each item to a list in your #GTraverseFunc as you walk over
12860 // the tree, then walk the list and remove each item.
12861 // <func>: the function to call for each node visited. If this function returns %TRUE, the traversal is stopped.
12862 // <user_data>: user data to pass to the function.
12863 void foreach_(AT0)(TraverseFunc func, AT0 /*void*/ user_data) nothrow {
12864 g_tree_foreach(&this, func, UpCast!(void*)(user_data));
12867 // Gets the height of a #GTree.
12869 // If the #GTree contains no nodes, the height is 0.
12870 // If the #GTree contains only one root node the height is 1.
12871 // If the root node has children the height is 2, etc.
12872 // RETURNS: the height of the #GTree.
12873 int height()() nothrow {
12874 return g_tree_height(&this);
12877 // Inserts a key/value pair into a #GTree. If the given key already exists
12878 // in the #GTree its corresponding value is set to the new value. If you
12879 // supplied a value_destroy_func when creating the #GTree, the old value is
12880 // freed using that function. If you supplied a @key_destroy_func when
12881 // creating the #GTree, the passed key is freed using that function.
12883 // The tree is automatically 'balanced' as new key/value pairs are added,
12884 // so that the distance from the root to every leaf is as small as possible.
12885 // <key>: the key to insert.
12886 // <value>: the value corresponding to the key.
12887 void insert(AT0, AT1)(AT0 /*void*/ key, AT1 /*void*/ value) nothrow {
12888 g_tree_insert(&this, UpCast!(void*)(key), UpCast!(void*)(value));
12891 // Unintrospectable method: lookup() / g_tree_lookup()
12892 // Gets the value corresponding to the given key. Since a #GTree is
12893 // automatically balanced as key/value pairs are added, key lookup is very
12894 // fast.
12896 // not found.
12897 // RETURNS: the value corresponding to the key, or %NULL if the key was
12898 // <key>: the key to look up.
12899 void* lookup(AT0)(AT0 /*const(void)*/ key) nothrow {
12900 return g_tree_lookup(&this, UpCast!(const(void)*)(key));
12903 // Looks up a key in the #GTree, returning the original key and the
12904 // associated value and a #gboolean which is %TRUE if the key was found. This
12905 // is useful if you need to free the memory allocated for the original key,
12906 // for example before calling g_tree_remove().
12907 // RETURNS: %TRUE if the key was found in the #GTree.
12908 // <lookup_key>: the key to look up.
12909 // <orig_key>: returns the original key.
12910 // <value>: returns the value associated with the key.
12911 int lookup_extended(AT0, AT1, AT2)(AT0 /*const(void)*/ lookup_key, AT1 /*void**/ orig_key, AT2 /*void**/ value) nothrow {
12912 return g_tree_lookup_extended(&this, UpCast!(const(void)*)(lookup_key), UpCast!(void**)(orig_key), UpCast!(void**)(value));
12915 // Gets the number of nodes in a #GTree.
12916 // RETURNS: the number of nodes in the #GTree.
12917 int nnodes()() nothrow {
12918 return g_tree_nnodes(&this);
12921 // Unintrospectable method: ref() / g_tree_ref()
12922 // VERSION: 2.22
12923 // Increments the reference count of @tree by one. It is safe to call
12924 // this function from any thread.
12925 // RETURNS: the passed in #GTree.
12926 Tree* ref_()() nothrow {
12927 return g_tree_ref(&this);
12930 // Removes a key/value pair from a #GTree.
12932 // If the #GTree was created using g_tree_new_full(), the key and value
12933 // are freed using the supplied destroy functions, otherwise you have to
12934 // make sure that any dynamically allocated values are freed yourself.
12935 // If the key does not exist in the #GTree, the function does nothing.
12937 // nothing)
12938 // RETURNS: %TRUE if the key was found (prior to 2.8, this function returned
12939 // <key>: the key to remove.
12940 int remove(AT0)(AT0 /*const(void)*/ key) nothrow {
12941 return g_tree_remove(&this, UpCast!(const(void)*)(key));
12944 // Inserts a new key and value into a #GTree similar to g_tree_insert().
12945 // The difference is that if the key already exists in the #GTree, it gets
12946 // replaced by the new key. If you supplied a @value_destroy_func when
12947 // creating the #GTree, the old value is freed using that function. If you
12948 // supplied a @key_destroy_func when creating the #GTree, the old key is
12949 // freed using that function.
12951 // The tree is automatically 'balanced' as new key/value pairs are added,
12952 // so that the distance from the root to every leaf is as small as possible.
12953 // <key>: the key to insert.
12954 // <value>: the value corresponding to the key.
12955 void replace(AT0, AT1)(AT0 /*void*/ key, AT1 /*void*/ value) nothrow {
12956 g_tree_replace(&this, UpCast!(void*)(key), UpCast!(void*)(value));
12959 // Unintrospectable method: search() / g_tree_search()
12960 // Searches a #GTree using @search_func.
12962 // The @search_func is called with a pointer to the key of a key/value
12963 // pair in the tree, and the passed in @user_data. If @search_func returns
12964 // 0 for a key/value pair, then the corresponding value is returned as
12965 // the result of g_tree_search(). If @search_func returns -1, searching
12966 // will proceed among the key/value pairs that have a smaller key; if
12967 // @search_func returns 1, searching will proceed among the key/value
12968 // pairs that have a larger key.
12970 // the key was not found.
12971 // RETURNS: the value corresponding to the found key, or %NULL if
12972 // <search_func>: a function used to search the #GTree
12973 // <user_data>: the data passed as the second argument to @search_func
12974 void* search(AT0)(CompareFunc search_func, AT0 /*const(void)*/ user_data) nothrow {
12975 return g_tree_search(&this, search_func, UpCast!(const(void)*)(user_data));
12978 // Removes a key and its associated value from a #GTree without calling
12979 // the key and value destroy functions.
12981 // If the key does not exist in the #GTree, the function does nothing.
12983 // nothing)
12984 // RETURNS: %TRUE if the key was found (prior to 2.8, this function returned
12985 // <key>: the key to remove.
12986 int steal(AT0)(AT0 /*const(void)*/ key) nothrow {
12987 return g_tree_steal(&this, UpCast!(const(void)*)(key));
12990 // Unintrospectable method: traverse() / g_tree_traverse()
12991 // Calls the given function for each node in the #GTree.
12993 // Deprecated:2.2: The order of a balanced tree is somewhat arbitrary. If you
12994 // just want to visit all nodes in sorted order, use g_tree_foreach()
12995 // instead. If you really need to visit nodes in a different order, consider
12996 // using an <link linkend="glib-N-ary-Trees">N-ary Tree</link>.
12997 // <traverse_func>: the function to call for each node visited. If this function returns %TRUE, the traversal is stopped.
12998 // <traverse_type>: the order in which nodes are visited, one of %G_IN_ORDER, %G_PRE_ORDER and %G_POST_ORDER.
12999 // <user_data>: user data to pass to the function.
13000 void traverse(AT0)(TraverseFunc traverse_func, TraverseType traverse_type, AT0 /*void*/ user_data) nothrow {
13001 g_tree_traverse(&this, traverse_func, traverse_type, UpCast!(void*)(user_data));
13004 // VERSION: 2.22
13005 // Decrements the reference count of @tree by one. If the reference count
13006 // drops to 0, all keys and values will be destroyed (if destroy
13007 // functions were specified) and all memory allocated by @tree will be
13008 // released.
13010 // It is safe to call this function from any thread.
13011 void unref()() nothrow {
13012 g_tree_unref(&this);
13015 // Unintrospectable function: new() / g_tree_new()
13016 // Creates a new #GTree.
13017 // RETURNS: a new #GTree.
13018 // <key_compare_func>: the function used to order the nodes in the #GTree. It should return values similar to the standard strcmp() function - 0 if the two arguments are equal, a negative value if the first argument comes before the second, or a positive value if the first argument comes after the second.
13019 static Tree* new_()(CompareFunc key_compare_func) nothrow {
13020 return g_tree_new(key_compare_func);
13023 // Unintrospectable function: new_full() / g_tree_new_full()
13024 // Creates a new #GTree like g_tree_new() and allows to specify functions
13025 // to free the memory allocated for the key and value that get called when
13026 // removing the entry from the #GTree.
13027 // RETURNS: a new #GTree.
13028 // <key_compare_func>: qsort()-style comparison function.
13029 // <key_compare_data>: data to pass to comparison function.
13030 // <key_destroy_func>: a function to free the memory allocated for the key used when removing the entry from the #GTree or %NULL if you don't want to supply such a function.
13031 // <value_destroy_func>: a function to free the memory allocated for the value used when removing the entry from the #GTree or %NULL if you don't want to supply such a function.
13032 static Tree* new_full(AT0)(CompareDataFunc key_compare_func, AT0 /*void*/ key_compare_data, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func) nothrow {
13033 return g_tree_new_full(key_compare_func, UpCast!(void*)(key_compare_data), key_destroy_func, value_destroy_func);
13036 // Unintrospectable function: new_with_data() / g_tree_new_with_data()
13037 // Creates a new #GTree with a comparison function that accepts user data.
13038 // See g_tree_new() for more details.
13039 // RETURNS: a new #GTree.
13040 // <key_compare_func>: qsort()-style comparison function.
13041 // <key_compare_data>: data to pass to comparison function.
13042 static Tree* new_with_data(AT0)(CompareDataFunc key_compare_func, AT0 /*void*/ key_compare_data) nothrow {
13043 return g_tree_new_with_data(key_compare_func, UpCast!(void*)(key_compare_data));
13047 enum int UNICHAR_MAX_DECOMPOSITION_LENGTH = 18;
13048 enum URI_RESERVED_CHARS_GENERIC_DELIMITERS = ":/?#[]@";
13049 enum URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS = "!$&'()*+,;=";
13050 enum int USEC_PER_SEC = 1000000;
13052 // These are the possible line break classifications.
13054 // The five Hangul types were added in Unicode 4.1, so, has been
13055 // introduced in GLib 2.10. Note that new types may be added in the future.
13056 // Applications should be ready to handle unknown values.
13057 // They may be regarded as %G_UNICODE_BREAK_UNKNOWN.
13059 // See <ulink url="http://www.unicode.org/unicode/reports/tr14/">http://www.unicode.org/unicode/reports/tr14/</ulink>.
13060 enum UnicodeBreakType {
13061 MANDATORY = 0,
13062 CARRIAGE_RETURN = 1,
13063 LINE_FEED = 2,
13064 COMBINING_MARK = 3,
13065 SURROGATE = 4,
13066 ZERO_WIDTH_SPACE = 5,
13067 INSEPARABLE = 6,
13068 NON_BREAKING_GLUE = 7,
13069 CONTINGENT = 8,
13070 SPACE = 9,
13071 AFTER = 10,
13072 BEFORE = 11,
13073 BEFORE_AND_AFTER = 12,
13074 HYPHEN = 13,
13075 NON_STARTER = 14,
13076 OPEN_PUNCTUATION = 15,
13077 CLOSE_PUNCTUATION = 16,
13078 QUOTATION = 17,
13079 EXCLAMATION = 18,
13080 IDEOGRAPHIC = 19,
13081 NUMERIC = 20,
13082 INFIX_SEPARATOR = 21,
13083 SYMBOL = 22,
13084 ALPHABETIC = 23,
13085 PREFIX = 24,
13086 POSTFIX = 25,
13087 COMPLEX_CONTEXT = 26,
13088 AMBIGUOUS = 27,
13089 UNKNOWN = 28,
13090 NEXT_LINE = 29,
13091 WORD_JOINER = 30,
13092 HANGUL_L_JAMO = 31,
13093 HANGUL_V_JAMO = 32,
13094 HANGUL_T_JAMO = 33,
13095 HANGUL_LV_SYLLABLE = 34,
13096 HANGUL_LVT_SYLLABLE = 35,
13097 CLOSE_PARANTHESIS = 36,
13098 CONDITIONAL_JAPANESE_STARTER = 37,
13099 HEBREW_LETTER = 38
13102 // The #GUnicodeScript enumeration identifies different writing
13103 // systems. The values correspond to the names as defined in the
13104 // Unicode standard. The enumeration has been added in GLib 2.14,
13105 // and is interchangeable with #PangoScript.
13107 // Note that new types may be added in the future. Applications
13108 // should be ready to handle unknown values.
13109 // See <ulink
13110 // url="http://www.unicode.org/reports/tr24/">Unicode Standard Annex
13111 // #24: Script names</ulink>.
13112 enum UnicodeScript {
13113 INVALID_CODE = -1,
13114 COMMON = 0,
13115 INHERITED = 1,
13116 ARABIC = 2,
13117 ARMENIAN = 3,
13118 BENGALI = 4,
13119 BOPOMOFO = 5,
13120 CHEROKEE = 6,
13121 COPTIC = 7,
13122 CYRILLIC = 8,
13123 DESERET = 9,
13124 DEVANAGARI = 10,
13125 ETHIOPIC = 11,
13126 GEORGIAN = 12,
13127 GOTHIC = 13,
13128 GREEK = 14,
13129 GUJARATI = 15,
13130 GURMUKHI = 16,
13131 HAN = 17,
13132 HANGUL = 18,
13133 HEBREW = 19,
13134 HIRAGANA = 20,
13135 KANNADA = 21,
13136 KATAKANA = 22,
13137 KHMER = 23,
13138 LAO = 24,
13139 LATIN = 25,
13140 MALAYALAM = 26,
13141 MONGOLIAN = 27,
13142 MYANMAR = 28,
13143 OGHAM = 29,
13144 OLD_ITALIC = 30,
13145 ORIYA = 31,
13146 RUNIC = 32,
13147 SINHALA = 33,
13148 SYRIAC = 34,
13149 TAMIL = 35,
13150 TELUGU = 36,
13151 THAANA = 37,
13152 THAI = 38,
13153 TIBETAN = 39,
13154 CANADIAN_ABORIGINAL = 40,
13155 YI = 41,
13156 TAGALOG = 42,
13157 HANUNOO = 43,
13158 BUHID = 44,
13159 TAGBANWA = 45,
13160 BRAILLE = 46,
13161 CYPRIOT = 47,
13162 LIMBU = 48,
13163 OSMANYA = 49,
13164 SHAVIAN = 50,
13165 LINEAR_B = 51,
13166 TAI_LE = 52,
13167 UGARITIC = 53,
13168 NEW_TAI_LUE = 54,
13169 BUGINESE = 55,
13170 GLAGOLITIC = 56,
13171 TIFINAGH = 57,
13172 SYLOTI_NAGRI = 58,
13173 OLD_PERSIAN = 59,
13174 KHAROSHTHI = 60,
13175 UNKNOWN = 61,
13176 BALINESE = 62,
13177 CUNEIFORM = 63,
13178 PHOENICIAN = 64,
13179 PHAGS_PA = 65,
13180 NKO = 66,
13181 KAYAH_LI = 67,
13182 LEPCHA = 68,
13183 REJANG = 69,
13184 SUNDANESE = 70,
13185 SAURASHTRA = 71,
13186 CHAM = 72,
13187 OL_CHIKI = 73,
13188 VAI = 74,
13189 CARIAN = 75,
13190 LYCIAN = 76,
13191 LYDIAN = 77,
13192 AVESTAN = 78,
13193 BAMUM = 79,
13194 EGYPTIAN_HIEROGLYPHS = 80,
13195 IMPERIAL_ARAMAIC = 81,
13196 INSCRIPTIONAL_PAHLAVI = 82,
13197 INSCRIPTIONAL_PARTHIAN = 83,
13198 JAVANESE = 84,
13199 KAITHI = 85,
13200 LISU = 86,
13201 MEETEI_MAYEK = 87,
13202 OLD_SOUTH_ARABIAN = 88,
13203 OLD_TURKIC = 89,
13204 SAMARITAN = 90,
13205 TAI_THAM = 91,
13206 TAI_VIET = 92,
13207 BATAK = 93,
13208 BRAHMI = 94,
13209 MANDAIC = 95,
13210 CHAKMA = 96,
13211 MEROITIC_CURSIVE = 97,
13212 MEROITIC_HIEROGLYPHS = 98,
13213 MIAO = 99,
13214 SHARADA = 100,
13215 SORA_SOMPENG = 101,
13216 TAKRI = 102
13219 // These are the possible character classifications from the
13220 // Unicode specification.
13221 // See <ulink url="http://www.unicode.org/Public/UNIDATA/UnicodeData.html">http://www.unicode.org/Public/UNIDATA/UnicodeData.html</ulink>.
13222 enum UnicodeType {
13223 CONTROL = 0,
13224 FORMAT = 1,
13225 UNASSIGNED = 2,
13226 PRIVATE_USE = 3,
13227 SURROGATE = 4,
13228 LOWERCASE_LETTER = 5,
13229 MODIFIER_LETTER = 6,
13230 OTHER_LETTER = 7,
13231 TITLECASE_LETTER = 8,
13232 UPPERCASE_LETTER = 9,
13233 SPACING_MARK = 10,
13234 ENCLOSING_MARK = 11,
13235 NON_SPACING_MARK = 12,
13236 DECIMAL_NUMBER = 13,
13237 LETTER_NUMBER = 14,
13238 OTHER_NUMBER = 15,
13239 CONNECT_PUNCTUATION = 16,
13240 DASH_PUNCTUATION = 17,
13241 CLOSE_PUNCTUATION = 18,
13242 FINAL_PUNCTUATION = 19,
13243 INITIAL_PUNCTUATION = 20,
13244 OTHER_PUNCTUATION = 21,
13245 OPEN_PUNCTUATION = 22,
13246 CURRENCY_SYMBOL = 23,
13247 MODIFIER_SYMBOL = 24,
13248 MATH_SYMBOL = 25,
13249 OTHER_SYMBOL = 26,
13250 LINE_SEPARATOR = 27,
13251 PARAGRAPH_SEPARATOR = 28,
13252 SPACE_SEPARATOR = 29
13255 // These are logical ids for special directories which are defined
13256 // depending on the platform used. You should use g_get_user_special_dir()
13257 // to retrieve the full path associated to the logical id.
13259 // The #GUserDirectory enumeration can be extended at later date. Not
13260 // every platform has a directory for every logical id in this
13261 // enumeration.
13262 enum UserDirectory /* Version 2.14 */ {
13263 DIRECTORY_DESKTOP = 0,
13264 DIRECTORY_DOCUMENTS = 1,
13265 DIRECTORY_DOWNLOAD = 2,
13266 DIRECTORY_MUSIC = 3,
13267 DIRECTORY_PICTURES = 4,
13268 DIRECTORY_PUBLIC_SHARE = 5,
13269 DIRECTORY_TEMPLATES = 6,
13270 DIRECTORY_VIDEOS = 7,
13271 N_DIRECTORIES = 8
13274 // #GVariant is a variant datatype; it stores a value along with
13275 // information about the type of that value. The range of possible
13276 // values is determined by the type. The type system used by #GVariant
13277 // is #GVariantType.
13279 // #GVariant instances always have a type and a value (which are given
13280 // at construction time). The type and value of a #GVariant instance
13281 // can never change other than by the #GVariant itself being
13282 // destroyed. A #GVariant cannot contain a pointer.
13284 // #GVariant is reference counted using g_variant_ref() and
13285 // g_variant_unref(). #GVariant also has floating reference counts --
13286 // see g_variant_ref_sink().
13288 // #GVariant is completely threadsafe. A #GVariant instance can be
13289 // concurrently accessed in any way from any number of threads without
13290 // problems.
13292 // #GVariant is heavily optimised for dealing with data in serialised
13293 // form. It works particularly well with data located in memory-mapped
13294 // files. It can perform nearly all deserialisation operations in a
13295 // small constant time, usually touching only a single memory page.
13296 // Serialised #GVariant data can also be sent over the network.
13298 // #GVariant is largely compatible with D-Bus. Almost all types of
13299 // #GVariant instances can be sent over D-Bus. See #GVariantType for
13300 // exceptions. (However, #GVariant's serialisation format is not the same
13301 // as the serialisation format of a D-Bus message body: use #GDBusMessage,
13302 // in the gio library, for those.)
13304 // For space-efficiency, the #GVariant serialisation format does not
13305 // automatically include the variant's type or endianness, which must
13306 // either be implied from context (such as knowledge that a particular
13307 // file format always contains a little-endian %G_VARIANT_TYPE_VARIANT)
13308 // or supplied out-of-band (for instance, a type and/or endianness
13309 // indicator could be placed at the beginning of a file, network message
13310 // or network stream).
13312 // A #GVariant's size is limited mainly by any lower level operating
13313 // system constraints, such as the number of bits in #gsize. For
13314 // example, it is reasonable to have a 2GB file mapped into memory
13315 // with #GMappedFile, and call g_variant_new_from_data() on it.
13317 // For convenience to C programmers, #GVariant features powerful
13318 // varargs-based value construction and destruction. This feature is
13319 // designed to be embedded in other libraries.
13321 // There is a Python-inspired text language for describing #GVariant
13322 // values. #GVariant includes a printer for this language and a parser
13323 // with type inferencing.
13325 // <refsect2>
13326 // <title>Memory Use</title>
13327 // <para>
13328 // #GVariant tries to be quite efficient with respect to memory use.
13329 // This section gives a rough idea of how much memory is used by the
13330 // current implementation. The information here is subject to change
13331 // in the future.
13332 // </para>
13333 // <para>
13334 // The memory allocated by #GVariant can be grouped into 4 broad
13335 // purposes: memory for serialised data, memory for the type
13336 // information cache, buffer management memory and memory for the
13337 // #GVariant structure itself.
13338 // </para>
13339 // <refsect3 id="gvariant-serialised-data-memory">
13340 // <title>Serialised Data Memory</title>
13341 // <para>
13342 // This is the memory that is used for storing GVariant data in
13343 // serialised form. This is what would be sent over the network or
13344 // what would end up on disk.
13345 // </para>
13346 // <para>
13347 // The amount of memory required to store a boolean is 1 byte. 16,
13348 // 32 and 64 bit integers and double precision floating point numbers
13349 // use their "natural" size. Strings (including object path and
13350 // signature strings) are stored with a nul terminator, and as such
13351 // use the length of the string plus 1 byte.
13352 // </para>
13353 // <para>
13354 // Maybe types use no space at all to represent the null value and
13355 // use the same amount of space (sometimes plus one byte) as the
13356 // equivalent non-maybe-typed value to represent the non-null case.
13357 // </para>
13358 // <para>
13359 // Arrays use the amount of space required to store each of their
13360 // members, concatenated. Additionally, if the items stored in an
13361 // array are not of a fixed-size (ie: strings, other arrays, etc)
13362 // then an additional framing offset is stored for each item. The
13363 // size of this offset is either 1, 2 or 4 bytes depending on the
13364 // overall size of the container. Additionally, extra padding bytes
13365 // are added as required for alignment of child values.
13366 // </para>
13367 // <para>
13368 // Tuples (including dictionary entries) use the amount of space
13369 // required to store each of their members, concatenated, plus one
13370 // framing offset (as per arrays) for each non-fixed-sized item in
13371 // the tuple, except for the last one. Additionally, extra padding
13372 // bytes are added as required for alignment of child values.
13373 // </para>
13374 // <para>
13375 // Variants use the same amount of space as the item inside of the
13376 // variant, plus 1 byte, plus the length of the type string for the
13377 // item inside the variant.
13378 // </para>
13379 // <para>
13380 // As an example, consider a dictionary mapping strings to variants.
13381 // In the case that the dictionary is empty, 0 bytes are required for
13382 // the serialisation.
13383 // </para>
13384 // <para>
13385 // If we add an item "width" that maps to the int32 value of 500 then
13386 // we will use 4 byte to store the int32 (so 6 for the variant
13387 // containing it) and 6 bytes for the string. The variant must be
13388 // aligned to 8 after the 6 bytes of the string, so that's 2 extra
13389 // bytes. 6 (string) + 2 (padding) + 6 (variant) is 14 bytes used
13390 // for the dictionary entry. An additional 1 byte is added to the
13391 // array as a framing offset making a total of 15 bytes.
13392 // </para>
13393 // <para>
13394 // If we add another entry, "title" that maps to a nullable string
13395 // that happens to have a value of null, then we use 0 bytes for the
13396 // null value (and 3 bytes for the variant to contain it along with
13397 // its type string) plus 6 bytes for the string. Again, we need 2
13398 // padding bytes. That makes a total of 6 + 2 + 3 = 11 bytes.
13399 // </para>
13400 // <para>
13401 // We now require extra padding between the two items in the array.
13402 // After the 14 bytes of the first item, that's 2 bytes required. We
13403 // now require 2 framing offsets for an extra two bytes. 14 + 2 + 11
13404 // + 2 = 29 bytes to encode the entire two-item dictionary.
13405 // </para>
13406 // </refsect3>
13407 // <refsect3>
13408 // <title>Type Information Cache</title>
13409 // <para>
13410 // For each GVariant type that currently exists in the program a type
13411 // information structure is kept in the type information cache. The
13412 // type information structure is required for rapid deserialisation.
13413 // </para>
13414 // <para>
13415 // Continuing with the above example, if a #GVariant exists with the
13416 // type "a{sv}" then a type information struct will exist for
13417 // "a{sv}", "{sv}", "s", and "v". Multiple uses of the same type
13418 // will share the same type information. Additionally, all
13419 // single-digit types are stored in read-only static memory and do
13420 // not contribute to the writable memory footprint of a program using
13421 // #GVariant.
13422 // </para>
13423 // <para>
13424 // Aside from the type information structures stored in read-only
13425 // memory, there are two forms of type information. One is used for
13426 // container types where there is a single element type: arrays and
13427 // maybe types. The other is used for container types where there
13428 // are multiple element types: tuples and dictionary entries.
13429 // </para>
13430 // <para>
13431 // Array type info structures are 6 * sizeof (void *), plus the
13432 // memory required to store the type string itself. This means that
13433 // on 32bit systems, the cache entry for "a{sv}" would require 30
13434 // bytes of memory (plus malloc overhead).
13435 // </para>
13436 // <para>
13437 // Tuple type info structures are 6 * sizeof (void *), plus 4 *
13438 // sizeof (void *) for each item in the tuple, plus the memory
13439 // required to store the type string itself. A 2-item tuple, for
13440 // example, would have a type information structure that consumed
13441 // writable memory in the size of 14 * sizeof (void *) (plus type
13442 // string) This means that on 32bit systems, the cache entry for
13443 // "{sv}" would require 61 bytes of memory (plus malloc overhead).
13444 // </para>
13445 // <para>
13446 // This means that in total, for our "a{sv}" example, 91 bytes of
13447 // type information would be allocated.
13448 // </para>
13449 // <para>
13450 // The type information cache, additionally, uses a #GHashTable to
13451 // store and lookup the cached items and stores a pointer to this
13452 // hash table in static storage. The hash table is freed when there
13453 // are zero items in the type cache.
13454 // </para>
13455 // <para>
13456 // Although these sizes may seem large it is important to remember
13457 // that a program will probably only have a very small number of
13458 // different types of values in it and that only one type information
13459 // structure is required for many different values of the same type.
13460 // </para>
13461 // </refsect3>
13462 // <refsect3>
13463 // <title>Buffer Management Memory</title>
13464 // <para>
13465 // #GVariant uses an internal buffer management structure to deal
13466 // with the various different possible sources of serialised data
13467 // that it uses. The buffer is responsible for ensuring that the
13468 // correct call is made when the data is no longer in use by
13469 // #GVariant. This may involve a g_free() or a g_slice_free() or
13470 // even g_mapped_file_unref().
13471 // </para>
13472 // <para>
13473 // One buffer management structure is used for each chunk of
13474 // serialised data. The size of the buffer management structure is 4
13475 // * (void *). On 32bit systems, that's 16 bytes.
13476 // </para>
13477 // </refsect3>
13478 // <refsect3>
13479 // <title>GVariant structure</title>
13480 // <para>
13481 // The size of a #GVariant structure is 6 * (void *). On 32 bit
13482 // systems, that's 24 bytes.
13483 // </para>
13484 // <para>
13485 // #GVariant structures only exist if they are explicitly created
13486 // with API calls. For example, if a #GVariant is constructed out of
13487 // serialised data for the example given above (with the dictionary)
13488 // then although there are 9 individual values that comprise the
13489 // entire dictionary (two keys, two values, two variants containing
13490 // the values, two dictionary entries, plus the dictionary itself),
13491 // only 1 #GVariant instance exists -- the one referring to the
13492 // dictionary.
13493 // </para>
13494 // <para>
13495 // If calls are made to start accessing the other values then
13496 // #GVariant instances will exist for those values only for as long
13497 // as they are in use (ie: until you call g_variant_unref()). The
13498 // type information is shared. The serialised data and the buffer
13499 // management structure for that serialised data is shared by the
13500 // child.
13501 // </para>
13502 // </refsect3>
13503 // <refsect3>
13504 // <title>Summary</title>
13505 // <para>
13506 // To put the entire example together, for our dictionary mapping
13507 // strings to variants (with two entries, as given above), we are
13508 // using 91 bytes of memory for type information, 29 byes of memory
13509 // for the serialised data, 16 bytes for buffer management and 24
13510 // bytes for the #GVariant instance, or a total of 160 bytes, plus
13511 // malloc overhead. If we were to use g_variant_get_child_value() to
13512 // access the two dictionary entries, we would use an additional 48
13513 // bytes. If we were to have other dictionaries of the same type, we
13514 // would use more memory for the serialised data and buffer
13515 // management for those dictionaries, but the type information would
13516 // be shared.
13517 // </para>
13518 // </refsect3>
13519 // </refsect2>
13520 struct Variant /* Version 2.24 */ {
13522 // Unintrospectable constructor: new() / g_variant_new()
13523 // VERSION: 2.24
13524 // Creates a new #GVariant instance.
13526 // Think of this function as an analogue to g_strdup_printf().
13528 // The type of the created instance and the arguments that are
13529 // expected by this function are determined by @format_string. See the
13530 // section on <link linkend='gvariant-format-strings'>GVariant Format
13531 // Strings</link>. Please note that the syntax of the format string is
13532 // very likely to be extended in the future.
13534 // The first character of the format string must not be '*' '?' '@' or
13535 // 'r'; in essence, a new #GVariant must always be constructed by this
13536 // function (and not merely passed through it unmodified).
13537 // RETURNS: a new floating #GVariant instance
13538 // <format_string>: a #GVariant format string
13539 alias g_variant_new new_; // Variadic
13541 // VERSION: 2.24
13542 // Creates a new #GVariant array from @children.
13544 // @child_type must be non-%NULL if @n_children is zero. Otherwise, the
13545 // child type is determined by inspecting the first element of the
13546 // @children array. If @child_type is non-%NULL then it must be a
13547 // definite type.
13549 // The items of the array are taken from the @children array. No entry
13550 // in the @children array may be %NULL.
13552 // All items in the array must have the same type, which must be the
13553 // same as @child_type, if given.
13555 // If the @children are floating references (see g_variant_ref_sink()), the
13556 // new instance takes ownership of them as if via g_variant_ref_sink().
13557 // RETURNS: a floating reference to a new #GVariant array
13558 // <child_type>: the element type of the new array
13559 // <children>: an array of #GVariant pointers, the children
13560 // <n_children>: the length of @children
13561 static Variant* new_array(AT0, AT1)(AT0 /*VariantType*/ child_type, AT1 /*Variant**/ children, size_t n_children) nothrow {
13562 return g_variant_new_array(UpCast!(VariantType*)(child_type), UpCast!(Variant**)(children), n_children);
13564 static auto opCall(AT0, AT1)(AT0 /*VariantType*/ child_type, AT1 /*Variant**/ children, size_t n_children) {
13565 return g_variant_new_array(UpCast!(VariantType*)(child_type), UpCast!(Variant**)(children), n_children);
13568 // VERSION: 2.24
13569 // Creates a new boolean #GVariant instance -- either %TRUE or %FALSE.
13570 // RETURNS: a floating reference to a new boolean #GVariant instance
13571 // <value>: a #gboolean value
13572 static Variant* new_boolean()(int value) nothrow {
13573 return g_variant_new_boolean(value);
13575 static auto opCall()(int value) {
13576 return g_variant_new_boolean(value);
13579 // VERSION: 2.24
13580 // Creates a new byte #GVariant instance.
13581 // RETURNS: a floating reference to a new byte #GVariant instance
13582 // <value>: a #guint8 value
13583 static Variant* new_byte()(ubyte value) nothrow {
13584 return g_variant_new_byte(value);
13586 static auto opCall()(ubyte value) {
13587 return g_variant_new_byte(value);
13590 // VERSION: 2.26
13591 // Creates an array-of-bytes #GVariant with the contents of @string.
13592 // This function is just like g_variant_new_string() except that the
13593 // string need not be valid utf8.
13595 // The nul terminator character at the end of the string is stored in
13596 // the array.
13597 // RETURNS: a floating reference to a new bytestring #GVariant instance
13598 // <string>: a normal nul-terminated string in no particular encoding
13599 static Variant* new_bytestring(AT0)(AT0 /*ubyte*/ string_) nothrow {
13600 return g_variant_new_bytestring(UpCast!(ubyte*)(string_));
13602 static auto opCall(AT0)(AT0 /*ubyte*/ string_) {
13603 return g_variant_new_bytestring(UpCast!(ubyte*)(string_));
13606 // VERSION: 2.26
13607 // Constructs an array of bytestring #GVariant from the given array of
13608 // strings.
13610 // If @length is -1 then @strv is %NULL-terminated.
13611 // RETURNS: a new floating #GVariant instance
13612 // <strv>: an array of strings
13613 // <length>: the length of @strv, or -1
13614 static Variant* new_bytestring_array(AT0)(AT0 /*char**/ strv, ssize_t length) nothrow {
13615 return g_variant_new_bytestring_array(toCString!(char**)(strv), length);
13617 static auto opCall(AT0)(AT0 /*char**/ strv, ssize_t length) {
13618 return g_variant_new_bytestring_array(toCString!(char**)(strv), length);
13621 // VERSION: 2.24
13622 // Creates a new dictionary entry #GVariant. @key and @value must be
13623 // non-%NULL. @key must be a value of a basic type (ie: not a container).
13625 // If the @key or @value are floating references (see g_variant_ref_sink()),
13626 // the new instance takes ownership of them as if via g_variant_ref_sink().
13627 // RETURNS: a floating reference to a new dictionary entry #GVariant
13628 // <key>: a basic #GVariant, the key
13629 // <value>: a #GVariant, the value
13630 static Variant* new_dict_entry(AT0, AT1)(AT0 /*Variant*/ key, AT1 /*Variant*/ value) nothrow {
13631 return g_variant_new_dict_entry(UpCast!(Variant*)(key), UpCast!(Variant*)(value));
13633 static auto opCall(AT0, AT1)(AT0 /*Variant*/ key, AT1 /*Variant*/ value) {
13634 return g_variant_new_dict_entry(UpCast!(Variant*)(key), UpCast!(Variant*)(value));
13637 // VERSION: 2.24
13638 // Creates a new double #GVariant instance.
13639 // RETURNS: a floating reference to a new double #GVariant instance
13640 // <value>: a #gdouble floating point value
13641 static Variant* new_double()(double value) nothrow {
13642 return g_variant_new_double(value);
13644 static auto opCall()(double value) {
13645 return g_variant_new_double(value);
13648 // VERSION: 2.32
13649 // Provides access to the serialised data for an array of fixed-sized
13650 // items.
13652 // @value must be an array with fixed-sized elements. Numeric types are
13653 // fixed-size as are tuples containing only other fixed-sized types.
13655 // @element_size must be the size of a single element in the array. For
13656 // example, if calling this function for an array of 32 bit integers,
13657 // you might say <code>sizeof (gint32)</code>. This value isn't used
13658 // except for the purpose of a double-check that the form of the
13659 // serialised data matches the caller's expectation.
13661 // @n_elements, which must be non-%NULL is set equal to the number of
13662 // items in the array.
13663 // RETURNS: a floating reference to a new array #GVariant instance
13664 // <element_type>: the #GVariantType of each element
13665 // <elements>: a pointer to the fixed array of contiguous elements
13666 // <n_elements>: the number of elements
13667 // <element_size>: the size of each element
13668 static Variant* new_fixed_array(AT0, AT1)(AT0 /*VariantType*/ element_type, AT1 /*const(void)*/ elements, size_t n_elements, size_t element_size) nothrow {
13669 return g_variant_new_fixed_array(UpCast!(VariantType*)(element_type), UpCast!(const(void)*)(elements), n_elements, element_size);
13671 static auto opCall(AT0, AT1)(AT0 /*VariantType*/ element_type, AT1 /*const(void)*/ elements, size_t n_elements, size_t element_size) {
13672 return g_variant_new_fixed_array(UpCast!(VariantType*)(element_type), UpCast!(const(void)*)(elements), n_elements, element_size);
13675 // VERSION: 2.24
13676 // Creates a new #GVariant instance from serialised data.
13678 // @type is the type of #GVariant instance that will be constructed.
13679 // The interpretation of @data depends on knowing the type.
13681 // @data is not modified by this function and must remain valid with an
13682 // unchanging value until such a time as @notify is called with
13683 // @user_data. If the contents of @data change before that time then
13684 // the result is undefined.
13686 // If @data is trusted to be serialised data in normal form then
13687 // @trusted should be %TRUE. This applies to serialised data created
13688 // within this process or read from a trusted location on the disk (such
13689 // as a file installed in /usr/lib alongside your application). You
13690 // should set trusted to %FALSE if @data is read from the network, a
13691 // file in the user's home directory, etc.
13693 // If @data was not stored in this machine's native endianness, any multi-byte
13694 // numeric values in the returned variant will also be in non-native
13695 // endianness. g_variant_byteswap() can be used to recover the original values.
13697 // @notify will be called with @user_data when @data is no longer
13698 // needed. The exact time of this call is unspecified and might even be
13699 // before this function returns.
13700 // RETURNS: a new floating #GVariant of type @type
13701 // <type>: a definite #GVariantType
13702 // <data>: the serialised data
13703 // <size>: the size of @data
13704 // <trusted>: %TRUE if @data is definitely in normal form
13705 // <notify>: function to call when @data is no longer needed
13706 // <user_data>: data for @notify
13707 static Variant* new_from_data(AT0, AT1, AT2)(AT0 /*VariantType*/ type, AT1 /*const(ubyte)*/ data, size_t size, int trusted, DestroyNotify notify, AT2 /*void*/ user_data) nothrow {
13708 return g_variant_new_from_data(UpCast!(VariantType*)(type), UpCast!(const(ubyte)*)(data), size, trusted, notify, UpCast!(void*)(user_data));
13710 static auto opCall(AT0, AT1, AT2)(AT0 /*VariantType*/ type, AT1 /*const(ubyte)*/ data, size_t size, int trusted, DestroyNotify notify, AT2 /*void*/ user_data) {
13711 return g_variant_new_from_data(UpCast!(VariantType*)(type), UpCast!(const(ubyte)*)(data), size, trusted, notify, UpCast!(void*)(user_data));
13714 // VERSION: 2.24
13715 // Creates a new handle #GVariant instance.
13717 // By convention, handles are indexes into an array of file descriptors
13718 // that are sent alongside a D-Bus message. If you're not interacting
13719 // with D-Bus, you probably don't need them.
13720 // RETURNS: a floating reference to a new handle #GVariant instance
13721 // <value>: a #gint32 value
13722 static Variant* new_handle()(int value) nothrow {
13723 return g_variant_new_handle(value);
13725 static auto opCall()(int value) {
13726 return g_variant_new_handle(value);
13729 // VERSION: 2.24
13730 // Creates a new int16 #GVariant instance.
13731 // RETURNS: a floating reference to a new int16 #GVariant instance
13732 // <value>: a #gint16 value
13733 static Variant* new_int16()(short value) nothrow {
13734 return g_variant_new_int16(value);
13736 static auto opCall()(short value) {
13737 return g_variant_new_int16(value);
13740 // VERSION: 2.24
13741 // Creates a new int32 #GVariant instance.
13742 // RETURNS: a floating reference to a new int32 #GVariant instance
13743 // <value>: a #gint32 value
13744 static Variant* new_int32()(int value) nothrow {
13745 return g_variant_new_int32(value);
13747 static auto opCall()(int value) {
13748 return g_variant_new_int32(value);
13751 // VERSION: 2.24
13752 // Creates a new int64 #GVariant instance.
13753 // RETURNS: a floating reference to a new int64 #GVariant instance
13754 // <value>: a #gint64 value
13755 static Variant* new_int64()(long value) nothrow {
13756 return g_variant_new_int64(value);
13758 static auto opCall()(long value) {
13759 return g_variant_new_int64(value);
13762 // VERSION: 2.24
13763 // Depending on if @child is %NULL, either wraps @child inside of a
13764 // maybe container or creates a Nothing instance for the given @type.
13766 // At least one of @child_type and @child must be non-%NULL.
13767 // If @child_type is non-%NULL then it must be a definite type.
13768 // If they are both non-%NULL then @child_type must be the type
13769 // of @child.
13771 // If @child is a floating reference (see g_variant_ref_sink()), the new
13772 // instance takes ownership of @child.
13773 // RETURNS: a floating reference to a new #GVariant maybe instance
13774 // <child_type>: the #GVariantType of the child, or %NULL
13775 // <child>: the child value, or %NULL
13776 static Variant* new_maybe(AT0, AT1)(AT0 /*VariantType*/ child_type=null, AT1 /*Variant*/ child=null) nothrow {
13777 return g_variant_new_maybe(UpCast!(VariantType*)(child_type), UpCast!(Variant*)(child));
13779 static auto opCall(AT0, AT1)(AT0 /*VariantType*/ child_type=null, AT1 /*Variant*/ child=null) {
13780 return g_variant_new_maybe(UpCast!(VariantType*)(child_type), UpCast!(Variant*)(child));
13783 // VERSION: 2.24
13784 // Creates a D-Bus object path #GVariant with the contents of @string.
13785 // @string must be a valid D-Bus object path. Use
13786 // g_variant_is_object_path() if you're not sure.
13787 // RETURNS: a floating reference to a new object path #GVariant instance
13788 // <object_path>: a normal C nul-terminated string
13789 static Variant* new_object_path(AT0)(AT0 /*char*/ object_path) nothrow {
13790 return g_variant_new_object_path(toCString!(char*)(object_path));
13792 static auto opCall(AT0)(AT0 /*char*/ object_path) {
13793 return g_variant_new_object_path(toCString!(char*)(object_path));
13796 // VERSION: 2.30
13797 // Constructs an array of object paths #GVariant from the given array of
13798 // strings.
13800 // Each string must be a valid #GVariant object path; see
13801 // g_variant_is_object_path().
13803 // If @length is -1 then @strv is %NULL-terminated.
13804 // RETURNS: a new floating #GVariant instance
13805 // <strv>: an array of strings
13806 // <length>: the length of @strv, or -1
13807 static Variant* new_objv(AT0)(AT0 /*char**/ strv, ssize_t length) nothrow {
13808 return g_variant_new_objv(toCString!(char**)(strv), length);
13810 static auto opCall(AT0)(AT0 /*char**/ strv, ssize_t length) {
13811 return g_variant_new_objv(toCString!(char**)(strv), length);
13814 // Unintrospectable constructor: new_parsed() / g_variant_new_parsed()
13815 // Parses @format and returns the result.
13817 // point that a value may appear in the text, a '%' character followed
13818 // by a GVariant format string (as per g_variant_new()) may appear. In
13819 // that case, the same arguments are collected from the argument list as
13820 // g_variant_new() would have collected.
13822 // Consider this simple example:
13824 // <informalexample><programlisting>
13825 // g_variant_new_parsed ("[('one', 1), ('two', %i), (%s, 3)]", 2, "three");
13826 // </programlisting></informalexample>
13828 // In the example, the variable argument parameters are collected and
13829 // filled in as if they were part of the original string to produce the
13830 // result of <code>[('one', 1), ('two', 2), ('three', 3)]</code>.
13832 // This function is intended only to be used with @format as a string
13833 // literal. Any parse error is fatal to the calling process. If you
13834 // want to parse data from untrusted sources, use g_variant_parse().
13836 // You may not use this function to return, unmodified, a single
13837 // #GVariant pointer from the argument list. ie: @format may not solely
13838 // be anything along the lines of "%*", "%?", "\%r", or anything starting
13839 // with "%@".
13840 // RETURNS: a new floating #GVariant instance
13841 // <format>: a text format #GVariant
13842 alias g_variant_new_parsed new_parsed; // Variadic
13844 // Unintrospectable constructor: new_parsed_va() / g_variant_new_parsed_va()
13845 // Parses @format and returns the result.
13847 // This is the version of g_variant_new_parsed() intended to be used
13848 // from libraries.
13850 // The return value will be floating if it was a newly created GVariant
13851 // instance. In the case that @format simply specified the collection
13852 // of a #GVariant pointer (eg: @format was "%*") then the collected
13853 // #GVariant pointer will be returned unmodified, without adding any
13854 // additional references.
13856 // In order to behave correctly in all cases it is necessary for the
13857 // calling function to g_variant_ref_sink() the return result before
13858 // returning control to the user that originally provided the pointer.
13859 // At this point, the caller will have their own full reference to the
13860 // result. This can also be done by adding the result to a container,
13861 // or by passing it to another g_variant_new() call.
13862 // RETURNS: a new, usually floating, #GVariant
13863 // <format>: a text format #GVariant
13864 // <app>: a pointer to a #va_list
13865 static Variant* /*new*/ new_parsed_va(AT0, AT1)(AT0 /*char*/ format, AT1 /*va_list*/ app) nothrow {
13866 return g_variant_new_parsed_va(toCString!(char*)(format), UpCast!(va_list*)(app));
13868 static auto opCall(AT0, AT1)(AT0 /*char*/ format, AT1 /*va_list*/ app) {
13869 return g_variant_new_parsed_va(toCString!(char*)(format), UpCast!(va_list*)(app));
13872 // VERSION: 2.24
13873 // Creates a D-Bus type signature #GVariant with the contents of
13874 // @string. @string must be a valid D-Bus type signature. Use
13875 // g_variant_is_signature() if you're not sure.
13876 // RETURNS: a floating reference to a new signature #GVariant instance
13877 // <signature>: a normal C nul-terminated string
13878 static Variant* new_signature(AT0)(AT0 /*char*/ signature) nothrow {
13879 return g_variant_new_signature(toCString!(char*)(signature));
13881 static auto opCall(AT0)(AT0 /*char*/ signature) {
13882 return g_variant_new_signature(toCString!(char*)(signature));
13885 // VERSION: 2.24
13886 // Creates a string #GVariant with the contents of @string.
13888 // @string must be valid utf8.
13889 // RETURNS: a floating reference to a new string #GVariant instance
13890 // <string>: a normal utf8 nul-terminated string
13891 static Variant* new_string(AT0)(AT0 /*char*/ string_) nothrow {
13892 return g_variant_new_string(toCString!(char*)(string_));
13894 static auto opCall(AT0)(AT0 /*char*/ string_) {
13895 return g_variant_new_string(toCString!(char*)(string_));
13898 // VERSION: 2.24
13899 // Constructs an array of strings #GVariant from the given array of
13900 // strings.
13902 // If @length is -1 then @strv is %NULL-terminated.
13903 // RETURNS: a new floating #GVariant instance
13904 // <strv>: an array of strings
13905 // <length>: the length of @strv, or -1
13906 static Variant* new_strv(AT0)(AT0 /*char**/ strv, ssize_t length) nothrow {
13907 return g_variant_new_strv(toCString!(char**)(strv), length);
13909 static auto opCall(AT0)(AT0 /*char**/ strv, ssize_t length) {
13910 return g_variant_new_strv(toCString!(char**)(strv), length);
13913 // VERSION: 2.24
13914 // Creates a new tuple #GVariant out of the items in @children. The
13915 // type is determined from the types of @children. No entry in the
13916 // @children array may be %NULL.
13918 // If @n_children is 0 then the unit tuple is constructed.
13920 // If the @children are floating references (see g_variant_ref_sink()), the
13921 // new instance takes ownership of them as if via g_variant_ref_sink().
13922 // RETURNS: a floating reference to a new #GVariant tuple
13923 // <children>: the items to make the tuple out of
13924 // <n_children>: the length of @children
13925 static Variant* new_tuple(AT0)(AT0 /*Variant**/ children, size_t n_children) nothrow {
13926 return g_variant_new_tuple(UpCast!(Variant**)(children), n_children);
13928 static auto opCall(AT0)(AT0 /*Variant**/ children, size_t n_children) {
13929 return g_variant_new_tuple(UpCast!(Variant**)(children), n_children);
13932 // VERSION: 2.24
13933 // Creates a new uint16 #GVariant instance.
13934 // RETURNS: a floating reference to a new uint16 #GVariant instance
13935 // <value>: a #guint16 value
13936 static Variant* new_uint16()(ushort value) nothrow {
13937 return g_variant_new_uint16(value);
13939 static auto opCall()(ushort value) {
13940 return g_variant_new_uint16(value);
13943 // VERSION: 2.24
13944 // Creates a new uint32 #GVariant instance.
13945 // RETURNS: a floating reference to a new uint32 #GVariant instance
13946 // <value>: a #guint32 value
13947 static Variant* new_uint32()(uint value) nothrow {
13948 return g_variant_new_uint32(value);
13950 static auto opCall()(uint value) {
13951 return g_variant_new_uint32(value);
13954 // VERSION: 2.24
13955 // Creates a new uint64 #GVariant instance.
13956 // RETURNS: a floating reference to a new uint64 #GVariant instance
13957 // <value>: a #guint64 value
13958 static Variant* new_uint64()(ulong value) nothrow {
13959 return g_variant_new_uint64(value);
13961 static auto opCall()(ulong value) {
13962 return g_variant_new_uint64(value);
13965 // Unintrospectable constructor: new_va() / g_variant_new_va()
13966 // VERSION: 2.24
13967 // This function is intended to be used by libraries based on
13968 // #GVariant that want to provide g_variant_new()-like functionality
13969 // to their users.
13971 // The API is more general than g_variant_new() to allow a wider range
13972 // of possible uses.
13974 // @format_string must still point to a valid format string, but it only
13975 // needs to be nul-terminated if @endptr is %NULL. If @endptr is
13976 // non-%NULL then it is updated to point to the first character past the
13977 // end of the format string.
13979 // @app is a pointer to a #va_list. The arguments, according to
13980 // @format_string, are collected from this #va_list and the list is left
13981 // pointing to the argument following the last.
13983 // These two generalisations allow mixing of multiple calls to
13984 // g_variant_new_va() and g_variant_get_va() within a single actual
13985 // varargs call by the user.
13987 // The return value will be floating if it was a newly created GVariant
13988 // instance (for example, if the format string was "(ii)"). In the case
13989 // that the format_string was '*', '?', 'r', or a format starting with
13990 // '@' then the collected #GVariant pointer will be returned unmodified,
13991 // without adding any additional references.
13993 // In order to behave correctly in all cases it is necessary for the
13994 // calling function to g_variant_ref_sink() the return result before
13995 // returning control to the user that originally provided the pointer.
13996 // At this point, the caller will have their own full reference to the
13997 // result. This can also be done by adding the result to a container,
13998 // or by passing it to another g_variant_new() call.
13999 // RETURNS: a new, usually floating, #GVariant
14000 // <format_string>: a string that is prefixed with a format string
14001 // <endptr>: location to store the end pointer, or %NULL
14002 // <app>: a pointer to a #va_list
14003 static Variant* /*new*/ new_va(AT0, AT1, AT2)(AT0 /*char*/ format_string, AT1 /*char**/ endptr, AT2 /*va_list*/ app) nothrow {
14004 return g_variant_new_va(toCString!(char*)(format_string), toCString!(char**)(endptr), UpCast!(va_list*)(app));
14006 static auto opCall(AT0, AT1, AT2)(AT0 /*char*/ format_string, AT1 /*char**/ endptr, AT2 /*va_list*/ app) {
14007 return g_variant_new_va(toCString!(char*)(format_string), toCString!(char**)(endptr), UpCast!(va_list*)(app));
14010 // VERSION: 2.24
14011 // Boxes @value. The result is a #GVariant instance representing a
14012 // variant containing the original value.
14014 // If @child is a floating reference (see g_variant_ref_sink()), the new
14015 // instance takes ownership of @child.
14016 // RETURNS: a floating reference to a new variant #GVariant instance
14017 // <value>: a #GVariant instance
14018 static Variant* new_variant(AT0)(AT0 /*Variant*/ value) nothrow {
14019 return g_variant_new_variant(UpCast!(Variant*)(value));
14021 static auto opCall(AT0)(AT0 /*Variant*/ value) {
14022 return g_variant_new_variant(UpCast!(Variant*)(value));
14025 // VERSION: 2.24
14026 // Performs a byteswapping operation on the contents of @value. The
14027 // result is that all multi-byte numeric data contained in @value is
14028 // byteswapped. That includes 16, 32, and 64bit signed and unsigned
14029 // integers as well as file handles and double precision floating point
14030 // values.
14032 // This function is an identity mapping on any value that does not
14033 // contain multi-byte numeric data. That include strings, booleans,
14034 // bytes and containers containing only these things (recursively).
14036 // The returned value is always in normal form and is marked as trusted.
14037 // RETURNS: the byteswapped form of @value
14038 Variant* /*new*/ byteswap()() nothrow {
14039 return g_variant_byteswap(&this);
14042 // VERSION: 2.24
14043 // Classifies @value according to its top-level type.
14044 // RETURNS: the #GVariantClass of @value
14045 VariantClass classify()() nothrow {
14046 return g_variant_classify(&this);
14049 // VERSION: 2.26
14050 // Compares @one and @two.
14052 // The types of @one and @two are #gconstpointer only to allow use of
14053 // this function with #GTree, #GPtrArray, etc. They must each be a
14054 // #GVariant.
14056 // Comparison is only defined for basic types (ie: booleans, numbers,
14057 // strings). For booleans, %FALSE is less than %TRUE. Numbers are
14058 // ordered in the usual way. Strings are in ASCII lexographical order.
14060 // It is a programmer error to attempt to compare container values or
14061 // two values that have types that are not exactly equal. For example,
14062 // you cannot compare a 32-bit signed integer with a 32-bit unsigned
14063 // integer. Also note that this function is not particularly
14064 // well-behaved when it comes to comparison of doubles; in particular,
14065 // the handling of incomparable values (ie: NaN) is undefined.
14067 // If you only require an equality comparison, g_variant_equal() is more
14068 // general.
14070 // zero if a = b;
14071 // positive value if a &gt; b.
14072 // RETURNS: negative value if a &lt; b;
14073 // <two>: a #GVariant instance of the same type
14074 int compare(AT0)(AT0 /*const(Variant)*/ two) nothrow {
14075 return g_variant_compare(&this, UpCast!(const(Variant)*)(two));
14078 // VERSION: 2.26
14079 // Similar to g_variant_get_bytestring() except that instead of
14080 // returning a constant string, the string is duplicated.
14082 // The return value must be freed using g_free().
14084 // (element-type guint8): a newly allocated string
14085 // RETURNS: (transfer full) (array zero-terminated=1 length=length)
14086 // <length>: a pointer to a #gsize, to store the length (not including the nul terminator)
14087 char* /*new*/ dup_bytestring(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14088 return g_variant_dup_bytestring(&this, UpCast!(size_t*)(length));
14091 // VERSION: 2.26
14092 // Gets the contents of an array of array of bytes #GVariant. This call
14093 // makes a deep copy; the return result should be released with
14094 // g_strfreev().
14096 // If @length is non-%NULL then the number of elements in the result is
14097 // stored there. In any case, the resulting array will be
14098 // %NULL-terminated.
14100 // For an empty array, @length will be set to 0 and a pointer to a
14101 // %NULL pointer will be returned.
14102 // RETURNS: an array of strings
14103 // <length>: the length of the result, or %NULL
14104 char** /*new*/ dup_bytestring_array(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14105 return g_variant_dup_bytestring_array(&this, UpCast!(size_t*)(length));
14108 // VERSION: 2.30
14109 // Gets the contents of an array of object paths #GVariant. This call
14110 // makes a deep copy; the return result should be released with
14111 // g_strfreev().
14113 // If @length is non-%NULL then the number of elements in the result
14114 // is stored there. In any case, the resulting array will be
14115 // %NULL-terminated.
14117 // For an empty array, @length will be set to 0 and a pointer to a
14118 // %NULL pointer will be returned.
14119 // RETURNS: an array of strings
14120 // <length>: the length of the result, or %NULL
14121 char** /*new*/ dup_objv(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14122 return g_variant_dup_objv(&this, UpCast!(size_t*)(length));
14125 // VERSION: 2.24
14126 // Similar to g_variant_get_string() except that instead of returning
14127 // a constant string, the string is duplicated.
14129 // The string will always be utf8 encoded.
14131 // The return value must be freed using g_free().
14132 // RETURNS: a newly allocated string, utf8 encoded
14133 // <length>: a pointer to a #gsize, to store the length
14134 char* /*new*/ dup_string(AT0)(/*out*/ AT0 /*size_t*/ length) nothrow {
14135 return g_variant_dup_string(&this, UpCast!(size_t*)(length));
14138 // VERSION: 2.24
14139 // Gets the contents of an array of strings #GVariant. This call
14140 // makes a deep copy; the return result should be released with
14141 // g_strfreev().
14143 // If @length is non-%NULL then the number of elements in the result
14144 // is stored there. In any case, the resulting array will be
14145 // %NULL-terminated.
14147 // For an empty array, @length will be set to 0 and a pointer to a
14148 // %NULL pointer will be returned.
14149 // RETURNS: an array of strings
14150 // <length>: the length of the result, or %NULL
14151 char** /*new*/ dup_strv(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14152 return g_variant_dup_strv(&this, UpCast!(size_t*)(length));
14155 // VERSION: 2.24
14156 // Checks if @one and @two have the same type and value.
14158 // The types of @one and @two are #gconstpointer only to allow use of
14159 // this function with #GHashTable. They must each be a #GVariant.
14160 // RETURNS: %TRUE if @one and @two are equal
14161 // <two>: a #GVariant instance
14162 int equal(AT0)(AT0 /*const(Variant)*/ two) nothrow {
14163 return g_variant_equal(&this, UpCast!(const(Variant)*)(two));
14166 // Unintrospectable method: get() / g_variant_get()
14167 // VERSION: 2.24
14168 // Deconstructs a #GVariant instance.
14170 // Think of this function as an analogue to scanf().
14172 // The arguments that are expected by this function are entirely
14173 // determined by @format_string. @format_string also restricts the
14174 // permissible types of @value. It is an error to give a value with
14175 // an incompatible type. See the section on <link
14176 // linkend='gvariant-format-strings'>GVariant Format Strings</link>.
14177 // Please note that the syntax of the format string is very likely to be
14178 // extended in the future.
14179 // <format_string>: a #GVariant format string
14180 /+ Not available -- variadic methods unsupported - use the C function directly.
14181 alias g_variant_get get; // Variadic
14184 // VERSION: 2.24
14185 // Returns the boolean value of @value.
14187 // It is an error to call this function with a @value of any type
14188 // other than %G_VARIANT_TYPE_BOOLEAN.
14189 // RETURNS: %TRUE or %FALSE
14190 int get_boolean()() nothrow {
14191 return g_variant_get_boolean(&this);
14194 // VERSION: 2.24
14195 // Returns the byte value of @value.
14197 // It is an error to call this function with a @value of any type
14198 // other than %G_VARIANT_TYPE_BYTE.
14199 // RETURNS: a #guchar
14200 ubyte get_byte()() nothrow {
14201 return g_variant_get_byte(&this);
14204 // VERSION: 2.26
14205 // Returns the string value of a #GVariant instance with an
14206 // array-of-bytes type. The string has no particular encoding.
14208 // If the array does not end with a nul terminator character, the empty
14209 // string is returned. For this reason, you can always trust that a
14210 // non-%NULL nul-terminated string will be returned by this function.
14212 // If the array contains a nul terminator character somewhere other than
14213 // the last byte then the returned string is the string, up to the first
14214 // such nul character.
14216 // It is an error to call this function with a @value that is not an
14217 // array of bytes.
14219 // The return value remains valid as long as @value exists.
14221 // the constant string
14222 ubyte* get_bytestring()() nothrow {
14223 return g_variant_get_bytestring(&this);
14226 // VERSION: 2.26
14227 // Gets the contents of an array of array of bytes #GVariant. This call
14228 // makes a shallow copy; the return result should be released with
14229 // g_free(), but the individual strings must not be modified.
14231 // If @length is non-%NULL then the number of elements in the result is
14232 // stored there. In any case, the resulting array will be
14233 // %NULL-terminated.
14235 // For an empty array, @length will be set to 0 and a pointer to a
14236 // %NULL pointer will be returned.
14237 // RETURNS: an array of constant strings
14238 // <length>: the length of the result, or %NULL
14239 char** /*new container*/ get_bytestring_array(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14240 return g_variant_get_bytestring_array(&this, UpCast!(size_t*)(length));
14243 // Unintrospectable method: get_child() / g_variant_get_child()
14244 // VERSION: 2.24
14245 // Reads a child item out of a container #GVariant instance and
14246 // deconstructs it according to @format_string. This call is
14247 // essentially a combination of g_variant_get_child_value() and
14248 // g_variant_get().
14249 // <index_>: the index of the child to deconstruct
14250 // <format_string>: a #GVariant format string
14251 /+ Not available -- variadic methods unsupported - use the C function directly.
14252 alias g_variant_get_child get_child; // Variadic
14255 // VERSION: 2.24
14256 // Reads a child item out of a container #GVariant instance. This
14257 // includes variants, maybes, arrays, tuples and dictionary
14258 // entries. It is an error to call this function on any other type of
14259 // #GVariant.
14261 // It is an error if @index_ is greater than the number of child items
14262 // in the container. See g_variant_n_children().
14264 // The returned value is never floating. You should free it with
14265 // g_variant_unref() when you're done with it.
14267 // This function is O(1).
14268 // RETURNS: the child at the specified index
14269 // <index_>: the index of the child to fetch
14270 Variant* /*new*/ get_child_value()(size_t index_) nothrow {
14271 return g_variant_get_child_value(&this, index_);
14274 // VERSION: 2.24
14275 // Returns a pointer to the serialised form of a #GVariant instance.
14276 // The returned data may not be in fully-normalised form if read from an
14277 // untrusted source. The returned data must not be freed; it remains
14278 // valid for as long as @value exists.
14280 // If @value is a fixed-sized value that was deserialised from a
14281 // corrupted serialised container then %NULL may be returned. In this
14282 // case, the proper thing to do is typically to use the appropriate
14283 // number of nul bytes in place of @value. If @value is not fixed-sized
14284 // then %NULL is never returned.
14286 // In the case that @value is already in serialised form, this function
14287 // is O(1). If the value is not already in serialised form,
14288 // serialisation occurs implicitly and is approximately O(n) in the size
14289 // of the result.
14291 // To deserialise the data returned by this function, in addition to the
14292 // serialised data, you must know the type of the #GVariant, and (if the
14293 // machine might be different) the endianness of the machine that stored
14294 // it. As a result, file formats or network messages that incorporate
14295 // serialised #GVariant<!---->s must include this information either
14296 // implicitly (for instance "the file always contains a
14297 // %G_VARIANT_TYPE_VARIANT and it is always in little-endian order") or
14298 // explicitly (by storing the type and/or endianness in addition to the
14299 // serialised data).
14300 // RETURNS: the serialised form of @value, or %NULL
14301 const(void)* get_data()() nothrow {
14302 return g_variant_get_data(&this);
14305 // VERSION: 2.24
14306 // Returns the double precision floating point value of @value.
14308 // It is an error to call this function with a @value of any type
14309 // other than %G_VARIANT_TYPE_DOUBLE.
14310 // RETURNS: a #gdouble
14311 double get_double()() nothrow {
14312 return g_variant_get_double(&this);
14315 // VERSION: 2.24
14316 // Provides access to the serialised data for an array of fixed-sized
14317 // items.
14319 // @value must be an array with fixed-sized elements. Numeric types are
14320 // fixed-size, as are tuples containing only other fixed-sized types.
14322 // @element_size must be the size of a single element in the array,
14323 // as given by the section on
14324 // <link linkend='gvariant-serialised-data-memory'>Serialised Data
14325 // Memory</link>.
14327 // In particular, arrays of these fixed-sized types can be interpreted
14328 // as an array of the given C type, with @element_size set to
14329 // <code>sizeof</code> the appropriate type:
14331 // <informaltable>
14332 // <tgroup cols='2'>
14333 // <thead><row><entry>element type</entry> <entry>C type</entry></row></thead>
14334 // <tbody>
14335 // <row><entry>%G_VARIANT_TYPE_INT16 (etc.)</entry>
14336 // <entry>#gint16 (etc.)</entry></row>
14337 // <row><entry>%G_VARIANT_TYPE_BOOLEAN</entry>
14338 // <entry>#guchar (not #gboolean!)</entry></row>
14339 // <row><entry>%G_VARIANT_TYPE_BYTE</entry> <entry>#guchar</entry></row>
14340 // <row><entry>%G_VARIANT_TYPE_HANDLE</entry> <entry>#guint32</entry></row>
14341 // <row><entry>%G_VARIANT_TYPE_DOUBLE</entry> <entry>#gdouble</entry></row>
14342 // </tbody>
14343 // </tgroup>
14344 // </informaltable>
14346 // For example, if calling this function for an array of 32 bit integers,
14347 // you might say <code>sizeof (gint32)</code>. This value isn't used
14348 // except for the purpose of a double-check that the form of the
14349 // serialised data matches the caller's expectation.
14351 // @n_elements, which must be non-%NULL is set equal to the number of
14352 // items in the array.
14354 // the fixed array
14355 // RETURNS: a pointer to
14356 // <n_elements>: a pointer to the location to store the number of items
14357 // <element_size>: the size of each element
14358 const(void)* get_fixed_array(AT0)(/*out*/ AT0 /*size_t*/ n_elements, size_t element_size) nothrow {
14359 return g_variant_get_fixed_array(&this, UpCast!(size_t*)(n_elements), element_size);
14362 // VERSION: 2.24
14363 // Returns the 32-bit signed integer value of @value.
14365 // It is an error to call this function with a @value of any type other
14366 // than %G_VARIANT_TYPE_HANDLE.
14368 // By convention, handles are indexes into an array of file descriptors
14369 // that are sent alongside a D-Bus message. If you're not interacting
14370 // with D-Bus, you probably don't need them.
14371 // RETURNS: a #gint32
14372 int get_handle()() nothrow {
14373 return g_variant_get_handle(&this);
14376 // VERSION: 2.24
14377 // Returns the 16-bit signed integer value of @value.
14379 // It is an error to call this function with a @value of any type
14380 // other than %G_VARIANT_TYPE_INT16.
14381 // RETURNS: a #gint16
14382 short get_int16()() nothrow {
14383 return g_variant_get_int16(&this);
14386 // VERSION: 2.24
14387 // Returns the 32-bit signed integer value of @value.
14389 // It is an error to call this function with a @value of any type
14390 // other than %G_VARIANT_TYPE_INT32.
14391 // RETURNS: a #gint32
14392 int get_int32()() nothrow {
14393 return g_variant_get_int32(&this);
14396 // VERSION: 2.24
14397 // Returns the 64-bit signed integer value of @value.
14399 // It is an error to call this function with a @value of any type
14400 // other than %G_VARIANT_TYPE_INT64.
14401 // RETURNS: a #gint64
14402 long get_int64()() nothrow {
14403 return g_variant_get_int64(&this);
14406 // VERSION: 2.24
14407 // Given a maybe-typed #GVariant instance, extract its value. If the
14408 // value is Nothing, then this function returns %NULL.
14409 // RETURNS: the contents of @value, or %NULL
14410 Variant* /*new*/ get_maybe()() nothrow {
14411 return g_variant_get_maybe(&this);
14414 // VERSION: 2.24
14415 // Gets a #GVariant instance that has the same value as @value and is
14416 // trusted to be in normal form.
14418 // If @value is already trusted to be in normal form then a new
14419 // reference to @value is returned.
14421 // If @value is not already trusted, then it is scanned to check if it
14422 // is in normal form. If it is found to be in normal form then it is
14423 // marked as trusted and a new reference to it is returned.
14425 // If @value is found not to be in normal form then a new trusted
14426 // #GVariant is created with the same value as @value.
14428 // It makes sense to call this function if you've received #GVariant
14429 // data from untrusted sources and you want to ensure your serialised
14430 // output is definitely in normal form.
14431 // RETURNS: a trusted #GVariant
14432 Variant* /*new*/ get_normal_form()() nothrow {
14433 return g_variant_get_normal_form(&this);
14436 // VERSION: 2.30
14437 // Gets the contents of an array of object paths #GVariant. This call
14438 // makes a shallow copy; the return result should be released with
14439 // g_free(), but the individual strings must not be modified.
14441 // If @length is non-%NULL then the number of elements in the result
14442 // is stored there. In any case, the resulting array will be
14443 // %NULL-terminated.
14445 // For an empty array, @length will be set to 0 and a pointer to a
14446 // %NULL pointer will be returned.
14447 // RETURNS: an array of constant strings
14448 // <length>: the length of the result, or %NULL
14449 char** /*new container*/ get_objv(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14450 return g_variant_get_objv(&this, UpCast!(size_t*)(length));
14453 // VERSION: 2.24
14454 // Determines the number of bytes that would be required to store @value
14455 // with g_variant_store().
14457 // If @value has a fixed-sized type then this function always returned
14458 // that fixed size.
14460 // In the case that @value is already in serialised form or the size has
14461 // already been calculated (ie: this function has been called before)
14462 // then this function is O(1). Otherwise, the size is calculated, an
14463 // operation which is approximately O(n) in the number of values
14464 // involved.
14465 // RETURNS: the serialised size of @value
14466 size_t get_size()() nothrow {
14467 return g_variant_get_size(&this);
14470 // VERSION: 2.24
14471 // Returns the string value of a #GVariant instance with a string
14472 // type. This includes the types %G_VARIANT_TYPE_STRING,
14473 // %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE.
14475 // The string will always be utf8 encoded.
14477 // If @length is non-%NULL then the length of the string (in bytes) is
14478 // returned there. For trusted values, this information is already
14479 // known. For untrusted values, a strlen() will be performed.
14481 // It is an error to call this function with a @value of any type
14482 // other than those three.
14484 // The return value remains valid as long as @value exists.
14485 // RETURNS: the constant string, utf8 encoded
14486 // <length>: a pointer to a #gsize, to store the length
14487 char* get_string(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14488 return g_variant_get_string(&this, UpCast!(size_t*)(length));
14491 // VERSION: 2.24
14492 // Gets the contents of an array of strings #GVariant. This call
14493 // makes a shallow copy; the return result should be released with
14494 // g_free(), but the individual strings must not be modified.
14496 // If @length is non-%NULL then the number of elements in the result
14497 // is stored there. In any case, the resulting array will be
14498 // %NULL-terminated.
14500 // For an empty array, @length will be set to 0 and a pointer to a
14501 // %NULL pointer will be returned.
14502 // RETURNS: an array of constant strings
14503 // <length>: the length of the result, or %NULL
14504 char** /*new container*/ get_strv(AT0)(/*out*/ AT0 /*size_t*/ length=null) nothrow {
14505 return g_variant_get_strv(&this, UpCast!(size_t*)(length));
14508 // VERSION: 2.24
14509 // Determines the type of @value.
14511 // The return value is valid for the lifetime of @value and must not
14512 // be freed.
14513 // RETURNS: a #GVariantType
14514 VariantType* get_type()() nothrow {
14515 return g_variant_get_type(&this);
14518 // VERSION: 2.24
14519 // Returns the type string of @value. Unlike the result of calling
14520 // g_variant_type_peek_string(), this string is nul-terminated. This
14521 // string belongs to #GVariant and must not be freed.
14522 // RETURNS: the type string for the type of @value
14523 char* get_type_string()() nothrow {
14524 return g_variant_get_type_string(&this);
14527 // VERSION: 2.24
14528 // Returns the 16-bit unsigned integer value of @value.
14530 // It is an error to call this function with a @value of any type
14531 // other than %G_VARIANT_TYPE_UINT16.
14532 // RETURNS: a #guint16
14533 ushort get_uint16()() nothrow {
14534 return g_variant_get_uint16(&this);
14537 // VERSION: 2.24
14538 // Returns the 32-bit unsigned integer value of @value.
14540 // It is an error to call this function with a @value of any type
14541 // other than %G_VARIANT_TYPE_UINT32.
14542 // RETURNS: a #guint32
14543 uint get_uint32()() nothrow {
14544 return g_variant_get_uint32(&this);
14547 // VERSION: 2.24
14548 // Returns the 64-bit unsigned integer value of @value.
14550 // It is an error to call this function with a @value of any type
14551 // other than %G_VARIANT_TYPE_UINT64.
14552 // RETURNS: a #guint64
14553 ulong get_uint64()() nothrow {
14554 return g_variant_get_uint64(&this);
14557 // Unintrospectable method: get_va() / g_variant_get_va()
14558 // VERSION: 2.24
14559 // This function is intended to be used by libraries based on #GVariant
14560 // that want to provide g_variant_get()-like functionality to their
14561 // users.
14563 // The API is more general than g_variant_get() to allow a wider range
14564 // of possible uses.
14566 // @format_string must still point to a valid format string, but it only
14567 // need to be nul-terminated if @endptr is %NULL. If @endptr is
14568 // non-%NULL then it is updated to point to the first character past the
14569 // end of the format string.
14571 // @app is a pointer to a #va_list. The arguments, according to
14572 // @format_string, are collected from this #va_list and the list is left
14573 // pointing to the argument following the last.
14575 // These two generalisations allow mixing of multiple calls to
14576 // g_variant_new_va() and g_variant_get_va() within a single actual
14577 // varargs call by the user.
14578 // <format_string>: a string that is prefixed with a format string
14579 // <endptr>: location to store the end pointer, or %NULL
14580 // <app>: a pointer to a #va_list
14581 void get_va(AT0, AT1, AT2)(AT0 /*char*/ format_string, AT1 /*char**/ endptr, AT2 /*va_list*/ app) nothrow {
14582 g_variant_get_va(&this, toCString!(char*)(format_string), toCString!(char**)(endptr), UpCast!(va_list*)(app));
14585 // VERSION: 2.24
14586 // Unboxes @value. The result is the #GVariant instance that was
14587 // contained in @value.
14588 // RETURNS: the item contained in the variant
14589 Variant* /*new*/ get_variant()() nothrow {
14590 return g_variant_get_variant(&this);
14593 // VERSION: 2.24
14594 // Generates a hash value for a #GVariant instance.
14596 // The output of this function is guaranteed to be the same for a given
14597 // value only per-process. It may change between different processor
14598 // architectures or even different versions of GLib. Do not use this
14599 // function as a basis for building protocols or file formats.
14601 // The type of @value is #gconstpointer only to allow use of this
14602 // function with #GHashTable. @value must be a #GVariant.
14603 // RETURNS: a hash value corresponding to @value
14604 uint hash()() nothrow {
14605 return g_variant_hash(&this);
14608 // VERSION: 2.24
14609 // Checks if @value is a container.
14610 // RETURNS: %TRUE if @value is a container
14611 int is_container()() nothrow {
14612 return g_variant_is_container(&this);
14615 // VERSION: 2.26
14616 // Checks whether @value has a floating reference count.
14618 // This function should only ever be used to assert that a given variant
14619 // is or is not floating, or for debug purposes. To acquire a reference
14620 // to a variant that might be floating, always use g_variant_ref_sink()
14621 // or g_variant_take_ref().
14623 // See g_variant_ref_sink() for more information about floating reference
14624 // counts.
14625 // RETURNS: whether @value is floating
14626 int is_floating()() nothrow {
14627 return g_variant_is_floating(&this);
14630 // VERSION: 2.24
14631 // Checks if @value is in normal form.
14633 // The main reason to do this is to detect if a given chunk of
14634 // serialised data is in normal form: load the data into a #GVariant
14635 // using g_variant_new_from_data() and then use this function to
14636 // check.
14638 // If @value is found to be in normal form then it will be marked as
14639 // being trusted. If the value was already marked as being trusted then
14640 // this function will immediately return %TRUE.
14641 // RETURNS: %TRUE if @value is in normal form
14642 int is_normal_form()() nothrow {
14643 return g_variant_is_normal_form(&this);
14646 // VERSION: 2.24
14647 // Checks if a value has a type matching the provided type.
14648 // RETURNS: %TRUE if the type of @value matches @type
14649 // <type>: a #GVariantType
14650 int is_of_type(AT0)(AT0 /*VariantType*/ type) nothrow {
14651 return g_variant_is_of_type(&this, UpCast!(VariantType*)(type));
14654 // Unintrospectable method: iter_new() / g_variant_iter_new()
14655 // VERSION: 2.24
14656 // Creates a heap-allocated #GVariantIter for iterating over the items
14657 // in @value.
14659 // Use g_variant_iter_free() to free the return value when you no longer
14660 // need it.
14662 // A reference is taken to @value and will be released only when
14663 // g_variant_iter_free() is called.
14664 // RETURNS: a new heap-allocated #GVariantIter
14665 VariantIter* /*new*/ iter_new()() nothrow {
14666 return g_variant_iter_new(&this);
14669 // Unintrospectable method: lookup() / g_variant_lookup()
14670 // VERSION: 2.28
14671 // Looks up a value in a dictionary #GVariant.
14673 // This function is a wrapper around g_variant_lookup_value() and
14674 // g_variant_get(). In the case that %NULL would have been returned,
14675 // this function returns %FALSE. Otherwise, it unpacks the returned
14676 // value and returns %TRUE.
14678 // See g_variant_get() for information about @format_string.
14679 // RETURNS: %TRUE if a value was unpacked
14680 // <key>: the key to lookup in the dictionary
14681 // <format_string>: a GVariant format string
14682 /+ Not available -- variadic methods unsupported - use the C function directly.
14683 alias g_variant_lookup lookup; // Variadic
14686 // VERSION: 2.28
14687 // Looks up a value in a dictionary #GVariant.
14689 // This function works with dictionaries of the type
14690 // <literal>a{s*}</literal> (and equally well with type
14691 // <literal>a{o*}</literal>, but we only further discuss the string case
14692 // for sake of clarity).
14694 // In the event that @dictionary has the type <literal>a{sv}</literal>,
14695 // the @expected_type string specifies what type of value is expected to
14696 // be inside of the variant. If the value inside the variant has a
14697 // different type then %NULL is returned. In the event that @dictionary
14698 // has a value type other than <literal>v</literal> then @expected_type
14699 // must directly match the key type and it is used to unpack the value
14700 // directly or an error occurs.
14702 // In either case, if @key is not found in @dictionary, %NULL is
14703 // returned.
14705 // If the key is found and the value has the correct type, it is
14706 // returned. If @expected_type was specified then any non-%NULL return
14707 // value will have this type.
14708 // RETURNS: the value of the dictionary key, or %NULL
14709 // <key>: the key to lookup in the dictionary
14710 // <expected_type>: a #GVariantType, or %NULL
14711 Variant* /*new*/ lookup_value(AT0, AT1)(AT0 /*char*/ key, AT1 /*VariantType*/ expected_type=null) nothrow {
14712 return g_variant_lookup_value(&this, toCString!(char*)(key), UpCast!(VariantType*)(expected_type));
14715 // VERSION: 2.24
14716 // Determines the number of children in a container #GVariant instance.
14717 // This includes variants, maybes, arrays, tuples and dictionary
14718 // entries. It is an error to call this function on any other type of
14719 // #GVariant.
14721 // For variants, the return value is always 1. For values with maybe
14722 // types, it is always zero or one. For arrays, it is the length of the
14723 // array. For tuples it is the number of tuple items (which depends
14724 // only on the type). For dictionary entries, it is always 2
14726 // This function is O(1).
14727 // RETURNS: the number of children in the container
14728 size_t n_children()() nothrow {
14729 return g_variant_n_children(&this);
14732 // VERSION: 2.24
14733 // Pretty-prints @value in the format understood by g_variant_parse().
14735 // The format is described <link linkend='gvariant-text'>here</link>.
14737 // If @type_annotate is %TRUE, then type information is included in
14738 // the output.
14739 // RETURNS: a newly-allocated string holding the result.
14740 // <type_annotate>: %TRUE if type information should be included in the output
14741 char* /*new*/ print()(int type_annotate) nothrow {
14742 return g_variant_print(&this, type_annotate);
14745 // Unintrospectable method: print_string() / g_variant_print_string()
14746 // VERSION: 2.24
14747 // Behaves as g_variant_print(), but operates on a #GString.
14749 // If @string is non-%NULL then it is appended to and returned. Else,
14750 // a new empty #GString is allocated and it is returned.
14751 // RETURNS: a #GString containing the string
14752 // <string>: a #GString, or %NULL
14753 // <type_annotate>: %TRUE if type information should be included in the output
14754 String* /*new*/ print_string(AT0)(AT0 /*String*/ string_, int type_annotate) nothrow {
14755 return g_variant_print_string(&this, UpCast!(String*)(string_), type_annotate);
14758 // VERSION: 2.24
14759 // Increases the reference count of @value.
14760 // RETURNS: the same @value
14761 Variant* /*new*/ ref_()() nothrow {
14762 return g_variant_ref(&this);
14765 // VERSION: 2.24
14766 // #GVariant uses a floating reference count system. All functions with
14767 // names starting with <literal>g_variant_new_</literal> return floating
14768 // references.
14770 // Calling g_variant_ref_sink() on a #GVariant with a floating reference
14771 // will convert the floating reference into a full reference. Calling
14772 // g_variant_ref_sink() on a non-floating #GVariant results in an
14773 // additional normal reference being added.
14775 // In other words, if the @value is floating, then this call "assumes
14776 // ownership" of the floating reference, converting it to a normal
14777 // reference. If the @value is not floating, then this call adds a
14778 // new normal reference increasing the reference count by one.
14780 // All calls that result in a #GVariant instance being inserted into a
14781 // container will call g_variant_ref_sink() on the instance. This means
14782 // that if the value was just created (and has only its floating
14783 // reference) then the container will assume sole ownership of the value
14784 // at that point and the caller will not need to unreference it. This
14785 // makes certain common styles of programming much easier while still
14786 // maintaining normal refcounting semantics in situations where values
14787 // are not floating.
14788 // RETURNS: the same @value
14789 Variant* /*new*/ ref_sink()() nothrow {
14790 return g_variant_ref_sink(&this);
14793 // VERSION: 2.24
14794 // Stores the serialised form of @value at @data. @data should be
14795 // large enough. See g_variant_get_size().
14797 // The stored data is in machine native byte order but may not be in
14798 // fully-normalised form if read from an untrusted source. See
14799 // g_variant_get_normal_form() for a solution.
14801 // As with g_variant_get_data(), to be able to deserialise the
14802 // serialised variant successfully, its type and (if the destination
14803 // machine might be different) its endianness must also be available.
14805 // This function is approximately O(n) in the size of @data.
14806 // <data>: the location to store the serialised data at
14807 void store(AT0)(AT0 /*void*/ data) nothrow {
14808 g_variant_store(&this, UpCast!(void*)(data));
14811 // If @value is floating, sink it. Otherwise, do nothing.
14813 // Typically you want to use g_variant_ref_sink() in order to
14814 // automatically do the correct thing with respect to floating or
14815 // non-floating references, but there is one specific scenario where
14816 // this function is helpful.
14818 // The situation where this function is helpful is when creating an API
14819 // that allows the user to provide a callback function that returns a
14820 // #GVariant. We certainly want to allow the user the flexibility to
14821 // return a non-floating reference from this callback (for the case
14822 // where the value that is being returned already exists).
14824 // At the same time, the style of the #GVariant API makes it likely that
14825 // for newly-created #GVariant instances, the user can be saved some
14826 // typing if they are allowed to return a #GVariant with a floating
14827 // reference.
14829 // Using this function on the return value of the user's callback allows
14830 // the user to do whichever is more convenient for them. The caller
14831 // will alway receives exactly one full reference to the value: either
14832 // the one that was returned in the first place, or a floating reference
14833 // that has been converted to a full reference.
14835 // This function has an odd interaction when combined with
14836 // g_variant_ref_sink() running at the same time in another thread on
14837 // the same #GVariant instance. If g_variant_ref_sink() runs first then
14838 // the result will be that the floating reference is converted to a hard
14839 // reference. If g_variant_take_ref() runs first then the result will
14840 // be that the floating reference is converted to a hard reference and
14841 // an additional reference on top of that one is added. It is best to
14842 // avoid this situation.
14843 // RETURNS: the same @value
14844 Variant* /*new*/ take_ref()() nothrow {
14845 return g_variant_take_ref(&this);
14848 // VERSION: 2.24
14849 // Decreases the reference count of @value. When its reference count
14850 // drops to 0, the memory used by the variant is freed.
14851 void unref()() nothrow {
14852 g_variant_unref(&this);
14855 // VERSION: 2.24
14856 // Determines if a given string is a valid D-Bus object path. You
14857 // should ensure that a string is a valid D-Bus object path before
14858 // passing it to g_variant_new_object_path().
14860 // A valid object path starts with '/' followed by zero or more
14861 // sequences of characters separated by '/' characters. Each sequence
14862 // must contain only the characters "[A-Z][a-z][0-9]_". No sequence
14863 // (including the one following the final '/' character) may be empty.
14864 // RETURNS: %TRUE if @string is a D-Bus object path
14865 // <string>: a normal C nul-terminated string
14866 static int is_object_path(AT0)(AT0 /*char*/ string_) nothrow {
14867 return g_variant_is_object_path(toCString!(char*)(string_));
14870 // VERSION: 2.24
14871 // Determines if a given string is a valid D-Bus type signature. You
14872 // should ensure that a string is a valid D-Bus type signature before
14873 // passing it to g_variant_new_signature().
14875 // D-Bus type signatures consist of zero or more definite #GVariantType
14876 // strings in sequence.
14877 // RETURNS: %TRUE if @string is a D-Bus type signature
14878 // <string>: a normal C nul-terminated string
14879 static int is_signature(AT0)(AT0 /*char*/ string_) nothrow {
14880 return g_variant_is_signature(toCString!(char*)(string_));
14883 // Parses a #GVariant from a text representation.
14885 // A single #GVariant is parsed from the content of @text.
14887 // The format is described <link linkend='gvariant-text'>here</link>.
14889 // The memory at @limit will never be accessed and the parser behaves as
14890 // if the character at @limit is the nul terminator. This has the
14891 // effect of bounding @text.
14893 // If @endptr is non-%NULL then @text is permitted to contain data
14894 // following the value that this function parses and @endptr will be
14895 // updated to point to the first character past the end of the text
14896 // parsed by this function. If @endptr is %NULL and there is extra data
14897 // then an error is returned.
14899 // If @type is non-%NULL then the value will be parsed to have that
14900 // type. This may result in additional parse errors (in the case that
14901 // the parsed value doesn't fit the type) but may also result in fewer
14902 // errors (in the case that the type would have been ambiguous, such as
14903 // with empty arrays).
14905 // In the event that the parsing is successful, the resulting #GVariant
14906 // is returned.
14908 // In case of any error, %NULL will be returned. If @error is non-%NULL
14909 // then it will be set to reflect the error that occurred.
14911 // Officially, the language understood by the parser is "any string
14912 // produced by g_variant_print()".
14913 // <type>: a #GVariantType, or %NULL
14914 // <text>: a string containing a GVariant in text form
14915 // <limit>: a pointer to the end of @text, or %NULL
14916 // <endptr>: a location to store the end pointer, or %NULL
14917 static Variant* /*new*/ parse(AT0, AT1, AT2, AT3, AT4)(AT0 /*VariantType*/ type, AT1 /*char*/ text, AT2 /*char*/ limit, AT3 /*char**/ endptr, AT4 /*GLib2.Error**/ error=null) nothrow {
14918 return g_variant_parse(UpCast!(VariantType*)(type), toCString!(char*)(text), toCString!(char*)(limit), toCString!(char**)(endptr), UpCast!(GLib2.Error**)(error));
14920 static Quark parser_get_error_quark()() nothrow {
14921 return g_variant_parser_get_error_quark();
14926 // A utility type for constructing container-type #GVariant instances.
14928 // This is an opaque structure and may only be accessed using the
14929 // following functions.
14931 // #GVariantBuilder is not threadsafe in any way. Do not attempt to
14932 // access it from more than one thread.
14933 struct VariantBuilder {
14934 private size_t[16] x;
14937 // VERSION: 2.24
14938 // Allocates and initialises a new #GVariantBuilder.
14940 // You should call g_variant_builder_unref() on the return value when it
14941 // is no longer needed. The memory will not be automatically freed by
14942 // any other call.
14944 // In most cases it is easier to place a #GVariantBuilder directly on
14945 // the stack of the calling function and initialise it with
14946 // g_variant_builder_init().
14947 // RETURNS: a #GVariantBuilder
14948 // <type>: a container type
14949 static VariantBuilder* /*new*/ new_(AT0)(AT0 /*VariantType*/ type) nothrow {
14950 return g_variant_builder_new(UpCast!(VariantType*)(type));
14952 static auto opCall(AT0)(AT0 /*VariantType*/ type) {
14953 return g_variant_builder_new(UpCast!(VariantType*)(type));
14956 // Unintrospectable method: add() / g_variant_builder_add()
14957 // VERSION: 2.24
14958 // Adds to a #GVariantBuilder.
14960 // This call is a convenience wrapper that is exactly equivalent to
14961 // calling g_variant_new() followed by g_variant_builder_add_value().
14963 // This function might be used as follows:
14965 // <programlisting>
14966 // GVariant *
14967 // make_pointless_dictionary (void)
14968 // {
14969 // GVariantBuilder *builder;
14970 // int i;
14972 // builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
14973 // for (i = 0; i < 16; i++)
14974 // {
14975 // gchar buf[3];
14977 // sprintf (buf, "%d", i);
14978 // g_variant_builder_add (builder, "{is}", i, buf);
14979 // }
14981 // return g_variant_builder_end (builder);
14982 // }
14983 // </programlisting>
14984 // <format_string>: a #GVariant varargs format string
14985 /+ Not available -- variadic methods unsupported - use the C function directly.
14986 alias g_variant_builder_add add; // Variadic
14989 // Unintrospectable method: add_parsed() / g_variant_builder_add_parsed()
14990 // VERSION: 2.26
14991 // Adds to a #GVariantBuilder.
14993 // This call is a convenience wrapper that is exactly equivalent to
14994 // calling g_variant_new_parsed() followed by
14995 // g_variant_builder_add_value().
14997 // This function might be used as follows:
14999 // <programlisting>
15000 // GVariant *
15001 // make_pointless_dictionary (void)
15002 // {
15003 // GVariantBuilder *builder;
15004 // int i;
15006 // builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
15007 // g_variant_builder_add_parsed (builder, "{'width', <%i>}", 600);
15008 // g_variant_builder_add_parsed (builder, "{'title', <%s>}", "foo");
15009 // g_variant_builder_add_parsed (builder, "{'transparency', <0.5>}");
15010 // return g_variant_builder_end (builder);
15011 // }
15012 // </programlisting>
15013 // <format>: a text format #GVariant
15014 /+ Not available -- variadic methods unsupported - use the C function directly.
15015 alias g_variant_builder_add_parsed add_parsed; // Variadic
15018 // VERSION: 2.24
15019 // Adds @value to @builder.
15021 // It is an error to call this function in any way that would create an
15022 // inconsistent value to be constructed. Some examples of this are
15023 // putting different types of items into an array, putting the wrong
15024 // types or number of items in a tuple, putting more than one value into
15025 // a variant, etc.
15027 // If @value is a floating reference (see g_variant_ref_sink()),
15028 // the @builder instance takes ownership of @value.
15029 // <value>: a #GVariant
15030 void add_value(AT0)(AT0 /*Variant*/ value) nothrow {
15031 g_variant_builder_add_value(&this, UpCast!(Variant*)(value));
15034 // Unintrospectable method: clear() / g_variant_builder_clear()
15035 // VERSION: 2.24
15036 // Releases all memory associated with a #GVariantBuilder without
15037 // freeing the #GVariantBuilder structure itself.
15039 // It typically only makes sense to do this on a stack-allocated
15040 // #GVariantBuilder if you want to abort building the value part-way
15041 // through. This function need not be called if you call
15042 // g_variant_builder_end() and it also doesn't need to be called on
15043 // builders allocated with g_variant_builder_new (see
15044 // g_variant_builder_unref() for that).
15046 // This function leaves the #GVariantBuilder structure set to all-zeros.
15047 // It is valid to call this function on either an initialised
15048 // #GVariantBuilder or one that is set to all-zeros but it is not valid
15049 // to call this function on uninitialised memory.
15050 void clear()() nothrow {
15051 g_variant_builder_clear(&this);
15054 // VERSION: 2.24
15055 // Closes the subcontainer inside the given @builder that was opened by
15056 // the most recent call to g_variant_builder_open().
15058 // It is an error to call this function in any way that would create an
15059 // inconsistent value to be constructed (ie: too few values added to the
15060 // subcontainer).
15061 void close()() nothrow {
15062 g_variant_builder_close(&this);
15065 // VERSION: 2.24
15066 // Ends the builder process and returns the constructed value.
15068 // It is not permissible to use @builder in any way after this call
15069 // except for reference counting operations (in the case of a
15070 // heap-allocated #GVariantBuilder) or by reinitialising it with
15071 // g_variant_builder_init() (in the case of stack-allocated).
15073 // It is an error to call this function in any way that would create an
15074 // inconsistent value to be constructed (ie: insufficient number of
15075 // items added to a container with a specific number of children
15076 // required). It is also an error to call this function if the builder
15077 // was created with an indefinite array or maybe type and no children
15078 // have been added; in this case it is impossible to infer the type of
15079 // the empty array.
15080 // RETURNS: a new, floating, #GVariant
15081 Variant* end()() nothrow {
15082 return g_variant_builder_end(&this);
15085 // Unintrospectable method: init() / g_variant_builder_init()
15086 // VERSION: 2.24
15087 // Initialises a #GVariantBuilder structure.
15089 // @type must be non-%NULL. It specifies the type of container to
15090 // construct. It can be an indefinite type such as
15091 // %G_VARIANT_TYPE_ARRAY or a definite type such as "as" or "(ii)".
15092 // Maybe, array, tuple, dictionary entry and variant-typed values may be
15093 // constructed.
15095 // After the builder is initialised, values are added using
15096 // g_variant_builder_add_value() or g_variant_builder_add().
15098 // After all the child values are added, g_variant_builder_end() frees
15099 // the memory associated with the builder and returns the #GVariant that
15100 // was created.
15102 // This function completely ignores the previous contents of @builder.
15103 // On one hand this means that it is valid to pass in completely
15104 // uninitialised memory. On the other hand, this means that if you are
15105 // initialising over top of an existing #GVariantBuilder you need to
15106 // first call g_variant_builder_clear() in order to avoid leaking
15107 // memory.
15109 // You must not call g_variant_builder_ref() or
15110 // g_variant_builder_unref() on a #GVariantBuilder that was initialised
15111 // with this function. If you ever pass a reference to a
15112 // #GVariantBuilder outside of the control of your own code then you
15113 // should assume that the person receiving that reference may try to use
15114 // reference counting; you should use g_variant_builder_new() instead of
15115 // this function.
15116 // <type>: a container type
15117 void init(AT0)(AT0 /*VariantType*/ type) nothrow {
15118 g_variant_builder_init(&this, UpCast!(VariantType*)(type));
15121 // VERSION: 2.24
15122 // Opens a subcontainer inside the given @builder. When done adding
15123 // items to the subcontainer, g_variant_builder_close() must be called.
15125 // It is an error to call this function in any way that would cause an
15126 // inconsistent value to be constructed (ie: adding too many values or
15127 // a value of an incorrect type).
15128 // <type>: a #GVariantType
15129 void open(AT0)(AT0 /*VariantType*/ type) nothrow {
15130 g_variant_builder_open(&this, UpCast!(VariantType*)(type));
15133 // VERSION: 2.24
15134 // Increases the reference count on @builder.
15136 // Don't call this on stack-allocated #GVariantBuilder instances or bad
15137 // things will happen.
15138 // RETURNS: a new reference to @builder
15139 VariantBuilder* /*new*/ ref_()() nothrow {
15140 return g_variant_builder_ref(&this);
15143 // VERSION: 2.24
15144 // Decreases the reference count on @builder.
15146 // In the event that there are no more references, releases all memory
15147 // associated with the #GVariantBuilder.
15149 // Don't call this on stack-allocated #GVariantBuilder instances or bad
15150 // things will happen.
15151 void unref()() nothrow {
15152 g_variant_builder_unref(&this);
15156 // The range of possible top-level types of #GVariant instances.
15157 enum VariantClass /* Version 2.24 */ {
15158 BOOLEAN = 98,
15159 BYTE = 121,
15160 INT16 = 110,
15161 UINT16 = 113,
15162 INT32 = 105,
15163 UINT32 = 117,
15164 INT64 = 120,
15165 UINT64 = 116,
15166 HANDLE = 104,
15167 DOUBLE = 100,
15168 STRING = 115,
15169 OBJECT_PATH = 111,
15170 SIGNATURE = 103,
15171 VARIANT = 118,
15172 MAYBE = 109,
15173 ARRAY = 97,
15174 TUPLE = 40,
15175 DICT_ENTRY = 123
15178 // #GVariantIter is an opaque data structure and can only be accessed
15179 // using the following functions.
15180 struct VariantIter {
15181 private size_t[16] x;
15184 // Unintrospectable method: copy() / g_variant_iter_copy()
15185 // VERSION: 2.24
15186 // Creates a new heap-allocated #GVariantIter to iterate over the
15187 // container that was being iterated over by @iter. Iteration begins on
15188 // the new iterator from the current position of the old iterator but
15189 // the two copies are independent past that point.
15191 // Use g_variant_iter_free() to free the return value when you no longer
15192 // need it.
15194 // A reference is taken to the container that @iter is iterating over
15195 // and will be releated only when g_variant_iter_free() is called.
15196 // RETURNS: a new heap-allocated #GVariantIter
15197 VariantIter* /*new*/ copy()() nothrow {
15198 return g_variant_iter_copy(&this);
15201 // VERSION: 2.24
15202 // Frees a heap-allocated #GVariantIter. Only call this function on
15203 // iterators that were returned by g_variant_iter_new() or
15204 // g_variant_iter_copy().
15205 void free()() nothrow {
15206 g_variant_iter_free(&this);
15209 // Unintrospectable method: init() / g_variant_iter_init()
15210 // VERSION: 2.24
15211 // Initialises (without allocating) a #GVariantIter. @iter may be
15212 // completely uninitialised prior to this call; its old value is
15213 // ignored.
15215 // The iterator remains valid for as long as @value exists, and need not
15216 // be freed in any way.
15217 // RETURNS: the number of items in @value
15218 // <value>: a container #GVariant
15219 size_t init(AT0)(AT0 /*Variant*/ value) nothrow {
15220 return g_variant_iter_init(&this, UpCast!(Variant*)(value));
15223 // Unintrospectable method: loop() / g_variant_iter_loop()
15224 // VERSION: 2.24
15225 // Gets the next item in the container and unpacks it into the variable
15226 // argument list according to @format_string, returning %TRUE.
15228 // If no more items remain then %FALSE is returned.
15230 // On the first call to this function, the pointers appearing on the
15231 // variable argument list are assumed to point at uninitialised memory.
15232 // On the second and later calls, it is assumed that the same pointers
15233 // will be given and that they will point to the memory as set by the
15234 // previous call to this function. This allows the previous values to
15235 // be freed, as appropriate.
15237 // This function is intended to be used with a while loop as
15238 // demonstrated in the following example. This function can only be
15239 // used when iterating over an array. It is only valid to call this
15240 // function with a string constant for the format string and the same
15241 // string constant must be used each time. Mixing calls to this
15242 // function and g_variant_iter_next() or g_variant_iter_next_value() on
15243 // the same iterator causes undefined behavior.
15245 // If you break out of a such a while loop using g_variant_iter_loop() then
15246 // you must free or unreference all the unpacked values as you would with
15247 // g_variant_get(). Failure to do so will cause a memory leak.
15249 // See the section on <link linkend='gvariant-format-strings'>GVariant
15250 // Format Strings</link>.
15252 // <example>
15253 // <title>Memory management with g_variant_iter_loop()</title>
15254 // <programlisting>
15255 // /<!-- -->* Iterates a dictionary of type 'a{sv}' *<!-- -->/
15256 // void
15257 // iterate_dictionary (GVariant *dictionary)
15258 // {
15259 // GVariantIter iter;
15260 // GVariant *value;
15261 // gchar *key;
15263 // g_variant_iter_init (&iter, dictionary);
15264 // while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
15265 // {
15266 // g_print ("Item '%s' has type '%s'\n", key,
15267 // g_variant_get_type_string (value));
15269 // /<!-- -->* no need to free 'key' and 'value' here *<!-- -->/
15270 // /<!-- -->* unless breaking out of this loop *<!-- -->/
15271 // }
15272 // }
15273 // </programlisting>
15274 // </example>
15276 // For most cases you should use g_variant_iter_next().
15278 // This function is really only useful when unpacking into #GVariant or
15279 // #GVariantIter in order to allow you to skip the call to
15280 // g_variant_unref() or g_variant_iter_free().
15282 // For example, if you are only looping over simple integer and string
15283 // types, g_variant_iter_next() is definitely preferred. For string
15284 // types, use the '&' prefix to avoid allocating any memory at all (and
15285 // thereby avoiding the need to free anything as well).
15287 // value
15288 // RETURNS: %TRUE if a value was unpacked, or %FALSE if there was no
15289 // <format_string>: a GVariant format string
15290 /+ Not available -- variadic methods unsupported - use the C function directly.
15291 alias g_variant_iter_loop loop; // Variadic
15294 // VERSION: 2.24
15295 // Queries the number of child items in the container that we are
15296 // iterating over. This is the total number of items -- not the number
15297 // of items remaining.
15299 // This function might be useful for preallocation of arrays.
15300 // RETURNS: the number of children in the container
15301 size_t n_children()() nothrow {
15302 return g_variant_iter_n_children(&this);
15305 // Unintrospectable method: next() / g_variant_iter_next()
15306 // VERSION: 2.24
15307 // Gets the next item in the container and unpacks it into the variable
15308 // argument list according to @format_string, returning %TRUE.
15310 // If no more items remain then %FALSE is returned.
15312 // All of the pointers given on the variable arguments list of this
15313 // function are assumed to point at uninitialised memory. It is the
15314 // responsibility of the caller to free all of the values returned by
15315 // the unpacking process.
15317 // See the section on <link linkend='gvariant-format-strings'>GVariant
15318 // Format Strings</link>.
15320 // <example>
15321 // <title>Memory management with g_variant_iter_next()</title>
15322 // <programlisting>
15323 // /<!-- -->* Iterates a dictionary of type 'a{sv}' *<!-- -->/
15324 // void
15325 // iterate_dictionary (GVariant *dictionary)
15326 // {
15327 // GVariantIter iter;
15328 // GVariant *value;
15329 // gchar *key;
15331 // g_variant_iter_init (&iter, dictionary);
15332 // while (g_variant_iter_next (&iter, "{sv}", &key, &value))
15333 // {
15334 // g_print ("Item '%s' has type '%s'\n", key,
15335 // g_variant_get_type_string (value));
15337 // /<!-- -->* must free data for ourselves *<!-- -->/
15338 // g_variant_unref (value);
15339 // g_free (key);
15340 // }
15341 // }
15342 // </programlisting>
15343 // </example>
15345 // For a solution that is likely to be more convenient to C programmers
15346 // when dealing with loops, see g_variant_iter_loop().
15347 // RETURNS: %TRUE if a value was unpacked, or %FALSE if there as no value
15348 // <format_string>: a GVariant format string
15349 /+ Not available -- variadic methods unsupported - use the C function directly.
15350 alias g_variant_iter_next next; // Variadic
15353 // VERSION: 2.24
15354 // Gets the next item in the container. If no more items remain then
15355 // %NULL is returned.
15357 // Use g_variant_unref() to drop your reference on the return value when
15358 // you no longer need it.
15360 // <example>
15361 // <title>Iterating with g_variant_iter_next_value()</title>
15362 // <programlisting>
15363 // /<!-- -->* recursively iterate a container *<!-- -->/
15364 // void
15365 // iterate_container_recursive (GVariant *container)
15366 // {
15367 // GVariantIter iter;
15368 // GVariant *child;
15370 // g_variant_iter_init (&iter, container);
15371 // while ((child = g_variant_iter_next_value (&iter)))
15372 // {
15373 // g_print ("type '%s'\n", g_variant_get_type_string (child));
15375 // if (g_variant_is_container (child))
15376 // iterate_container_recursive (child);
15378 // g_variant_unref (child);
15379 // }
15380 // }
15381 // </programlisting>
15382 // </example>
15383 // RETURNS: a #GVariant, or %NULL
15384 Variant* /*new*/ next_value()() nothrow {
15385 return g_variant_iter_next_value(&this);
15389 // Error codes returned by parsing text-format GVariants.
15390 enum VariantParseError {
15391 FAILED = 0,
15392 BASIC_TYPE_EXPECTED = 1,
15393 CANNOT_INFER_TYPE = 2,
15394 DEFINITE_TYPE_EXPECTED = 3,
15395 INPUT_NOT_AT_END = 4,
15396 INVALID_CHARACTER = 5,
15397 INVALID_FORMAT_STRING = 6,
15398 INVALID_OBJECT_PATH = 7,
15399 INVALID_SIGNATURE = 8,
15400 INVALID_TYPE_STRING = 9,
15401 NO_COMMON_TYPE = 10,
15402 NUMBER_OUT_OF_RANGE = 11,
15403 NUMBER_TOO_BIG = 12,
15404 TYPE_ERROR = 13,
15405 UNEXPECTED_TOKEN = 14,
15406 UNKNOWN_KEYWORD = 15,
15407 UNTERMINATED_STRING_CONSTANT = 16,
15408 VALUE_EXPECTED = 17
15411 // This section introduces the GVariant type system. It is based, in
15412 // large part, on the D-Bus type system, with two major changes and some minor
15413 // lifting of restrictions. The <ulink
15414 // url='http://dbus.freedesktop.org/doc/dbus-specification.html'>DBus
15415 // specification</ulink>, therefore, provides a significant amount of
15416 // information that is useful when working with GVariant.
15418 // The first major change with respect to the D-Bus type system is the
15419 // introduction of maybe (or "nullable") types. Any type in GVariant can be
15420 // converted to a maybe type, in which case, "nothing" (or "null") becomes a
15421 // valid value. Maybe types have been added by introducing the
15422 // character "<literal>m</literal>" to type strings.
15424 // The second major change is that the GVariant type system supports the
15425 // concept of "indefinite types" -- types that are less specific than
15426 // the normal types found in D-Bus. For example, it is possible to speak
15427 // of "an array of any type" in GVariant, where the D-Bus type system
15428 // would require you to speak of "an array of integers" or "an array of
15429 // strings". Indefinite types have been added by introducing the
15430 // characters "<literal>*</literal>", "<literal>?</literal>" and
15431 // "<literal>r</literal>" to type strings.
15433 // Finally, all arbitrary restrictions relating to the complexity of
15434 // types are lifted along with the restriction that dictionary entries
15435 // may only appear nested inside of arrays.
15437 // Just as in D-Bus, GVariant types are described with strings ("type
15438 // strings"). Subject to the differences mentioned above, these strings
15439 // are of the same form as those found in DBus. Note, however: D-Bus
15440 // always works in terms of messages and therefore individual type
15441 // strings appear nowhere in its interface. Instead, "signatures"
15442 // are a concatenation of the strings of the type of each argument in a
15443 // message. GVariant deals with single values directly so GVariant type
15444 // strings always describe the type of exactly one value. This means
15445 // that a D-Bus signature string is generally not a valid GVariant type
15446 // string -- except in the case that it is the signature of a message
15447 // containing exactly one argument.
15449 // An indefinite type is similar in spirit to what may be called an
15450 // abstract type in other type systems. No value can exist that has an
15451 // indefinite type as its type, but values can exist that have types
15452 // that are subtypes of indefinite types. That is to say,
15453 // g_variant_get_type() will never return an indefinite type, but
15454 // calling g_variant_is_of_type() with an indefinite type may return
15455 // %TRUE. For example, you cannot have a value that represents "an
15456 // array of no particular type", but you can have an "array of integers"
15457 // which certainly matches the type of "an array of no particular type",
15458 // since "array of integers" is a subtype of "array of no particular
15459 // type".
15461 // This is similar to how instances of abstract classes may not
15462 // directly exist in other type systems, but instances of their
15463 // non-abstract subtypes may. For example, in GTK, no object that has
15464 // the type of #GtkBin can exist (since #GtkBin is an abstract class),
15465 // but a #GtkWindow can certainly be instantiated, and you would say
15466 // that the #GtkWindow is a #GtkBin (since #GtkWindow is a subclass of
15467 // #GtkBin).
15469 // A detailed description of GVariant type strings is given here:
15471 // <refsect2 id='gvariant-typestrings'>
15472 // <title>GVariant Type Strings</title>
15473 // <para>
15474 // A GVariant type string can be any of the following:
15475 // </para>
15476 // <itemizedlist>
15477 // <listitem>
15478 // <para>
15479 // any basic type string (listed below)
15480 // </para>
15481 // </listitem>
15482 // <listitem>
15483 // <para>
15484 // "<literal>v</literal>", "<literal>r</literal>" or
15485 // "<literal>*</literal>"
15486 // </para>
15487 // </listitem>
15488 // <listitem>
15489 // <para>
15490 // one of the characters '<literal>a</literal>' or
15491 // '<literal>m</literal>', followed by another type string
15492 // </para>
15493 // </listitem>
15494 // <listitem>
15495 // <para>
15496 // the character '<literal>(</literal>', followed by a concatenation
15497 // of zero or more other type strings, followed by the character
15498 // '<literal>)</literal>'
15499 // </para>
15500 // </listitem>
15501 // <listitem>
15502 // <para>
15503 // the character '<literal>{</literal>', followed by a basic type
15504 // string (see below), followed by another type string, followed by
15505 // the character '<literal>}</literal>'
15506 // </para>
15507 // </listitem>
15508 // </itemizedlist>
15509 // <para>
15510 // A basic type string describes a basic type (as per
15511 // g_variant_type_is_basic()) and is always a single
15512 // character in length. The valid basic type strings are
15513 // "<literal>b</literal>", "<literal>y</literal>",
15514 // "<literal>n</literal>", "<literal>q</literal>",
15515 // "<literal>i</literal>", "<literal>u</literal>",
15516 // "<literal>x</literal>", "<literal>t</literal>",
15517 // "<literal>h</literal>", "<literal>d</literal>",
15518 // "<literal>s</literal>", "<literal>o</literal>",
15519 // "<literal>g</literal>" and "<literal>?</literal>".
15520 // </para>
15521 // <para>
15522 // The above definition is recursive to arbitrary depth.
15523 // "<literal>aaaaai</literal>" and "<literal>(ui(nq((y)))s)</literal>"
15524 // are both valid type strings, as is
15525 // "<literal>a(aa(ui)(qna{ya(yd)}))</literal>".
15526 // </para>
15527 // <para>
15528 // The meaning of each of the characters is as follows:
15529 // </para>
15530 // <informaltable>
15531 // <tgroup cols='2'>
15532 // <tbody>
15533 // <row>
15534 // <entry>
15535 // <para>
15536 // <emphasis role='strong'>Character</emphasis>
15537 // </para>
15538 // </entry>
15539 // <entry>
15540 // <para>
15541 // <emphasis role='strong'>Meaning</emphasis>
15542 // </para>
15543 // </entry>
15544 // </row>
15545 // <row>
15546 // <entry>
15547 // <para>
15548 // <literal>b</literal>
15549 // </para>
15550 // </entry>
15551 // <entry>
15552 // <para>
15553 // the type string of %G_VARIANT_TYPE_BOOLEAN; a boolean value.
15554 // </para>
15555 // </entry>
15556 // </row>
15557 // <row>
15558 // <entry>
15559 // <para>
15560 // <literal>y</literal>
15561 // </para>
15562 // </entry>
15563 // <entry>
15564 // <para>
15565 // the type string of %G_VARIANT_TYPE_BYTE; a byte.
15566 // </para>
15567 // </entry>
15568 // </row>
15569 // <row>
15570 // <entry>
15571 // <para>
15572 // <literal>n</literal>
15573 // </para>
15574 // </entry>
15575 // <entry>
15576 // <para>
15577 // the type string of %G_VARIANT_TYPE_INT16; a signed 16 bit
15578 // integer.
15579 // </para>
15580 // </entry>
15581 // </row>
15582 // <row>
15583 // <entry>
15584 // <para>
15585 // <literal>q</literal>
15586 // </para>
15587 // </entry>
15588 // <entry>
15589 // <para>
15590 // the type string of %G_VARIANT_TYPE_UINT16; an unsigned 16 bit
15591 // integer.
15592 // </para>
15593 // </entry>
15594 // </row>
15595 // <row>
15596 // <entry>
15597 // <para>
15598 // <literal>i</literal>
15599 // </para>
15600 // </entry>
15601 // <entry>
15602 // <para>
15603 // the type string of %G_VARIANT_TYPE_INT32; a signed 32 bit
15604 // integer.
15605 // </para>
15606 // </entry>
15607 // </row>
15608 // <row>
15609 // <entry>
15610 // <para>
15611 // <literal>u</literal>
15612 // </para>
15613 // </entry>
15614 // <entry>
15615 // <para>
15616 // the type string of %G_VARIANT_TYPE_UINT32; an unsigned 32 bit
15617 // integer.
15618 // </para>
15619 // </entry>
15620 // </row>
15621 // <row>
15622 // <entry>
15623 // <para>
15624 // <literal>x</literal>
15625 // </para>
15626 // </entry>
15627 // <entry>
15628 // <para>
15629 // the type string of %G_VARIANT_TYPE_INT64; a signed 64 bit
15630 // integer.
15631 // </para>
15632 // </entry>
15633 // </row>
15634 // <row>
15635 // <entry>
15636 // <para>
15637 // <literal>t</literal>
15638 // </para>
15639 // </entry>
15640 // <entry>
15641 // <para>
15642 // the type string of %G_VARIANT_TYPE_UINT64; an unsigned 64 bit
15643 // integer.
15644 // </para>
15645 // </entry>
15646 // </row>
15647 // <row>
15648 // <entry>
15649 // <para>
15650 // <literal>h</literal>
15651 // </para>
15652 // </entry>
15653 // <entry>
15654 // <para>
15655 // the type string of %G_VARIANT_TYPE_HANDLE; a signed 32 bit
15656 // value that, by convention, is used as an index into an array
15657 // of file descriptors that are sent alongside a D-Bus message.
15658 // </para>
15659 // </entry>
15660 // </row>
15661 // <row>
15662 // <entry>
15663 // <para>
15664 // <literal>d</literal>
15665 // </para>
15666 // </entry>
15667 // <entry>
15668 // <para>
15669 // the type string of %G_VARIANT_TYPE_DOUBLE; a double precision
15670 // floating point value.
15671 // </para>
15672 // </entry>
15673 // </row>
15674 // <row>
15675 // <entry>
15676 // <para>
15677 // <literal>s</literal>
15678 // </para>
15679 // </entry>
15680 // <entry>
15681 // <para>
15682 // the type string of %G_VARIANT_TYPE_STRING; a string.
15683 // </para>
15684 // </entry>
15685 // </row>
15686 // <row>
15687 // <entry>
15688 // <para>
15689 // <literal>o</literal>
15690 // </para>
15691 // </entry>
15692 // <entry>
15693 // <para>
15694 // the type string of %G_VARIANT_TYPE_OBJECT_PATH; a string in
15695 // the form of a D-Bus object path.
15696 // </para>
15697 // </entry>
15698 // </row>
15699 // <row>
15700 // <entry>
15701 // <para>
15702 // <literal>g</literal>
15703 // </para>
15704 // </entry>
15705 // <entry>
15706 // <para>
15707 // the type string of %G_VARIANT_TYPE_STRING; a string in the
15708 // form of a D-Bus type signature.
15709 // </para>
15710 // </entry>
15711 // </row>
15712 // <row>
15713 // <entry>
15714 // <para>
15715 // <literal>?</literal>
15716 // </para>
15717 // </entry>
15718 // <entry>
15719 // <para>
15720 // the type string of %G_VARIANT_TYPE_BASIC; an indefinite type
15721 // that is a supertype of any of the basic types.
15722 // </para>
15723 // </entry>
15724 // </row>
15725 // <row>
15726 // <entry>
15727 // <para>
15728 // <literal>v</literal>
15729 // </para>
15730 // </entry>
15731 // <entry>
15732 // <para>
15733 // the type string of %G_VARIANT_TYPE_VARIANT; a container type
15734 // that contain any other type of value.
15735 // </para>
15736 // </entry>
15737 // </row>
15738 // <row>
15739 // <entry>
15740 // <para>
15741 // <literal>a</literal>
15742 // </para>
15743 // </entry>
15744 // <entry>
15745 // <para>
15746 // used as a prefix on another type string to mean an array of
15747 // that type; the type string "<literal>ai</literal>", for
15748 // example, is the type of an array of 32 bit signed integers.
15749 // </para>
15750 // </entry>
15751 // </row>
15752 // <row>
15753 // <entry>
15754 // <para>
15755 // <literal>m</literal>
15756 // </para>
15757 // </entry>
15758 // <entry>
15759 // <para>
15760 // used as a prefix on another type string to mean a "maybe", or
15761 // "nullable", version of that type; the type string
15762 // "<literal>ms</literal>", for example, is the type of a value
15763 // that maybe contains a string, or maybe contains nothing.
15764 // </para>
15765 // </entry>
15766 // </row>
15767 // <row>
15768 // <entry>
15769 // <para>
15770 // <literal>()</literal>
15771 // </para>
15772 // </entry>
15773 // <entry>
15774 // <para>
15775 // used to enclose zero or more other concatenated type strings
15776 // to create a tuple type; the type string
15777 // "<literal>(is)</literal>", for example, is the type of a pair
15778 // of an integer and a string.
15779 // </para>
15780 // </entry>
15781 // </row>
15782 // <row>
15783 // <entry>
15784 // <para>
15785 // <literal>r</literal>
15786 // </para>
15787 // </entry>
15788 // <entry>
15789 // <para>
15790 // the type string of %G_VARIANT_TYPE_TUPLE; an indefinite type
15791 // that is a supertype of any tuple type, regardless of the
15792 // number of items.
15793 // </para>
15794 // </entry>
15795 // </row>
15796 // <row>
15797 // <entry>
15798 // <para>
15799 // <literal>{}</literal>
15800 // </para>
15801 // </entry>
15802 // <entry>
15803 // <para>
15804 // used to enclose a basic type string concatenated with another
15805 // type string to create a dictionary entry type, which usually
15806 // appears inside of an array to form a dictionary; the type
15807 // string "<literal>a{sd}</literal>", for example, is the type of
15808 // a dictionary that maps strings to double precision floating
15809 // point values.
15810 // </para>
15811 // <para>
15812 // The first type (the basic type) is the key type and the second
15813 // type is the value type. The reason that the first type is
15814 // restricted to being a basic type is so that it can easily be
15815 // hashed.
15816 // </para>
15817 // </entry>
15818 // </row>
15819 // <row>
15820 // <entry>
15821 // <para>
15822 // <literal>*</literal>
15823 // </para>
15824 // </entry>
15825 // <entry>
15826 // <para>
15827 // the type string of %G_VARIANT_TYPE_ANY; the indefinite type
15828 // that is a supertype of all types. Note that, as with all type
15829 // strings, this character represents exactly one type. It
15830 // cannot be used inside of tuples to mean "any number of items".
15831 // </para>
15832 // </entry>
15833 // </row>
15834 // </tbody>
15835 // </tgroup>
15836 // </informaltable>
15837 // <para>
15838 // Any type string of a container that contains an indefinite type is,
15839 // itself, an indefinite type. For example, the type string
15840 // "<literal>a*</literal>" (corresponding to %G_VARIANT_TYPE_ARRAY) is
15841 // an indefinite type that is a supertype of every array type.
15842 // "<literal>(*s)</literal>" is a supertype of all tuples that
15843 // contain exactly two items where the second item is a string.
15844 // </para>
15845 // <para>
15846 // "<literal>a{?*}</literal>" is an indefinite type that is a
15847 // supertype of all arrays containing dictionary entries where the key
15848 // is any basic type and the value is any type at all. This is, by
15849 // definition, a dictionary, so this type string corresponds to
15850 // %G_VARIANT_TYPE_DICTIONARY. Note that, due to the restriction that
15851 // the key of a dictionary entry must be a basic type,
15852 // "<literal>{**}</literal>" is not a valid type string.
15853 // </para>
15854 // </refsect2>
15855 struct VariantType {
15857 // VERSION: 2.24
15858 // Creates a new #GVariantType corresponding to the type string given
15859 // by @type_string. It is appropriate to call g_variant_type_free() on
15860 // the return value.
15862 // It is a programmer error to call this function with an invalid type
15863 // string. Use g_variant_type_string_is_valid() if you are unsure.
15864 // RETURNS: a new #GVariantType
15865 // <type_string>: a valid GVariant type string
15866 static VariantType* /*new*/ new_(AT0)(AT0 /*char*/ type_string) nothrow {
15867 return g_variant_type_new(toCString!(char*)(type_string));
15869 static auto opCall(AT0)(AT0 /*char*/ type_string) {
15870 return g_variant_type_new(toCString!(char*)(type_string));
15873 // Constructs a new tuple type, from @items.
15875 // @length is the number of items in @items, or -1 to indicate that
15876 // @items is %NULL-terminated.
15878 // It is appropriate to call g_variant_type_free() on the return value.
15881 // Since 2.24
15882 // RETURNS: a new tuple #GVariantType
15883 // <items>: an array of #GVariantTypes, one for each item
15884 // <length>: the length of @items, or -1
15885 static VariantType* /*new*/ new_tuple(AT0)(AT0 /*VariantType**/ items, int length) nothrow {
15886 return g_variant_type_new_tuple(UpCast!(VariantType**)(items), length);
15888 static auto opCall(AT0)(AT0 /*VariantType**/ items, int length) {
15889 return g_variant_type_new_tuple(UpCast!(VariantType**)(items), length);
15892 // Makes a copy of a #GVariantType. It is appropriate to call
15893 // g_variant_type_free() on the return value. @type may not be %NULL.
15896 // Since 2.24
15897 // RETURNS: a new #GVariantType
15898 VariantType* /*new*/ copy()() nothrow {
15899 return g_variant_type_copy(&this);
15902 // Returns a newly-allocated copy of the type string corresponding to
15903 // @type. The returned string is nul-terminated. It is appropriate to
15904 // call g_free() on the return value.
15907 // Since 2.24
15908 // RETURNS: the corresponding type string
15909 char* /*new*/ dup_string()() nothrow {
15910 return g_variant_type_dup_string(&this);
15913 // Determines the element type of an array or maybe type.
15915 // This function may only be used with array or maybe types.
15918 // Since 2.24
15919 // RETURNS: the element type of @type
15920 VariantType* element()() nothrow {
15921 return g_variant_type_element(&this);
15924 // Compares @type1 and @type2 for equality.
15926 // Only returns %TRUE if the types are exactly equal. Even if one type
15927 // is an indefinite type and the other is a subtype of it, %FALSE will
15928 // be returned if they are not exactly equal. If you want to check for
15929 // subtypes, use g_variant_type_is_subtype_of().
15931 // The argument types of @type1 and @type2 are only #gconstpointer to
15932 // allow use with #GHashTable without function pointer casting. For
15933 // both arguments, a valid #GVariantType must be provided.
15936 // Since 2.24
15937 // RETURNS: %TRUE if @type1 and @type2 are exactly equal
15938 // <type2>: a #GVariantType
15939 int equal(AT0)(AT0 /*const(VariantType)*/ type2) nothrow {
15940 return g_variant_type_equal(&this, UpCast!(const(VariantType)*)(type2));
15943 // Determines the first item type of a tuple or dictionary entry
15944 // type.
15946 // This function may only be used with tuple or dictionary entry types,
15947 // but must not be used with the generic tuple type
15948 // %G_VARIANT_TYPE_TUPLE.
15950 // In the case of a dictionary entry type, this returns the type of
15951 // the key.
15953 // %NULL is returned in case of @type being %G_VARIANT_TYPE_UNIT.
15955 // This call, together with g_variant_type_next() provides an iterator
15956 // interface over tuple and dictionary entry types.
15959 // Since 2.24
15960 // RETURNS: the first item type of @type, or %NULL
15961 VariantType* first()() nothrow {
15962 return g_variant_type_first(&this);
15965 // Frees a #GVariantType that was allocated with
15966 // g_variant_type_copy(), g_variant_type_new() or one of the container
15967 // type constructor functions.
15969 // In the case that @type is %NULL, this function does nothing.
15971 // Since 2.24
15972 void free()() nothrow {
15973 g_variant_type_free(&this);
15976 // Returns the length of the type string corresponding to the given
15977 // @type. This function must be used to determine the valid extent of
15978 // the memory region returned by g_variant_type_peek_string().
15981 // Since 2.24
15982 // RETURNS: the length of the corresponding type string
15983 size_t get_string_length()() nothrow {
15984 return g_variant_type_get_string_length(&this);
15987 // Hashes @type.
15989 // The argument type of @type is only #gconstpointer to allow use with
15990 // #GHashTable without function pointer casting. A valid
15991 // #GVariantType must be provided.
15994 // Since 2.24
15995 // RETURNS: the hash value
15996 uint hash()() nothrow {
15997 return g_variant_type_hash(&this);
16000 // Determines if the given @type is an array type. This is true if the
16001 // type string for @type starts with an 'a'.
16003 // This function returns %TRUE for any indefinite type for which every
16004 // definite subtype is an array type -- %G_VARIANT_TYPE_ARRAY, for
16005 // example.
16008 // Since 2.24
16009 // RETURNS: %TRUE if @type is an array type
16010 int is_array()() nothrow {
16011 return g_variant_type_is_array(&this);
16014 // Determines if the given @type is a basic type.
16016 // Basic types are booleans, bytes, integers, doubles, strings, object
16017 // paths and signatures.
16019 // Only a basic type may be used as the key of a dictionary entry.
16021 // This function returns %FALSE for all indefinite types except
16022 // %G_VARIANT_TYPE_BASIC.
16025 // Since 2.24
16026 // RETURNS: %TRUE if @type is a basic type
16027 int is_basic()() nothrow {
16028 return g_variant_type_is_basic(&this);
16031 // Determines if the given @type is a container type.
16033 // Container types are any array, maybe, tuple, or dictionary
16034 // entry types plus the variant type.
16036 // This function returns %TRUE for any indefinite type for which every
16037 // definite subtype is a container -- %G_VARIANT_TYPE_ARRAY, for
16038 // example.
16041 // Since 2.24
16042 // RETURNS: %TRUE if @type is a container type
16043 int is_container()() nothrow {
16044 return g_variant_type_is_container(&this);
16047 // Determines if the given @type is definite (ie: not indefinite).
16049 // A type is definite if its type string does not contain any indefinite
16050 // type characters ('*', '?', or 'r').
16052 // A #GVariant instance may not have an indefinite type, so calling
16053 // this function on the result of g_variant_get_type() will always
16054 // result in %TRUE being returned. Calling this function on an
16055 // indefinite type like %G_VARIANT_TYPE_ARRAY, however, will result in
16056 // %FALSE being returned.
16059 // Since 2.24
16060 // RETURNS: %TRUE if @type is definite
16061 int is_definite()() nothrow {
16062 return g_variant_type_is_definite(&this);
16065 // Determines if the given @type is a dictionary entry type. This is
16066 // true if the type string for @type starts with a '{'.
16068 // This function returns %TRUE for any indefinite type for which every
16069 // definite subtype is a dictionary entry type --
16070 // %G_VARIANT_TYPE_DICT_ENTRY, for example.
16073 // Since 2.24
16074 // RETURNS: %TRUE if @type is a dictionary entry type
16075 int is_dict_entry()() nothrow {
16076 return g_variant_type_is_dict_entry(&this);
16079 // Determines if the given @type is a maybe type. This is true if the
16080 // type string for @type starts with an 'm'.
16082 // This function returns %TRUE for any indefinite type for which every
16083 // definite subtype is a maybe type -- %G_VARIANT_TYPE_MAYBE, for
16084 // example.
16087 // Since 2.24
16088 // RETURNS: %TRUE if @type is a maybe type
16089 int is_maybe()() nothrow {
16090 return g_variant_type_is_maybe(&this);
16093 // Checks if @type is a subtype of @supertype.
16095 // This function returns %TRUE if @type is a subtype of @supertype. All
16096 // types are considered to be subtypes of themselves. Aside from that,
16097 // only indefinite types can have subtypes.
16100 // Since 2.24
16101 // RETURNS: %TRUE if @type is a subtype of @supertype
16102 // <supertype>: a #GVariantType
16103 int is_subtype_of(AT0)(AT0 /*VariantType*/ supertype) nothrow {
16104 return g_variant_type_is_subtype_of(&this, UpCast!(VariantType*)(supertype));
16107 // Determines if the given @type is a tuple type. This is true if the
16108 // type string for @type starts with a '(' or if @type is
16109 // %G_VARIANT_TYPE_TUPLE.
16111 // This function returns %TRUE for any indefinite type for which every
16112 // definite subtype is a tuple type -- %G_VARIANT_TYPE_TUPLE, for
16113 // example.
16116 // Since 2.24
16117 // RETURNS: %TRUE if @type is a tuple type
16118 int is_tuple()() nothrow {
16119 return g_variant_type_is_tuple(&this);
16122 // Determines if the given @type is the variant type.
16125 // Since 2.24
16126 // RETURNS: %TRUE if @type is the variant type
16127 int is_variant()() nothrow {
16128 return g_variant_type_is_variant(&this);
16131 // Determines the key type of a dictionary entry type.
16133 // This function may only be used with a dictionary entry type. Other
16134 // than the additional restriction, this call is equivalent to
16135 // g_variant_type_first().
16138 // Since 2.24
16139 // RETURNS: the key type of the dictionary entry
16140 VariantType* key()() nothrow {
16141 return g_variant_type_key(&this);
16144 // Determines the number of items contained in a tuple or
16145 // dictionary entry type.
16147 // This function may only be used with tuple or dictionary entry types,
16148 // but must not be used with the generic tuple type
16149 // %G_VARIANT_TYPE_TUPLE.
16151 // In the case of a dictionary entry type, this function will always
16152 // return 2.
16155 // Since 2.24
16156 // RETURNS: the number of items in @type
16157 size_t n_items()() nothrow {
16158 return g_variant_type_n_items(&this);
16161 // Constructs the type corresponding to an array of elements of the
16162 // type @type.
16164 // It is appropriate to call g_variant_type_free() on the return value.
16167 // Since 2.24
16168 // RETURNS: a new array #GVariantType
16169 VariantType* /*new*/ new_array()() nothrow {
16170 return g_variant_type_new_array(&this);
16173 // Constructs the type corresponding to a dictionary entry with a key
16174 // of type @key and a value of type @value.
16176 // It is appropriate to call g_variant_type_free() on the return value.
16179 // Since 2.24
16180 // RETURNS: a new dictionary entry #GVariantType
16181 // <value>: a #GVariantType
16182 VariantType* /*new*/ new_dict_entry(AT0)(AT0 /*VariantType*/ value) nothrow {
16183 return g_variant_type_new_dict_entry(&this, UpCast!(VariantType*)(value));
16186 // Constructs the type corresponding to a maybe instance containing
16187 // type @type or Nothing.
16189 // It is appropriate to call g_variant_type_free() on the return value.
16192 // Since 2.24
16193 // RETURNS: a new maybe #GVariantType
16194 VariantType* /*new*/ new_maybe()() nothrow {
16195 return g_variant_type_new_maybe(&this);
16198 // Determines the next item type of a tuple or dictionary entry
16199 // type.
16201 // @type must be the result of a previous call to
16202 // g_variant_type_first() or g_variant_type_next().
16204 // If called on the key type of a dictionary entry then this call
16205 // returns the value type. If called on the value type of a dictionary
16206 // entry then this call returns %NULL.
16208 // For tuples, %NULL is returned when @type is the last item in a tuple.
16211 // Since 2.24
16212 // RETURNS: the next #GVariantType after @type, or %NULL
16213 VariantType* next()() nothrow {
16214 return g_variant_type_next(&this);
16217 // Unintrospectable method: peek_string() / g_variant_type_peek_string()
16218 // Returns the type string corresponding to the given @type. The
16219 // result is not nul-terminated; in order to determine its length you
16220 // must call g_variant_type_get_string_length().
16222 // To get a nul-terminated string, see g_variant_type_dup_string().
16225 // Since 2.24
16226 // RETURNS: the corresponding type string (not nul-terminated)
16227 char* peek_string()() nothrow {
16228 return g_variant_type_peek_string(&this);
16231 // Determines the value type of a dictionary entry type.
16233 // This function may only be used with a dictionary entry type.
16236 // Since 2.24
16237 // RETURNS: the value type of the dictionary entry
16238 VariantType* value()() nothrow {
16239 return g_variant_type_value(&this);
16241 static VariantType* checked_(AT0)(AT0 /*char*/ arg_a) nothrow {
16242 return g_variant_type_checked_(toCString!(char*)(arg_a));
16245 // Checks if @type_string is a valid GVariant type string. This call is
16246 // equivalent to calling g_variant_type_string_scan() and confirming
16247 // that the following character is a nul terminator.
16250 // Since 2.24
16251 // RETURNS: %TRUE if @type_string is exactly one valid type string
16252 // <type_string>: a pointer to any string
16253 static int string_is_valid(AT0)(AT0 /*char*/ type_string) nothrow {
16254 return g_variant_type_string_is_valid(toCString!(char*)(type_string));
16257 // VERSION: 2.24
16258 // Scan for a single complete and valid GVariant type string in @string.
16259 // The memory pointed to by @limit (or bytes beyond it) is never
16260 // accessed.
16262 // If a valid type string is found, @endptr is updated to point to the
16263 // first character past the end of the string that was found and %TRUE
16264 // is returned.
16266 // If there is no valid type string starting at @string, or if the type
16267 // string does not end before @limit then %FALSE is returned.
16269 // For the simple case of checking if a string is a valid type string,
16270 // see g_variant_type_string_is_valid().
16271 // RETURNS: %TRUE if a valid type string was found
16272 // <string>: a pointer to any string
16273 // <limit>: the end of @string, or %NULL
16274 // <endptr>: location to store the end pointer, or %NULL
16275 static int string_scan(AT0, AT1, AT2)(AT0 /*char*/ string_, AT1 /*char*/ limit=null, /*out*/ AT2 /*char**/ endptr=null) nothrow {
16276 return g_variant_type_string_scan(toCString!(char*)(string_), toCString!(char*)(limit), toCString!(char**)(endptr));
16281 // Declares a type of function which takes no arguments
16282 // and has no return value. It is used to specify the type
16283 // function passed to g_atexit().
16284 extern (C) alias void function () nothrow VoidFunc;
16286 enum int WIN32_MSG_HANDLE = 19981206;
16288 // VERSION: 2.8
16289 // A wrapper for the POSIX access() function. This function is used to
16290 // test a pathname for one or several of read, write or execute
16291 // permissions, or just existence.
16293 // On Windows, the file protection mechanism is not at all POSIX-like,
16294 // and the underlying function in the C library only checks the
16295 // FAT-style READONLY attribute, and does not look at the ACL of a
16296 // file at all. This function is this in practise almost useless on
16297 // Windows. Software that needs to handle file permissions on Windows
16298 // more exactly should use the Win32 API.
16300 // See your C library manual for more details about access().
16302 // object that has all the tested permissions, or -1 otherwise or on
16303 // error.
16304 // RETURNS: zero if the pathname refers to an existing file system
16305 // <filename>: a pathname in the GLib file name encoding (UTF-8 on Windows)
16306 // <mode>: as in access()
16307 static int access(AT0)(AT0 /*char*/ filename, int mode) nothrow {
16308 return g_access(toCString!(char*)(filename), mode);
16312 // MOVED TO: Array.free
16313 // Frees the memory allocated for the #GArray. If @free_segment is
16314 // %TRUE it frees the memory block holding the elements as well and
16315 // also each element if @array has a @element_free_func set. Pass
16316 // %FALSE if you want to free the #GArray wrapper but preserve the
16317 // underlying array for use elsewhere. If the reference count of @array
16318 // is greater than one, the #GArray wrapper is preserved but the size
16319 // of @array will be set to zero.
16321 // <note><para>If array elements contain dynamically-allocated memory,
16322 // they should be freed separately.</para></note>
16323 // <array>: a #GArray.
16324 // <free_segment>: if %TRUE the actual element data is freed as well.
16325 static char* /*new*/ array_free(AT0)(AT0 /*Array*/ array, int free_segment) nothrow {
16326 return g_array_free(UpCast!(Array*)(array), free_segment);
16330 // VERSION: 2.22
16331 // MOVED TO: Array.get_element_size
16332 // Gets the size of the elements in @array.
16333 // RETURNS: Size of each element, in bytes.
16334 // <array>: A #GArray.
16335 static uint array_get_element_size(AT0)(AT0 /*Array*/ array) nothrow {
16336 return g_array_get_element_size(UpCast!(Array*)(array));
16340 // VERSION: 2.32
16341 // MOVED TO: Array.set_clear_func
16342 // Sets a function to clear an element of @array.
16344 // The @clear_func will be called when an element in the array
16345 // data segment is removed and when the array is freed and data
16346 // segment is deallocated as well.
16348 // Note that in contrast with other uses of #GDestroyNotify
16349 // functions, @clear_func is expected to clear the contents of
16350 // the array element it is given, but not free the element itself.
16351 // <array>: A #GArray
16352 // <clear_func>: a function to clear an element of @array
16353 static void array_set_clear_func(AT0)(AT0 /*Array*/ array, DestroyNotify clear_func) nothrow {
16354 g_array_set_clear_func(UpCast!(Array*)(array), clear_func);
16358 // VERSION: 2.22
16359 // MOVED TO: Array.unref
16360 // Atomically decrements the reference count of @array by one. If the
16361 // reference count drops to 0, all memory allocated by the array is
16362 // released. This function is MT-safe and may be called from any
16363 // thread.
16364 // <array>: A #GArray.
16365 static void array_unref(AT0)(AT0 /*Array*/ array) nothrow {
16366 g_array_unref(UpCast!(Array*)(array));
16370 // Determines the numeric value of a character as a decimal
16371 // digit. Differs from g_unichar_digit_value() because it takes
16372 // a char, so there's no worry about sign extension if characters
16373 // are signed.
16375 // g_ascii_isdigit()), its numeric value. Otherwise, -1.
16376 // RETURNS: If @c is a decimal digit (according to
16377 // <c>: an ASCII character.
16378 static int ascii_digit_value()(char c) nothrow {
16379 return g_ascii_digit_value(c);
16383 // Converts a #gdouble to a string, using the '.' as
16384 // decimal point.
16386 // This functions generates enough precision that converting
16387 // the string back using g_ascii_strtod() gives the same machine-number
16388 // (on machines with IEEE compatible 64bit doubles). It is
16389 // guaranteed that the size of the resulting string will never
16390 // be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes.
16391 // RETURNS: The pointer to the buffer with the converted string.
16392 // <buffer>: A buffer to place the resulting string in
16393 // <buf_len>: The length of the buffer.
16394 // <d>: The #gdouble to convert
16395 static char* /*new*/ ascii_dtostr(AT0)(AT0 /*char*/ buffer, int buf_len, double d) nothrow {
16396 return g_ascii_dtostr(toCString!(char*)(buffer), buf_len, d);
16400 // Converts a #gdouble to a string, using the '.' as
16401 // decimal point. To format the number you pass in
16402 // a printf()-style format string. Allowed conversion
16403 // specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
16405 // If you just want to want to serialize the value into a
16406 // string, use g_ascii_dtostr().
16407 // RETURNS: The pointer to the buffer with the converted string.
16408 // <buffer>: A buffer to place the resulting string in
16409 // <buf_len>: The length of the buffer.
16410 // <format>: The printf()-style format to use for the code to use for converting.
16411 // <d>: The #gdouble to convert
16412 static char* /*new*/ ascii_formatd(AT0, AT1)(AT0 /*char*/ buffer, int buf_len, AT1 /*char*/ format, double d) nothrow {
16413 return g_ascii_formatd(toCString!(char*)(buffer), buf_len, toCString!(char*)(format), d);
16417 // Compare two strings, ignoring the case of ASCII characters.
16419 // Unlike the BSD strcasecmp() function, this only recognizes standard
16420 // ASCII letters and ignores the locale, treating all non-ASCII
16421 // bytes as if they are not letters.
16423 // This function should be used only on strings that are known to be
16424 // in encodings where the bytes corresponding to ASCII letters always
16425 // represent themselves. This includes UTF-8 and the ISO-8859-*
16426 // charsets, but not for instance double-byte encodings like the
16427 // Windows Codepage 932, where the trailing bytes of double-byte
16428 // characters include all ASCII letters. If you compare two CP932
16429 // strings using this function, you will get false matches.
16431 // or a positive value if @s1 &gt; @s2.
16432 // RETURNS: 0 if the strings match, a negative value if @s1 &lt; @s2,
16433 // <s1>: string to compare with @s2.
16434 // <s2>: string to compare with @s1.
16435 static int ascii_strcasecmp(AT0, AT1)(AT0 /*char*/ s1, AT1 /*char*/ s2) nothrow {
16436 return g_ascii_strcasecmp(toCString!(char*)(s1), toCString!(char*)(s2));
16440 // Converts all upper case ASCII letters to lower case ASCII letters.
16442 // characters in @str converted to lower case, with
16443 // semantics that exactly match g_ascii_tolower(). (Note
16444 // that this is unlike the old g_strdown(), which modified
16445 // the string in place.)
16446 // RETURNS: a newly-allocated string, with all the upper case
16447 // <str>: a string.
16448 // <len>: length of @str in bytes, or -1 if @str is nul-terminated.
16449 static char* /*new*/ ascii_strdown(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
16450 return g_ascii_strdown(toCString!(char*)(str), len);
16454 // Compare @s1 and @s2, ignoring the case of ASCII characters and any
16455 // characters after the first @n in each string.
16457 // Unlike the BSD strcasecmp() function, this only recognizes standard
16458 // ASCII letters and ignores the locale, treating all non-ASCII
16459 // characters as if they are not letters.
16461 // The same warning as in g_ascii_strcasecmp() applies: Use this
16462 // function only on strings known to be in encodings where bytes
16463 // corresponding to ASCII letters always represent themselves.
16465 // or a positive value if @s1 &gt; @s2.
16466 // RETURNS: 0 if the strings match, a negative value if @s1 &lt; @s2,
16467 // <s1>: string to compare with @s2.
16468 // <s2>: string to compare with @s1.
16469 // <n>: number of characters to compare.
16470 static int ascii_strncasecmp(AT0, AT1)(AT0 /*char*/ s1, AT1 /*char*/ s2, size_t n) nothrow {
16471 return g_ascii_strncasecmp(toCString!(char*)(s1), toCString!(char*)(s2), n);
16475 // Converts a string to a #gdouble value.
16477 // This function behaves like the standard strtod() function
16478 // does in the C locale. It does this without actually changing
16479 // the current locale, since that would not be thread-safe.
16480 // A limitation of the implementation is that this function
16481 // will still accept localized versions of infinities and NANs.
16483 // This function is typically used when reading configuration
16484 // files or other non-user input that should be locale independent.
16485 // To handle input from the user you should normally use the
16486 // locale-sensitive system strtod() function.
16488 // To convert from a #gdouble to a string in a locale-insensitive
16489 // way, use g_ascii_dtostr().
16491 // If the correct value would cause overflow, plus or minus <literal>HUGE_VAL</literal>
16492 // is returned (according to the sign of the value), and <literal>ERANGE</literal> is
16493 // stored in <literal>errno</literal>. If the correct value would cause underflow,
16494 // zero is returned and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
16496 // This function resets <literal>errno</literal> before calling strtod() so that
16497 // you can reliably detect overflow and underflow.
16498 // RETURNS: the #gdouble value.
16499 // <nptr>: the string to convert to a numeric value.
16500 // <endptr>: if non-%NULL, it returns the character after the last character used in the conversion.
16501 static double ascii_strtod(AT0, AT1)(AT0 /*char*/ nptr, AT1 /*char**/ endptr) nothrow {
16502 return g_ascii_strtod(toCString!(char*)(nptr), toCString!(char**)(endptr));
16506 // VERSION: 2.12
16507 // Converts a string to a #gint64 value.
16508 // This function behaves like the standard strtoll() function
16509 // does in the C locale. It does this without actually
16510 // changing the current locale, since that would not be
16511 // thread-safe.
16513 // This function is typically used when reading configuration
16514 // files or other non-user input that should be locale independent.
16515 // To handle input from the user you should normally use the
16516 // locale-sensitive system strtoll() function.
16518 // If the correct value would cause overflow, %G_MAXINT64 or %G_MININT64
16519 // is returned, and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
16520 // If the base is outside the valid range, zero is returned, and
16521 // <literal>EINVAL</literal> is stored in <literal>errno</literal>. If the
16522 // string conversion fails, zero is returned, and @endptr returns @nptr
16523 // (if @endptr is non-%NULL).
16524 // RETURNS: the #gint64 value or zero on error.
16525 // <nptr>: the string to convert to a numeric value.
16526 // <endptr>: if non-%NULL, it returns the character after the last character used in the conversion.
16527 // <base>: to be used for the conversion, 2..36 or 0
16528 static long ascii_strtoll(AT0, AT1)(AT0 /*char*/ nptr, AT1 /*char**/ endptr, uint base) nothrow {
16529 return g_ascii_strtoll(toCString!(char*)(nptr), toCString!(char**)(endptr), base);
16533 // VERSION: 2.2
16534 // Converts a string to a #guint64 value.
16535 // This function behaves like the standard strtoull() function
16536 // does in the C locale. It does this without actually
16537 // changing the current locale, since that would not be
16538 // thread-safe.
16540 // This function is typically used when reading configuration
16541 // files or other non-user input that should be locale independent.
16542 // To handle input from the user you should normally use the
16543 // locale-sensitive system strtoull() function.
16545 // If the correct value would cause overflow, %G_MAXUINT64
16546 // is returned, and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
16547 // If the base is outside the valid range, zero is returned, and
16548 // <literal>EINVAL</literal> is stored in <literal>errno</literal>.
16549 // If the string conversion fails, zero is returned, and @endptr returns
16550 // @nptr (if @endptr is non-%NULL).
16551 // RETURNS: the #guint64 value or zero on error.
16552 // <nptr>: the string to convert to a numeric value.
16553 // <endptr>: if non-%NULL, it returns the character after the last character used in the conversion.
16554 // <base>: to be used for the conversion, 2..36 or 0
16555 static ulong ascii_strtoull(AT0, AT1)(AT0 /*char*/ nptr, AT1 /*char**/ endptr, uint base) nothrow {
16556 return g_ascii_strtoull(toCString!(char*)(nptr), toCString!(char**)(endptr), base);
16560 // Converts all lower case ASCII letters to upper case ASCII letters.
16562 // characters in @str converted to upper case, with
16563 // semantics that exactly match g_ascii_toupper(). (Note
16564 // that this is unlike the old g_strup(), which modified
16565 // the string in place.)
16566 // RETURNS: a newly allocated string, with all the lower case
16567 // <str>: a string.
16568 // <len>: length of @str in bytes, or -1 if @str is nul-terminated.
16569 static char* /*new*/ ascii_strup(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
16570 return g_ascii_strup(toCString!(char*)(str), len);
16574 // Convert a character to ASCII lower case.
16576 // Unlike the standard C library tolower() function, this only
16577 // recognizes standard ASCII letters and ignores the locale, returning
16578 // all non-ASCII characters unchanged, even if they are lower case
16579 // letters in a particular character set. Also unlike the standard
16580 // library function, this takes and returns a char, not an int, so
16581 // don't call it on <literal>EOF</literal> but no need to worry about casting to #guchar
16582 // before passing a possibly non-ASCII character in.
16584 // If @c is not an ASCII upper case letter,
16585 // @c is returned unchanged.
16586 // RETURNS: the result of converting @c to lower case.
16587 // <c>: any character.
16588 static char ascii_tolower()(char c) nothrow {
16589 return g_ascii_tolower(c);
16593 // Convert a character to ASCII upper case.
16595 // Unlike the standard C library toupper() function, this only
16596 // recognizes standard ASCII letters and ignores the locale, returning
16597 // all non-ASCII characters unchanged, even if they are upper case
16598 // letters in a particular character set. Also unlike the standard
16599 // library function, this takes and returns a char, not an int, so
16600 // don't call it on <literal>EOF</literal> but no need to worry about casting to #guchar
16601 // before passing a possibly non-ASCII character in.
16603 // If @c is not an ASCII lower case letter,
16604 // @c is returned unchanged.
16605 // RETURNS: the result of converting @c to upper case.
16606 // <c>: any character.
16607 static char ascii_toupper()(char c) nothrow {
16608 return g_ascii_toupper(c);
16612 // Determines the numeric value of a character as a hexidecimal
16613 // digit. Differs from g_unichar_xdigit_value() because it takes
16614 // a char, so there's no worry about sign extension if characters
16615 // are signed.
16617 // g_ascii_isxdigit()), its numeric value. Otherwise, -1.
16618 // RETURNS: If @c is a hex digit (according to
16619 // <c>: an ASCII character.
16620 static int ascii_xdigit_value()(char c) nothrow {
16621 return g_ascii_xdigit_value(c);
16624 static void assert_warning(AT0, AT1, AT2, AT3)(AT0 /*char*/ log_domain, AT1 /*char*/ file, int line, AT2 /*char*/ pretty_function, AT3 /*char*/ expression) nothrow {
16625 g_assert_warning(toCString!(char*)(log_domain), toCString!(char*)(file), line, toCString!(char*)(pretty_function), toCString!(char*)(expression));
16628 static void assertion_message(AT0, AT1, AT2, AT3)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, AT3 /*char*/ message) nothrow {
16629 g_assertion_message(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), toCString!(char*)(message));
16632 // Unintrospectable function: assertion_message_cmpnum() / g_assertion_message_cmpnum()
16633 static void assertion_message_cmpnum(AT0, AT1, AT2, AT3, AT4)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, AT3 /*char*/ expr, real arg1, AT4 /*char*/ cmp, real arg2, char numtype) nothrow {
16634 g_assertion_message_cmpnum(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), toCString!(char*)(expr), arg1, toCString!(char*)(cmp), arg2, numtype);
16637 static void assertion_message_cmpstr(AT0, AT1, AT2, AT3, AT4, AT5, AT6)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, AT3 /*char*/ expr, AT4 /*char*/ arg1, AT5 /*char*/ cmp, AT6 /*char*/ arg2) nothrow {
16638 g_assertion_message_cmpstr(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), toCString!(char*)(expr), toCString!(char*)(arg1), toCString!(char*)(cmp), toCString!(char*)(arg2));
16641 static void assertion_message_error(AT0, AT1, AT2, AT3, AT4)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, AT3 /*char*/ expr, AT4 /*Error*/ error, Quark error_domain, int error_code) nothrow {
16642 g_assertion_message_error(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), toCString!(char*)(expr), UpCast!(Error*)(error), error_domain, error_code);
16645 static void assertion_message_expr(AT0, AT1, AT2, AT3)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, AT3 /*char*/ expr) nothrow {
16646 g_assertion_message_expr(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), toCString!(char*)(expr));
16650 // Specifies a function to be called at normal program termination.
16652 // Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor
16653 // macro that maps to a call to the atexit() function in the C
16654 // library. This means that in case the code that calls g_atexit(),
16655 // i.e. atexit(), is in a DLL, the function will be called when the
16656 // DLL is detached from the program. This typically makes more sense
16657 // than that the function is called when the GLib DLL is detached,
16658 // which happened earlier when g_atexit() was a function in the GLib
16659 // DLL.
16661 // The behaviour of atexit() in the context of dynamically loaded
16662 // modules is not formally specified and varies wildly.
16664 // On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
16665 // loaded module which is unloaded before the program terminates might
16666 // well cause a crash at program exit.
16668 // Some POSIX systems implement atexit() like Windows, and have each
16669 // dynamically loaded module maintain an own atexit chain that is
16670 // called when the module is unloaded.
16672 // On other POSIX systems, before a dynamically loaded module is
16673 // unloaded, the registered atexit functions (if any) residing in that
16674 // module are called, regardless where the code that registered them
16675 // resided. This is presumably the most robust approach.
16677 // As can be seen from the above, for portability it's best to avoid
16678 // calling g_atexit() (or atexit()) except in the main executable of a
16679 // program.
16681 // Deprecated:2.32: It is best to avoid g_atexit().
16682 // <func>: the function to call on normal program termination.
16683 static void atexit()(VoidFunc func) nothrow {
16684 g_atexit(func);
16688 // VERSION: 2.4
16689 // Atomically adds @val to the value of @atomic.
16691 // Think of this operation as an atomic version of
16692 // <literal>{ tmp = *atomic; *@atomic += @val; return tmp; }</literal>
16694 // This call acts as a full compiler and hardware memory barrier.
16696 // Before version 2.30, this function did not return a value
16697 // (but g_atomic_int_exchange_and_add() did, and had the same meaning).
16698 // RETURNS: the value of @atomic before the add, signed
16699 // <atomic>: a pointer to a #gint or #guint
16700 // <val>: the value to add
16701 static int atomic_int_add()(int* atomic, int val) nothrow {
16702 return g_atomic_int_add(atomic, val);
16706 // VERSION: 2.30
16707 // Performs an atomic bitwise 'and' of the value of @atomic and @val,
16708 // storing the result back in @atomic.
16710 // This call acts as a full compiler and hardware memory barrier.
16712 // Think of this operation as an atomic version of
16713 // <literal>{ tmp = *atomic; *@atomic &= @val; return tmp; }</literal>
16714 // RETURNS: the value of @atomic before the operation, unsigned
16715 // <atomic>: a pointer to a #gint or #guint
16716 // <val>: the value to 'and'
16717 static uint atomic_int_and(AT0)(AT0 /*uint*/ atomic, uint val) nothrow {
16718 return g_atomic_int_and(UpCast!(uint*)(atomic), val);
16722 // VERSION: 2.4
16723 // Compares @atomic to @oldval and, if equal, sets it to @newval.
16724 // If @atomic was not equal to @oldval then no change occurs.
16726 // This compare and exchange is done atomically.
16728 // Think of this operation as an atomic version of
16729 // <literal>{ if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; }</literal>
16731 // This call acts as a full compiler and hardware memory barrier.
16732 // RETURNS: %TRUE if the exchange took place
16733 // <atomic>: a pointer to a #gint or #guint
16734 // <oldval>: the value to compare with
16735 // <newval>: the value to conditionally replace with
16736 static int atomic_int_compare_and_exchange()(int* atomic, int oldval, int newval) nothrow {
16737 return g_atomic_int_compare_and_exchange(atomic, oldval, newval);
16741 // VERSION: 2.4
16742 // Decrements the value of @atomic by 1.
16744 // Think of this operation as an atomic version of
16745 // <literal>{ *@atomic -= 1; return (*@atomic == 0); }</literal>
16747 // This call acts as a full compiler and hardware memory barrier.
16748 // RETURNS: %TRUE if the resultant value is zero
16749 // <atomic>: a pointer to a #gint or #guint
16750 static int atomic_int_dec_and_test()(int* atomic) nothrow {
16751 return g_atomic_int_dec_and_test(atomic);
16755 // VERSION: 2.4
16756 // DEPRECATED (v2.30) function: atomic_int_exchange_and_add - Use g_atomic_int_add() instead.
16757 // This function existed before g_atomic_int_add() returned the prior
16758 // value of the integer (which it now does). It is retained only for
16759 // compatibility reasons. Don't use this function in new code.
16760 // RETURNS: the value of @atomic before the add, signed
16761 // <atomic>: a pointer to a #gint
16762 // <val>: the value to add
16763 static int atomic_int_exchange_and_add()(int* atomic, int val) nothrow {
16764 return g_atomic_int_exchange_and_add(atomic, val);
16768 // VERSION: 2.4
16769 // Gets the current value of @atomic.
16771 // This call acts as a full compiler and hardware
16772 // memory barrier (before the get).
16773 // RETURNS: the value of the integer
16774 // <atomic>: a pointer to a #gint or #guint
16775 static int atomic_int_get()(int* atomic) nothrow {
16776 return g_atomic_int_get(atomic);
16780 // VERSION: 2.4
16781 // Increments the value of @atomic by 1.
16783 // Think of this operation as an atomic version of
16784 // <literal>{ *@atomic += 1; }</literal>
16786 // This call acts as a full compiler and hardware memory barrier.
16787 // <atomic>: a pointer to a #gint or #guint
16788 static void atomic_int_inc()(int* atomic) nothrow {
16789 g_atomic_int_inc(atomic);
16793 // VERSION: 2.30
16794 // Performs an atomic bitwise 'or' of the value of @atomic and @val,
16795 // storing the result back in @atomic.
16797 // Think of this operation as an atomic version of
16798 // <literal>{ tmp = *atomic; *@atomic |= @val; return tmp; }</literal>
16800 // This call acts as a full compiler and hardware memory barrier.
16801 // RETURNS: the value of @atomic before the operation, unsigned
16802 // <atomic>: a pointer to a #gint or #guint
16803 // <val>: the value to 'or'
16804 static uint atomic_int_or(AT0)(AT0 /*uint*/ atomic, uint val) nothrow {
16805 return g_atomic_int_or(UpCast!(uint*)(atomic), val);
16809 // VERSION: 2.4
16810 // Sets the value of @atomic to @newval.
16812 // This call acts as a full compiler and hardware
16813 // memory barrier (after the set).
16814 // <atomic>: a pointer to a #gint or #guint
16815 // <newval>: a new value to store
16816 static void atomic_int_set()(int* atomic, int newval) nothrow {
16817 g_atomic_int_set(atomic, newval);
16821 // VERSION: 2.30
16822 // Performs an atomic bitwise 'xor' of the value of @atomic and @val,
16823 // storing the result back in @atomic.
16825 // Think of this operation as an atomic version of
16826 // <literal>{ tmp = *atomic; *@atomic ^= @val; return tmp; }</literal>
16828 // This call acts as a full compiler and hardware memory barrier.
16829 // RETURNS: the value of @atomic before the operation, unsigned
16830 // <atomic>: a pointer to a #gint or #guint
16831 // <val>: the value to 'xor'
16832 static uint atomic_int_xor(AT0)(AT0 /*uint*/ atomic, uint val) nothrow {
16833 return g_atomic_int_xor(UpCast!(uint*)(atomic), val);
16837 // VERSION: 2.30
16838 // Atomically adds @val to the value of @atomic.
16840 // Think of this operation as an atomic version of
16841 // <literal>{ tmp = *atomic; *@atomic += @val; return tmp; }</literal>
16843 // This call acts as a full compiler and hardware memory barrier.
16844 // RETURNS: the value of @atomic before the add, signed
16845 // <atomic>: a pointer to a #gpointer-sized value
16846 // <val>: the value to add
16847 static ssize_t atomic_pointer_add(AT0)(AT0 /*void*/ atomic, ssize_t val) nothrow {
16848 return g_atomic_pointer_add(UpCast!(void*)(atomic), val);
16852 // VERSION: 2.30
16853 // Performs an atomic bitwise 'and' of the value of @atomic and @val,
16854 // storing the result back in @atomic.
16856 // Think of this operation as an atomic version of
16857 // <literal>{ tmp = *atomic; *@atomic &= @val; return tmp; }</literal>
16859 // This call acts as a full compiler and hardware memory barrier.
16860 // RETURNS: the value of @atomic before the operation, unsigned
16861 // <atomic>: a pointer to a #gpointer-sized value
16862 // <val>: the value to 'and'
16863 static size_t atomic_pointer_and(AT0)(AT0 /*void*/ atomic, size_t val) nothrow {
16864 return g_atomic_pointer_and(UpCast!(void*)(atomic), val);
16868 // VERSION: 2.4
16869 // Compares @atomic to @oldval and, if equal, sets it to @newval.
16870 // If @atomic was not equal to @oldval then no change occurs.
16872 // This compare and exchange is done atomically.
16874 // Think of this operation as an atomic version of
16875 // <literal>{ if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; }</literal>
16877 // This call acts as a full compiler and hardware memory barrier.
16878 // RETURNS: %TRUE if the exchange took place
16879 // <atomic>: a pointer to a #gpointer-sized value
16880 // <oldval>: the value to compare with
16881 // <newval>: the value to conditionally replace with
16882 static int atomic_pointer_compare_and_exchange(AT0, AT1, AT2)(AT0 /*void*/ atomic, AT1 /*void*/ oldval, AT2 /*void*/ newval) nothrow {
16883 return g_atomic_pointer_compare_and_exchange(UpCast!(void*)(atomic), UpCast!(void*)(oldval), UpCast!(void*)(newval));
16887 // Unintrospectable function: atomic_pointer_get() / g_atomic_pointer_get()
16888 // VERSION: 2.4
16889 // Gets the current value of @atomic.
16891 // This call acts as a full compiler and hardware
16892 // memory barrier (before the get).
16893 // RETURNS: the value of the pointer
16894 // <atomic>: a pointer to a #gpointer-sized value
16895 static void* atomic_pointer_get(AT0)(AT0 /*void*/ atomic) nothrow {
16896 return g_atomic_pointer_get(UpCast!(void*)(atomic));
16900 // VERSION: 2.30
16901 // Performs an atomic bitwise 'or' of the value of @atomic and @val,
16902 // storing the result back in @atomic.
16904 // Think of this operation as an atomic version of
16905 // <literal>{ tmp = *atomic; *@atomic |= @val; return tmp; }</literal>
16907 // This call acts as a full compiler and hardware memory barrier.
16908 // RETURNS: the value of @atomic before the operation, unsigned
16909 // <atomic>: a pointer to a #gpointer-sized value
16910 // <val>: the value to 'or'
16911 static size_t atomic_pointer_or(AT0)(AT0 /*void*/ atomic, size_t val) nothrow {
16912 return g_atomic_pointer_or(UpCast!(void*)(atomic), val);
16916 // VERSION: 2.4
16917 // Sets the value of @atomic to @newval.
16919 // This call acts as a full compiler and hardware
16920 // memory barrier (after the set).
16921 // <atomic>: a pointer to a #gpointer-sized value
16922 // <newval>: a new value to store
16923 static void atomic_pointer_set(AT0, AT1)(AT0 /*void*/ atomic, AT1 /*void*/ newval) nothrow {
16924 g_atomic_pointer_set(UpCast!(void*)(atomic), UpCast!(void*)(newval));
16928 // VERSION: 2.30
16929 // Performs an atomic bitwise 'xor' of the value of @atomic and @val,
16930 // storing the result back in @atomic.
16932 // Think of this operation as an atomic version of
16933 // <literal>{ tmp = *atomic; *@atomic ^= @val; return tmp; }</literal>
16935 // This call acts as a full compiler and hardware memory barrier.
16936 // RETURNS: the value of @atomic before the operation, unsigned
16937 // <atomic>: a pointer to a #gpointer-sized value
16938 // <val>: the value to 'xor'
16939 static size_t atomic_pointer_xor(AT0)(AT0 /*void*/ atomic, size_t val) nothrow {
16940 return g_atomic_pointer_xor(UpCast!(void*)(atomic), val);
16944 // VERSION: 2.12
16945 // Decode a sequence of Base-64 encoded text into binary data
16947 // newly allocated buffer containing the binary data
16948 // that @text represents. The returned buffer must
16949 // be freed with g_free().
16950 // <text>: zero-terminated string with base64 text to decode
16951 // <out_len>: The length of the decoded data is written here
16952 static ubyte* /*new*/ base64_decode(AT0, AT1)(AT0 /*char*/ text, /*out*/ AT1 /*size_t*/ out_len) nothrow {
16953 return g_base64_decode(toCString!(char*)(text), UpCast!(size_t*)(out_len));
16957 // VERSION: 2.20
16958 // Decode a sequence of Base-64 encoded text into binary data
16959 // by overwriting the input data.
16961 // is the same as the input @text.
16962 // RETURNS: The binary data that @text responds. This pointer
16963 // <text>: zero-terminated string with base64 text to decode
16964 // <out_len>: The length of the decoded data is written here
16965 static ubyte* base64_decode_inplace(AT0, AT1)(/*inout*/ AT0 /*ubyte*/ text, /*inout*/ AT1 /*size_t*/ out_len) nothrow {
16966 return g_base64_decode_inplace(UpCast!(ubyte*)(text), UpCast!(size_t*)(out_len));
16970 // VERSION: 2.12
16971 // Incrementally decode a sequence of binary data from its Base-64 stringified
16972 // representation. By calling this function multiple times you can convert
16973 // data in chunks to avoid having to have the full encoded data in memory.
16975 // The output buffer must be large enough to fit all the data that will
16976 // be written to it. Since base64 encodes 3 bytes in 4 chars you need
16977 // at least: (@len / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero
16978 // state).
16979 // RETURNS: The number of bytes of output that was written
16980 // <in>: binary input data
16981 // <len>: max length of @in data to decode
16982 // <out>: output buffer
16983 // <state>: Saved state between steps, initialize to 0
16984 // <save>: Saved state between steps, initialize to 0
16985 static size_t base64_decode_step(AT0, AT1, AT2)(AT0 /*ubyte*/ in_, size_t len, /*out*/ AT1 /*ubyte*/ out_, /*inout*/ int* state, /*inout*/ AT2 /*uint*/ save) nothrow {
16986 return g_base64_decode_step(UpCast!(ubyte*)(in_), len, UpCast!(ubyte*)(out_), state, UpCast!(uint*)(save));
16990 // VERSION: 2.12
16991 // Encode a sequence of binary data into its Base-64 stringified
16992 // representation.
16994 // encoded string representing @data. The returned string must
16995 // be freed with g_free().
16996 // RETURNS: a newly allocated, zero-terminated Base-64
16997 // <data>: the binary data to encode
16998 // <len>: the length of @data
16999 static char* /*new*/ base64_encode(AT0)(AT0 /*ubyte*/ data, size_t len) nothrow {
17000 return g_base64_encode(UpCast!(ubyte*)(data), len);
17004 // VERSION: 2.12
17005 // Flush the status from a sequence of calls to g_base64_encode_step().
17007 // The output buffer must be large enough to fit all the data that will
17008 // be written to it. It will need up to 4 bytes, or up to 5 bytes if
17009 // line-breaking is enabled.
17010 // RETURNS: The number of bytes of output that was written
17011 // <break_lines>: whether to break long lines
17012 // <out>: pointer to destination buffer
17013 // <state>: Saved state from g_base64_encode_step()
17014 // <save>: Saved state from g_base64_encode_step()
17015 static size_t base64_encode_close(AT0)(int break_lines, /*out*/ AT0 /*ubyte*/ out_, /*inout*/ int* state, /*inout*/ int* save) nothrow {
17016 return g_base64_encode_close(break_lines, UpCast!(ubyte*)(out_), state, save);
17020 // VERSION: 2.12
17021 // Incrementally encode a sequence of binary data into its Base-64 stringified
17022 // representation. By calling this function multiple times you can convert
17023 // data in chunks to avoid having to have the full encoded data in memory.
17025 // When all of the data has been converted you must call
17026 // g_base64_encode_close() to flush the saved state.
17028 // The output buffer must be large enough to fit all the data that will
17029 // be written to it. Due to the way base64 encodes you will need
17030 // at least: (@len / 3 + 1) * 4 + 4 bytes (+ 4 may be needed in case of
17031 // non-zero state). If you enable line-breaking you will need at least:
17032 // ((@len / 3 + 1) * 4 + 4) / 72 + 1 bytes of extra space.
17034 // @break_lines is typically used when putting base64-encoded data in emails.
17035 // It breaks the lines at 72 columns instead of putting all of the text on
17036 // the same line. This avoids problems with long lines in the email system.
17037 // Note however that it breaks the lines with <literal>LF</literal>
17038 // characters, not <literal>CR LF</literal> sequences, so the result cannot
17039 // be passed directly to SMTP or certain other protocols.
17040 // RETURNS: The number of bytes of output that was written
17041 // <in>: the binary data to encode
17042 // <len>: the length of @in
17043 // <break_lines>: whether to break long lines
17044 // <out>: pointer to destination buffer
17045 // <state>: Saved state between steps, initialize to 0
17046 // <save>: Saved state between steps, initialize to 0
17047 static size_t base64_encode_step(AT0, AT1)(AT0 /*ubyte*/ in_, size_t len, int break_lines, /*out*/ AT1 /*ubyte*/ out_, /*inout*/ int* state, /*inout*/ int* save) nothrow {
17048 return g_base64_encode_step(UpCast!(ubyte*)(in_), len, break_lines, UpCast!(ubyte*)(out_), state, save);
17052 // Gets the name of the file without any leading directory
17053 // components. It returns a pointer into the given file name
17054 // string.
17056 // directory components
17058 // Deprecated:2.2: Use g_path_get_basename() instead, but notice
17059 // that g_path_get_basename() allocates new memory for the
17060 // returned string, unlike this function which returns a pointer
17061 // into the argument.
17062 // RETURNS: the name of the file without any leading
17063 // <file_name>: the name of the file
17064 static char* basename(AT0)(AT0 /*char*/ file_name) nothrow {
17065 return g_basename(toCString!(char*)(file_name));
17069 // VERSION: 2.24
17070 // Sets the indicated @lock_bit in @address. If the bit is already
17071 // set, this call will block until g_bit_unlock() unsets the
17072 // corresponding bit.
17074 // Attempting to lock on two different bits within the same integer is
17075 // not supported and will very probably cause deadlocks.
17077 // The value of the bit that is set is (1u << @bit). If @bit is not
17078 // between 0 and 31 then the result is undefined.
17080 // This function accesses @address atomically. All other accesses to
17081 // @address must be atomic in order for this function to work
17082 // reliably.
17083 // <address>: a pointer to an integer
17084 // <lock_bit>: a bit value between 0 and 31
17085 static void bit_lock()(int* address, int lock_bit) nothrow {
17086 g_bit_lock(address, lock_bit);
17090 // Find the position of the first bit set in @mask, searching
17091 // from (but not including) @nth_bit upwards. Bits are numbered
17092 // from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
17093 // usually). To start searching from the 0th bit, set @nth_bit to -1.
17094 // RETURNS: the index of the first bit set which is higher than @nth_bit
17095 // <mask>: a #gulong containing flags
17096 // <nth_bit>: the index of the bit to start the search from
17097 static int bit_nth_lsf()(c_ulong mask, int nth_bit) nothrow {
17098 return g_bit_nth_lsf(mask, nth_bit);
17102 // Find the position of the first bit set in @mask, searching
17103 // from (but not including) @nth_bit downwards. Bits are numbered
17104 // from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
17105 // usually). To start searching from the last bit, set @nth_bit to
17106 // -1 or GLIB_SIZEOF_LONG * 8.
17107 // RETURNS: the index of the first bit set which is lower than @nth_bit
17108 // <mask>: a #gulong containing flags
17109 // <nth_bit>: the index of the bit to start the search from
17110 static int bit_nth_msf()(c_ulong mask, int nth_bit) nothrow {
17111 return g_bit_nth_msf(mask, nth_bit);
17115 // Gets the number of bits used to hold @number,
17116 // e.g. if @number is 4, 3 bits are needed.
17117 // RETURNS: the number of bits used to hold @number
17118 // <number>: a #guint
17119 static uint bit_storage()(c_ulong number) nothrow {
17120 return g_bit_storage(number);
17124 // VERSION: 2.24
17125 // Sets the indicated @lock_bit in @address, returning %TRUE if
17126 // successful. If the bit is already set, returns %FALSE immediately.
17128 // Attempting to lock on two different bits within the same integer is
17129 // not supported.
17131 // The value of the bit that is set is (1u << @bit). If @bit is not
17132 // between 0 and 31 then the result is undefined.
17134 // This function accesses @address atomically. All other accesses to
17135 // @address must be atomic in order for this function to work
17136 // reliably.
17137 // RETURNS: %TRUE if the lock was acquired
17138 // <address>: a pointer to an integer
17139 // <lock_bit>: a bit value between 0 and 31
17140 static int bit_trylock()(int* address, int lock_bit) nothrow {
17141 return g_bit_trylock(address, lock_bit);
17145 // VERSION: 2.24
17146 // Clears the indicated @lock_bit in @address. If another thread is
17147 // currently blocked in g_bit_lock() on this same bit then it will be
17148 // woken up.
17150 // This function accesses @address atomically. All other accesses to
17151 // @address must be atomic in order for this function to work
17152 // reliably.
17153 // <address>: a pointer to an integer
17154 // <lock_bit>: a bit value between 0 and 31
17155 static void bit_unlock()(int* address, int lock_bit) nothrow {
17156 g_bit_unlock(address, lock_bit);
17159 // MOVED TO: BookmarkFile.error_quark
17160 static Quark bookmark_file_error_quark()() nothrow {
17161 return g_bookmark_file_error_quark();
17165 // Unintrospectable function: build_filename() / g_build_filename()
17166 // Creates a filename from a series of elements using the correct
17167 // separator for filenames.
17169 // On Unix, this function behaves identically to <literal>g_build_path
17170 // (G_DIR_SEPARATOR_S, first_element, ....)</literal>.
17172 // On Windows, it takes into account that either the backslash
17173 // (<literal>\</literal> or slash (<literal>/</literal>) can be used
17174 // as separator in filenames, but otherwise behaves as on Unix. When
17175 // file pathname separators need to be inserted, the one that last
17176 // previously occurred in the parameters (reading from left to right)
17177 // is used.
17179 // No attempt is made to force the resulting filename to be an absolute
17180 // path. If the first element is a relative path, the result will
17181 // be a relative path.
17182 // RETURNS: a newly-allocated string that must be freed with g_free().
17183 // <first_element>: the first element in the path
17184 alias g_build_filename build_filename; // Variadic
17187 // VERSION: 2.8
17188 // Behaves exactly like g_build_filename(), but takes the path elements
17189 // as a string array, instead of varargs. This function is mainly
17190 // meant for language bindings.
17191 // RETURNS: a newly-allocated string that must be freed with g_free().
17192 // <args>: %NULL-terminated array of strings containing the path elements.
17193 static char* /*new*/ build_filenamev(AT0)(AT0 /*char**/ args) nothrow {
17194 return g_build_filenamev(toCString!(char**)(args));
17198 // Unintrospectable function: build_path() / g_build_path()
17199 // Creates a path from a series of elements using @separator as the
17200 // separator between elements. At the boundary between two elements,
17201 // any trailing occurrences of separator in the first element, or
17202 // leading occurrences of separator in the second element are removed
17203 // and exactly one copy of the separator is inserted.
17205 // Empty elements are ignored.
17207 // The number of leading copies of the separator on the result is
17208 // the same as the number of leading copies of the separator on
17209 // the first non-empty element.
17211 // The number of trailing copies of the separator on the result is
17212 // the same as the number of trailing copies of the separator on
17213 // the last non-empty element. (Determination of the number of
17214 // trailing copies is done without stripping leading copies, so
17215 // if the separator is <literal>ABA</literal>, <literal>ABABA</literal>
17216 // has 1 trailing copy.)
17218 // However, if there is only a single non-empty element, and there
17219 // are no characters in that element not part of the leading or
17220 // trailing separators, then the result is exactly the original value
17221 // of that element.
17223 // Other than for determination of the number of leading and trailing
17224 // copies of the separator, elements consisting only of copies
17225 // of the separator are ignored.
17226 // RETURNS: a newly-allocated string that must be freed with g_free().
17227 // <separator>: a string used to separator the elements of the path.
17228 // <first_element>: the first element in the path
17229 alias g_build_path build_path; // Variadic
17232 // VERSION: 2.8
17233 // Behaves exactly like g_build_path(), but takes the path elements
17234 // as a string array, instead of varargs. This function is mainly
17235 // meant for language bindings.
17236 // RETURNS: a newly-allocated string that must be freed with g_free().
17237 // <separator>: a string used to separator the elements of the path.
17238 // <args>: %NULL-terminated array of strings containing the path elements.
17239 static char* /*new*/ build_pathv(AT0, AT1)(AT0 /*char*/ separator, AT1 /*char**/ args) nothrow {
17240 return g_build_pathv(toCString!(char*)(separator), toCString!(char**)(args));
17244 // MOVED TO: ByteArray.free
17245 // Frees the memory allocated by the #GByteArray. If @free_segment is
17246 // %TRUE it frees the actual byte data. If the reference count of
17247 // @array is greater than one, the #GByteArray wrapper is preserved but
17248 // the size of @array will be set to zero.
17249 // <array>: a #GByteArray.
17250 // <free_segment>: if %TRUE the actual byte data is freed as well.
17251 static ubyte* byte_array_free(AT0)(AT0 /*ByteArray*/ array, int free_segment) nothrow {
17252 return g_byte_array_free(UpCast!(ByteArray*)(array), free_segment);
17256 // VERSION: 2.32
17257 // MOVED TO: ByteArray.free_to_bytes
17258 // Transfers the data from the #GByteArray into a new immutable #GBytes.
17260 // The #GByteArray is freed unless the reference count of @array is greater
17261 // than one, the #GByteArray wrapper is preserved but the size of @array
17262 // will be set to zero.
17264 // This is identical to using g_bytes_new_take() and g_byte_array_free()
17265 // together.
17268 // data that was in the array
17269 // RETURNS: a new immutable #GBytes representing same byte
17270 // <array>: a #GByteArray
17271 static Bytes* /*new*/ byte_array_free_to_bytes(AT0)(AT0 /*ByteArray*/ array) nothrow {
17272 return g_byte_array_free_to_bytes(UpCast!(ByteArray*)(array));
17276 // VERSION: 2.32
17277 // MOVED TO: ByteArray.new_take
17278 // Create byte array containing the data. The data will be owned by the array
17279 // and will be freed with g_free(), i.e. it could be allocated using g_strdup().
17280 // RETURNS: a new #GByteArray
17281 // <data>: byte data for the array
17282 // <len>: length of @data
17283 static ByteArray* /*new*/ byte_array_new_take(AT0)(AT0 /*ubyte*/ data, size_t len) nothrow {
17284 return g_byte_array_new_take(UpCast!(ubyte*)(data), len);
17288 // VERSION: 2.22
17289 // MOVED TO: ByteArray.unref
17290 // Atomically decrements the reference count of @array by one. If the
17291 // reference count drops to 0, all memory allocated by the array is
17292 // released. This function is MT-safe and may be called from any
17293 // thread.
17294 // <array>: A #GByteArray.
17295 static void byte_array_unref(AT0)(AT0 /*ByteArray*/ array) nothrow {
17296 g_byte_array_unref(UpCast!(ByteArray*)(array));
17300 // VERSION: 2.8
17301 // A wrapper for the POSIX chdir() function. The function changes the
17302 // current directory of the process to @path.
17304 // See your C library manual for more details about chdir().
17305 // RETURNS: 0 on success, -1 if an error occurred.
17306 // <path>: a pathname in the GLib file name encoding (UTF-8 on Windows)
17307 static int chdir(AT0)(AT0 /*char*/ path) nothrow {
17308 return g_chdir(toCString!(char*)(path));
17312 // VERSION: 2.6
17313 // Checks that the GLib library in use is compatible with the
17314 // given version. Generally you would pass in the constants
17315 // #GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION
17316 // as the three arguments to this function; that produces
17317 // a check that the library in use is compatible with
17318 // the version of GLib the application or module was compiled
17319 // against.
17321 // Compatibility is defined by two things: first the version
17322 // of the running library is newer than the version
17323 // @required_major.required_minor.@required_micro. Second
17324 // the running library must be binary compatible with the
17325 // version @required_major.required_minor.@required_micro
17326 // (same major version.)
17328 // given version, or a string describing the version mismatch.
17329 // The returned string is owned by GLib and must not be modified
17330 // or freed.
17331 // RETURNS: %NULL if the GLib library is compatible with the
17332 // <required_major>: the required major version.
17333 // <required_minor>: the required minor version.
17334 // <required_micro>: the required micro version.
17335 static char* check_version()(uint required_major, uint required_minor, uint required_micro) nothrow {
17336 return glib_check_version(required_major, required_minor, required_micro);
17340 // VERSION: 2.16
17341 // MOVED TO: Checksum.type_get_length
17342 // Gets the length in bytes of digests of type @checksum_type
17344 // not supported.
17345 // RETURNS: the checksum length, or -1 if @checksum_type is
17346 // <checksum_type>: a #GChecksumType
17347 static ssize_t checksum_type_get_length()(ChecksumType checksum_type) nothrow {
17348 return g_checksum_type_get_length(checksum_type);
17352 // Unintrospectable function: child_watch_add() / g_child_watch_add()
17353 // VERSION: 2.4
17354 // Sets a function to be called when the child indicated by @pid
17355 // exits, at a default priority, #G_PRIORITY_DEFAULT.
17357 // If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
17358 // you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
17359 // the spawn function for the child watching to work.
17361 // Note that on platforms where #GPid must be explicitly closed
17362 // (see g_spawn_close_pid()) @pid must not be closed while the
17363 // source is still active. Typically, you will want to call
17364 // g_spawn_close_pid() in the callback function for the source.
17366 // GLib supports only a single callback per process id.
17368 // This internally creates a main loop source using
17369 // g_child_watch_source_new() and attaches it to the main loop context
17370 // using g_source_attach(). You can do these steps manually if you
17371 // need greater control.
17372 // RETURNS: the ID (greater than 0) of the event source.
17373 // <pid>: process id to watch. On POSIX the pid of a child process. On Windows a handle for a process (which doesn't have to be a child).
17374 // <function>: function to call
17375 // <data>: data to pass to @function
17376 static uint child_watch_add(AT0)(Pid pid, ChildWatchFunc function_, AT0 /*void*/ data) nothrow {
17377 return g_child_watch_add(pid, function_, UpCast!(void*)(data));
17381 // VERSION: 2.4
17382 // Sets a function to be called when the child indicated by @pid
17383 // exits, at the priority @priority.
17385 // If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
17386 // you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
17387 // the spawn function for the child watching to work.
17389 // Note that on platforms where #GPid must be explicitly closed
17390 // (see g_spawn_close_pid()) @pid must not be closed while the
17391 // source is still active. Typically, you will want to call
17392 // g_spawn_close_pid() in the callback function for the source.
17394 // GLib supports only a single callback per process id.
17396 // This internally creates a main loop source using
17397 // g_child_watch_source_new() and attaches it to the main loop context
17398 // using g_source_attach(). You can do these steps manually if you
17399 // need greater control.
17400 // RETURNS: the ID (greater than 0) of the event source.
17401 // <priority>: the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
17402 // <pid>: process to watch. On POSIX the pid of a child process. On Windows a handle for a process (which doesn't have to be a child).
17403 // <function>: function to call
17404 // <data>: data to pass to @function
17405 // <notify>: function to call when the idle is removed, or %NULL
17406 static uint child_watch_add_full(AT0)(int priority, Pid pid, ChildWatchFunc function_, AT0 /*void*/ data, DestroyNotify notify) nothrow {
17407 return g_child_watch_add_full(priority, pid, function_, UpCast!(void*)(data), notify);
17411 // VERSION: 2.4
17412 // Creates a new child_watch source.
17414 // The source will not initially be associated with any #GMainContext
17415 // and must be added to one with g_source_attach() before it will be
17416 // executed.
17418 // Note that child watch sources can only be used in conjunction with
17419 // <literal>g_spawn...</literal> when the %G_SPAWN_DO_NOT_REAP_CHILD
17420 // flag is used.
17422 // Note that on platforms where #GPid must be explicitly closed
17423 // (see g_spawn_close_pid()) @pid must not be closed while the
17424 // source is still active. Typically, you will want to call
17425 // g_spawn_close_pid() in the callback function for the source.
17427 // Note further that using g_child_watch_source_new() is not
17428 // compatible with calling <literal>waitpid(-1)</literal> in
17429 // the application. Calling waitpid() for individual pids will
17430 // still work fine.
17431 // RETURNS: the newly-created child watch source
17432 // <pid>: process to watch. On POSIX the pid of a child process. On Windows a handle for a process (which doesn't have to be a child).
17433 static Source* /*new*/ child_watch_source_new()(Pid pid) nothrow {
17434 return g_child_watch_source_new(pid);
17438 // If @err is %NULL, does nothing. If @err is non-%NULL,
17439 // calls g_error_free() on *@err and sets *@err to %NULL.
17440 static void clear_error(AT0)(AT0 /*GLib2.Error**/ error=null) nothrow {
17441 g_clear_error(UpCast!(GLib2.Error**)(error));
17445 // VERSION: 2.16
17446 // Computes the checksum for a binary @data of @length. This is a
17447 // convenience wrapper for g_checksum_new(), g_checksum_get_string()
17448 // and g_checksum_free().
17450 // The hexadecimal string returned will be in lower case.
17452 // The returned string should be freed with g_free() when done using it.
17453 // RETURNS: the digest of the binary data as a string in hexadecimal.
17454 // <checksum_type>: a #GChecksumType
17455 // <data>: binary blob to compute the digest of
17456 // <length>: length of @data
17457 static char* /*new*/ compute_checksum_for_data(AT0)(ChecksumType checksum_type, AT0 /*ubyte*/ data, size_t length) nothrow {
17458 return g_compute_checksum_for_data(checksum_type, UpCast!(ubyte*)(data), length);
17462 // VERSION: 2.16
17463 // Computes the checksum of a string.
17465 // The hexadecimal string returned will be in lower case.
17467 // should be freed with g_free() when done using it.
17468 // RETURNS: the checksum as a hexadecimal string. The returned string
17469 // <checksum_type>: a #GChecksumType
17470 // <str>: the string to compute the checksum of
17471 // <length>: the length of the string, or -1 if the string is null-terminated.
17472 static char* /*new*/ compute_checksum_for_string(AT0)(ChecksumType checksum_type, AT0 /*char*/ str, ssize_t length) nothrow {
17473 return g_compute_checksum_for_string(checksum_type, toCString!(char*)(str), length);
17477 // VERSION: 2.30
17478 // Computes the HMAC for a binary @data of @length. This is a
17479 // convenience wrapper for g_hmac_new(), g_hmac_get_string()
17480 // and g_hmac_unref().
17482 // The hexadecimal string returned will be in lower case.
17484 // The returned string should be freed with g_free() when done using it.
17485 // RETURNS: the HMAC of the binary data as a string in hexadecimal.
17486 // <digest_type>: a #GChecksumType to use for the HMAC
17487 // <key>: the key to use in the HMAC
17488 // <key_len>: the length of the key
17489 // <data>: binary blob to compute the HMAC of
17490 // <length>: length of @data
17491 static char* /*new*/ compute_hmac_for_data(AT0, AT1)(ChecksumType digest_type, AT0 /*ubyte*/ key, size_t key_len, AT1 /*ubyte*/ data, size_t length) nothrow {
17492 return g_compute_hmac_for_data(digest_type, UpCast!(ubyte*)(key), key_len, UpCast!(ubyte*)(data), length);
17496 // VERSION: 2.30
17497 // Computes the HMAC for a string.
17499 // The hexadecimal string returned will be in lower case.
17501 // The returned string should be freed with g_free()
17502 // when done using it.
17503 // RETURNS: the HMAC as a hexadecimal string.
17504 // <digest_type>: a #GChecksumType to use for the HMAC
17505 // <key>: the key to use in the HMAC
17506 // <key_len>: the length of the key
17507 // <str>: the string to compute the HMAC for
17508 // <length>: the length of the string, or -1 if the string is nul-terminated
17509 static char* /*new*/ compute_hmac_for_string(AT0, AT1)(ChecksumType digest_type, AT0 /*ubyte*/ key, size_t key_len, AT1 /*char*/ str, ssize_t length) nothrow {
17510 return g_compute_hmac_for_string(digest_type, UpCast!(ubyte*)(key), key_len, toCString!(char*)(str), length);
17514 // Converts a string from one character set to another.
17516 // Note that you should use g_iconv() for streaming
17517 // conversions<footnoteref linkend="streaming-state"/>.
17519 // nul-terminated string, which must be freed with
17520 // g_free(). Otherwise %NULL and @error will be set.
17521 // RETURNS: If the conversion was successful, a newly allocated
17522 // <str>: the string to convert
17523 // <len>: the length of the string, or -1 if the string is nul-terminated<footnote id="nul-unsafe">
17524 // <to_codeset>: name of character set into which to convert @str
17525 // <from_codeset>: character set of @str.
17526 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
17527 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
17528 static char* /*new*/ convert(AT0, AT1, AT2, AT3, AT4, AT5)(AT0 /*char*/ str, ssize_t len, AT1 /*char*/ to_codeset, AT2 /*char*/ from_codeset, /*out*/ AT3 /*size_t*/ bytes_read, /*out*/ AT4 /*size_t*/ bytes_written, AT5 /*GLib2.Error**/ error=null) nothrow {
17529 return g_convert(toCString!(char*)(str), len, toCString!(char*)(to_codeset), toCString!(char*)(from_codeset), UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
17532 static Quark convert_error_quark()() nothrow {
17533 return g_convert_error_quark();
17537 // Converts a string from one character set to another, possibly
17538 // including fallback sequences for characters not representable
17539 // in the output. Note that it is not guaranteed that the specification
17540 // for the fallback sequences in @fallback will be honored. Some
17541 // systems may do an approximate conversion from @from_codeset
17542 // to @to_codeset in their iconv() functions,
17543 // in which case GLib will simply return that approximate conversion.
17545 // Note that you should use g_iconv() for streaming
17546 // conversions<footnoteref linkend="streaming-state"/>.
17548 // nul-terminated string, which must be freed with
17549 // g_free(). Otherwise %NULL and @error will be set.
17550 // RETURNS: If the conversion was successful, a newly allocated
17551 // <str>: the string to convert
17552 // <len>: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
17553 // <to_codeset>: name of character set into which to convert @str
17554 // <from_codeset>: character set of @str.
17555 // <fallback>: UTF-8 string to use in place of character not present in the target encoding. (The string must be representable in the target encoding).
17556 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input.
17557 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
17558 static char* /*new*/ convert_with_fallback(AT0, AT1, AT2, AT3, AT4, AT5, AT6)(AT0 /*char*/ str, ssize_t len, AT1 /*char*/ to_codeset, AT2 /*char*/ from_codeset, AT3 /*char*/ fallback, AT4 /*size_t*/ bytes_read, AT5 /*size_t*/ bytes_written, AT6 /*GLib2.Error**/ error=null) nothrow {
17559 return g_convert_with_fallback(toCString!(char*)(str), len, toCString!(char*)(to_codeset), toCString!(char*)(from_codeset), toCString!(char*)(fallback), UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
17563 // Converts a string from one character set to another.
17565 // Note that you should use g_iconv() for streaming
17566 // conversions<footnote id="streaming-state">
17567 // <para>
17568 // Despite the fact that @byes_read can return information about partial
17569 // characters, the <literal>g_convert_...</literal> functions
17570 // are not generally suitable for streaming. If the underlying converter
17571 // being used maintains internal state, then this won't be preserved
17572 // across successive calls to g_convert(), g_convert_with_iconv() or
17573 // g_convert_with_fallback(). (An example of this is the GNU C converter
17574 // for CP1255 which does not emit a base character until it knows that
17575 // the next character is not a mark that could combine with the base
17576 // character.)
17577 // </para>
17578 // </footnote>.
17580 // nul-terminated string, which must be freed with
17581 // g_free(). Otherwise %NULL and @error will be set.
17582 // RETURNS: If the conversion was successful, a newly allocated
17583 // <str>: the string to convert
17584 // <len>: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
17585 // <converter>: conversion descriptor from g_iconv_open()
17586 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
17587 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
17588 static char* /*new*/ convert_with_iconv(AT0, AT1, AT2, AT3)(AT0 /*char*/ str, ssize_t len, IConv converter, AT1 /*size_t*/ bytes_read, AT2 /*size_t*/ bytes_written, AT3 /*GLib2.Error**/ error=null) nothrow {
17589 return g_convert_with_iconv(toCString!(char*)(str), len, converter, UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
17593 // Frees all the data elements of the datalist.
17594 // The data elements' destroy functions are called
17595 // if they have been set.
17596 // <datalist>: a datalist.
17597 static void datalist_clear(AT0)(AT0 /*Data**/ datalist) nothrow {
17598 g_datalist_clear(UpCast!(Data**)(datalist));
17602 // Unintrospectable function: datalist_foreach() / g_datalist_foreach()
17603 // Calls the given function for each data element of the datalist. The
17604 // function is called with each data element's #GQuark id and data,
17605 // together with the given @user_data parameter. Note that this
17606 // function is NOT thread-safe. So unless @datalist can be protected
17607 // from any modifications during invocation of this function, it should
17608 // not be called.
17609 // <datalist>: a datalist.
17610 // <func>: the function to call for each data element.
17611 // <user_data>: user data to pass to the function.
17612 static void datalist_foreach(AT0, AT1)(AT0 /*Data**/ datalist, DataForeachFunc func, AT1 /*void*/ user_data) nothrow {
17613 g_datalist_foreach(UpCast!(Data**)(datalist), func, UpCast!(void*)(user_data));
17617 // Unintrospectable function: datalist_get_data() / g_datalist_get_data()
17618 // Gets a data element, using its string identifier. This is slower than
17619 // g_datalist_id_get_data() because it compares strings.
17620 // <datalist>: a datalist.
17621 // <key>: the string identifying a data element.
17622 static void* datalist_get_data(AT0, AT1)(AT0 /*Data**/ datalist, AT1 /*char*/ key) nothrow {
17623 return g_datalist_get_data(UpCast!(Data**)(datalist), toCString!(char*)(key));
17627 // VERSION: 2.8
17628 // Gets flags values packed in together with the datalist.
17629 // See g_datalist_set_flags().
17630 // RETURNS: the flags of the datalist
17631 // <datalist>: pointer to the location that holds a list
17632 static uint datalist_get_flags(AT0)(AT0 /*Data**/ datalist) nothrow {
17633 return g_datalist_get_flags(UpCast!(Data**)(datalist));
17637 // Unintrospectable function: datalist_id_get_data() / g_datalist_id_get_data()
17638 // Retrieves the data element corresponding to @key_id.
17639 // <datalist>: a datalist.
17640 // <key_id>: the #GQuark identifying a data element.
17641 static void* datalist_id_get_data(AT0)(AT0 /*Data**/ datalist, Quark key_id) nothrow {
17642 return g_datalist_id_get_data(UpCast!(Data**)(datalist), key_id);
17646 // Unintrospectable function: datalist_id_remove_no_notify() / g_datalist_id_remove_no_notify()
17647 // Removes an element, without calling its destroy notification
17648 // function.
17649 // <datalist>: a datalist.
17650 // <key_id>: the #GQuark identifying a data element.
17651 static void* datalist_id_remove_no_notify(AT0)(AT0 /*Data**/ datalist, Quark key_id) nothrow {
17652 return g_datalist_id_remove_no_notify(UpCast!(Data**)(datalist), key_id);
17656 // Sets the data corresponding to the given #GQuark id, and the
17657 // function to be called when the element is removed from the datalist.
17658 // Any previous data with the same key is removed, and its destroy
17659 // function is called.
17660 // <datalist>: a datalist.
17661 // <key_id>: the #GQuark to identify the data element.
17662 // <data>: the data element or %NULL to remove any previous element corresponding to @key_id.
17663 // <destroy_func>: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it. If @data is %NULL, then @destroy_func must also be %NULL.
17664 static void datalist_id_set_data_full(AT0, AT1)(AT0 /*Data**/ datalist, Quark key_id, AT1 /*void*/ data, DestroyNotify destroy_func) nothrow {
17665 g_datalist_id_set_data_full(UpCast!(Data**)(datalist), key_id, UpCast!(void*)(data), destroy_func);
17669 // Resets the datalist to %NULL. It does not free any memory or call
17670 // any destroy functions.
17671 // <datalist>: a pointer to a pointer to a datalist.
17672 static void datalist_init(AT0)(AT0 /*Data**/ datalist) nothrow {
17673 g_datalist_init(UpCast!(Data**)(datalist));
17677 // VERSION: 2.8
17678 // Turns on flag values for a data list. This function is used
17679 // to keep a small number of boolean flags in an object with
17680 // a data list without using any additional space. It is
17681 // not generally useful except in circumstances where space
17682 // is very tight. (It is used in the base #GObject type, for
17683 // example.)
17684 // <datalist>: pointer to the location that holds a list
17685 // <flags>: the flags to turn on. The values of the flags are restricted by %G_DATALIST_FLAGS_MASK (currently 3; giving two possible boolean flags). A value for @flags that doesn't fit within the mask is an error.
17686 static void datalist_set_flags(AT0)(AT0 /*Data**/ datalist, uint flags) nothrow {
17687 g_datalist_set_flags(UpCast!(Data**)(datalist), flags);
17691 // VERSION: 2.8
17692 // Turns off flag values for a data list. See g_datalist_unset_flags()
17693 // <datalist>: pointer to the location that holds a list
17694 // <flags>: the flags to turn off. The values of the flags are restricted by %G_DATALIST_FLAGS_MASK (currently 3: giving two possible boolean flags). A value for @flags that doesn't fit within the mask is an error.
17695 static void datalist_unset_flags(AT0)(AT0 /*Data**/ datalist, uint flags) nothrow {
17696 g_datalist_unset_flags(UpCast!(Data**)(datalist), flags);
17700 // Destroys the dataset, freeing all memory allocated, and calling any
17701 // destroy functions set for data elements.
17702 // <dataset_location>: the location identifying the dataset.
17703 static void dataset_destroy(AT0)(AT0 /*const(void)*/ dataset_location) nothrow {
17704 g_dataset_destroy(UpCast!(const(void)*)(dataset_location));
17708 // Unintrospectable function: dataset_foreach() / g_dataset_foreach()
17709 // Calls the given function for each data element which is associated
17710 // with the given location. Note that this function is NOT thread-safe.
17711 // So unless @datalist can be protected from any modifications during
17712 // invocation of this function, it should not be called.
17713 // <dataset_location>: the location identifying the dataset.
17714 // <func>: the function to call for each data element.
17715 // <user_data>: user data to pass to the function.
17716 static void dataset_foreach(AT0, AT1)(AT0 /*const(void)*/ dataset_location, DataForeachFunc func, AT1 /*void*/ user_data) nothrow {
17717 g_dataset_foreach(UpCast!(const(void)*)(dataset_location), func, UpCast!(void*)(user_data));
17721 // Unintrospectable function: dataset_id_get_data() / g_dataset_id_get_data()
17722 // Gets the data element corresponding to a #GQuark.
17723 // <dataset_location>: the location identifying the dataset.
17724 // <key_id>: the #GQuark id to identify the data element.
17725 static void* dataset_id_get_data(AT0)(AT0 /*const(void)*/ dataset_location, Quark key_id) nothrow {
17726 return g_dataset_id_get_data(UpCast!(const(void)*)(dataset_location), key_id);
17730 // Unintrospectable function: dataset_id_remove_no_notify() / g_dataset_id_remove_no_notify()
17731 // Removes an element, without calling its destroy notification
17732 // function.
17733 // <dataset_location>: the location identifying the dataset.
17734 // <key_id>: the #GQuark ID identifying the data element.
17735 static void* dataset_id_remove_no_notify(AT0)(AT0 /*const(void)*/ dataset_location, Quark key_id) nothrow {
17736 return g_dataset_id_remove_no_notify(UpCast!(const(void)*)(dataset_location), key_id);
17740 // Sets the data element associated with the given #GQuark id, and also
17741 // the function to call when the data element is destroyed. Any
17742 // previous data with the same key is removed, and its destroy function
17743 // is called.
17744 // <dataset_location>: the location identifying the dataset.
17745 // <key_id>: the #GQuark id to identify the data element.
17746 // <data>: the data element.
17747 // <destroy_func>: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it.
17748 static void dataset_id_set_data_full(AT0, AT1)(AT0 /*const(void)*/ dataset_location, Quark key_id, AT1 /*void*/ data, DestroyNotify destroy_func) nothrow {
17749 g_dataset_id_set_data_full(UpCast!(const(void)*)(dataset_location), key_id, UpCast!(void*)(data), destroy_func);
17753 // MOVED TO: Date.get_days_in_month
17754 // Returns the number of days in a month, taking leap
17755 // years into account.
17756 // RETURNS: number of days in @month during the @year
17757 // <month>: month
17758 // <year>: year
17759 static ubyte date_get_days_in_month()(DateMonth month, DateYear year) nothrow {
17760 return g_date_get_days_in_month(month, year);
17764 // MOVED TO: Date.get_monday_weeks_in_year
17765 // Returns the number of weeks in the year, where weeks
17766 // are taken to start on Monday. Will be 52 or 53. The
17767 // date must be valid. (Years always have 52 7-day periods,
17768 // plus 1 or 2 extra days depending on whether it's a leap
17769 // year. This function is basically telling you how many
17770 // Mondays are in the year, i.e. there are 53 Mondays if
17771 // one of the extra days happens to be a Monday.)
17772 // RETURNS: number of Mondays in the year
17773 // <year>: a year
17774 static ubyte date_get_monday_weeks_in_year()(DateYear year) nothrow {
17775 return g_date_get_monday_weeks_in_year(year);
17779 // MOVED TO: Date.get_sunday_weeks_in_year
17780 // Returns the number of weeks in the year, where weeks
17781 // are taken to start on Sunday. Will be 52 or 53. The
17782 // date must be valid. (Years always have 52 7-day periods,
17783 // plus 1 or 2 extra days depending on whether it's a leap
17784 // year. This function is basically telling you how many
17785 // Sundays are in the year, i.e. there are 53 Sundays if
17786 // one of the extra days happens to be a Sunday.)
17787 // RETURNS: the number of weeks in @year
17788 // <year>: year to count weeks in
17789 static ubyte date_get_sunday_weeks_in_year()(DateYear year) nothrow {
17790 return g_date_get_sunday_weeks_in_year(year);
17794 // MOVED TO: Date.is_leap_year
17795 // Returns %TRUE if the year is a leap year.
17796 // <footnote><para>For the purposes of this function,
17797 // leap year is every year divisible by 4 unless that year
17798 // is divisible by 100. If it is divisible by 100 it would
17799 // be a leap year only if that year is also divisible
17800 // by 400.</para></footnote>
17801 // RETURNS: %TRUE if the year is a leap year
17802 // <year>: year to check
17803 static int date_is_leap_year()(DateYear year) nothrow {
17804 return g_date_is_leap_year(year);
17808 // MOVED TO: Date.strftime
17809 // Generates a printed representation of the date, in a
17810 // <link linkend="setlocale">locale</link>-specific way.
17811 // Works just like the platform's C library strftime() function,
17812 // but only accepts date-related formats; time-related formats
17813 // give undefined results. Date must be valid. Unlike strftime()
17814 // (which uses the locale encoding), works on a UTF-8 format
17815 // string and stores a UTF-8 result.
17817 // This function does not provide any conversion specifiers in
17818 // addition to those implemented by the platform's C library.
17819 // For example, don't expect that using g_date_strftime() would
17820 // make the \%F provided by the C99 strftime() work on Windows
17821 // where the C library only complies to C89.
17822 // RETURNS: number of characters written to the buffer, or 0 the buffer was too small
17823 // <s>: destination buffer
17824 // <slen>: buffer size
17825 // <format>: format string
17826 // <date>: valid #GDate
17827 static size_t date_strftime(AT0, AT1, AT2)(AT0 /*char*/ s, size_t slen, AT1 /*char*/ format, AT2 /*Date*/ date) nothrow {
17828 return g_date_strftime(toCString!(char*)(s), slen, toCString!(char*)(format), UpCast!(Date*)(date));
17832 // VERSION: 2.26
17833 // MOVED TO: DateTime.compare
17834 // A comparison function for #GDateTimes that is suitable
17835 // as a #GCompareFunc. Both #GDateTimes must be non-%NULL.
17837 // than @dt2.
17838 // RETURNS: -1, 0 or 1 if @dt1 is less than, equal to or greater
17839 // <dt1>: first #GDateTime to compare
17840 // <dt2>: second #GDateTime to compare
17841 static int date_time_compare(AT0, AT1)(AT0 /*const(void)*/ dt1, AT1 /*const(void)*/ dt2) nothrow {
17842 return g_date_time_compare(UpCast!(const(void)*)(dt1), UpCast!(const(void)*)(dt2));
17846 // VERSION: 2.26
17847 // MOVED TO: DateTime.equal
17848 // Checks to see if @dt1 and @dt2 are equal.
17850 // Equal here means that they represent the same moment after converting
17851 // them to the same time zone.
17852 // RETURNS: %TRUE if @dt1 and @dt2 are equal
17853 // <dt1>: a #GDateTime
17854 // <dt2>: a #GDateTime
17855 static int date_time_equal(AT0, AT1)(AT0 /*const(void)*/ dt1, AT1 /*const(void)*/ dt2) nothrow {
17856 return g_date_time_equal(UpCast!(const(void)*)(dt1), UpCast!(const(void)*)(dt2));
17860 // VERSION: 2.26
17861 // MOVED TO: DateTime.hash
17862 // Hashes @datetime into a #guint, suitable for use within #GHashTable.
17863 // RETURNS: a #guint containing the hash
17864 // <datetime>: a #GDateTime
17865 static uint date_time_hash(AT0)(AT0 /*const(void)*/ datetime) nothrow {
17866 return g_date_time_hash(UpCast!(const(void)*)(datetime));
17870 // MOVED TO: Date.valid_day
17871 // Returns %TRUE if the day of the month is valid (a day is valid if it's
17872 // between 1 and 31 inclusive).
17873 // RETURNS: %TRUE if the day is valid
17874 // <day>: day to check
17875 static int date_valid_day()(DateDay day) nothrow {
17876 return g_date_valid_day(day);
17880 // MOVED TO: Date.valid_dmy
17881 // Returns %TRUE if the day-month-year triplet forms a valid, existing day
17882 // in the range of days #GDate understands (Year 1 or later, no more than
17883 // a few thousand years in the future).
17884 // RETURNS: %TRUE if the date is a valid one
17885 // <day>: day
17886 // <month>: month
17887 // <year>: year
17888 static int date_valid_dmy()(DateDay day, DateMonth month, DateYear year) nothrow {
17889 return g_date_valid_dmy(day, month, year);
17893 // MOVED TO: Date.valid_julian
17894 // Returns %TRUE if the Julian day is valid. Anything greater than zero
17895 // is basically a valid Julian, though there is a 32-bit limit.
17896 // RETURNS: %TRUE if the Julian day is valid
17897 // <julian_date>: Julian day to check
17898 static int date_valid_julian()(uint julian_date) nothrow {
17899 return g_date_valid_julian(julian_date);
17903 // MOVED TO: Date.valid_month
17904 // Returns %TRUE if the month value is valid. The 12 #GDateMonth
17905 // enumeration values are the only valid months.
17906 // RETURNS: %TRUE if the month is valid
17907 // <month>: month
17908 static int date_valid_month()(DateMonth month) nothrow {
17909 return g_date_valid_month(month);
17913 // MOVED TO: Date.valid_weekday
17914 // Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
17915 // values are the only valid weekdays.
17916 // RETURNS: %TRUE if the weekday is valid
17917 // <weekday>: weekday
17918 static int date_valid_weekday()(DateWeekday weekday) nothrow {
17919 return g_date_valid_weekday(weekday);
17923 // MOVED TO: Date.valid_year
17924 // Returns %TRUE if the year is valid. Any year greater than 0 is valid,
17925 // though there is a 16-bit limit to what #GDate will understand.
17926 // RETURNS: %TRUE if the year is valid
17927 // <year>: year
17928 static int date_valid_year()(DateYear year) nothrow {
17929 return g_date_valid_year(year);
17933 // VERSION: 2.26
17934 // This is a variant of g_dgettext() that allows specifying a locale
17935 // category instead of always using <envar>LC_MESSAGES</envar>. See g_dgettext() for
17936 // more information about how this functions differs from calling
17937 // dcgettext() directly.
17938 // RETURNS: the translated string for the given locale category
17939 // <domain>: the translation domain to use, or %NULL to use the domain set with textdomain()
17940 // <msgid>: message to translate
17941 // <category>: a locale category
17942 static char* dcgettext(AT0, AT1)(AT0 /*char*/ domain, AT1 /*char*/ msgid, int category) nothrow {
17943 return g_dcgettext(toCString!(char*)(domain), toCString!(char*)(msgid), category);
17947 // VERSION: 2.18
17948 // This function is a wrapper of dgettext() which does not translate
17949 // the message if the default domain as set with textdomain() has no
17950 // translations for the current locale.
17952 // The advantage of using this function over dgettext() proper is that
17953 // libraries using this function (like GTK+) will not use translations
17954 // if the application using the library does not have translations for
17955 // the current locale. This results in a consistent English-only
17956 // interface instead of one having partial translations. For this
17957 // feature to work, the call to textdomain() and setlocale() should
17958 // precede any g_dgettext() invocations. For GTK+, it means calling
17959 // textdomain() before gtk_init or its variants.
17961 // This function disables translations if and only if upon its first
17962 // call all the following conditions hold:
17963 // <itemizedlist>
17964 // <listitem>@domain is not %NULL</listitem>
17965 // <listitem>textdomain() has been called to set a default text domain</listitem>
17966 // <listitem>there is no translations available for the default text domain
17967 // and the current locale</listitem>
17968 // <listitem>current locale is not "C" or any English locales (those
17969 // starting with "en_")</listitem>
17970 // </itemizedlist>
17972 // Note that this behavior may not be desired for example if an application
17973 // has its untranslated messages in a language other than English. In those
17974 // cases the application should call textdomain() after initializing GTK+.
17976 // Applications should normally not use this function directly,
17977 // but use the _() macro for translations.
17978 // RETURNS: The translated string
17979 // <domain>: the translation domain to use, or %NULL to use the domain set with textdomain()
17980 // <msgid>: message to translate
17981 static char* dgettext(AT0, AT1)(AT0 /*char*/ domain, AT1 /*char*/ msgid) nothrow {
17982 return g_dgettext(toCString!(char*)(domain), toCString!(char*)(msgid));
17986 // VERSION: 2.30
17987 // MOVED TO: Dir.make_tmp
17988 // Creates a subdirectory in the preferred directory for temporary
17989 // files (as returned by g_get_tmp_dir()).
17991 // @tmpl should be a string in the GLib file name encoding containing
17992 // a sequence of six 'X' characters, as the parameter to g_mkstemp().
17993 // However, unlike these functions, the template should only be a
17994 // basename, no directory components are allowed. If template is
17995 // %NULL, a default template is used.
17997 // Note that in contrast to g_mkdtemp() (and mkdtemp()) @tmpl is not
17998 // modified, and might thus be a read-only literal string.
18000 // should be freed with g_free() when not needed any longer and is
18001 // is in the GLib file name encoding. In case of errors, %NULL is
18002 // returned and @error will be set.
18003 // RETURNS: The actual name used. This string
18004 // <tmpl>: Template for directory name, as in g_mkdtemp(), basename only, or %NULL for a default template
18005 static char* /*new*/ dir_make_tmp(AT0, AT1)(AT0 /*char*/ tmpl, AT1 /*GLib2.Error**/ error=null) nothrow {
18006 return g_dir_make_tmp(toCString!(char*)(tmpl), UpCast!(GLib2.Error**)(error));
18010 // Compares two #gpointer arguments and returns %TRUE if they are equal.
18011 // It can be passed to g_hash_table_new() as the @key_equal_func
18012 // parameter, when using opaque pointers compared by pointer value as keys
18013 // in a #GHashTable.
18015 // This equality function is also appropriate for keys that are integers stored
18016 // in pointers, such as <literal>GINT_TO_POINTER (n)</literal>.
18017 // RETURNS: %TRUE if the two keys match.
18018 // <v1>: a key
18019 // <v2>: a key to compare with @v1
18020 static int direct_equal(AT0, AT1)(AT0 /*const(void)*/ v1=null, AT1 /*const(void)*/ v2=null) nothrow {
18021 return g_direct_equal(UpCast!(const(void)*)(v1), UpCast!(const(void)*)(v2));
18025 // Converts a gpointer to a hash value.
18026 // It can be passed to g_hash_table_new() as the @hash_func parameter,
18027 // when using opaque pointers compared by pointer value as keys in a
18028 // #GHashTable.
18030 // This hash function is also appropriate for keys that are integers stored
18031 // in pointers, such as <literal>GINT_TO_POINTER (n)</literal>.
18032 // RETURNS: a hash value corresponding to the key.
18033 // <v>: a #gpointer key
18034 static uint direct_hash(AT0)(AT0 /*const(void)*/ v=null) nothrow {
18035 return g_direct_hash(UpCast!(const(void)*)(v));
18039 // VERSION: 2.18
18040 // This function is a wrapper of dngettext() which does not translate
18041 // the message if the default domain as set with textdomain() has no
18042 // translations for the current locale.
18044 // See g_dgettext() for details of how this differs from dngettext()
18045 // proper.
18046 // RETURNS: The translated string
18047 // <domain>: the translation domain to use, or %NULL to use the domain set with textdomain()
18048 // <msgid>: message to translate
18049 // <msgid_plural>: plural form of the message
18050 // <n>: the quantity for which translation is needed
18051 static char* dngettext(AT0, AT1, AT2)(AT0 /*char*/ domain, AT1 /*char*/ msgid, AT2 /*char*/ msgid_plural, c_ulong n) nothrow {
18052 return g_dngettext(toCString!(char*)(domain), toCString!(char*)(msgid), toCString!(char*)(msgid_plural), n);
18056 // VERSION: 2.22
18057 // Compares the two #gdouble values being pointed to and returns
18058 // %TRUE if they are equal.
18059 // It can be passed to g_hash_table_new() as the @key_equal_func
18060 // parameter, when using non-%NULL pointers to doubles as keys in a
18061 // #GHashTable.
18062 // RETURNS: %TRUE if the two keys match.
18063 // <v1>: a pointer to a #gdouble key
18064 // <v2>: a pointer to a #gdouble key to compare with @v1
18065 static int double_equal(AT0, AT1)(AT0 /*const(void)*/ v1, AT1 /*const(void)*/ v2) nothrow {
18066 return g_double_equal(UpCast!(const(void)*)(v1), UpCast!(const(void)*)(v2));
18070 // VERSION: 2.22
18071 // Converts a pointer to a #gdouble to a hash value.
18072 // It can be passed to g_hash_table_new() as the @hash_func parameter,
18073 // It can be passed to g_hash_table_new() as the @hash_func parameter,
18074 // when using non-%NULL pointers to doubles as keys in a #GHashTable.
18075 // RETURNS: a hash value corresponding to the key.
18076 // <v>: a pointer to a #gdouble key
18077 static uint double_hash(AT0)(AT0 /*const(void)*/ v) nothrow {
18078 return g_double_hash(UpCast!(const(void)*)(v));
18082 // VERSION: 2.16
18083 // This function is a variant of g_dgettext() which supports
18084 // a disambiguating message context. GNU gettext uses the
18085 // '\004' character to separate the message context and
18086 // message id in @msgctxtid.
18087 // If 0 is passed as @msgidoffset, this function will fall back to
18088 // trying to use the deprecated convention of using "|" as a separation
18089 // character.
18091 // This uses g_dgettext() internally. See that functions for differences
18092 // with dgettext() proper.
18094 // Applications should normally not use this function directly,
18095 // but use the C_() macro for translations with context.
18096 // RETURNS: The translated string
18097 // <domain>: the translation domain to use, or %NULL to use the domain set with textdomain()
18098 // <msgctxtid>: a combined message context and message id, separated by a \004 character
18099 // <msgidoffset>: the offset of the message id in @msgctxid
18100 static char* dpgettext(AT0, AT1)(AT0 /*char*/ domain, AT1 /*char*/ msgctxtid, size_t msgidoffset) nothrow {
18101 return g_dpgettext(toCString!(char*)(domain), toCString!(char*)(msgctxtid), msgidoffset);
18105 // VERSION: 2.18
18106 // This function is a variant of g_dgettext() which supports
18107 // a disambiguating message context. GNU gettext uses the
18108 // '\004' character to separate the message context and
18109 // message id in @msgctxtid.
18111 // This uses g_dgettext() internally. See that functions for differences
18112 // with dgettext() proper.
18114 // This function differs from C_() in that it is not a macro and
18115 // thus you may use non-string-literals as context and msgid arguments.
18116 // RETURNS: The translated string
18117 // <domain>: the translation domain to use, or %NULL to use the domain set with textdomain()
18118 // <context>: the message context
18119 // <msgid>: the message
18120 static char* dpgettext2(AT0, AT1, AT2)(AT0 /*char*/ domain, AT1 /*char*/ context, AT2 /*char*/ msgid) nothrow {
18121 return g_dpgettext2(toCString!(char*)(domain), toCString!(char*)(context), toCString!(char*)(msgid));
18125 // VERSION: 2.32
18126 // Returns the value of the environment variable @variable in the
18127 // provided list @envp.
18129 // The name and value are in the GLib file name encoding.
18130 // On UNIX, this means the actual bytes which might or might not
18131 // be in some consistent character set and encoding. On Windows,
18132 // it is in UTF-8. On Windows, in case the environment variable's
18133 // value contains references to other environment variables, they
18134 // are expanded.
18136 // the environment variable is not set in @envp. The returned
18137 // string is owned by @envp, and will be freed if @variable is
18138 // set or unset again.
18139 // RETURNS: the value of the environment variable, or %NULL if
18140 // <envp>: an environment list (eg, as returned from g_get_environ())
18141 // <variable>: the environment variable to get, in the GLib file name encoding
18142 static char* environ_getenv(AT0, AT1)(AT0 /*char**/ envp, AT1 /*char*/ variable) nothrow {
18143 return g_environ_getenv(toCString!(char**)(envp), toCString!(char*)(variable));
18147 // VERSION: 2.32
18148 // Sets the environment variable @variable in the provided list
18149 // @envp to @value.
18151 // Both the variable's name and value should be in the GLib
18152 // file name encoding. On UNIX, this means that they can be
18153 // arbitrary byte strings. On Windows, they should be in UTF-8.
18155 // updated environment list. Free it using g_strfreev().
18156 // RETURNS: the
18157 // <envp>: an environment list that can be freed using g_strfreev() (e.g., as returned from g_get_environ())
18158 // <variable>: the environment variable to set, must not contain '='
18159 // <value>: the value for to set the variable to
18160 // <overwrite>: whether to change the variable if it already exists
18161 static char** /*new*/ environ_setenv(AT0, AT1, AT2)(AT0 /*char**/ envp, AT1 /*char*/ variable, AT2 /*char*/ value, int overwrite) nothrow {
18162 return g_environ_setenv(toCString!(char**)(envp), toCString!(char*)(variable), toCString!(char*)(value), overwrite);
18166 // VERSION: 2.32
18167 // Removes the environment variable @variable from the provided
18168 // environment @envp.
18170 // updated environment list. Free it using g_strfreev().
18171 // RETURNS: the
18172 // <envp>: an environment list that can be freed using g_strfreev() (e.g., as returned from g_get_environ())
18173 // <variable>: the environment variable to remove, must not contain '='
18174 static char** /*new*/ environ_unsetenv(AT0, AT1)(AT0 /*char**/ envp, AT1 /*char*/ variable) nothrow {
18175 return g_environ_unsetenv(toCString!(char**)(envp), toCString!(char*)(variable));
18179 // Gets a #GFileError constant based on the passed-in @err_no.
18180 // For example, if you pass in <literal>EEXIST</literal> this function returns
18181 // #G_FILE_ERROR_EXIST. Unlike <literal>errno</literal> values, you can portably
18182 // assume that all #GFileError values will exist.
18184 // Normally a #GFileError value goes into a #GError returned
18185 // from a function that manipulates files. So you would use
18186 // g_file_error_from_errno() when constructing a #GError.
18187 // RETURNS: #GFileError corresponding to the given @errno
18188 // <err_no>: an "errno" value
18189 static FileError file_error_from_errno()(int err_no) nothrow {
18190 return g_file_error_from_errno(err_no);
18193 static Quark file_error_quark()() nothrow {
18194 return g_file_error_quark();
18198 // Reads an entire file into allocated memory, with good error
18199 // checking.
18201 // If the call was successful, it returns %TRUE and sets @contents to the file
18202 // contents and @length to the length of the file contents in bytes. The string
18203 // stored in @contents will be nul-terminated, so for text files you can pass
18204 // %NULL for the @length argument. If the call was not successful, it returns
18205 // %FALSE and sets @error. The error domain is #G_FILE_ERROR. Possible error
18206 // codes are those in the #GFileError enumeration. In the error case,
18207 // @contents is set to %NULL and @length is set to zero.
18208 // RETURNS: %TRUE on success, %FALSE if an error occurred
18209 // <filename>: name of a file to read contents from, in the GLib file name encoding
18210 // <contents>: location to store an allocated string, use g_free() to free the returned string
18211 // <length>: location to store length in bytes of the contents, or %NULL
18212 static int file_get_contents(AT0, AT1, AT2, AT3)(AT0 /*char*/ filename, /*out*/ AT1 /*ubyte**/ contents, /*out*/ AT2 /*size_t*/ length, AT3 /*GLib2.Error**/ error=null) nothrow {
18213 return g_file_get_contents(toCString!(char*)(filename), UpCast!(ubyte**)(contents), UpCast!(size_t*)(length), UpCast!(GLib2.Error**)(error));
18217 // Opens a file for writing in the preferred directory for temporary
18218 // files (as returned by g_get_tmp_dir()).
18220 // @tmpl should be a string in the GLib file name encoding containing
18221 // a sequence of six 'X' characters, as the parameter to g_mkstemp().
18222 // However, unlike these functions, the template should only be a
18223 // basename, no directory components are allowed. If template is
18224 // %NULL, a default template is used.
18226 // Note that in contrast to g_mkstemp() (and mkstemp()) @tmpl is not
18227 // modified, and might thus be a read-only literal string.
18229 // Upon success, and if @name_used is non-%NULL, the actual name used
18230 // is returned in @name_used. This string should be freed with g_free()
18231 // when not needed any longer. The returned name is in the GLib file
18232 // name encoding.
18234 // reading and writing. The file is opened in binary mode on platforms
18235 // where there is a difference. The file handle should be closed with
18236 // close(). In case of errors, -1 is returned and @error will be set.
18237 // RETURNS: A file handle (as from open()) to the file opened for
18238 // <tmpl>: Template for file name, as in g_mkstemp(), basename only, or %NULL for a default template
18239 // <name_used>: location to store actual name used, or %NULL
18240 static int file_open_tmp(AT0, AT1, AT2)(AT0 /*char*/ tmpl, /*out*/ AT1 /*char**/ name_used, AT2 /*GLib2.Error**/ error=null) nothrow {
18241 return g_file_open_tmp(toCString!(char*)(tmpl), toCString!(char**)(name_used), UpCast!(GLib2.Error**)(error));
18245 // VERSION: 2.4
18246 // Reads the contents of the symbolic link @filename like the POSIX
18247 // readlink() function. The returned string is in the encoding used
18248 // for filenames. Use g_filename_to_utf8() to convert it to UTF-8.
18250 // or %NULL if an error occurred.
18251 // RETURNS: A newly-allocated string with the contents of the symbolic link,
18252 // <filename>: the symbolic link
18253 static char* /*new*/ file_read_link(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) nothrow {
18254 return g_file_read_link(toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
18258 // VERSION: 2.8
18259 // Writes all of @contents to a file named @filename, with good error checking.
18260 // If a file called @filename already exists it will be overwritten.
18262 // This write is atomic in the sense that it is first written to a temporary
18263 // file which is then renamed to the final name. Notes:
18264 // <itemizedlist>
18265 // <listitem>
18266 // On Unix, if @filename already exists hard links to @filename will break.
18267 // Also since the file is recreated, existing permissions, access control
18268 // lists, metadata etc. may be lost. If @filename is a symbolic link,
18269 // the link itself will be replaced, not the linked file.
18270 // </listitem>
18271 // <listitem>
18272 // On Windows renaming a file will not remove an existing file with the
18273 // new name, so on Windows there is a race condition between the existing
18274 // file being removed and the temporary file being renamed.
18275 // </listitem>
18276 // <listitem>
18277 // On Windows there is no way to remove a file that is open to some
18278 // process, or mapped into memory. Thus, this function will fail if
18279 // @filename already exists and is open.
18280 // </listitem>
18281 // </itemizedlist>
18283 // If the call was successful, it returns %TRUE. If the call was not successful,
18284 // it returns %FALSE and sets @error. The error domain is #G_FILE_ERROR.
18285 // Possible error codes are those in the #GFileError enumeration.
18287 // Note that the name for the temporary file is constructed by appending up
18288 // to 7 characters to @filename.
18289 // RETURNS: %TRUE on success, %FALSE if an error occurred
18290 // <filename>: name of a file to write @contents to, in the GLib file name encoding
18291 // <contents>: string to write to the file
18292 // <length>: length of @contents, or -1 if @contents is a nul-terminated string
18293 static int file_set_contents(AT0, AT1, AT2)(AT0 /*char*/ filename, AT1 /*ubyte*/ contents, ssize_t length, AT2 /*GLib2.Error**/ error=null) nothrow {
18294 return g_file_set_contents(toCString!(char*)(filename), UpCast!(ubyte*)(contents), length, UpCast!(GLib2.Error**)(error));
18298 // Returns %TRUE if any of the tests in the bitfield @test are
18299 // %TRUE. For example, <literal>(G_FILE_TEST_EXISTS |
18300 // G_FILE_TEST_IS_DIR)</literal> will return %TRUE if the file exists;
18301 // the check whether it's a directory doesn't matter since the existence
18302 // test is %TRUE. With the current set of available tests, there's no point
18303 // passing in more than one test at a time.
18305 // Apart from %G_FILE_TEST_IS_SYMLINK all tests follow symbolic links,
18306 // so for a symbolic link to a regular file g_file_test() will return
18307 // %TRUE for both %G_FILE_TEST_IS_SYMLINK and %G_FILE_TEST_IS_REGULAR.
18309 // Note, that for a dangling symbolic link g_file_test() will return
18310 // %TRUE for %G_FILE_TEST_IS_SYMLINK and %FALSE for all other flags.
18312 // You should never use g_file_test() to test whether it is safe
18313 // to perform an operation, because there is always the possibility
18314 // of the condition changing before you actually perform the operation.
18315 // For example, you might think you could use %G_FILE_TEST_IS_SYMLINK
18316 // to know whether it is safe to write to a file without being
18317 // tricked into writing into a different location. It doesn't work!
18318 // |[
18319 // /&ast; DON'T DO THIS &ast;/
18320 // if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK))
18321 // {
18322 // fd = g_open (filename, O_WRONLY);
18323 // /&ast; write to fd &ast;/
18324 // }
18325 // ]|
18327 // Another thing to note is that %G_FILE_TEST_EXISTS and
18328 // %G_FILE_TEST_IS_EXECUTABLE are implemented using the access()
18329 // system call. This usually doesn't matter, but if your program
18330 // is setuid or setgid it means that these tests will give you
18331 // the answer for the real user ID and group ID, rather than the
18332 // effective user ID and group ID.
18334 // On Windows, there are no symlinks, so testing for
18335 // %G_FILE_TEST_IS_SYMLINK will always return %FALSE. Testing for
18336 // %G_FILE_TEST_IS_EXECUTABLE will just check that the file exists and
18337 // its name indicates that it is executable, checking for well-known
18338 // extensions and those listed in the <envar>PATHEXT</envar> environment variable.
18339 // RETURNS: whether a test was %TRUE
18340 // <filename>: a filename to test in the GLib file name encoding
18341 // <test>: bitfield of #GFileTest flags
18342 static int file_test(AT0)(AT0 /*char*/ filename, FileTest test) nothrow {
18343 return g_file_test(toCString!(char*)(filename), test);
18347 // VERSION: 2.6
18348 // Returns the display basename for the particular filename, guaranteed
18349 // to be valid UTF-8. The display name might not be identical to the filename,
18350 // for instance there might be problems converting it to UTF-8, and some files
18351 // can be translated in the display.
18353 // If GLib cannot make sense of the encoding of @filename, as a last resort it
18354 // replaces unknown characters with U+FFFD, the Unicode replacement character.
18355 // You can search the result for the UTF-8 encoding of this character (which is
18356 // "\357\277\275" in octal notation) to find out if @filename was in an invalid
18357 // encoding.
18359 // You must pass the whole absolute pathname to this functions so that
18360 // translation of well known locations can be done.
18362 // This function is preferred over g_filename_display_name() if you know the
18363 // whole path, as it allows translation.
18365 // a rendition of the basename of the filename in valid UTF-8
18366 // RETURNS: a newly allocated string containing
18367 // <filename>: an absolute pathname in the GLib file name encoding
18368 static char* /*new*/ filename_display_basename(AT0)(AT0 /*char*/ filename) nothrow {
18369 return g_filename_display_basename(toCString!(char*)(filename));
18373 // VERSION: 2.6
18374 // Converts a filename into a valid UTF-8 string. The conversion is
18375 // not necessarily reversible, so you should keep the original around
18376 // and use the return value of this function only for display purposes.
18377 // Unlike g_filename_to_utf8(), the result is guaranteed to be non-%NULL
18378 // even if the filename actually isn't in the GLib file name encoding.
18380 // If GLib cannot make sense of the encoding of @filename, as a last resort it
18381 // replaces unknown characters with U+FFFD, the Unicode replacement character.
18382 // You can search the result for the UTF-8 encoding of this character (which is
18383 // "\357\277\275" in octal notation) to find out if @filename was in an invalid
18384 // encoding.
18386 // If you know the whole pathname of the file you should use
18387 // g_filename_display_basename(), since that allows location-based
18388 // translation of filenames.
18390 // a rendition of the filename in valid UTF-8
18391 // RETURNS: a newly allocated string containing
18392 // <filename>: a pathname hopefully in the GLib file name encoding
18393 static char* /*new*/ filename_display_name(AT0)(AT0 /*char*/ filename) nothrow {
18394 return g_filename_display_name(toCString!(char*)(filename));
18398 // Converts an escaped ASCII-encoded URI to a local filename in the
18399 // encoding used for filenames.
18401 // filename, or %NULL on an error.
18402 // RETURNS: a newly-allocated string holding the resulting
18403 // <uri>: a uri describing a filename (escaped, encoded in ASCII).
18404 // <hostname>: Location to store hostname for the URI, or %NULL. If there is no hostname in the URI, %NULL will be stored in this location.
18405 static char* /*new*/ filename_from_uri(AT0, AT1, AT2)(AT0 /*char*/ uri, AT1 /*char**/ hostname, AT2 /*GLib2.Error**/ error=null) nothrow {
18406 return g_filename_from_uri(toCString!(char*)(uri), toCString!(char**)(hostname), UpCast!(GLib2.Error**)(error));
18410 // Converts a string from UTF-8 to the encoding GLib uses for
18411 // filenames. Note that on Windows GLib uses UTF-8 for filenames;
18412 // on other platforms, this function indirectly depends on the
18413 // <link linkend="setlocale">current locale</link>.
18414 // RETURNS: The converted string, or %NULL on an error.
18415 // <utf8string>: a UTF-8 encoded string.
18416 // <len>: the length of the string, or -1 if the string is nul-terminated.
18417 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
18418 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
18419 static char* /*new*/ filename_from_utf8(AT0, AT1, AT2, AT3)(AT0 /*char*/ utf8string, ssize_t len, AT1 /*size_t*/ bytes_read, AT2 /*size_t*/ bytes_written, AT3 /*GLib2.Error**/ error=null) nothrow {
18420 return g_filename_from_utf8(toCString!(char*)(utf8string), len, UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
18424 // Converts an absolute filename to an escaped ASCII-encoded URI, with the path
18425 // component following Section 3.3. of RFC 2396.
18427 // URI, or %NULL on an error.
18428 // RETURNS: a newly-allocated string holding the resulting
18429 // <filename>: an absolute filename specified in the GLib file name encoding, which is the on-disk file name bytes on Unix, and UTF-8 on Windows
18430 // <hostname>: A UTF-8 encoded hostname, or %NULL for none.
18431 static char* /*new*/ filename_to_uri(AT0, AT1, AT2)(AT0 /*char*/ filename, AT1 /*char*/ hostname, AT2 /*GLib2.Error**/ error=null) nothrow {
18432 return g_filename_to_uri(toCString!(char*)(filename), toCString!(char*)(hostname), UpCast!(GLib2.Error**)(error));
18436 // Converts a string which is in the encoding used by GLib for
18437 // filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8
18438 // for filenames; on other platforms, this function indirectly depends on
18439 // the <link linkend="setlocale">current locale</link>.
18440 // RETURNS: The converted string, or %NULL on an error.
18441 // <opsysstring>: a string in the encoding for filenames
18442 // <len>: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
18443 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
18444 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
18445 static char* /*new*/ filename_to_utf8(AT0, AT1, AT2, AT3)(AT0 /*char*/ opsysstring, ssize_t len, AT1 /*size_t*/ bytes_read, AT2 /*size_t*/ bytes_written, AT3 /*GLib2.Error**/ error=null) nothrow {
18446 return g_filename_to_utf8(toCString!(char*)(opsysstring), len, UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
18450 // Locates the first executable named @program in the user's path, in the
18451 // same way that execvp() would locate it. Returns an allocated string
18452 // with the absolute path name, or %NULL if the program is not found in
18453 // the path. If @program is already an absolute path, returns a copy of
18454 // @program if @program exists and is executable, and %NULL otherwise.
18456 // On Windows, if @program does not have a file type suffix, tries
18457 // with the suffixes .exe, .cmd, .bat and .com, and the suffixes in
18458 // the <envar>PATHEXT</envar> environment variable.
18460 // On Windows, it looks for the file in the same way as CreateProcess()
18461 // would. This means first in the directory where the executing
18462 // program was loaded from, then in the current directory, then in the
18463 // Windows 32-bit system directory, then in the Windows directory, and
18464 // finally in the directories in the <envar>PATH</envar> environment
18465 // variable. If the program is found, the return value contains the
18466 // full name including the type suffix.
18467 // RETURNS: absolute path, or %NULL
18468 // <program>: a program name in the GLib file name encoding
18469 static char* /*new*/ find_program_in_path(AT0)(AT0 /*char*/ program) nothrow {
18470 return g_find_program_in_path(toCString!(char*)(program));
18474 // VERSION: 2.30
18475 // Formats a size (for example the size of a file) into a human readable
18476 // string. Sizes are rounded to the nearest size prefix (kB, MB, GB)
18477 // and are displayed rounded to the nearest tenth. E.g. the file size
18478 // 3292528 bytes will be converted into the string "3.2 MB".
18480 // The prefix units base is 1000 (i.e. 1 kB is 1000 bytes).
18482 // This string should be freed with g_free() when not needed any longer.
18484 // See g_format_size_full() for more options about how the size might be
18485 // formatted.
18487 // file size
18488 // RETURNS: a newly-allocated formatted string containing a human readable
18489 // <size>: a size in bytes
18490 static char* /*new*/ format_size()(ulong size) nothrow {
18491 return g_format_size(size);
18495 // VERSION: 2.16
18496 // Formats a size (for example the size of a file) into a human
18497 // readable string. Sizes are rounded to the nearest size prefix
18498 // (KB, MB, GB) and are displayed rounded to the nearest tenth.
18499 // E.g. the file size 3292528 bytes will be converted into the
18500 // string "3.1 MB".
18502 // The prefix units base is 1024 (i.e. 1 KB is 1024 bytes).
18504 // This string should be freed with g_free() when not needed any longer.
18506 // readable file size
18509 // Deprecated:2.30: This function is broken due to its use of SI
18510 // suffixes to denote IEC units. Use g_format_size() instead.
18511 // RETURNS: a newly-allocated formatted string containing a human
18512 // <size>: a size in bytes
18513 static char* /*new*/ format_size_for_display()(long size) nothrow {
18514 return g_format_size_for_display(size);
18518 // VERSION: 2.30
18519 // Formats a size.
18521 // This function is similar to g_format_size() but allows for flags
18522 // that modify the output. See #GFormatSizeFlags.
18524 // readable file size
18525 // RETURNS: a newly-allocated formatted string containing a human
18526 // <size>: a size in bytes
18527 // <flags>: #GFormatSizeFlags to modify the output
18528 static char* /*new*/ format_size_full()(ulong size, FormatSizeFlags flags) nothrow {
18529 return g_format_size_full(size, flags);
18533 // Unintrospectable function: fprintf() / g_fprintf()
18534 // VERSION: 2.2
18535 // An implementation of the standard fprintf() function which supports
18536 // positional parameters, as specified in the Single Unix Specification.
18537 // RETURNS: the number of bytes printed.
18538 // <file>: the stream to write to.
18539 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
18540 alias g_fprintf fprintf; // Variadic
18543 // Frees the memory pointed to by @mem.
18544 // If @mem is %NULL it simply returns.
18545 // <mem>: the memory to free
18546 static void free(AT0)(AT0 /*void*/ mem) nothrow {
18547 g_free(UpCast!(void*)(mem));
18551 // VERSION: 2.2
18552 // Gets a human-readable name for the application, as set by
18553 // g_set_application_name(). This name should be localized if
18554 // possible, and is intended for display to the user. Contrast with
18555 // g_get_prgname(), which gets a non-localized name. If
18556 // g_set_application_name() has not been called, returns the result of
18557 // g_get_prgname() (which may be %NULL if g_set_prgname() has also not
18558 // been called).
18559 // RETURNS: human-readable application name. may return %NULL
18560 static char* get_application_name()() nothrow {
18561 return g_get_application_name();
18565 // Obtains the character set for the <link linkend="setlocale">current
18566 // locale</link>; you might use this character set as an argument to
18567 // g_convert(), to convert from the current locale's encoding to some
18568 // other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
18569 // are nice shortcuts, though.)
18571 // On Windows the character set returned by this function is the
18572 // so-called system default ANSI code-page. That is the character set
18573 // used by the "narrow" versions of C library and Win32 functions that
18574 // handle file names. It might be different from the character set
18575 // used by the C library's current locale.
18577 // The return value is %TRUE if the locale's encoding is UTF-8, in that
18578 // case you can perhaps avoid calling g_convert().
18580 // The string returned in @charset is not allocated, and should not be
18581 // freed.
18582 // RETURNS: %TRUE if the returned charset is UTF-8
18583 // <charset>: return location for character set name
18584 static int get_charset(AT0)(AT0 /*char**/ charset) nothrow {
18585 return g_get_charset(toCString!(char**)(charset));
18589 // Gets the character set for the current locale.
18591 // of the character set. This string must be freed with g_free().
18592 // RETURNS: a newly allocated string containing the name
18593 static char* /*new*/ get_codeset()() nothrow {
18594 return g_get_codeset();
18598 // Gets the current directory.
18600 // The returned string should be freed when no longer needed.
18601 // The encoding of the returned string is system defined.
18602 // On Windows, it is always UTF-8.
18603 // RETURNS: the current directory
18604 static char* /*new*/ get_current_dir()() nothrow {
18605 return g_get_current_dir();
18609 // Equivalent to the UNIX gettimeofday() function, but portable.
18611 // You may find g_get_real_time() to be more convenient.
18612 // <result>: #GTimeVal structure in which to store current time.
18613 static void get_current_time(AT0)(AT0 /*TimeVal*/ result) nothrow {
18614 g_get_current_time(UpCast!(TimeVal*)(result));
18618 // VERSION: 2.28
18619 // Gets the list of environment variables for the current process.
18621 // The list is %NULL terminated and each item in the list is of the
18622 // form 'NAME=VALUE'.
18624 // This is equivalent to direct access to the 'environ' global variable,
18625 // except portable.
18627 // The return value is freshly allocated and it should be freed with
18628 // g_strfreev() when it is no longer needed.
18630 // environment variables
18631 // RETURNS: the list of
18632 static char** /*new*/ get_environ()() nothrow {
18633 return g_get_environ();
18637 // VERSION: 2.6
18638 // Determines the preferred character sets used for filenames.
18639 // The first character set from the @charsets is the filename encoding, the
18640 // subsequent character sets are used when trying to generate a displayable
18641 // representation of a filename, see g_filename_display_name().
18643 // On Unix, the character sets are determined by consulting the
18644 // environment variables <envar>G_FILENAME_ENCODING</envar> and
18645 // <envar>G_BROKEN_FILENAMES</envar>. On Windows, the character set
18646 // used in the GLib API is always UTF-8 and said environment variables
18647 // have no effect.
18649 // <envar>G_FILENAME_ENCODING</envar> may be set to a comma-separated list
18650 // of character set names. The special token "&commat;locale" is taken to
18651 // mean the character set for the <link linkend="setlocale">current
18652 // locale</link>. If <envar>G_FILENAME_ENCODING</envar> is not set, but
18653 // <envar>G_BROKEN_FILENAMES</envar> is, the character set of the current
18654 // locale is taken as the filename encoding. If neither environment variable
18655 // is set, UTF-8 is taken as the filename encoding, but the character
18656 // set of the current locale is also put in the list of encodings.
18658 // The returned @charsets belong to GLib and must not be freed.
18660 // Note that on Unix, regardless of the locale character set or
18661 // <envar>G_FILENAME_ENCODING</envar> value, the actual file names present
18662 // on a system might be in any random encoding or just gibberish.
18663 // RETURNS: %TRUE if the filename encoding is UTF-8.
18664 // <charsets>: return location for the %NULL-terminated list of encoding names
18665 static int get_filename_charsets(AT0)(AT0 /*char***/ charsets) nothrow {
18666 return g_get_filename_charsets(toCString!(char***)(charsets));
18670 // Gets the current user's home directory as defined in the
18671 // password database.
18673 // Note that in contrast to traditional UNIX tools, this function
18674 // prefers <filename>passwd</filename> entries over the <envar>HOME</envar>
18675 // environment variable.
18677 // One of the reasons for this decision is that applications in many
18678 // cases need special handling to deal with the case where
18679 // <envar>HOME</envar> is
18680 // <simplelist>
18681 // <member>Not owned by the user</member>
18682 // <member>Not writeable</member>
18683 // <member>Not even readable</member>
18684 // </simplelist>
18685 // Since applications are in general <emphasis>not</emphasis> written
18686 // to deal with these situations it was considered better to make
18687 // g_get_home_dir() not pay attention to <envar>HOME</envar> and to
18688 // return the real home directory for the user. If applications
18689 // want to pay attention to <envar>HOME</envar>, they can do:
18690 // |[
18691 // const char *homedir = g_getenv ("HOME");
18692 // if (!homedir)
18693 // homedir = g_get_home_dir (<!-- -->);
18694 // ]|
18695 // RETURNS: the current user's home directory
18696 static char* get_home_dir()() nothrow {
18697 return g_get_home_dir();
18701 // VERSION: 2.8
18702 // Return a name for the machine.
18704 // The returned name is not necessarily a fully-qualified domain name,
18705 // or even present in DNS or some other name service at all. It need
18706 // not even be unique on your local network or site, but usually it
18707 // is. Callers should not rely on the return value having any specific
18708 // properties like uniqueness for security purposes. Even if the name
18709 // of the machine is changed while an application is running, the
18710 // return value from this function does not change. The returned
18711 // string is owned by GLib and should not be modified or freed. If no
18712 // name can be determined, a default fixed string "localhost" is
18713 // returned.
18714 // RETURNS: the host name of the machine.
18715 static char* get_host_name()() nothrow {
18716 return g_get_host_name();
18720 // VERSION: 2.6
18721 // Computes a list of applicable locale names, which can be used to
18722 // e.g. construct locale-dependent filenames or search paths. The returned
18723 // list is sorted from most desirable to least desirable and always contains
18724 // the default locale "C".
18726 // For example, if LANGUAGE=de:en_US, then the returned list is
18727 // "de", "en_US", "en", "C".
18729 // This function consults the environment variables <envar>LANGUAGE</envar>,
18730 // <envar>LC_ALL</envar>, <envar>LC_MESSAGES</envar> and <envar>LANG</envar>
18731 // to find the list of locales specified by the user.
18733 // that must not be modified or freed.
18734 // RETURNS: a %NULL-terminated array of strings owned by GLib
18735 static char** get_language_names()() nothrow {
18736 return g_get_language_names();
18740 // VERSION: 2.28
18741 // Returns a list of derived variants of @locale, which can be used to
18742 // e.g. construct locale-dependent filenames or search paths. The returned
18743 // list is sorted from most desirable to least desirable.
18744 // This function handles territory, charset and extra locale modifiers.
18746 // For example, if @locale is "fr_BE", then the returned list
18747 // is "fr_BE", "fr".
18749 // If you need the list of variants for the <emphasis>current locale</emphasis>,
18750 // use g_get_language_names().
18752 // allocated array of newly allocated strings with the locale variants. Free with
18753 // g_strfreev().
18754 // RETURNS: a newly
18755 // <locale>: a locale identifier
18756 static char** /*new*/ get_locale_variants(AT0)(AT0 /*char*/ locale) nothrow {
18757 return g_get_locale_variants(toCString!(char*)(locale));
18761 // VERSION: 2.28
18762 // Queries the system monotonic time, if available.
18764 // On POSIX systems with clock_gettime() and <literal>CLOCK_MONOTONIC</literal> this call
18765 // is a very shallow wrapper for that. Otherwise, we make a best effort
18766 // that probably involves returning the wall clock time (with at least
18767 // microsecond accuracy, subject to the limitations of the OS kernel).
18769 // It's important to note that POSIX <literal>CLOCK_MONOTONIC</literal> does
18770 // not count time spent while the machine is suspended.
18772 // On Windows, "limitations of the OS kernel" is a rather substantial
18773 // statement. Depending on the configuration of the system, the wall
18774 // clock time is updated as infrequently as 64 times a second (which
18775 // is approximately every 16ms). Also, on XP (but not on Vista or later)
18776 // the monotonic clock is locally monotonic, but may differ in exact
18777 // value between processes due to timer wrap handling.
18778 // RETURNS: the monotonic time, in microseconds
18779 static long get_monotonic_time()() nothrow {
18780 return g_get_monotonic_time();
18784 // Gets the name of the program. This name should <emphasis>not</emphasis>
18785 // be localized, contrast with g_get_application_name().
18786 // (If you are using GDK or GTK+ the program name is set in gdk_init(),
18787 // which is called by gtk_init(). The program name is found by taking
18788 // the last component of <literal>argv[0]</literal>.)
18790 // to GLib and must not be modified or freed.
18791 // RETURNS: the name of the program. The returned string belongs
18792 static char* /*new*/ get_prgname()() nothrow {
18793 return g_get_prgname();
18797 // Gets the real name of the user. This usually comes from the user's entry
18798 // in the <filename>passwd</filename> file. The encoding of the returned
18799 // string is system-defined. (On Windows, it is, however, always UTF-8.)
18800 // If the real user name cannot be determined, the string "Unknown" is
18801 // returned.
18802 // RETURNS: the user's real name.
18803 static char* get_real_name()() nothrow {
18804 return g_get_real_name();
18808 // VERSION: 2.28
18809 // Queries the system wall-clock time.
18811 // This call is functionally equivalent to g_get_current_time() except
18812 // that the return value is often more convenient than dealing with a
18813 // #GTimeVal.
18815 // You should only use this call if you are actually interested in the real
18816 // wall-clock time. g_get_monotonic_time() is probably more useful for
18817 // measuring intervals.
18818 // RETURNS: the number of microseconds since January 1, 1970 UTC.
18819 static long get_real_time()() nothrow {
18820 return g_get_real_time();
18824 // VERSION: 2.6
18825 // Returns an ordered list of base directories in which to access
18826 // system-wide configuration information.
18828 // On UNIX platforms this is determined using the mechanisms described in
18829 // the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
18830 // XDG Base Directory Specification</ulink>.
18831 // In this case the list of directories retrieved will be XDG_CONFIG_DIRS.
18833 // On Windows is the directory that contains application data for all users.
18834 // A typical path is C:\Documents and Settings\All Users\Application Data.
18835 // This folder is used for application data that is not user specific.
18836 // For example, an application can store a spell-check dictionary, a database
18837 // of clip art, or a log file in the CSIDL_COMMON_APPDATA folder.
18838 // This information will not roam and is available to anyone using the computer.
18840 // not be modified or freed.
18841 // RETURNS: a %NULL-terminated array of strings owned by GLib that must
18842 static char** get_system_config_dirs()() nothrow {
18843 return g_get_system_config_dirs();
18847 // VERSION: 2.6
18848 // Returns an ordered list of base directories in which to access
18849 // system-wide application data.
18851 // On UNIX platforms this is determined using the mechanisms described in
18852 // the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
18853 // XDG Base Directory Specification</ulink>
18854 // In this case the list of directories retrieved will be XDG_DATA_DIRS.
18856 // On Windows the first elements in the list are the Application Data
18857 // and Documents folders for All Users. (These can be determined only
18858 // on Windows 2000 or later and are not present in the list on other
18859 // Windows versions.) See documentation for CSIDL_COMMON_APPDATA and
18860 // CSIDL_COMMON_DOCUMENTS.
18862 // Then follows the "share" subfolder in the installation folder for
18863 // the package containing the DLL that calls this function, if it can
18864 // be determined.
18866 // Finally the list contains the "share" subfolder in the installation
18867 // folder for GLib, and in the installation folder for the package the
18868 // application's .exe file belongs to.
18870 // The installation folders above are determined by looking up the
18871 // folder where the module (DLL or EXE) in question is located. If the
18872 // folder's name is "bin", its parent is used, otherwise the folder
18873 // itself.
18875 // Note that on Windows the returned list can vary depending on where
18876 // this function is called.
18878 // not be modified or freed.
18879 // RETURNS: a %NULL-terminated array of strings owned by GLib that must
18880 static char** get_system_data_dirs()() nothrow {
18881 return g_get_system_data_dirs();
18885 // Gets the directory to use for temporary files. This is found from
18886 // inspecting the environment variables <envar>TMPDIR</envar>,
18887 // <envar>TMP</envar>, and <envar>TEMP</envar> in that order. If none
18888 // of those are defined "/tmp" is returned on UNIX and "C:\" on Windows.
18889 // The encoding of the returned string is system-defined. On Windows,
18890 // it is always UTF-8. The return value is never %NULL or the empty string.
18891 // RETURNS: the directory to use for temporary files.
18892 static char* get_tmp_dir()() nothrow {
18893 return g_get_tmp_dir();
18897 // VERSION: 2.6
18898 // Returns a base directory in which to store non-essential, cached
18899 // data specific to particular user.
18901 // On UNIX platforms this is determined using the mechanisms described in
18902 // the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
18903 // XDG Base Directory Specification</ulink>.
18904 // In this case the directory retrieved will be XDG_CACHE_HOME.
18906 // On Windows is the directory that serves as a common repository for
18907 // temporary Internet files. A typical path is
18908 // C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
18909 // See documentation for CSIDL_INTERNET_CACHE.
18911 // or freed.
18912 // RETURNS: a string owned by GLib that must not be modified
18913 static char* get_user_cache_dir()() nothrow {
18914 return g_get_user_cache_dir();
18918 // VERSION: 2.6
18919 // Returns a base directory in which to store user-specific application
18920 // configuration information such as user preferences and settings.
18922 // On UNIX platforms this is determined using the mechanisms described in
18923 // the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
18924 // XDG Base Directory Specification</ulink>.
18925 // In this case the directory retrieved will be XDG_CONFIG_HOME.
18927 // On Windows this is the folder to use for local (as opposed to
18928 // roaming) application data. See documentation for
18929 // CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
18930 // what g_get_user_data_dir() returns.
18932 // or freed.
18933 // RETURNS: a string owned by GLib that must not be modified
18934 static char* get_user_config_dir()() nothrow {
18935 return g_get_user_config_dir();
18939 // VERSION: 2.6
18940 // Returns a base directory in which to access application data such
18941 // as icons that is customized for a particular user.
18943 // On UNIX platforms this is determined using the mechanisms described in
18944 // the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
18945 // XDG Base Directory Specification</ulink>.
18946 // In this case the directory retrieved will be XDG_DATA_HOME.
18948 // On Windows this is the folder to use for local (as opposed to
18949 // roaming) application data. See documentation for
18950 // CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
18951 // what g_get_user_config_dir() returns.
18953 // or freed.
18954 // RETURNS: a string owned by GLib that must not be modified
18955 static char* get_user_data_dir()() nothrow {
18956 return g_get_user_data_dir();
18960 // Gets the user name of the current user. The encoding of the returned
18961 // string is system-defined. On UNIX, it might be the preferred file name
18962 // encoding, or something else, and there is no guarantee that it is even
18963 // consistent on a machine. On Windows, it is always UTF-8.
18964 // RETURNS: the user name of the current user.
18965 static char* get_user_name()() nothrow {
18966 return g_get_user_name();
18970 // VERSION: 2.28
18971 // Returns a directory that is unique to the current user on the local
18972 // system.
18974 // On UNIX platforms this is determined using the mechanisms described in
18975 // the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
18976 // XDG Base Directory Specification</ulink>. This is the directory
18977 // specified in the <envar>XDG_RUNTIME_DIR</envar> environment variable.
18978 // In the case that this variable is not set, GLib will issue a warning
18979 // message to stderr and return the value of g_get_user_cache_dir().
18981 // On Windows this is the folder to use for local (as opposed to
18982 // roaming) application data. See documentation for
18983 // CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
18984 // what g_get_user_config_dir() returns.
18985 // RETURNS: a string owned by GLib that must not be modified or freed.
18986 static char* get_user_runtime_dir()() nothrow {
18987 return g_get_user_runtime_dir();
18991 // VERSION: 2.14
18992 // Returns the full path of a special directory using its logical id.
18994 // On Unix this is done using the XDG special user directories.
18995 // For compatibility with existing practise, %G_USER_DIRECTORY_DESKTOP
18996 // falls back to <filename>$HOME/Desktop</filename> when XDG special
18997 // user directories have not been set up.
18999 // Depending on the platform, the user might be able to change the path
19000 // of the special directory without requiring the session to restart; GLib
19001 // will not reflect any change once the special directories are loaded.
19003 // if the logical id was not found. The returned string is owned by
19004 // GLib and should not be modified or freed.
19005 // RETURNS: the path to the specified special directory, or %NULL
19006 // <directory>: the logical id of special directory
19007 static char* get_user_special_dir()(UserDirectory directory) nothrow {
19008 return g_get_user_special_dir(directory);
19012 // Returns the value of an environment variable.
19014 // The name and value are in the GLib file name encoding. On UNIX,
19015 // this means the actual bytes which might or might not be in some
19016 // consistent character set and encoding. On Windows, it is in UTF-8.
19017 // On Windows, in case the environment variable's value contains
19018 // references to other environment variables, they are expanded.
19020 // the environment variable is not found. The returned string
19021 // may be overwritten by the next call to g_getenv(), g_setenv()
19022 // or g_unsetenv().
19023 // RETURNS: the value of the environment variable, or %NULL if
19024 // <variable>: the environment variable to get, in the GLib file name encoding
19025 static char* getenv(AT0)(AT0 /*char*/ variable) nothrow {
19026 return g_getenv(toCString!(char*)(variable));
19030 // VERSION: 2.32
19031 // MOVED TO: HashTable.add
19032 // This is a convenience function for using a #GHashTable as a set. It
19033 // is equivalent to calling g_hash_table_replace() with @key as both the
19034 // key and the value.
19036 // When a hash table only ever contains keys that have themselves as the
19037 // corresponding value it is able to be stored more efficiently. See
19038 // the discussion in the section description.
19039 // <hash_table>: a #GHashTable
19040 // <key>: a key to insert
19041 static void hash_table_add(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*void*/ key) nothrow {
19042 g_hash_table_add(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(void*)(key));
19046 // VERSION: 2.32
19047 // MOVED TO: HashTable.contains
19048 // Checks if @key is in @hash_table.
19049 // <hash_table>: a #GHashTable
19050 // <key>: a key to check
19051 static int hash_table_contains(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
19052 return g_hash_table_contains(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
19056 // MOVED TO: HashTable.destroy
19057 // Destroys all keys and values in the #GHashTable and decrements its
19058 // reference count by 1. If keys and/or values are dynamically allocated,
19059 // you should either free them first or create the #GHashTable with destroy
19060 // notifiers using g_hash_table_new_full(). In the latter case the destroy
19061 // functions you supplied will be called on all keys and values during the
19062 // destruction phase.
19063 // <hash_table>: a #GHashTable
19064 static void hash_table_destroy(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
19065 g_hash_table_destroy(UpCast!(GLib2.HashTable*)(hash_table));
19069 // MOVED TO: HashTable.insert
19070 // Inserts a new key and value into a #GHashTable.
19072 // If the key already exists in the #GHashTable its current
19073 // value is replaced with the new value. If you supplied a
19074 // @value_destroy_func when creating the #GHashTable, the old
19075 // value is freed using that function. If you supplied a
19076 // @key_destroy_func when creating the #GHashTable, the passed
19077 // key is freed using that function.
19078 // <hash_table>: a #GHashTable
19079 // <key>: a key to insert
19080 // <value>: the value to associate with the key
19081 static void hash_table_insert(AT0, AT1, AT2)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*void*/ key, AT2 /*void*/ value) nothrow {
19082 g_hash_table_insert(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(void*)(key), UpCast!(void*)(value));
19086 // MOVED TO: HashTable.lookup_extended
19087 // Looks up a key in the #GHashTable, returning the original key and the
19088 // associated value and a #gboolean which is %TRUE if the key was found. This
19089 // is useful if you need to free the memory allocated for the original key,
19090 // for example before calling g_hash_table_remove().
19092 // You can actually pass %NULL for @lookup_key to test
19093 // whether the %NULL key exists, provided the hash and equal functions
19094 // of @hash_table are %NULL-safe.
19095 // RETURNS: %TRUE if the key was found in the #GHashTable
19096 // <hash_table>: a #GHashTable
19097 // <lookup_key>: the key to look up
19098 // <orig_key>: return location for the original key, or %NULL
19099 // <value>: return location for the value associated with the key, or %NULL
19100 static int hash_table_lookup_extended(AT0, AT1, AT2, AT3)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ lookup_key, AT2 /*void**/ orig_key=null, AT3 /*void**/ value=null) nothrow {
19101 return g_hash_table_lookup_extended(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(lookup_key), UpCast!(void**)(orig_key), UpCast!(void**)(value));
19105 // MOVED TO: HashTable.remove
19106 // Removes a key and its associated value from a #GHashTable.
19108 // If the #GHashTable was created using g_hash_table_new_full(), the
19109 // key and value are freed using the supplied destroy functions, otherwise
19110 // you have to make sure that any dynamically allocated values are freed
19111 // yourself.
19112 // RETURNS: %TRUE if the key was found and removed from the #GHashTable
19113 // <hash_table>: a #GHashTable
19114 // <key>: the key to remove
19115 static int hash_table_remove(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
19116 return g_hash_table_remove(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
19120 // VERSION: 2.12
19121 // MOVED TO: HashTable.remove_all
19122 // Removes all keys and their associated values from a #GHashTable.
19124 // If the #GHashTable was created using g_hash_table_new_full(),
19125 // the keys and values are freed using the supplied destroy functions,
19126 // otherwise you have to make sure that any dynamically allocated
19127 // values are freed yourself.
19128 // <hash_table>: a #GHashTable
19129 static void hash_table_remove_all(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
19130 g_hash_table_remove_all(UpCast!(GLib2.HashTable*)(hash_table));
19134 // MOVED TO: HashTable.replace
19135 // Inserts a new key and value into a #GHashTable similar to
19136 // g_hash_table_insert(). The difference is that if the key
19137 // already exists in the #GHashTable, it gets replaced by the
19138 // new key. If you supplied a @value_destroy_func when creating
19139 // the #GHashTable, the old value is freed using that function.
19140 // If you supplied a @key_destroy_func when creating the
19141 // #GHashTable, the old key is freed using that function.
19142 // <hash_table>: a #GHashTable
19143 // <key>: a key to insert
19144 // <value>: the value to associate with the key
19145 static void hash_table_replace(AT0, AT1, AT2)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*void*/ key, AT2 /*void*/ value) nothrow {
19146 g_hash_table_replace(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(void*)(key), UpCast!(void*)(value));
19150 // MOVED TO: HashTable.size
19151 // Returns the number of elements contained in the #GHashTable.
19152 // RETURNS: the number of key/value pairs in the #GHashTable.
19153 // <hash_table>: a #GHashTable
19154 static uint hash_table_size(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
19155 return g_hash_table_size(UpCast!(GLib2.HashTable*)(hash_table));
19159 // MOVED TO: HashTable.steal
19160 // Removes a key and its associated value from a #GHashTable without
19161 // calling the key and value destroy functions.
19162 // RETURNS: %TRUE if the key was found and removed from the #GHashTable
19163 // <hash_table>: a #GHashTable
19164 // <key>: the key to remove
19165 static int hash_table_steal(AT0, AT1)(AT0 /*GLib2.HashTable*/ hash_table, AT1 /*const(void)*/ key) nothrow {
19166 return g_hash_table_steal(UpCast!(GLib2.HashTable*)(hash_table), UpCast!(const(void)*)(key));
19170 // VERSION: 2.12
19171 // MOVED TO: HashTable.steal_all
19172 // Removes all keys and their associated values from a #GHashTable
19173 // without calling the key and value destroy functions.
19174 // <hash_table>: a #GHashTable
19175 static void hash_table_steal_all(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
19176 g_hash_table_steal_all(UpCast!(GLib2.HashTable*)(hash_table));
19180 // VERSION: 2.10
19181 // MOVED TO: HashTable.unref
19182 // Atomically decrements the reference count of @hash_table by one.
19183 // If the reference count drops to 0, all keys and values will be
19184 // destroyed, and all memory allocated by the hash table is released.
19185 // This function is MT-safe and may be called from any thread.
19186 // <hash_table>: a valid #GHashTable
19187 static void hash_table_unref(AT0)(AT0 /*GLib2.HashTable*/ hash_table) nothrow {
19188 g_hash_table_unref(UpCast!(GLib2.HashTable*)(hash_table));
19192 // MOVED TO: Hook.destroy
19193 // Destroys a #GHook, given its ID.
19194 // RETURNS: %TRUE if the #GHook was found in the #GHookList and destroyed
19195 // <hook_list>: a #GHookList
19196 // <hook_id>: a hook ID
19197 static int hook_destroy(AT0)(AT0 /*HookList*/ hook_list, c_ulong hook_id) nothrow {
19198 return g_hook_destroy(UpCast!(HookList*)(hook_list), hook_id);
19202 // MOVED TO: Hook.destroy_link
19203 // Removes one #GHook from a #GHookList, marking it
19204 // inactive and calling g_hook_unref() on it.
19205 // <hook_list>: a #GHookList
19206 // <hook>: the #GHook to remove
19207 static void hook_destroy_link(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
19208 g_hook_destroy_link(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
19212 // MOVED TO: Hook.free
19213 // Calls the #GHookList @finalize_hook function if it exists,
19214 // and frees the memory allocated for the #GHook.
19215 // <hook_list>: a #GHookList
19216 // <hook>: the #GHook to free
19217 static void hook_free(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
19218 g_hook_free(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
19222 // MOVED TO: Hook.insert_before
19223 // Inserts a #GHook into a #GHookList, before a given #GHook.
19224 // <hook_list>: a #GHookList
19225 // <sibling>: the #GHook to insert the new #GHook before
19226 // <hook>: the #GHook to insert
19227 static void hook_insert_before(AT0, AT1, AT2)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ sibling, AT2 /*Hook*/ hook) nothrow {
19228 g_hook_insert_before(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(sibling), UpCast!(Hook*)(hook));
19232 // MOVED TO: Hook.prepend
19233 // Prepends a #GHook on the start of a #GHookList.
19234 // <hook_list>: a #GHookList
19235 // <hook>: the #GHook to add to the start of @hook_list
19236 static void hook_prepend(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
19237 g_hook_prepend(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
19241 // MOVED TO: Hook.unref
19242 // Decrements the reference count of a #GHook.
19243 // If the reference count falls to 0, the #GHook is removed
19244 // from the #GHookList and g_hook_free() is called to free it.
19245 // <hook_list>: a #GHookList
19246 // <hook>: the #GHook to unref
19247 static void hook_unref(AT0, AT1)(AT0 /*HookList*/ hook_list, AT1 /*Hook*/ hook) nothrow {
19248 g_hook_unref(UpCast!(HookList*)(hook_list), UpCast!(Hook*)(hook));
19252 // VERSION: 2.22
19253 // Tests if @hostname contains segments with an ASCII-compatible
19254 // encoding of an Internationalized Domain Name. If this returns
19255 // %TRUE, you should decode the hostname with g_hostname_to_unicode()
19256 // before displaying it to the user.
19258 // Note that a hostname might contain a mix of encoded and unencoded
19259 // segments, and so it is possible for g_hostname_is_non_ascii() and
19260 // g_hostname_is_ascii_encoded() to both return %TRUE for a name.
19262 // segments.
19263 // RETURNS: %TRUE if @hostname contains any ASCII-encoded
19264 // <hostname>: a hostname
19265 static int hostname_is_ascii_encoded(AT0)(AT0 /*char*/ hostname) nothrow {
19266 return g_hostname_is_ascii_encoded(toCString!(char*)(hostname));
19270 // VERSION: 2.22
19271 // Tests if @hostname is the string form of an IPv4 or IPv6 address.
19272 // (Eg, "192.168.0.1".)
19273 // RETURNS: %TRUE if @hostname is an IP address
19274 // <hostname>: a hostname (or IP address in string form)
19275 static int hostname_is_ip_address(AT0)(AT0 /*char*/ hostname) nothrow {
19276 return g_hostname_is_ip_address(toCString!(char*)(hostname));
19280 // VERSION: 2.22
19281 // Tests if @hostname contains Unicode characters. If this returns
19282 // %TRUE, you need to encode the hostname with g_hostname_to_ascii()
19283 // before using it in non-IDN-aware contexts.
19285 // Note that a hostname might contain a mix of encoded and unencoded
19286 // segments, and so it is possible for g_hostname_is_non_ascii() and
19287 // g_hostname_is_ascii_encoded() to both return %TRUE for a name.
19288 // RETURNS: %TRUE if @hostname contains any non-ASCII characters
19289 // <hostname>: a hostname
19290 static int hostname_is_non_ascii(AT0)(AT0 /*char*/ hostname) nothrow {
19291 return g_hostname_is_non_ascii(toCString!(char*)(hostname));
19295 // VERSION: 2.22
19296 // Converts @hostname to its canonical ASCII form; an ASCII-only
19297 // string containing no uppercase letters and not ending with a
19298 // trailing dot.
19300 // @hostname is in some way invalid.
19301 // RETURNS: an ASCII hostname, which must be freed, or %NULL if
19302 // <hostname>: a valid UTF-8 or ASCII hostname
19303 static char* /*new*/ hostname_to_ascii(AT0)(AT0 /*char*/ hostname) nothrow {
19304 return g_hostname_to_ascii(toCString!(char*)(hostname));
19308 // VERSION: 2.22
19309 // Converts @hostname to its canonical presentation form; a UTF-8
19310 // string in Unicode normalization form C, containing no uppercase
19311 // letters, no forbidden characters, and no ASCII-encoded segments,
19312 // and not ending with a trailing dot.
19314 // Of course if @hostname is not an internationalized hostname, then
19315 // the canonical presentation form will be entirely ASCII.
19317 // @hostname is in some way invalid.
19318 // RETURNS: a UTF-8 hostname, which must be freed, or %NULL if
19319 // <hostname>: a valid UTF-8 or ASCII hostname
19320 static char* /*new*/ hostname_to_unicode(AT0)(AT0 /*char*/ hostname) nothrow {
19321 return g_hostname_to_unicode(toCString!(char*)(hostname));
19325 // Unintrospectable function: idle_add() / g_idle_add()
19326 // Adds a function to be called whenever there are no higher priority
19327 // events pending to the default main loop. The function is given the
19328 // default idle priority, #G_PRIORITY_DEFAULT_IDLE. If the function
19329 // returns %FALSE it is automatically removed from the list of event
19330 // sources and will not be called again.
19332 // This internally creates a main loop source using g_idle_source_new()
19333 // and attaches it to the main loop context using g_source_attach().
19334 // You can do these steps manually if you need greater control.
19335 // RETURNS: the ID (greater than 0) of the event source.
19336 // <function>: function to call
19337 // <data>: data to pass to @function.
19338 static uint idle_add(AT0)(SourceFunc function_, AT0 /*void*/ data) nothrow {
19339 return g_idle_add(function_, UpCast!(void*)(data));
19343 // Adds a function to be called whenever there are no higher priority
19344 // events pending. If the function returns %FALSE it is automatically
19345 // removed from the list of event sources and will not be called again.
19347 // This internally creates a main loop source using g_idle_source_new()
19348 // and attaches it to the main loop context using g_source_attach().
19349 // You can do these steps manually if you need greater control.
19350 // RETURNS: the ID (greater than 0) of the event source.
19351 // <priority>: the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
19352 // <function>: function to call
19353 // <data>: data to pass to @function
19354 // <notify>: function to call when the idle is removed, or %NULL
19355 static uint idle_add_full(AT0)(int priority, SourceFunc function_, AT0 /*void*/ data, DestroyNotify notify) nothrow {
19356 return g_idle_add_full(priority, function_, UpCast!(void*)(data), notify);
19360 // Removes the idle function with the given data.
19361 // RETURNS: %TRUE if an idle source was found and removed.
19362 // <data>: the data for the idle source's callback.
19363 static int idle_remove_by_data(AT0)(AT0 /*void*/ data) nothrow {
19364 return g_idle_remove_by_data(UpCast!(void*)(data));
19368 // Creates a new idle source.
19370 // The source will not initially be associated with any #GMainContext
19371 // and must be added to one with g_source_attach() before it will be
19372 // executed. Note that the default priority for idle sources is
19373 // %G_PRIORITY_DEFAULT_IDLE, as compared to other sources which
19374 // have a default priority of %G_PRIORITY_DEFAULT.
19375 // RETURNS: the newly-created idle source
19376 static Source* /*new*/ idle_source_new()() nothrow {
19377 return g_idle_source_new();
19381 // VERSION: 2.22
19382 // Compares the two #gint64 values being pointed to and returns
19383 // %TRUE if they are equal.
19384 // It can be passed to g_hash_table_new() as the @key_equal_func
19385 // parameter, when using non-%NULL pointers to 64-bit integers as keys in a
19386 // #GHashTable.
19387 // RETURNS: %TRUE if the two keys match.
19388 // <v1>: a pointer to a #gint64 key
19389 // <v2>: a pointer to a #gint64 key to compare with @v1
19390 static int int64_equal(AT0, AT1)(AT0 /*const(void)*/ v1, AT1 /*const(void)*/ v2) nothrow {
19391 return g_int64_equal(UpCast!(const(void)*)(v1), UpCast!(const(void)*)(v2));
19395 // VERSION: 2.22
19396 // Converts a pointer to a #gint64 to a hash value.
19398 // It can be passed to g_hash_table_new() as the @hash_func parameter,
19399 // when using non-%NULL pointers to 64-bit integer values as keys in a
19400 // #GHashTable.
19401 // RETURNS: a hash value corresponding to the key.
19402 // <v>: a pointer to a #gint64 key
19403 static uint int64_hash(AT0)(AT0 /*const(void)*/ v) nothrow {
19404 return g_int64_hash(UpCast!(const(void)*)(v));
19408 // Compares the two #gint values being pointed to and returns
19409 // %TRUE if they are equal.
19410 // It can be passed to g_hash_table_new() as the @key_equal_func
19411 // parameter, when using non-%NULL pointers to integers as keys in a
19412 // #GHashTable.
19414 // Note that this function acts on pointers to #gint, not on #gint directly:
19415 // if your hash table's keys are of the form
19416 // <literal>GINT_TO_POINTER (n)</literal>, use g_direct_equal() instead.
19417 // RETURNS: %TRUE if the two keys match.
19418 // <v1>: a pointer to a #gint key
19419 // <v2>: a pointer to a #gint key to compare with @v1
19420 static int int_equal(AT0, AT1)(AT0 /*const(void)*/ v1, AT1 /*const(void)*/ v2) nothrow {
19421 return g_int_equal(UpCast!(const(void)*)(v1), UpCast!(const(void)*)(v2));
19425 // Converts a pointer to a #gint to a hash value.
19426 // It can be passed to g_hash_table_new() as the @hash_func parameter,
19427 // when using non-%NULL pointers to integer values as keys in a #GHashTable.
19429 // Note that this function acts on pointers to #gint, not on #gint directly:
19430 // if your hash table's keys are of the form
19431 // <literal>GINT_TO_POINTER (n)</literal>, use g_direct_hash() instead.
19432 // RETURNS: a hash value corresponding to the key.
19433 // <v>: a pointer to a #gint key
19434 static uint int_hash(AT0)(AT0 /*const(void)*/ v) nothrow {
19435 return g_int_hash(UpCast!(const(void)*)(v));
19439 // VERSION: 2.10
19440 // Returns a canonical representation for @string. Interned strings can
19441 // be compared for equality by comparing the pointers, instead of using strcmp().
19442 // g_intern_static_string() does not copy the string, therefore @string must
19443 // not be freed or modified.
19444 // RETURNS: a canonical representation for the string
19445 // <string>: a static string
19446 static char* intern_static_string(AT0)(AT0 /*char*/ string_=null) nothrow {
19447 return g_intern_static_string(toCString!(char*)(string_));
19451 // VERSION: 2.10
19452 // Returns a canonical representation for @string. Interned strings can
19453 // be compared for equality by comparing the pointers, instead of using strcmp().
19454 // RETURNS: a canonical representation for the string
19455 // <string>: a string
19456 static char* intern_string(AT0)(AT0 /*char*/ string_=null) nothrow {
19457 return g_intern_string(toCString!(char*)(string_));
19461 // Unintrospectable function: io_add_watch() / g_io_add_watch()
19462 // Adds the #GIOChannel into the default main loop context
19463 // with the default priority.
19464 // RETURNS: the event source id
19465 // <channel>: a #GIOChannel
19466 // <condition>: the condition to watch for
19467 // <func>: the function to call when the condition is satisfied
19468 // <user_data>: user data to pass to @func
19469 static uint io_add_watch(AT0, AT1)(AT0 /*IOChannel*/ channel, IOCondition condition, IOFunc func, AT1 /*void*/ user_data) nothrow {
19470 return g_io_add_watch(UpCast!(IOChannel*)(channel), condition, func, UpCast!(void*)(user_data));
19474 // Adds the #GIOChannel into the default main loop context
19475 // with the given priority.
19477 // This internally creates a main loop source using g_io_create_watch()
19478 // and attaches it to the main loop context with g_source_attach().
19479 // You can do these steps manually if you need greater control.
19480 // RETURNS: the event source id
19481 // <channel>: a #GIOChannel
19482 // <priority>: the priority of the #GIOChannel source
19483 // <condition>: the condition to watch for
19484 // <func>: the function to call when the condition is satisfied
19485 // <user_data>: user data to pass to @func
19486 // <notify>: the function to call when the source is removed
19487 static uint io_add_watch_full(AT0, AT1)(AT0 /*IOChannel*/ channel, int priority, IOCondition condition, IOFunc func, AT1 /*void*/ user_data, DestroyNotify notify) nothrow {
19488 return g_io_add_watch_full(UpCast!(IOChannel*)(channel), priority, condition, func, UpCast!(void*)(user_data), notify);
19492 // MOVED TO: IOChannel.error_from_errno
19493 // Converts an <literal>errno</literal> error number to a #GIOChannelError.
19495 // %G_IO_CHANNEL_ERROR_INVAL.
19496 // RETURNS: a #GIOChannelError error number, e.g.
19497 // <en>: an <literal>errno</literal> error number, e.g. <literal>EINVAL</literal>
19498 static IOChannelError io_channel_error_from_errno()(int en) nothrow {
19499 return g_io_channel_error_from_errno(en);
19503 // MOVED TO: IOChannel.error_quark
19505 // RETURNS: the quark used as %G_IO_CHANNEL_ERROR
19506 static Quark io_channel_error_quark()() nothrow {
19507 return g_io_channel_error_quark();
19511 // Creates a #GSource that's dispatched when @condition is met for the
19512 // given @channel. For example, if condition is #G_IO_IN, the source will
19513 // be dispatched when there's data available for reading.
19515 // g_io_add_watch() is a simpler interface to this same functionality, for
19516 // the case where you want to add the source to the default main loop context
19517 // at the default priority.
19519 // On Windows, polling a #GSource created to watch a channel for a socket
19520 // puts the socket in non-blocking mode. This is a side-effect of the
19521 // implementation and unavoidable.
19522 // RETURNS: a new #GSource
19523 // <channel>: a #GIOChannel to watch
19524 // <condition>: conditions to watch for
19525 static Source* /*new*/ io_create_watch(AT0)(AT0 /*IOChannel*/ channel, IOCondition condition) nothrow {
19526 return g_io_create_watch(UpCast!(IOChannel*)(channel), condition);
19529 // MOVED TO: KeyFile.error_quark
19530 static Quark key_file_error_quark()() nothrow {
19531 return g_key_file_error_quark();
19535 // VERSION: 2.8
19536 // Gets the names of all variables set in the environment.
19538 // Programs that want to be portable to Windows should typically use
19539 // this function and g_getenv() instead of using the environ array
19540 // from the C library directly. On Windows, the strings in the environ
19541 // array are in system codepage encoding, while in most of the typical
19542 // use cases for environment variables in GLib-using programs you want
19543 // the UTF-8 encoding that this function and g_getenv() provide.
19545 // list of strings which must be freed with g_strfreev().
19546 // RETURNS: a %NULL-terminated
19547 static char** /*new*/ listenv()() nothrow {
19548 return g_listenv();
19552 // Converts a string from UTF-8 to the encoding used for strings by
19553 // the C runtime (usually the same as that used by the operating
19554 // system) in the <link linkend="setlocale">current locale</link>. On
19555 // Windows this means the system codepage.
19556 // RETURNS: The converted string, or %NULL on an error.
19557 // <utf8string>: a UTF-8 encoded string
19558 // <len>: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
19559 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
19560 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
19561 static char* /*new*/ locale_from_utf8(AT0, AT1, AT2, AT3)(AT0 /*char*/ utf8string, ssize_t len, AT1 /*size_t*/ bytes_read, AT2 /*size_t*/ bytes_written, AT3 /*GLib2.Error**/ error=null) nothrow {
19562 return g_locale_from_utf8(toCString!(char*)(utf8string), len, UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
19566 // Converts a string which is in the encoding used for strings by
19567 // the C runtime (usually the same as that used by the operating
19568 // system) in the <link linkend="setlocale">current locale</link> into a
19569 // UTF-8 string.
19570 // RETURNS: The converted string, or %NULL on an error.
19571 // <opsysstring>: a string in the encoding of the current locale. On Windows this means the system codepage.
19572 // <len>: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
19573 // <bytes_read>: location to store the number of bytes in the input string that were successfully converted, or %NULL. Even if the conversion was successful, this may be less than @len if there were partial characters at the end of the input. If the error #G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte offset after the last valid input sequence.
19574 // <bytes_written>: the number of bytes stored in the output buffer (not including the terminating nul).
19575 static char* /*new*/ locale_to_utf8(AT0, AT1, AT2, AT3)(AT0 /*char*/ opsysstring, ssize_t len, AT1 /*size_t*/ bytes_read, AT2 /*size_t*/ bytes_written, AT3 /*GLib2.Error**/ error=null) nothrow {
19576 return g_locale_to_utf8(toCString!(char*)(opsysstring), len, UpCast!(size_t*)(bytes_read), UpCast!(size_t*)(bytes_written), UpCast!(GLib2.Error**)(error));
19580 // Unintrospectable function: log() / g_log()
19581 // Logs an error or debugging message.
19583 // If the log level has been set as fatal, the abort()
19584 // function is called to terminate the program.
19585 // <log_domain>: the log domain, usually #G_LOG_DOMAIN
19586 // <log_level>: the log level, either from #GLogLevelFlags or a user-defined level
19587 // <format>: the message format. See the printf() documentation
19588 alias g_log log; // Variadic
19591 // The default log handler set up by GLib; g_log_set_default_handler()
19592 // allows to install an alternate default log handler.
19593 // This is used if no log handler has been set for the particular log
19594 // domain and log level combination. It outputs the message to stderr
19595 // or stdout and if the log level is fatal it calls abort().
19597 // The behavior of this log handler can be influenced by a number of
19598 // environment variables:
19599 // <variablelist>
19600 // <varlistentry>
19601 // <term><envar>G_MESSAGES_PREFIXED</envar></term>
19602 // <listitem>
19603 // A :-separated list of log levels for which messages should
19604 // be prefixed by the program name and PID of the aplication.
19605 // </listitem>
19606 // </varlistentry>
19607 // <varlistentry>
19608 // <term><envar>G_MESSAGES_DEBUG</envar></term>
19609 // <listitem>
19610 // A space-separated list of log domains for which debug and
19611 // informational messages are printed. By default these
19612 // messages are not printed.
19613 // </listitem>
19614 // </varlistentry>
19615 // </variablelist>
19617 // stderr is used for levels %G_LOG_LEVEL_ERROR, %G_LOG_LEVEL_CRITICAL,
19618 // %G_LOG_LEVEL_WARNING and %G_LOG_LEVEL_MESSAGE. stdout is used for
19619 // the rest.
19620 // <log_domain>: the log domain of the message
19621 // <log_level>: the level of the message
19622 // <message>: the message
19623 // <unused_data>: data passed from g_log() which is unused
19624 static void log_default_handler(AT0, AT1, AT2)(AT0 /*char*/ log_domain, LogLevelFlags log_level, AT1 /*char*/ message, AT2 /*void*/ unused_data) nothrow {
19625 g_log_default_handler(toCString!(char*)(log_domain), log_level, toCString!(char*)(message), UpCast!(void*)(unused_data));
19629 // Removes the log handler.
19630 // <log_domain>: the log domain
19631 // <handler_id>: the id of the handler, which was returned in g_log_set_handler()
19632 static void log_remove_handler(AT0)(AT0 /*char*/ log_domain, uint handler_id) nothrow {
19633 g_log_remove_handler(toCString!(char*)(log_domain), handler_id);
19637 // Sets the message levels which are always fatal, in any log domain.
19638 // When a message with any of these levels is logged the program terminates.
19639 // You can only set the levels defined by GLib to be fatal.
19640 // %G_LOG_LEVEL_ERROR is always fatal.
19642 // You can also make some message levels fatal at runtime by setting
19643 // the <envar>G_DEBUG</envar> environment variable (see
19644 // <ulink url="glib-running.html">Running GLib Applications</ulink>).
19645 // RETURNS: the old fatal mask
19646 // <fatal_mask>: the mask containing bits set for each level of error which is to be fatal
19647 static LogLevelFlags log_set_always_fatal()(LogLevelFlags fatal_mask) nothrow {
19648 return g_log_set_always_fatal(fatal_mask);
19652 // Unintrospectable function: log_set_default_handler() / g_log_set_default_handler()
19653 // VERSION: 2.6
19654 // Installs a default log handler which is used if no
19655 // log handler has been set for the particular log domain
19656 // and log level combination. By default, GLib uses
19657 // g_log_default_handler() as default log handler.
19658 // RETURNS: the previous default log handler
19659 // <log_func>: the log handler function
19660 // <user_data>: data passed to the log handler
19661 static LogFunc log_set_default_handler(AT0)(LogFunc log_func, AT0 /*void*/ user_data) nothrow {
19662 return g_log_set_default_handler(log_func, UpCast!(void*)(user_data));
19666 // Sets the log levels which are fatal in the given domain.
19667 // %G_LOG_LEVEL_ERROR is always fatal.
19668 // RETURNS: the old fatal mask for the log domain
19669 // <log_domain>: the log domain
19670 // <fatal_mask>: the new fatal mask
19671 static LogLevelFlags log_set_fatal_mask(AT0)(AT0 /*char*/ log_domain, LogLevelFlags fatal_mask) nothrow {
19672 return g_log_set_fatal_mask(toCString!(char*)(log_domain), fatal_mask);
19676 // Unintrospectable function: log_set_handler() / g_log_set_handler()
19677 // Sets the log handler for a domain and a set of log levels.
19678 // To handle fatal and recursive messages the @log_levels parameter
19679 // must be combined with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION
19680 // bit flags.
19682 // Note that since the #G_LOG_LEVEL_ERROR log level is always fatal, if
19683 // you want to set a handler for this log level you must combine it with
19684 // #G_LOG_FLAG_FATAL.
19686 // <example>
19687 // <title>Adding a log handler for all warning messages in the default
19688 // (application) domain</title>
19689 // <programlisting>
19690 // g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
19691 // | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
19692 // </programlisting>
19693 // </example>
19695 // <example>
19696 // <title>Adding a log handler for all critical messages from GTK+</title>
19697 // <programlisting>
19698 // g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
19699 // | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
19700 // </programlisting>
19701 // </example>
19703 // <example>
19704 // <title>Adding a log handler for <emphasis>all</emphasis> messages from
19705 // GLib</title>
19706 // <programlisting>
19707 // g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
19708 // | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
19709 // </programlisting>
19710 // </example>
19711 // RETURNS: the id of the new handler
19712 // <log_domain>: the log domain, or %NULL for the default "" application domain
19713 // <log_levels>: the log levels to apply the log handler for. To handle fatal and recursive messages as well, combine the log levels with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION bit flags.
19714 // <log_func>: the log handler function
19715 // <user_data>: data passed to the log handler
19716 static uint log_set_handler(AT0, AT1)(AT0 /*char*/ log_domain, LogLevelFlags log_levels, LogFunc log_func, AT1 /*void*/ user_data) nothrow {
19717 return g_log_set_handler(toCString!(char*)(log_domain), log_levels, log_func, UpCast!(void*)(user_data));
19721 // Unintrospectable function: logv() / g_logv()
19722 // Logs an error or debugging message.
19724 // If the log level has been set as fatal, the abort()
19725 // function is called to terminate the program.
19726 // <log_domain>: the log domain
19727 // <log_level>: the log level
19728 // <format>: the message format. See the printf() documentation
19729 // <args>: the parameters to insert into the format string
19730 static void logv(AT0, AT1)(AT0 /*char*/ log_domain, LogLevelFlags log_level, AT1 /*char*/ format, va_list args) nothrow {
19731 g_logv(toCString!(char*)(log_domain), log_level, toCString!(char*)(format), args);
19735 // MOVED TO: MainContext.default
19736 // Returns the global default main context. This is the main context
19737 // used for main loop functions when a main loop is not explicitly
19738 // specified, and corresponds to the "main" main loop. See also
19739 // g_main_context_get_thread_default().
19740 // RETURNS: the global default main context.
19741 static MainContext* main_context_default()() nothrow {
19742 return g_main_context_default();
19746 // VERSION: 2.22
19747 // MOVED TO: MainContext.get_thread_default
19748 // Gets the thread-default #GMainContext for this thread. Asynchronous
19749 // operations that want to be able to be run in contexts other than
19750 // the default one should call this method or
19751 // g_main_context_ref_thread_default() to get a #GMainContext to add
19752 // their #GSource<!-- -->s to. (Note that even in single-threaded
19753 // programs applications may sometimes want to temporarily push a
19754 // non-default context, so it is not safe to assume that this will
19755 // always return %NULL if you are running in the default thread.)
19757 // If you need to hold a reference on the context, use
19758 // g_main_context_ref_thread_default() instead.
19760 // %NULL if the thread-default context is the global default context.
19761 // RETURNS: the thread-default #GMainContext, or
19762 static MainContext* main_context_get_thread_default()() nothrow {
19763 return g_main_context_get_thread_default();
19767 // VERSION: 2.32
19768 // MOVED TO: MainContext.ref_thread_default
19769 // Gets the thread-default #GMainContext for this thread, as with
19770 // g_main_context_get_thread_default(), but also adds a reference to
19771 // it with g_main_context_ref(). In addition, unlike
19772 // g_main_context_get_thread_default(), if the thread-default context
19773 // is the global default context, this will return that #GMainContext
19774 // (with a ref added to it) rather than returning %NULL.
19776 // with g_main_context_unref() when you are done with it.
19777 // RETURNS: the thread-default #GMainContext. Unref
19778 static MainContext* /*new*/ main_context_ref_thread_default()() nothrow {
19779 return g_main_context_ref_thread_default();
19783 // VERSION: 2.12
19784 // Returns the currently firing source for this thread.
19785 // RETURNS: The currently firing source or %NULL.
19786 static Source* main_current_source()() nothrow {
19787 return g_main_current_source();
19791 // Returns the depth of the stack of calls to
19792 // g_main_context_dispatch() on any #GMainContext in the current thread.
19793 // That is, when called from the toplevel, it gives 0. When
19794 // called from within a callback from g_main_context_iteration()
19795 // (or g_main_loop_run(), etc.) it returns 1. When called from within
19796 // a callback to a recursive call to g_main_context_iteration(),
19797 // it returns 2. And so forth.
19799 // This function is useful in a situation like the following:
19800 // Imagine an extremely simple "garbage collected" system.
19802 // |[
19803 // static GList *free_list;
19805 // gpointer
19806 // allocate_memory (gsize size)
19807 // {
19808 // gpointer result = g_malloc (size);
19809 // free_list = g_list_prepend (free_list, result);
19810 // return result;
19811 // }
19813 // void
19814 // free_allocated_memory (void)
19815 // {
19816 // GList *l;
19817 // for (l = free_list; l; l = l->next);
19818 // g_free (l->data);
19819 // g_list_free (free_list);
19820 // free_list = NULL;
19821 // }
19823 // [...]
19825 // while (TRUE);
19826 // {
19827 // g_main_context_iteration (NULL, TRUE);
19828 // free_allocated_memory();
19829 // }
19830 // ]|
19832 // This works from an application, however, if you want to do the same
19833 // thing from a library, it gets more difficult, since you no longer
19834 // control the main loop. You might think you can simply use an idle
19835 // function to make the call to free_allocated_memory(), but that
19836 // doesn't work, since the idle function could be called from a
19837 // recursive callback. This can be fixed by using g_main_depth()
19839 // |[
19840 // gpointer
19841 // allocate_memory (gsize size)
19842 // {
19843 // FreeListBlock *block = g_new (FreeListBlock, 1);
19844 // block->mem = g_malloc (size);
19845 // block->depth = g_main_depth ();
19846 // free_list = g_list_prepend (free_list, block);
19847 // return block->mem;
19848 // }
19850 // void
19851 // free_allocated_memory (void)
19852 // {
19853 // GList *l;
19855 // int depth = g_main_depth ();
19856 // for (l = free_list; l; );
19857 // {
19858 // GList *next = l->next;
19859 // FreeListBlock *block = l->data;
19860 // if (block->depth > depth)
19861 // {
19862 // g_free (block->mem);
19863 // g_free (block);
19864 // free_list = g_list_delete_link (free_list, l);
19865 // }
19867 // l = next;
19868 // }
19869 // }
19870 // ]|
19872 // There is a temptation to use g_main_depth() to solve
19873 // problems with reentrancy. For instance, while waiting for data
19874 // to be received from the network in response to a menu item,
19875 // the menu item might be selected again. It might seem that
19876 // one could make the menu item's callback return immediately
19877 // and do nothing if g_main_depth() returns a value greater than 1.
19878 // However, this should be avoided since the user then sees selecting
19879 // the menu item do nothing. Furthermore, you'll find yourself adding
19880 // these checks all over your code, since there are doubtless many,
19881 // many things that the user could do. Instead, you can use the
19882 // following techniques:
19884 // <orderedlist>
19885 // <listitem>
19886 // <para>
19887 // Use gtk_widget_set_sensitive() or modal dialogs to prevent
19888 // the user from interacting with elements while the main
19889 // loop is recursing.
19890 // </para>
19891 // </listitem>
19892 // <listitem>
19893 // <para>
19894 // Avoid main loop recursion in situations where you can't handle
19895 // arbitrary callbacks. Instead, structure your code so that you
19896 // simply return to the main loop and then get called again when
19897 // there is more work to do.
19898 // </para>
19899 // </listitem>
19900 // </orderedlist>
19901 // RETURNS: The main loop recursion level in the current thread
19902 static int main_depth()() nothrow {
19903 return g_main_depth();
19907 // Unintrospectable function: malloc() / g_malloc()
19908 // Allocates @n_bytes bytes of memory.
19909 // If @n_bytes is 0 it returns %NULL.
19910 // RETURNS: a pointer to the allocated memory
19911 // <n_bytes>: the number of bytes to allocate
19912 static void* malloc()(size_t n_bytes) nothrow {
19913 return g_malloc(n_bytes);
19917 // Unintrospectable function: malloc0() / g_malloc0()
19918 // Allocates @n_bytes bytes of memory, initialized to 0's.
19919 // If @n_bytes is 0 it returns %NULL.
19920 // RETURNS: a pointer to the allocated memory
19921 // <n_bytes>: the number of bytes to allocate
19922 static void* malloc0()(size_t n_bytes) nothrow {
19923 return g_malloc0(n_bytes);
19927 // Unintrospectable function: malloc0_n() / g_malloc0_n()
19928 // VERSION: 2.24
19929 // This function is similar to g_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes,
19930 // but care is taken to detect possible overflow during multiplication.
19931 // RETURNS: a pointer to the allocated memory
19932 // <n_blocks>: the number of blocks to allocate
19933 // <n_block_bytes>: the size of each block in bytes
19934 static void* malloc0_n()(size_t n_blocks, size_t n_block_bytes) nothrow {
19935 return g_malloc0_n(n_blocks, n_block_bytes);
19939 // Unintrospectable function: malloc_n() / g_malloc_n()
19940 // VERSION: 2.24
19941 // This function is similar to g_malloc(), allocating (@n_blocks * @n_block_bytes) bytes,
19942 // but care is taken to detect possible overflow during multiplication.
19943 // RETURNS: a pointer to the allocated memory
19944 // <n_blocks>: the number of blocks to allocate
19945 // <n_block_bytes>: the size of each block in bytes
19946 static void* malloc_n()(size_t n_blocks, size_t n_block_bytes) nothrow {
19947 return g_malloc_n(n_blocks, n_block_bytes);
19951 // Unintrospectable function: markup_collect_attributes() / g_markup_collect_attributes()
19952 // VERSION: 2.16
19953 // Collects the attributes of the element from the data passed to the
19954 // #GMarkupParser start_element function, dealing with common error
19955 // conditions and supporting boolean values.
19957 // This utility function is not required to write a parser but can save
19958 // a lot of typing.
19960 // The @element_name, @attribute_names, @attribute_values and @error
19961 // parameters passed to the start_element callback should be passed
19962 // unmodified to this function.
19964 // Following these arguments is a list of "supported" attributes to collect.
19965 // It is an error to specify multiple attributes with the same name. If any
19966 // attribute not in the list appears in the @attribute_names array then an
19967 // unknown attribute error will result.
19969 // The #GMarkupCollectType field allows specifying the type of collection
19970 // to perform and if a given attribute must appear or is optional.
19972 // The attribute name is simply the name of the attribute to collect.
19974 // The pointer should be of the appropriate type (see the descriptions
19975 // under #GMarkupCollectType) and may be %NULL in case a particular
19976 // attribute is to be allowed but ignored.
19978 // This function deals with issuing errors for missing attributes
19979 // (of type %G_MARKUP_ERROR_MISSING_ATTRIBUTE), unknown attributes
19980 // (of type %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE) and duplicate
19981 // attributes (of type %G_MARKUP_ERROR_INVALID_CONTENT) as well
19982 // as parse errors for boolean-valued attributes (again of type
19983 // %G_MARKUP_ERROR_INVALID_CONTENT). In all of these cases %FALSE
19984 // will be returned and @error will be set as appropriate.
19985 // RETURNS: %TRUE if successful
19986 // <element_name>: the current tag name
19987 // <attribute_names>: the attribute names
19988 // <attribute_values>: the attribute values
19989 // <error>: a pointer to a #GError or %NULL
19990 // <first_type>: the #GMarkupCollectType of the first attribute
19991 // <first_attr>: the name of the first attribute
19992 alias g_markup_collect_attributes markup_collect_attributes; // Variadic
19994 static Quark markup_error_quark()() nothrow {
19995 return g_markup_error_quark();
19999 // Escapes text so that the markup parser will parse it verbatim.
20000 // Less than, greater than, ampersand, etc. are replaced with the
20001 // corresponding entities. This function would typically be used
20002 // when writing out a file to be parsed with the markup parser.
20004 // Note that this function doesn't protect whitespace and line endings
20005 // from being processed according to the XML rules for normalization
20006 // of line endings and attribute values.
20008 // Note also that this function will produce character references in
20009 // the range of &amp;#x1; ... &amp;#x1f; for all control sequences
20010 // except for tabstop, newline and carriage return. The character
20011 // references in this range are not valid XML 1.0, but they are
20012 // valid XML 1.1 and will be accepted by the GMarkup parser.
20013 // RETURNS: a newly allocated string with the escaped text
20014 // <text>: some valid UTF-8 text
20015 // <length>: length of @text in bytes, or -1 if the text is nul-terminated
20016 static char* /*new*/ markup_escape_text(AT0)(AT0 /*char*/ text, ssize_t length) nothrow {
20017 return g_markup_escape_text(toCString!(char*)(text), length);
20021 // Unintrospectable function: markup_printf_escaped() / g_markup_printf_escaped()
20022 // VERSION: 2.4
20023 // Formats arguments according to @format, escaping
20024 // all string and character arguments in the fashion
20025 // of g_markup_escape_text(). This is useful when you
20026 // want to insert literal strings into XML-style markup
20027 // output, without having to worry that the strings
20028 // might themselves contain markup.
20030 // |[
20031 // const char *store = "Fortnum &amp; Mason";
20032 // const char *item = "Tea";
20033 // char *output;
20034 // &nbsp;
20035 // output = g_markup_printf_escaped ("&lt;purchase&gt;"
20036 // "&lt;store&gt;&percnt;s&lt;/store&gt;"
20037 // "&lt;item&gt;&percnt;s&lt;/item&gt;"
20038 // "&lt;/purchase&gt;",
20039 // store, item);
20040 // ]|
20042 // operation. Free with g_free().
20043 // RETURNS: newly allocated result from formatting
20044 // <format>: printf() style format string
20045 alias g_markup_printf_escaped markup_printf_escaped; // Variadic
20048 // Unintrospectable function: markup_vprintf_escaped() / g_markup_vprintf_escaped()
20049 // VERSION: 2.4
20050 // Formats the data in @args according to @format, escaping
20051 // all string and character arguments in the fashion
20052 // of g_markup_escape_text(). See g_markup_printf_escaped().
20054 // operation. Free with g_free().
20055 // RETURNS: newly allocated result from formatting
20056 // <format>: printf() style format string
20057 // <args>: variable argument list, similar to vprintf()
20058 static char* /*new*/ markup_vprintf_escaped(AT0)(AT0 /*char*/ format, va_list args) nothrow {
20059 return g_markup_vprintf_escaped(toCString!(char*)(format), args);
20063 // Checks whether the allocator used by g_malloc() is the system's
20064 // malloc implementation. If it returns %TRUE memory allocated with
20065 // malloc() can be used interchangeable with memory allocated using g_malloc().
20066 // This function is useful for avoiding an extra copy of allocated memory returned
20067 // by a non-GLib-based API.
20069 // A different allocator can be set using g_mem_set_vtable().
20070 // RETURNS: if %TRUE, malloc() and g_malloc() can be mixed.
20071 static int mem_is_system_malloc()() nothrow {
20072 return g_mem_is_system_malloc();
20076 // Outputs a summary of memory usage.
20078 // It outputs the frequency of allocations of different sizes,
20079 // the total number of bytes which have been allocated,
20080 // the total number of bytes which have been freed,
20081 // and the difference between the previous two values, i.e. the number of bytes
20082 // still in use.
20084 // Note that this function will not output anything unless you have
20085 // previously installed the #glib_mem_profiler_table with g_mem_set_vtable().
20086 static void mem_profile()() nothrow {
20087 g_mem_profile();
20091 // Sets the #GMemVTable to use for memory allocation. You can use this to provide
20092 // custom memory allocation routines. <emphasis>This function must be called
20093 // before using any other GLib functions.</emphasis> The @vtable only needs to
20094 // provide malloc(), realloc(), and free() functions; GLib can provide default
20095 // implementations of the others. The malloc() and realloc() implementations
20096 // should return %NULL on failure, GLib will handle error-checking for you.
20097 // @vtable is copied, so need not persist after this function has been called.
20098 // <vtable>: table of memory allocation routines.
20099 static void mem_set_vtable(AT0)(AT0 /*MemVTable*/ vtable) nothrow {
20100 g_mem_set_vtable(UpCast!(MemVTable*)(vtable));
20104 // Unintrospectable function: memdup() / g_memdup()
20105 // Allocates @byte_size bytes of memory, and copies @byte_size bytes into it
20106 // from @mem. If @mem is %NULL it returns %NULL.
20108 // is %NULL.
20109 // RETURNS: a pointer to the newly-allocated copy of the memory, or %NULL if @mem
20110 // <mem>: the memory to copy.
20111 // <byte_size>: the number of bytes to copy.
20112 static void* memdup(AT0)(AT0 /*const(void)*/ mem, uint byte_size) nothrow {
20113 return g_memdup(UpCast!(const(void)*)(mem), byte_size);
20117 // VERSION: 2.8
20118 // Create a directory if it doesn't already exist. Create intermediate
20119 // parent directories as needed, too.
20121 // created. Returns -1 if an error occurred, with errno set.
20122 // RETURNS: 0 if the directory already exists, or was successfully
20123 // <pathname>: a pathname in the GLib file name encoding
20124 // <mode>: permissions to use for newly created directories
20125 static int mkdir_with_parents(AT0)(AT0 /*char*/ pathname, int mode) nothrow {
20126 return g_mkdir_with_parents(toCString!(char*)(pathname), mode);
20130 // VERSION: 2.30
20131 // Creates a temporary directory. See the mkdtemp() documentation
20132 // on most UNIX-like systems.
20134 // The parameter is a string that should follow the rules for
20135 // mkdtemp() templates, i.e. contain the string "XXXXXX".
20136 // g_mkdtemp() is slightly more flexible than mkdtemp() in that the
20137 // sequence does not have to occur at the very end of the template
20138 // and you can pass a @mode and additional @flags. The X string will
20139 // be modified to form the name of a directory that didn't exist.
20140 // The string should be in the GLib file name encoding. Most importantly,
20141 // on Windows it should be in UTF-8.
20143 // to hold the directory name. In case of errors, %NULL is
20144 // returned and %errno will be set.
20145 // RETURNS: A pointer to @tmpl, which has been modified
20146 // <tmpl>: template directory name
20147 static char* /*new*/ mkdtemp(AT0)(AT0 /*char*/ tmpl) nothrow {
20148 return g_mkdtemp(toCString!(char*)(tmpl));
20152 // VERSION: 2.30
20153 // Creates a temporary directory. See the mkdtemp() documentation
20154 // on most UNIX-like systems.
20156 // The parameter is a string that should follow the rules for
20157 // mkdtemp() templates, i.e. contain the string "XXXXXX".
20158 // g_mkdtemp() is slightly more flexible than mkdtemp() in that the
20159 // sequence does not have to occur at the very end of the template
20160 // and you can pass a @mode. The X string will be modified to form
20161 // the name of a directory that didn't exist. The string should be
20162 // in the GLib file name encoding. Most importantly, on Windows it
20163 // should be in UTF-8.
20165 // to hold the directory name. In case of errors, %NULL is
20166 // returned, and %errno will be set.
20167 // RETURNS: A pointer to @tmpl, which has been modified
20168 // <tmpl>: template directory name
20169 // <mode>: permissions to create the temporary directory with
20170 static char* /*new*/ mkdtemp_full(AT0)(AT0 /*char*/ tmpl, int mode) nothrow {
20171 return g_mkdtemp_full(toCString!(char*)(tmpl), mode);
20175 // Opens a temporary file. See the mkstemp() documentation
20176 // on most UNIX-like systems.
20178 // The parameter is a string that should follow the rules for
20179 // mkstemp() templates, i.e. contain the string "XXXXXX".
20180 // g_mkstemp() is slightly more flexible than mkstemp() in that the
20181 // sequence does not have to occur at the very end of the template.
20182 // The X string will be modified to form the name of a file that
20183 // didn't exist. The string should be in the GLib file name encoding.
20184 // Most importantly, on Windows it should be in UTF-8.
20186 // opened for reading and writing. The file is opened in binary
20187 // mode on platforms where there is a difference. The file handle
20188 // should be closed with close(). In case of errors, -1 is
20189 // returned and %errno will be set.
20190 // RETURNS: A file handle (as from open()) to the file
20191 // <tmpl>: template filename
20192 static int mkstemp(AT0)(AT0 /*char*/ tmpl) nothrow {
20193 return g_mkstemp(toCString!(char*)(tmpl));
20197 // VERSION: 2.22
20198 // Opens a temporary file. See the mkstemp() documentation
20199 // on most UNIX-like systems.
20201 // The parameter is a string that should follow the rules for
20202 // mkstemp() templates, i.e. contain the string "XXXXXX".
20203 // g_mkstemp_full() is slightly more flexible than mkstemp()
20204 // in that the sequence does not have to occur at the very end of the
20205 // template and you can pass a @mode and additional @flags. The X
20206 // string will be modified to form the name of a file that didn't exist.
20207 // The string should be in the GLib file name encoding. Most importantly,
20208 // on Windows it should be in UTF-8.
20210 // opened for reading and writing. The file handle should be
20211 // closed with close(). In case of errors, -1 is returned
20212 // and %errno will be set.
20213 // RETURNS: A file handle (as from open()) to the file
20214 // <tmpl>: template filename
20215 // <flags>: flags to pass to an open() call in addition to O_EXCL and O_CREAT, which are passed automatically
20216 // <mode>: permissions to create the temporary file with
20217 static int mkstemp_full(AT0)(AT0 /*char*/ tmpl, int flags, int mode) nothrow {
20218 return g_mkstemp_full(toCString!(char*)(tmpl), flags, mode);
20222 // Set the pointer at the specified location to %NULL.
20223 // <nullify_location>: the memory address of the pointer.
20224 static void nullify_pointer(AT0)(AT0 /*void**/ nullify_location) nothrow {
20225 g_nullify_pointer(UpCast!(void**)(nullify_location));
20229 // Prompts the user with
20230 // <computeroutput>[E]xit, [H]alt, show [S]tack trace or [P]roceed</computeroutput>.
20231 // This function is intended to be used for debugging use only.
20232 // The following example shows how it can be used together with
20233 // the g_log() functions.
20235 // |[
20236 // &num;include &lt;glib.h&gt;
20238 // static void
20239 // log_handler (const gchar *log_domain,
20240 // GLogLevelFlags log_level,
20241 // const gchar *message,
20242 // gpointer user_data)
20243 // {
20244 // g_log_default_handler (log_domain, log_level, message, user_data);
20246 // g_on_error_query (MY_PROGRAM_NAME);
20247 // }
20249 // int
20250 // main (int argc, char *argv[])
20251 // {
20252 // g_log_set_handler (MY_LOG_DOMAIN,
20253 // G_LOG_LEVEL_WARNING |
20254 // G_LOG_LEVEL_ERROR |
20255 // G_LOG_LEVEL_CRITICAL,
20256 // log_handler,
20257 // NULL);
20258 // /&ast; ... &ast;/
20259 // ]|
20261 // If [E]xit is selected, the application terminates with a call
20262 // to <literal>_exit(0)</literal>.
20264 // If [S]tack trace is selected, g_on_error_stack_trace() is called.
20265 // This invokes <command>gdb</command>, which attaches to the current
20266 // process and shows a stack trace. The prompt is then shown again.
20268 // If [P]roceed is selected, the function returns.
20270 // This function may cause different actions on non-UNIX platforms.
20271 // <prg_name>: the program name, needed by <command>gdb</command> for the [S]tack trace option. If @prg_name is %NULL, g_get_prgname() is called to get the program name (which will work correctly if gdk_init() or gtk_init() has been called)
20272 static void on_error_query(AT0)(AT0 /*char*/ prg_name) nothrow {
20273 g_on_error_query(toCString!(char*)(prg_name));
20277 // Invokes <command>gdb</command>, which attaches to the current
20278 // process and shows a stack trace. Called by g_on_error_query()
20279 // when the [S]tack trace option is selected. You can get the current
20280 // process's "program name" with g_get_prgname(), assuming that you
20281 // have called gtk_init() or gdk_init().
20283 // This function may cause different actions on non-UNIX platforms.
20284 // <prg_name>: the program name, needed by <command>gdb</command> for the [S]tack trace option.
20285 static void on_error_stack_trace(AT0)(AT0 /*char*/ prg_name) nothrow {
20286 g_on_error_stack_trace(toCString!(char*)(prg_name));
20290 // VERSION: 2.14
20291 // MOVED TO: Once.init_enter
20292 // Function to be called when starting a critical initialization
20293 // section. The argument @location must point to a static
20294 // 0-initialized variable that will be set to a value other than 0 at
20295 // the end of the initialization section. In combination with
20296 // g_once_init_leave() and the unique address @value_location, it can
20297 // be ensured that an initialization section will be executed only once
20298 // during a program's life time, and that concurrent threads are
20299 // blocked until initialization completed. To be used in constructs
20300 // like this:
20302 // |[
20303 // static gsize initialization_value = 0;
20305 // if (g_once_init_enter (&amp;initialization_value))
20306 // {
20307 // gsize setup_value = 42; /&ast;* initialization code here *&ast;/
20309 // g_once_init_leave (&amp;initialization_value, setup_value);
20310 // }
20312 // /&ast;* use initialization_value here *&ast;/
20313 // ]|
20315 // %FALSE and blocks otherwise
20316 // RETURNS: %TRUE if the initialization section should be entered,
20317 // <location>: location of a static initializable variable containing 0
20318 static int once_init_enter(AT0)(AT0 /*void*/ location) nothrow {
20319 return g_once_init_enter(UpCast!(void*)(location));
20323 // VERSION: 2.14
20324 // MOVED TO: Once.init_leave
20325 // Counterpart to g_once_init_enter(). Expects a location of a static
20326 // 0-initialized initialization variable, and an initialization value
20327 // other than 0. Sets the variable to the initialization value, and
20328 // releases concurrent threads blocking in g_once_init_enter() on this
20329 // initialization variable.
20330 // <location>: location of a static initializable variable containing 0
20331 // <result>: new non-0 value for *@value_location
20332 static void once_init_leave(AT0)(AT0 /*void*/ location, size_t result) nothrow {
20333 g_once_init_leave(UpCast!(void*)(location), result);
20336 static Quark option_error_quark()() nothrow {
20337 return g_option_error_quark();
20341 // Parses a string containing debugging options
20342 // into a %guint containing bit flags. This is used
20343 // within GDK and GTK+ to parse the debug options passed on the
20344 // command line or through environment variables.
20346 // If @string is equal to <code>"all"</code>, all flags are set. Any flags
20347 // specified along with <code>"all"</code> in @string are inverted; thus,
20348 // <code>"all,foo,bar"</code> or <code>"foo,bar,all"</code> sets all flags
20349 // except those corresponding to <code>"foo"</code> and <code>"bar"</code>.
20351 // If @string is equal to <code>"help"</code>, all the available keys in @keys
20352 // are printed out to standard error.
20353 // RETURNS: the combined set of bit flags.
20354 // <string>: a list of debug options separated by colons, spaces, or commas, or %NULL.
20355 // <keys>: pointer to an array of #GDebugKey which associate strings with bit flags.
20356 // <nkeys>: the number of #GDebugKey<!-- -->s in the array.
20357 static uint parse_debug_string(AT0, AT1)(AT0 /*char*/ string_, AT1 /*DebugKey*/ keys, uint nkeys) nothrow {
20358 return g_parse_debug_string(toCString!(char*)(string_), UpCast!(DebugKey*)(keys), nkeys);
20362 // Gets the last component of the filename.
20364 // If @file_name ends with a directory separator it gets the component
20365 // before the last slash. If @file_name consists only of directory
20366 // separators (and on Windows, possibly a drive letter), a single
20367 // separator is returned. If @file_name is empty, it gets ".".
20369 // component of the filename
20370 // RETURNS: a newly allocated string containing the last
20371 // <file_name>: the name of the file
20372 static char* /*new*/ path_get_basename(AT0)(AT0 /*char*/ file_name) nothrow {
20373 return g_path_get_basename(toCString!(char*)(file_name));
20377 // Gets the directory components of a file name.
20379 // If the file name has no directory components "." is returned.
20380 // The returned string should be freed when no longer needed.
20381 // RETURNS: the directory components of the file
20382 // <file_name>: the name of the file
20383 static char* /*new*/ path_get_dirname(AT0)(AT0 /*char*/ file_name) nothrow {
20384 return g_path_get_dirname(toCString!(char*)(file_name));
20388 // Returns %TRUE if the given @file_name is an absolute file name.
20389 // Note that this is a somewhat vague concept on Windows.
20391 // On POSIX systems, an absolute file name is well-defined. It always
20392 // starts from the single root directory. For example "/usr/local".
20394 // On Windows, the concepts of current drive and drive-specific
20395 // current directory introduce vagueness. This function interprets as
20396 // an absolute file name one that either begins with a directory
20397 // separator such as "\Users\tml" or begins with the root on a drive,
20398 // for example "C:\Windows". The first case also includes UNC paths
20399 // such as "\\myserver\docs\foo". In all cases, either slashes or
20400 // backslashes are accepted.
20402 // Note that a file name relative to the current drive root does not
20403 // truly specify a file uniquely over time and across processes, as
20404 // the current drive is a per-process value and can be changed.
20406 // File names relative the current directory on some specific drive,
20407 // such as "D:foo/bar", are not interpreted as absolute by this
20408 // function, but they obviously are not relative to the normal current
20409 // directory as returned by getcwd() or g_get_current_dir()
20410 // either. Such paths should be avoided, or need to be handled using
20411 // Windows-specific code.
20412 // RETURNS: %TRUE if @file_name is absolute
20413 // <file_name>: a file name
20414 static int path_is_absolute(AT0)(AT0 /*char*/ file_name) nothrow {
20415 return g_path_is_absolute(toCString!(char*)(file_name));
20419 // Returns a pointer into @file_name after the root component,
20420 // i.e. after the "/" in UNIX or "C:\" under Windows. If @file_name
20421 // is not an absolute path it returns %NULL.
20422 // RETURNS: a pointer into @file_name after the root component
20423 // <file_name>: a file name
20424 static char* path_skip_root(AT0)(AT0 /*char*/ file_name) nothrow {
20425 return g_path_skip_root(toCString!(char*)(file_name));
20429 // Matches a string against a compiled pattern. Passing the correct
20430 // length of the string given is mandatory. The reversed string can be
20431 // omitted by passing %NULL, this is more efficient if the reversed
20432 // version of the string to be matched is not at hand, as
20433 // g_pattern_match() will only construct it if the compiled pattern
20434 // requires reverse matches.
20436 // Note that, if the user code will (possibly) match a string against a
20437 // multitude of patterns containing wildcards, chances are high that
20438 // some patterns will require a reversed string. In this case, it's
20439 // more efficient to provide the reversed string to avoid multiple
20440 // constructions thereof in the various calls to g_pattern_match().
20442 // Note also that the reverse of a UTF-8 encoded string can in general
20443 // <emphasis>not</emphasis> be obtained by g_strreverse(). This works
20444 // only if the string doesn't contain any multibyte characters. GLib
20445 // offers the g_utf8_strreverse() function to reverse UTF-8 encoded
20446 // strings.
20447 // <pspec>: a #GPatternSpec
20448 // <string_length>: the length of @string (in bytes, i.e. strlen(), <emphasis>not</emphasis> g_utf8_strlen())
20449 // <string>: the UTF-8 encoded string to match
20450 // <string_reversed>: the reverse of @string or %NULL
20451 static int pattern_match(AT0, AT1, AT2)(AT0 /*PatternSpec*/ pspec, uint string_length, AT1 /*char*/ string_, AT2 /*char*/ string_reversed) nothrow {
20452 return g_pattern_match(UpCast!(PatternSpec*)(pspec), string_length, toCString!(char*)(string_), toCString!(char*)(string_reversed));
20456 // Matches a string against a pattern given as a string. If this
20457 // function is to be called in a loop, it's more efficient to compile
20458 // the pattern once with g_pattern_spec_new() and call
20459 // g_pattern_match_string() repeatedly.
20460 // <pattern>: the UTF-8 encoded pattern
20461 // <string>: the UTF-8 encoded string to match
20462 static int pattern_match_simple(AT0, AT1)(AT0 /*char*/ pattern, AT1 /*char*/ string_) nothrow {
20463 return g_pattern_match_simple(toCString!(char*)(pattern), toCString!(char*)(string_));
20467 // Matches a string against a compiled pattern. If the string is to be
20468 // matched against more than one pattern, consider using
20469 // g_pattern_match() instead while supplying the reversed string.
20470 // <pspec>: a #GPatternSpec
20471 // <string>: the UTF-8 encoded string to match
20472 static int pattern_match_string(AT0, AT1)(AT0 /*PatternSpec*/ pspec, AT1 /*char*/ string_) nothrow {
20473 return g_pattern_match_string(UpCast!(PatternSpec*)(pspec), toCString!(char*)(string_));
20477 // VERSION: 2.30
20478 // This is equivalent to g_bit_lock, but working on pointers (or other
20479 // pointer-sized values).
20481 // For portability reasons, you may only lock on the bottom 32 bits of
20482 // the pointer.
20483 // <address>: a pointer to a #gpointer-sized value
20484 // <lock_bit>: a bit value between 0 and 31
20485 static void pointer_bit_lock(AT0)(AT0 /*void*/ address, int lock_bit) nothrow {
20486 g_pointer_bit_lock(UpCast!(void*)(address), lock_bit);
20490 // VERSION: 2.30
20491 // This is equivalent to g_bit_trylock, but working on pointers (or
20492 // other pointer-sized values).
20494 // For portability reasons, you may only lock on the bottom 32 bits of
20495 // the pointer.
20496 // RETURNS: %TRUE if the lock was acquired
20497 // <address>: a pointer to a #gpointer-sized value
20498 // <lock_bit>: a bit value between 0 and 31
20499 static int pointer_bit_trylock(AT0)(AT0 /*void*/ address, int lock_bit) nothrow {
20500 return g_pointer_bit_trylock(UpCast!(void*)(address), lock_bit);
20504 // VERSION: 2.30
20505 // This is equivalent to g_bit_unlock, but working on pointers (or other
20506 // pointer-sized values).
20508 // For portability reasons, you may only lock on the bottom 32 bits of
20509 // the pointer.
20510 // <address>: a pointer to a #gpointer-sized value
20511 // <lock_bit>: a bit value between 0 and 31
20512 static void pointer_bit_unlock(AT0)(AT0 /*void*/ address, int lock_bit) nothrow {
20513 g_pointer_bit_unlock(UpCast!(void*)(address), lock_bit);
20517 // VERSION: 2.20
20518 // Polls @fds, as with the poll() system call, but portably. (On
20519 // systems that don't have poll(), it is emulated using select().)
20520 // This is used internally by #GMainContext, but it can be called
20521 // directly if you need to block until a file descriptor is ready, but
20522 // don't want to run the full main loop.
20524 // Each element of @fds is a #GPollFD describing a single file
20525 // descriptor to poll. The %fd field indicates the file descriptor,
20526 // and the %events field indicates the events to poll for. On return,
20527 // the %revents fields will be filled with the events that actually
20528 // occurred.
20530 // On POSIX systems, the file descriptors in @fds can be any sort of
20531 // file descriptor, but the situation is much more complicated on
20532 // Windows. If you need to use g_poll() in code that has to run on
20533 // Windows, the easiest solution is to construct all of your
20534 // #GPollFD<!-- -->s with g_io_channel_win32_make_pollfd().
20536 // were filled in, or 0 if the operation timed out, or -1 on error or
20537 // if the call was interrupted.
20538 // RETURNS: the number of entries in @fds whose %revents fields
20539 // <fds>: file descriptors to poll
20540 // <nfds>: the number of file descriptors in @fds
20541 // <timeout>: amount of time to wait, in milliseconds, or -1 to wait forever
20542 static int poll(AT0)(AT0 /*PollFD*/ fds, uint nfds, int timeout) nothrow {
20543 return g_poll(UpCast!(PollFD*)(fds), nfds, timeout);
20547 // Unintrospectable function: prefix_error() / g_prefix_error()
20548 // VERSION: 2.16
20549 // Formats a string according to @format and
20550 // prefix it to an existing error message. If
20551 // nothing.
20553 // If *@err is %NULL (ie: an error variable is
20554 // present but there is no error condition) then
20555 // also do nothing. Whether or not it makes
20556 // sense to take advantage of this feature is up
20557 // to you.
20558 // <err>: a return location for a #GError, or %NULL
20559 // <format>: printf()-style format string
20560 alias g_prefix_error prefix_error; // Variadic
20563 // Unintrospectable function: print() / g_print()
20564 // Outputs a formatted message via the print handler.
20565 // The default print handler simply outputs the message to stdout.
20567 // g_print() should not be used from within libraries for debugging
20568 // messages, since it may be redirected by applications to special
20569 // purpose message windows or even files. Instead, libraries should
20570 // use g_log(), or the convenience functions g_message(), g_warning()
20571 // and g_error().
20572 // <format>: the message format. See the printf() documentation
20573 alias g_print print; // Variadic
20576 // Unintrospectable function: printerr() / g_printerr()
20577 // Outputs a formatted message via the error message handler.
20578 // The default handler simply outputs the message to stderr.
20580 // g_printerr() should not be used from within libraries.
20581 // Instead g_log() should be used, or the convenience functions
20582 // g_message(), g_warning() and g_error().
20583 // <format>: the message format. See the printf() documentation
20584 alias g_printerr printerr; // Variadic
20587 // Unintrospectable function: printf() / g_printf()
20588 // VERSION: 2.2
20589 // An implementation of the standard printf() function which supports
20590 // positional parameters, as specified in the Single Unix Specification.
20591 // RETURNS: the number of bytes printed.
20592 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
20593 alias g_printf printf; // Variadic
20596 // Unintrospectable function: printf_string_upper_bound() / g_printf_string_upper_bound()
20597 // Calculates the maximum space needed to store the output
20598 // of the sprintf() function.
20599 // RETURNS: the maximum space needed to store the formatted string
20600 // <format>: the format string. See the printf() documentation
20601 // <args>: the parameters to be inserted into the format string
20602 static size_t printf_string_upper_bound(AT0)(AT0 /*char*/ format, va_list args) nothrow {
20603 return g_printf_string_upper_bound(toCString!(char*)(format), args);
20607 // If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
20608 // The error variable @dest points to must be %NULL.
20609 // <dest>: error return location
20610 // <src>: error to move into the return location
20611 static void propagate_error(AT0, AT1)(AT0 /*Error**/ dest, AT1 /*Error*/ src) nothrow {
20612 g_propagate_error(UpCast!(Error**)(dest), UpCast!(Error*)(src));
20616 // Unintrospectable function: propagate_prefixed_error() / g_propagate_prefixed_error()
20617 // VERSION: 2.16
20618 // If @dest is %NULL, free @src; otherwise,
20619 // moves @src into *@dest. *@dest must be %NULL.
20620 // After the move, add a prefix as with
20621 // g_prefix_error().
20622 // <dest>: error return location
20623 // <src>: error to move into the return location
20624 // <format>: printf()-style format string
20625 alias g_propagate_prefixed_error propagate_prefixed_error; // Variadic
20628 // MOVED TO: PtrArray.add
20629 // Adds a pointer to the end of the pointer array. The array will grow
20630 // in size automatically if necessary.
20631 // <array>: a #GPtrArray.
20632 // <data>: the pointer to add.
20633 static void ptr_array_add(AT0, AT1)(AT0 /*PtrArray*/ array, AT1 /*void*/ data) nothrow {
20634 g_ptr_array_add(UpCast!(PtrArray*)(array), UpCast!(void*)(data));
20638 // MOVED TO: PtrArray.remove
20639 // Removes the first occurrence of the given pointer from the pointer
20640 // array. The following elements are moved down one place. If @array
20641 // has a non-%NULL #GDestroyNotify function it is called for the
20642 // removed element.
20644 // It returns %TRUE if the pointer was removed, or %FALSE if the
20645 // pointer was not found.
20646 // <array>: a #GPtrArray.
20647 // <data>: the pointer to remove.
20648 static int ptr_array_remove(AT0, AT1)(AT0 /*PtrArray*/ array, AT1 /*void*/ data) nothrow {
20649 return g_ptr_array_remove(UpCast!(PtrArray*)(array), UpCast!(void*)(data));
20653 // MOVED TO: PtrArray.remove_fast
20654 // Removes the first occurrence of the given pointer from the pointer
20655 // array. The last element in the array is used to fill in the space,
20656 // so this function does not preserve the order of the array. But it is
20657 // faster than g_ptr_array_remove(). If @array has a non-%NULL
20658 // #GDestroyNotify function it is called for the removed element.
20660 // It returns %TRUE if the pointer was removed, or %FALSE if the
20661 // pointer was not found.
20662 // <array>: a #GPtrArray.
20663 // <data>: the pointer to remove.
20664 static int ptr_array_remove_fast(AT0, AT1)(AT0 /*PtrArray*/ array, AT1 /*void*/ data) nothrow {
20665 return g_ptr_array_remove_fast(UpCast!(PtrArray*)(array), UpCast!(void*)(data));
20669 // VERSION: 2.4
20670 // MOVED TO: PtrArray.remove_range
20671 // Removes the given number of pointers starting at the given index
20672 // from a #GPtrArray. The following elements are moved to close the
20673 // gap. If @array has a non-%NULL #GDestroyNotify function it is called
20674 // for the removed elements.
20675 // <array>: a @GPtrArray.
20676 // <index_>: the index of the first pointer to remove.
20677 // <length>: the number of pointers to remove.
20678 static void ptr_array_remove_range(AT0)(AT0 /*PtrArray*/ array, uint index_, uint length) nothrow {
20679 g_ptr_array_remove_range(UpCast!(PtrArray*)(array), index_, length);
20683 // VERSION: 2.22
20684 // MOVED TO: PtrArray.set_free_func
20685 // Sets a function for freeing each element when @array is destroyed
20686 // either via g_ptr_array_unref(), when g_ptr_array_free() is called
20687 // with @free_segment set to %TRUE or when removing elements.
20688 // <array>: A #GPtrArray.
20689 // <element_free_func>: A function to free elements with destroy @array or %NULL.
20690 static void ptr_array_set_free_func(AT0)(AT0 /*PtrArray*/ array, DestroyNotify element_free_func) nothrow {
20691 g_ptr_array_set_free_func(UpCast!(PtrArray*)(array), element_free_func);
20695 // MOVED TO: PtrArray.set_size
20696 // Sets the size of the array. When making the array larger,
20697 // newly-added elements will be set to %NULL. When making it smaller,
20698 // if @array has a non-%NULL #GDestroyNotify function then it will be
20699 // called for the removed elements.
20700 // <array>: a #GPtrArray.
20701 // <length>: the new length of the pointer array.
20702 static void ptr_array_set_size(AT0)(AT0 /*PtrArray*/ array, int length) nothrow {
20703 g_ptr_array_set_size(UpCast!(PtrArray*)(array), length);
20707 // VERSION: 2.22
20708 // MOVED TO: PtrArray.unref
20709 // Atomically decrements the reference count of @array by one. If the
20710 // reference count drops to 0, the effect is the same as calling
20711 // g_ptr_array_free() with @free_segment set to %TRUE. This function
20712 // is MT-safe and may be called from any thread.
20713 // <array>: A #GPtrArray.
20714 static void ptr_array_unref(AT0)(AT0 /*PtrArray*/ array) nothrow {
20715 g_ptr_array_unref(UpCast!(PtrArray*)(array));
20719 // Unintrospectable function: qsort_with_data() / g_qsort_with_data()
20720 // This is just like the standard C qsort() function, but
20721 // the comparison routine accepts a user data argument.
20723 // This is guaranteed to be a stable sort since version 2.32.
20724 // <pbase>: start of array to sort
20725 // <total_elems>: elements in the array
20726 // <size>: size of each element
20727 // <compare_func>: function to compare elements
20728 // <user_data>: data to pass to @compare_func
20729 static void qsort_with_data(AT0, AT1)(AT0 /*const(void)*/ pbase, int total_elems, size_t size, CompareDataFunc compare_func, AT1 /*void*/ user_data) nothrow {
20730 g_qsort_with_data(UpCast!(const(void)*)(pbase), total_elems, size, compare_func, UpCast!(void*)(user_data));
20734 // Gets the #GQuark identifying the given (static) string. If the
20735 // string does not currently have an associated #GQuark, a new #GQuark
20736 // is created, linked to the given string.
20738 // Note that this function is identical to g_quark_from_string() except
20739 // that if a new #GQuark is created the string itself is used rather
20740 // than a copy. This saves memory, but can only be used if the string
20741 // will <emphasis>always</emphasis> exist. It can be used with
20742 // statically allocated strings in the main program, but not with
20743 // statically allocated memory in dynamically loaded modules, if you
20744 // expect to ever unload the module again (e.g. do not use this
20745 // function in GTK+ theme engines).
20746 // <string>: a string.
20747 static Quark quark_from_static_string(AT0)(AT0 /*char*/ string_=null) nothrow {
20748 return g_quark_from_static_string(toCString!(char*)(string_));
20752 // Gets the #GQuark identifying the given string. If the string does
20753 // not currently have an associated #GQuark, a new #GQuark is created,
20754 // using a copy of the string.
20755 // <string>: a string.
20756 static Quark quark_from_string(AT0)(AT0 /*char*/ string_=null) nothrow {
20757 return g_quark_from_string(toCString!(char*)(string_));
20761 // Gets the string associated with the given #GQuark.
20762 // <quark>: a #GQuark.
20763 static char* quark_to_string()(Quark quark) nothrow {
20764 return g_quark_to_string(quark);
20768 // Gets the #GQuark associated with the given string, or 0 if string is
20769 // %NULL or it has no associated #GQuark.
20771 // If you want the GQuark to be created if it doesn't already exist,
20772 // use g_quark_from_string() or g_quark_from_static_string().
20773 // <string>: a string.
20774 static Quark quark_try_string(AT0)(AT0 /*char*/ string_=null) nothrow {
20775 return g_quark_try_string(toCString!(char*)(string_));
20779 // Returns a random #gdouble equally distributed over the range [0..1).
20780 // RETURNS: A random number.
20781 static double random_double()() nothrow {
20782 return g_random_double();
20786 // Returns a random #gdouble equally distributed over the range [@begin..@end).
20787 // RETURNS: A random number.
20788 // <begin>: lower closed bound of the interval.
20789 // <end>: upper open bound of the interval.
20790 static double random_double_range()(double begin, double end) nothrow {
20791 return g_random_double_range(begin, end);
20795 // Return a random #guint32 equally distributed over the range
20796 // [0..2^32-1].
20797 // RETURNS: A random number.
20798 static uint random_int()() nothrow {
20799 return g_random_int();
20803 // Returns a random #gint32 equally distributed over the range
20804 // [@begin..@end-1].
20805 // RETURNS: A random number.
20806 // <begin>: lower closed bound of the interval.
20807 // <end>: upper open bound of the interval.
20808 static int random_int_range()(int begin, int end) nothrow {
20809 return g_random_int_range(begin, end);
20813 // Sets the seed for the global random number generator, which is used
20814 // by the <function>g_random_*</function> functions, to @seed.
20815 // <seed>: a value to reinitialize the global random number generator.
20816 static void random_set_seed()(uint seed) nothrow {
20817 g_random_set_seed(seed);
20821 // Unintrospectable function: realloc() / g_realloc()
20822 // Reallocates the memory pointed to by @mem, so that it now has space for
20823 // @n_bytes bytes of memory. It returns the new address of the memory, which may
20824 // have been moved. @mem may be %NULL, in which case it's considered to
20825 // have zero-length. @n_bytes may be 0, in which case %NULL will be returned
20826 // and @mem will be freed unless it is %NULL.
20827 // RETURNS: the new address of the allocated memory
20828 // <mem>: the memory to reallocate
20829 // <n_bytes>: new size of the memory in bytes
20830 static void* realloc(AT0)(AT0 /*void*/ mem, size_t n_bytes) nothrow {
20831 return g_realloc(UpCast!(void*)(mem), n_bytes);
20835 // Unintrospectable function: realloc_n() / g_realloc_n()
20836 // VERSION: 2.24
20837 // This function is similar to g_realloc(), allocating (@n_blocks * @n_block_bytes) bytes,
20838 // but care is taken to detect possible overflow during multiplication.
20839 // RETURNS: the new address of the allocated memory
20840 // <mem>: the memory to reallocate
20841 // <n_blocks>: the number of blocks to allocate
20842 // <n_block_bytes>: the size of each block in bytes
20843 static void* realloc_n(AT0)(AT0 /*void*/ mem, size_t n_blocks, size_t n_block_bytes) nothrow {
20844 return g_realloc_n(UpCast!(void*)(mem), n_blocks, n_block_bytes);
20848 // VERSION: 2.14
20849 // MOVED TO: Regex.check_replacement
20850 // Checks whether @replacement is a valid replacement string
20851 // (see g_regex_replace()), i.e. that all escape sequences in
20852 // it are valid.
20854 // If @has_references is not %NULL then @replacement is checked
20855 // for pattern references. For instance, replacement text 'foo\n'
20856 // does not contain references and may be evaluated without information
20857 // about actual match, but '\0\1' (whole match followed by first
20858 // subpattern) requires valid #GMatchInfo object.
20859 // RETURNS: whether @replacement is a valid replacement string
20860 // <replacement>: the replacement string
20861 // <has_references>: location to store information about references in @replacement or %NULL
20862 static int regex_check_replacement(AT0, AT1)(AT0 /*char*/ replacement, /*out*/ int* has_references, AT1 /*GLib2.Error**/ error=null) nothrow {
20863 return g_regex_check_replacement(toCString!(char*)(replacement), has_references, UpCast!(GLib2.Error**)(error));
20866 // MOVED TO: Regex.error_quark
20867 static Quark regex_error_quark()() nothrow {
20868 return g_regex_error_quark();
20872 // VERSION: 2.30
20873 // MOVED TO: Regex.escape_nul
20874 // Escapes the nul characters in @string to "\x00". It can be used
20875 // to compile a regex with embedded nul characters.
20877 // For completeness, @length can be -1 for a nul-terminated string.
20878 // In this case the output string will be of course equal to @string.
20879 // RETURNS: a newly-allocated escaped string
20880 // <string>: the string to escape
20881 // <length>: the length of @string
20882 static char* /*new*/ regex_escape_nul(AT0)(AT0 /*char*/ string_, int length) nothrow {
20883 return g_regex_escape_nul(toCString!(char*)(string_), length);
20887 // VERSION: 2.14
20888 // MOVED TO: Regex.escape_string
20889 // Escapes the special characters used for regular expressions
20890 // in @string, for instance "a.b*c" becomes "a\.b\*c". This
20891 // function is useful to dynamically generate regular expressions.
20893 // @string can contain nul characters that are replaced with "\0",
20894 // in this case remember to specify the correct length of @string
20895 // in @length.
20896 // RETURNS: a newly-allocated escaped string
20897 // <string>: the string to escape
20898 // <length>: the length of @string, or -1 if @string is nul-terminated
20899 static char* /*new*/ regex_escape_string(AT0)(AT0 /*char*/ string_, int length) nothrow {
20900 return g_regex_escape_string(toCString!(char*)(string_), length);
20904 // VERSION: 2.14
20905 // MOVED TO: Regex.match_simple
20906 // Scans for a match in @string for @pattern.
20908 // This function is equivalent to g_regex_match() but it does not
20909 // require to compile the pattern with g_regex_new(), avoiding some
20910 // lines of code when you need just to do a match without extracting
20911 // substrings, capture counts, and so on.
20913 // If this function is to be called on the same @pattern more than
20914 // once, it's more efficient to compile the pattern once with
20915 // g_regex_new() and then use g_regex_match().
20916 // RETURNS: %TRUE if the string matched, %FALSE otherwise
20917 // <pattern>: the regular expression
20918 // <string>: the string to scan for matches
20919 // <compile_options>: compile options for the regular expression, or 0
20920 // <match_options>: match options, or 0
20921 static int regex_match_simple(AT0, AT1)(AT0 /*char*/ pattern, AT1 /*char*/ string_, RegexCompileFlags compile_options, RegexMatchFlags match_options) nothrow {
20922 return g_regex_match_simple(toCString!(char*)(pattern), toCString!(char*)(string_), compile_options, match_options);
20926 // VERSION: 2.22
20927 // Resets the cache used for g_get_user_special_dir(), so
20928 // that the latest on-disk version is used. Call this only
20929 // if you just changed the data on disk yourself.
20931 // Due to threadsafety issues this may cause leaking of strings
20932 // that were previously returned from g_get_user_special_dir()
20933 // that can't be freed. We ensure to only leak the data for
20934 // the directories that actually changed value though.
20935 static void reload_user_special_dirs_cache()() nothrow {
20936 g_reload_user_special_dirs_cache();
20939 static void return_if_fail_warning(AT0, AT1, AT2)(AT0 /*char*/ log_domain, AT1 /*char*/ pretty_function, AT2 /*char*/ expression) nothrow {
20940 g_return_if_fail_warning(toCString!(char*)(log_domain), toCString!(char*)(pretty_function), toCString!(char*)(expression));
20944 // VERSION: 2.6
20945 // A wrapper for the POSIX rmdir() function. The rmdir() function
20946 // deletes a directory from the filesystem.
20948 // See your C library manual for more details about how rmdir() works
20949 // on your system.
20951 // occurred
20952 // RETURNS: 0 if the directory was successfully removed, -1 if an error
20953 // <filename>: a pathname in the GLib file name encoding (UTF-8 on Windows)
20954 static int rmdir(AT0)(AT0 /*char*/ filename) nothrow {
20955 return g_rmdir(toCString!(char*)(filename));
20959 // VERSION: 2.14
20960 // MOVED TO: Sequence.move
20961 // Moves the item pointed to by @src to the position indicated by @dest.
20962 // After calling this function @dest will point to the position immediately
20963 // after @src. It is allowed for @src and @dest to point into different
20964 // sequences.
20965 // <src>: a #GSequenceIter pointing to the item to move
20966 // <dest>: a #GSequenceIter pointing to the position to which the item is moved.
20967 static void sequence_move(AT0, AT1)(AT0 /*SequenceIter*/ src, AT1 /*SequenceIter*/ dest) nothrow {
20968 g_sequence_move(UpCast!(SequenceIter*)(src), UpCast!(SequenceIter*)(dest));
20972 // VERSION: 2.14
20973 // MOVED TO: Sequence.move_range
20974 // Inserts the (@begin, @end) range at the destination pointed to by ptr.
20975 // The @begin and @end iters must point into the same sequence. It is
20976 // allowed for @dest to point to a different sequence than the one pointed
20977 // into by @begin and @end.
20979 // If @dest is NULL, the range indicated by @begin and @end is
20980 // removed from the sequence. If @dest iter points to a place within
20981 // the (@begin, @end) range, the range does not move.
20982 // <dest>: a #GSequenceIter
20983 // <begin>: a #GSequenceIter
20984 // <end>: a #GSequenceIter
20985 static void sequence_move_range(AT0, AT1, AT2)(AT0 /*SequenceIter*/ dest, AT1 /*SequenceIter*/ begin, AT2 /*SequenceIter*/ end) nothrow {
20986 g_sequence_move_range(UpCast!(SequenceIter*)(dest), UpCast!(SequenceIter*)(begin), UpCast!(SequenceIter*)(end));
20990 // VERSION: 2.14
20991 // MOVED TO: Sequence.remove
20992 // Removes the item pointed to by @iter. It is an error to pass the
20993 // end iterator to this function.
20995 // If the sequence has a data destroy function associated with it, this
20996 // function is called on the data for the removed item.
20997 // <iter>: a #GSequenceIter
20998 static void sequence_remove(AT0)(AT0 /*SequenceIter*/ iter) nothrow {
20999 g_sequence_remove(UpCast!(SequenceIter*)(iter));
21003 // VERSION: 2.14
21004 // MOVED TO: Sequence.remove_range
21005 // Removes all items in the (@begin, @end) range.
21007 // If the sequence has a data destroy function associated with it, this
21008 // function is called on the data for the removed items.
21009 // <begin>: a #GSequenceIter
21010 // <end>: a #GSequenceIter
21011 static void sequence_remove_range(AT0, AT1)(AT0 /*SequenceIter*/ begin, AT1 /*SequenceIter*/ end) nothrow {
21012 g_sequence_remove_range(UpCast!(SequenceIter*)(begin), UpCast!(SequenceIter*)(end));
21016 // VERSION: 2.14
21017 // MOVED TO: Sequence.set
21018 // Changes the data for the item pointed to by @iter to be @data. If
21019 // the sequence has a data destroy function associated with it, that
21020 // function is called on the existing data that @iter pointed to.
21021 // <iter>: a #GSequenceIter
21022 // <data>: new data for the item
21023 static void sequence_set(AT0, AT1)(AT0 /*SequenceIter*/ iter, AT1 /*void*/ data) nothrow {
21024 g_sequence_set(UpCast!(SequenceIter*)(iter), UpCast!(void*)(data));
21028 // VERSION: 2.14
21029 // MOVED TO: Sequence.swap
21030 // Swaps the items pointed to by @a and @b. It is allowed for @a and @b
21031 // to point into difference sequences.
21032 // <a>: a #GSequenceIter
21033 // <b>: a #GSequenceIter
21034 static void sequence_swap(AT0, AT1)(AT0 /*SequenceIter*/ a, AT1 /*SequenceIter*/ b) nothrow {
21035 g_sequence_swap(UpCast!(SequenceIter*)(a), UpCast!(SequenceIter*)(b));
21039 // VERSION: 2.2
21040 // Sets a human-readable name for the application. This name should be
21041 // localized if possible, and is intended for display to the user.
21042 // Contrast with g_set_prgname(), which sets a non-localized name.
21043 // g_set_prgname() will be called automatically by gtk_init(),
21044 // but g_set_application_name() will not.
21046 // Note that for thread safety reasons, this function can only
21047 // be called once.
21049 // The application name will be used in contexts such as error messages,
21050 // or when displaying an application's name in the task list.
21051 // <application_name>: localized name of the application
21052 static void set_application_name(AT0)(AT0 /*char*/ application_name) nothrow {
21053 g_set_application_name(toCString!(char*)(application_name));
21057 // Unintrospectable function: set_error() / g_set_error()
21058 // Does nothing if @err is %NULL; if @err is non-%NULL, then *@err
21059 // must be %NULL. A new #GError is created and assigned to *@err.
21060 // <err>: a return location for a #GError, or %NULL
21061 // <domain>: error domain
21062 // <code>: error code
21063 // <format>: printf()-style format
21064 alias g_set_error set_error; // Variadic
21067 // VERSION: 2.18
21068 // Does nothing if @err is %NULL; if @err is non-%NULL, then *@err
21069 // must be %NULL. A new #GError is created and assigned to *@err.
21070 // Unlike g_set_error(), @message is not a printf()-style format string.
21071 // Use this function if @message contains text you don't have control over,
21072 // that could include printf() escape sequences.
21073 // <err>: a return location for a #GError, or %NULL
21074 // <domain>: error domain
21075 // <code>: error code
21076 // <message>: error message
21077 static void set_error_literal(AT0, AT1)(AT0 /*Error**/ err, Quark domain, int code, AT1 /*char*/ message) nothrow {
21078 g_set_error_literal(UpCast!(Error**)(err), domain, code, toCString!(char*)(message));
21082 // Sets the name of the program. This name should <emphasis>not</emphasis>
21083 // be localized, contrast with g_set_application_name(). Note that for
21084 // thread-safety reasons this function can only be called once.
21085 // <prgname>: the name of the program.
21086 static void set_prgname(AT0)(AT0 /*char*/ prgname) nothrow {
21087 g_set_prgname(toCString!(char*)(prgname));
21091 // Unintrospectable function: set_print_handler() / g_set_print_handler()
21092 // Sets the print handler.
21094 // Any messages passed to g_print() will be output via
21095 // the new handler. The default handler simply outputs
21096 // the message to stdout. By providing your own handler
21097 // you can redirect the output, to a GTK+ widget or a
21098 // log file for example.
21099 // RETURNS: the old print handler
21100 // <func>: the new print handler
21101 static PrintFunc set_print_handler()(PrintFunc func) nothrow {
21102 return g_set_print_handler(func);
21106 // Unintrospectable function: set_printerr_handler() / g_set_printerr_handler()
21107 // Sets the handler for printing error messages.
21109 // Any messages passed to g_printerr() will be output via
21110 // the new handler. The default handler simply outputs the
21111 // message to stderr. By providing your own handler you can
21112 // redirect the output, to a GTK+ widget or a log file for
21113 // example.
21114 // RETURNS: the old error message handler
21115 // <func>: the new error message handler
21116 static PrintFunc set_printerr_handler()(PrintFunc func) nothrow {
21117 return g_set_printerr_handler(func);
21121 // VERSION: 2.4
21122 // Sets an environment variable. Both the variable's name and value
21123 // should be in the GLib file name encoding. On UNIX, this means that
21124 // they can be arbitrary byte strings. On Windows, they should be in
21125 // UTF-8.
21127 // Note that on some systems, when variables are overwritten, the memory
21128 // used for the previous variables and its value isn't reclaimed.
21130 // <warning><para>
21131 // Environment variable handling in UNIX is not thread-safe, and your
21132 // program may crash if one thread calls g_setenv() while another
21133 // thread is calling getenv(). (And note that many functions, such as
21134 // gettext(), call getenv() internally.) This function is only safe to
21135 // use at the very start of your program, before creating any other
21136 // threads (or creating objects that create worker threads of their
21137 // own).
21138 // </para><para>
21139 // If you need to set up the environment for a child process, you can
21140 // use g_get_environ() to get an environment array, modify that with
21141 // g_environ_setenv() and g_environ_unsetenv(), and then pass that
21142 // array directly to execvpe(), g_spawn_async(), or the like.
21143 // </para></warning>
21144 // RETURNS: %FALSE if the environment variable couldn't be set.
21145 // <variable>: the environment variable to set, must not contain '='.
21146 // <value>: the value for to set the variable to.
21147 // <overwrite>: whether to change the variable if it already exists.
21148 static int setenv(AT0, AT1)(AT0 /*char*/ variable, AT1 /*char*/ value, int overwrite) nothrow {
21149 return g_setenv(toCString!(char*)(variable), toCString!(char*)(value), overwrite);
21152 static Quark shell_error_quark()() nothrow {
21153 return g_shell_error_quark();
21157 // Parses a command line into an argument vector, in much the same way
21158 // the shell would, but without many of the expansions the shell would
21159 // perform (variable expansion, globs, operators, filename expansion,
21160 // etc. are not supported). The results are defined to be the same as
21161 // those you would get from a UNIX98 /bin/sh, as long as the input
21162 // contains none of the unsupported shell expansions. If the input
21163 // does contain such expansions, they are passed through
21164 // literally. Possible errors are those from the #G_SHELL_ERROR
21165 // domain. Free the returned vector with g_strfreev().
21166 // RETURNS: %TRUE on success, %FALSE if error set
21167 // <command_line>: command line to parse
21168 // <argcp>: return location for number of args
21169 // <argvp>: return location for array of args
21170 static int shell_parse_argv(AT0, AT1, AT2)(AT0 /*char*/ command_line, /*out*/ int* argcp, /*out*/ AT1 /*char***/ argvp, AT2 /*GLib2.Error**/ error=null) nothrow {
21171 return g_shell_parse_argv(toCString!(char*)(command_line), argcp, toCString!(char***)(argvp), UpCast!(GLib2.Error**)(error));
21175 // Quotes a string so that the shell (/bin/sh) will interpret the
21176 // quoted string to mean @unquoted_string. If you pass a filename to
21177 // the shell, for example, you should first quote it with this
21178 // function. The return value must be freed with g_free(). The
21179 // quoting style used is undefined (single or double quotes may be
21180 // used).
21181 // RETURNS: quoted string
21182 // <unquoted_string>: a literal string
21183 static char* /*new*/ shell_quote(AT0)(AT0 /*char*/ unquoted_string) nothrow {
21184 return g_shell_quote(toCString!(char*)(unquoted_string));
21188 // Unquotes a string as the shell (/bin/sh) would. Only handles
21189 // quotes; if a string contains file globs, arithmetic operators,
21190 // variables, backticks, redirections, or other special-to-the-shell
21191 // features, the result will be different from the result a real shell
21192 // would produce (the variables, backticks, etc. will be passed
21193 // through literally instead of being expanded). This function is
21194 // guaranteed to succeed if applied to the result of
21195 // g_shell_quote(). If it fails, it returns %NULL and sets the
21196 // error. The @quoted_string need not actually contain quoted or
21197 // escaped text; g_shell_unquote() simply goes through the string and
21198 // unquotes/unescapes anything that the shell would. Both single and
21199 // double quotes are handled, as are escapes including escaped
21200 // newlines. The return value must be freed with g_free(). Possible
21201 // errors are in the #G_SHELL_ERROR domain.
21203 // Shell quoting rules are a bit strange. Single quotes preserve the
21204 // literal string exactly. escape sequences are not allowed; not even
21205 // \' - if you want a ' in the quoted text, you have to do something
21206 // like 'foo'\''bar'. Double quotes allow $, `, ", \, and newline to
21207 // be escaped with backslash. Otherwise double quotes preserve things
21208 // literally.
21209 // RETURNS: an unquoted string
21210 // <quoted_string>: shell-quoted string
21211 static char* /*new*/ shell_unquote(AT0, AT1)(AT0 /*char*/ quoted_string, AT1 /*GLib2.Error**/ error=null) nothrow {
21212 return g_shell_unquote(toCString!(char*)(quoted_string), UpCast!(GLib2.Error**)(error));
21216 // Unintrospectable function: slice_alloc() / g_slice_alloc()
21217 // VERSION: 2.10
21218 // Allocates a block of memory from the slice allocator.
21219 // The block adress handed out can be expected to be aligned
21220 // to at least <literal>1 * sizeof (void*)</literal>,
21221 // though in general slices are 2 * sizeof (void*) bytes aligned,
21222 // if a malloc() fallback implementation is used instead,
21223 // the alignment may be reduced in a libc dependent fashion.
21224 // Note that the underlying slice allocation mechanism can
21225 // be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
21226 // environment variable.
21227 // RETURNS: a pointer to the allocated memory block
21228 // <block_size>: the number of bytes to allocate
21229 static void* slice_alloc()(size_t block_size) nothrow {
21230 return g_slice_alloc(block_size);
21234 // Unintrospectable function: slice_alloc0() / g_slice_alloc0()
21235 // VERSION: 2.10
21236 // Allocates a block of memory via g_slice_alloc() and initializes
21237 // the returned memory to 0. Note that the underlying slice allocation
21238 // mechanism can be changed with the
21239 // <link linkend="G_SLICE">G_SLICE=always-malloc</link>
21240 // environment variable.
21241 // RETURNS: a pointer to the allocated block
21242 // <block_size>: the number of bytes to allocate
21243 static void* slice_alloc0()(size_t block_size) nothrow {
21244 return g_slice_alloc0(block_size);
21248 // Unintrospectable function: slice_copy() / g_slice_copy()
21249 // VERSION: 2.14
21250 // Allocates a block of memory from the slice allocator
21251 // and copies @block_size bytes into it from @mem_block.
21252 // RETURNS: a pointer to the allocated memory block
21253 // <block_size>: the number of bytes to allocate
21254 // <mem_block>: the memory to copy
21255 static void* slice_copy(AT0)(size_t block_size, AT0 /*const(void)*/ mem_block) nothrow {
21256 return g_slice_copy(block_size, UpCast!(const(void)*)(mem_block));
21260 // VERSION: 2.10
21261 // Frees a block of memory.
21263 // The memory must have been allocated via g_slice_alloc() or
21264 // g_slice_alloc0() and the @block_size has to match the size
21265 // specified upon allocation. Note that the exact release behaviour
21266 // can be changed with the
21267 // <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
21268 // variable, also see <link linkend="G_SLICE">G_SLICE</link> for
21269 // related debugging options.
21270 // <block_size>: the size of the block
21271 // <mem_block>: a pointer to the block to free
21272 static void slice_free1(AT0)(size_t block_size, AT0 /*void*/ mem_block) nothrow {
21273 g_slice_free1(block_size, UpCast!(void*)(mem_block));
21277 // VERSION: 2.10
21278 // Frees a linked list of memory blocks of structure type @type.
21280 // The memory blocks must be equal-sized, allocated via
21281 // g_slice_alloc() or g_slice_alloc0() and linked together by a
21282 // @next pointer (similar to #GSList). The offset of the @next
21283 // field in each block is passed as third argument.
21284 // Note that the exact release behaviour can be changed with the
21285 // <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
21286 // variable, also see <link linkend="G_SLICE">G_SLICE</link> for
21287 // related debugging options.
21288 // <block_size>: the size of the blocks
21289 // <mem_chain>: a pointer to the first block of the chain
21290 // <next_offset>: the offset of the @next field in the blocks
21291 static void slice_free_chain_with_offset(AT0)(size_t block_size, AT0 /*void*/ mem_chain, size_t next_offset) nothrow {
21292 g_slice_free_chain_with_offset(block_size, UpCast!(void*)(mem_chain), next_offset);
21295 static long slice_get_config()(SliceConfig ckey) nothrow {
21296 return g_slice_get_config(ckey);
21299 static long* slice_get_config_state(AT0)(SliceConfig ckey, long address, AT0 /*uint*/ n_values) nothrow {
21300 return g_slice_get_config_state(ckey, address, UpCast!(uint*)(n_values));
21303 static void slice_set_config()(SliceConfig ckey, long value) nothrow {
21304 g_slice_set_config(ckey, value);
21308 // Unintrospectable function: snprintf() / g_snprintf()
21309 // A safer form of the standard sprintf() function. The output is guaranteed
21310 // to not exceed @n characters (including the terminating nul character), so
21311 // it is easy to ensure that a buffer overflow cannot occur.
21313 // See also g_strdup_printf().
21315 // In versions of GLib prior to 1.2.3, this function may return -1 if the
21316 // output was truncated, and the truncated string may not be nul-terminated.
21317 // In versions prior to 1.3.12, this function returns the length of the output
21318 // string.
21320 // The return value of g_snprintf() conforms to the snprintf()
21321 // function as standardized in ISO C99. Note that this is different from
21322 // traditional snprintf(), which returns the length of the output string.
21324 // The format string may contain positional parameters, as specified in
21325 // the Single Unix Specification.
21327 // was large enough.
21328 // RETURNS: the number of bytes which would be produced if the buffer
21329 // <string>: the buffer to hold the output.
21330 // <n>: the maximum number of bytes to produce (including the terminating nul character).
21331 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
21332 alias g_snprintf snprintf; // Variadic
21335 // MOVED TO: Source.remove
21336 // Removes the source with the given id from the default main context.
21337 // The id of
21338 // a #GSource is given by g_source_get_id(), or will be returned by the
21339 // functions g_source_attach(), g_idle_add(), g_idle_add_full(),
21340 // g_timeout_add(), g_timeout_add_full(), g_child_watch_add(),
21341 // g_child_watch_add_full(), g_io_add_watch(), and g_io_add_watch_full().
21343 // See also g_source_destroy(). You must use g_source_destroy() for sources
21344 // added to a non-default main context.
21345 // RETURNS: %TRUE if the source was found and removed.
21346 // <tag>: the ID of the source to remove.
21347 static int source_remove()(uint tag) nothrow {
21348 return g_source_remove(tag);
21352 // MOVED TO: Source.remove_by_funcs_user_data
21353 // Removes a source from the default main loop context given the
21354 // source functions and user data. If multiple sources exist with the
21355 // same source functions and user data, only one will be destroyed.
21356 // RETURNS: %TRUE if a source was found and removed.
21357 // <funcs>: The @source_funcs passed to g_source_new()
21358 // <user_data>: the user data for the callback
21359 static int source_remove_by_funcs_user_data(AT0, AT1)(AT0 /*SourceFuncs*/ funcs, AT1 /*void*/ user_data) nothrow {
21360 return g_source_remove_by_funcs_user_data(UpCast!(SourceFuncs*)(funcs), UpCast!(void*)(user_data));
21364 // MOVED TO: Source.remove_by_user_data
21365 // Removes a source from the default main loop context given the user
21366 // data for the callback. If multiple sources exist with the same user
21367 // data, only one will be destroyed.
21368 // RETURNS: %TRUE if a source was found and removed.
21369 // <user_data>: the user_data for the callback.
21370 static int source_remove_by_user_data(AT0)(AT0 /*void*/ user_data) nothrow {
21371 return g_source_remove_by_user_data(UpCast!(void*)(user_data));
21375 // VERSION: 2.26
21376 // MOVED TO: Source.set_name_by_id
21377 // Sets the name of a source using its ID.
21379 // This is a convenience utility to set source names from the return
21380 // value of g_idle_add(), g_timeout_add(), etc.
21381 // <tag>: a #GSource ID
21382 // <name>: debug name for the source
21383 static void source_set_name_by_id(AT0)(uint tag, AT0 /*char*/ name) nothrow {
21384 g_source_set_name_by_id(tag, toCString!(char*)(name));
21388 // Gets the smallest prime number from a built-in array of primes which
21389 // is larger than @num. This is used within GLib to calculate the optimum
21390 // size of a #GHashTable.
21392 // The built-in array of primes ranges from 11 to 13845163 such that
21393 // each prime is approximately 1.5-2 times the previous prime.
21395 // which is larger than @num
21396 // RETURNS: the smallest prime number from a built-in array of primes
21397 // <num>: a #guint
21398 static uint spaced_primes_closest()(uint num) nothrow {
21399 return g_spaced_primes_closest(num);
21403 // See g_spawn_async_with_pipes() for a full description; this function
21404 // simply calls the g_spawn_async_with_pipes() without any pipes.
21406 // You should call g_spawn_close_pid() on the returned child process
21407 // reference when you don't need it any more.
21409 // <note><para>
21410 // If you are writing a GTK+ application, and the program you
21411 // are spawning is a graphical application, too, then you may
21412 // want to use gdk_spawn_on_screen() instead to ensure that
21413 // the spawned program opens its windows on the right screen.
21414 // </para></note>
21416 // <note><para> Note that the returned @child_pid on Windows is a
21417 // handle to the child process and not its identifier. Process handles
21418 // and process identifiers are different concepts on Windows.
21419 // </para></note>
21420 // RETURNS: %TRUE on success, %FALSE if error is set
21421 // <working_directory>: child's current working directory, or %NULL to inherit parent's
21422 // <argv>: child's argument vector
21423 // <envp>: child's environment, or %NULL to inherit parent's
21424 // <flags>: flags from #GSpawnFlags
21425 // <child_setup>: function to run in the child just before exec()
21426 // <user_data>: user data for @child_setup
21427 // <child_pid>: return location for child process reference, or %NULL
21428 static int spawn_async(AT0, AT1, AT2, AT3, AT4, AT5)(AT0 /*char*/ working_directory, AT1 /*char**/ argv, AT2 /*char**/ envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, AT3 /*void*/ user_data, /*out*/ AT4 /*Pid*/ child_pid, AT5 /*GLib2.Error**/ error=null) nothrow {
21429 return g_spawn_async(toCString!(char*)(working_directory), toCString!(char**)(argv), toCString!(char**)(envp), flags, child_setup, UpCast!(void*)(user_data), UpCast!(Pid*)(child_pid), UpCast!(GLib2.Error**)(error));
21433 // Executes a child program asynchronously (your program will not
21434 // block waiting for the child to exit). The child program is
21435 // specified by the only argument that must be provided, @argv. @argv
21436 // should be a %NULL-terminated array of strings, to be passed as the
21437 // argument vector for the child. The first string in @argv is of
21438 // course the name of the program to execute. By default, the name of
21439 // the program must be a full path; the <envar>PATH</envar> shell variable
21440 // will only be searched if you pass the %G_SPAWN_SEARCH_PATH flag.
21441 // If the program name is not a full path and %G_SPAWN_SEARCH_PATH flag is not
21442 // used, then the program will be run from the current directory (or
21443 // @working_directory, if specified); this might be unexpected or even
21444 // dangerous in some cases when the current directory is world-writable.
21446 // On Windows, note that all the string or string vector arguments to
21447 // this function and the other g_spawn*() functions are in UTF-8, the
21448 // GLib file name encoding. Unicode characters that are not part of
21449 // the system codepage passed in these arguments will be correctly
21450 // available in the spawned program only if it uses wide character API
21451 // to retrieve its command line. For C programs built with Microsoft's
21452 // tools it is enough to make the program have a wmain() instead of
21453 // main(). wmain() has a wide character argument vector as parameter.
21455 // At least currently, mingw doesn't support wmain(), so if you use
21456 // mingw to develop the spawned program, it will have to call the
21457 // undocumented function __wgetmainargs() to get the wide character
21458 // argument vector and environment. See gspawn-win32-helper.c in the
21459 // GLib sources or init.c in the mingw runtime sources for a prototype
21460 // for that function. Alternatively, you can retrieve the Win32 system
21461 // level wide character command line passed to the spawned program
21462 // using the GetCommandLineW() function.
21464 // On Windows the low-level child process creation API
21465 // <function>CreateProcess()</function> doesn't use argument vectors,
21466 // but a command line. The C runtime library's
21467 // <function>spawn*()</function> family of functions (which
21468 // g_spawn_async_with_pipes() eventually calls) paste the argument
21469 // vector elements together into a command line, and the C runtime startup code
21470 // does a corresponding reconstruction of an argument vector from the
21471 // command line, to be passed to main(). Complications arise when you have
21472 // argument vector elements that contain spaces of double quotes. The
21473 // <function>spawn*()</function> functions don't do any quoting or
21474 // escaping, but on the other hand the startup code does do unquoting
21475 // and unescaping in order to enable receiving arguments with embedded
21476 // spaces or double quotes. To work around this asymmetry,
21477 // g_spawn_async_with_pipes() will do quoting and escaping on argument
21478 // vector elements that need it before calling the C runtime
21479 // spawn() function.
21481 // The returned @child_pid on Windows is a handle to the child
21482 // process, not its identifier. Process handles and process
21483 // identifiers are different concepts on Windows.
21485 // @envp is a %NULL-terminated array of strings, where each string
21486 // has the form <literal>KEY=VALUE</literal>. This will become
21487 // the child's environment. If @envp is %NULL, the child inherits its
21488 // parent's environment.
21490 // @flags should be the bitwise OR of any flags you want to affect the
21491 // function's behaviour. The %G_SPAWN_DO_NOT_REAP_CHILD means that the
21492 // child will not automatically be reaped; you must use a child watch to
21493 // be notified about the death of the child process. Eventually you must
21494 // call g_spawn_close_pid() on the @child_pid, in order to free
21495 // resources which may be associated with the child process. (On Unix,
21496 // using a child watch is equivalent to calling waitpid() or handling
21497 // the <literal>SIGCHLD</literal> signal manually. On Windows, calling g_spawn_close_pid()
21498 // is equivalent to calling CloseHandle() on the process handle returned
21499 // in @child_pid). See g_child_watch_add().
21501 // %G_SPAWN_LEAVE_DESCRIPTORS_OPEN means that the parent's open file
21502 // descriptors will be inherited by the child; otherwise all
21503 // descriptors except stdin/stdout/stderr will be closed before
21504 // calling exec() in the child. %G_SPAWN_SEARCH_PATH
21505 // means that <literal>argv[0]</literal> need not be an absolute path, it
21506 // will be looked for in the user's <envar>PATH</envar>.
21507 // %G_SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output will
21508 // be discarded, instead of going to the same location as the parent's
21509 // standard output. If you use this flag, @standard_output must be %NULL.
21510 // %G_SPAWN_STDERR_TO_DEV_NULL means that the child's standard error
21511 // will be discarded, instead of going to the same location as the parent's
21512 // standard error. If you use this flag, @standard_error must be %NULL.
21513 // %G_SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's
21514 // standard input (by default, the child's standard input is attached to
21515 // /dev/null). If you use this flag, @standard_input must be %NULL.
21516 // %G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of @argv is
21517 // the file to execute, while the remaining elements are the
21518 // actual argument vector to pass to the file. Normally
21519 // g_spawn_async_with_pipes() uses @argv[0] as the file to execute, and
21520 // passes all of @argv to the child.
21522 // @child_setup and @user_data are a function and user data. On POSIX
21523 // platforms, the function is called in the child after GLib has
21524 // performed all the setup it plans to perform (including creating
21525 // pipes, closing file descriptors, etc.) but before calling
21526 // exec(). That is, @child_setup is called just
21527 // before calling exec() in the child. Obviously
21528 // actions taken in this function will only affect the child, not the
21529 // parent.
21531 // On Windows, there is no separate fork() and exec()
21532 // functionality. Child processes are created and run with a single
21533 // API call, CreateProcess(). There is no sensible thing @child_setup
21534 // could be used for on Windows so it is ignored and not called.
21536 // If non-%NULL, @child_pid will on Unix be filled with the child's
21537 // process ID. You can use the process ID to send signals to the
21538 // child, or to use g_child_watch_add() (or waitpid()) if you specified the
21539 // %G_SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @child_pid will be
21540 // filled with a handle to the child process only if you specified the
21541 // %G_SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child
21542 // process using the Win32 API, for example wait for its termination
21543 // with the <function>WaitFor*()</function> functions, or examine its
21544 // exit code with GetExitCodeProcess(). You should close the handle
21545 // with CloseHandle() or g_spawn_close_pid() when you no longer need it.
21547 // If non-%NULL, the @standard_input, @standard_output, @standard_error
21548 // locations will be filled with file descriptors for writing to the child's
21549 // standard input or reading from its standard output or standard error.
21550 // The caller of g_spawn_async_with_pipes() must close these file descriptors
21551 // when they are no longer in use. If these parameters are %NULL, the corresponding
21552 // pipe won't be created.
21554 // If @standard_input is NULL, the child's standard input is attached to
21555 // /dev/null unless %G_SPAWN_CHILD_INHERITS_STDIN is set.
21557 // If @standard_error is NULL, the child's standard error goes to the same
21558 // location as the parent's standard error unless %G_SPAWN_STDERR_TO_DEV_NULL
21559 // is set.
21561 // If @standard_output is NULL, the child's standard output goes to the same
21562 // location as the parent's standard output unless %G_SPAWN_STDOUT_TO_DEV_NULL
21563 // is set.
21565 // @error can be %NULL to ignore errors, or non-%NULL to report errors.
21566 // If an error is set, the function returns %FALSE. Errors
21567 // are reported even if they occur in the child (for example if the
21568 // executable in <literal>argv[0]</literal> is not found). Typically
21569 // the <literal>message</literal> field of returned errors should be displayed
21570 // to users. Possible errors are those from the #G_SPAWN_ERROR domain.
21572 // If an error occurs, @child_pid, @standard_input, @standard_output,
21573 // and @standard_error will not be filled with valid values.
21575 // If @child_pid is not %NULL and an error does not occur then the returned
21576 // process reference must be closed using g_spawn_close_pid().
21578 // <note><para>
21579 // If you are writing a GTK+ application, and the program you
21580 // are spawning is a graphical application, too, then you may
21581 // want to use gdk_spawn_on_screen_with_pipes() instead to ensure that
21582 // the spawned program opens its windows on the right screen.
21583 // </para></note>
21584 // RETURNS: %TRUE on success, %FALSE if an error was set
21585 // <working_directory>: child's current working directory, or %NULL to inherit parent's, in the GLib file name encoding
21586 // <argv>: child's argument vector, in the GLib file name encoding
21587 // <envp>: child's environment, or %NULL to inherit parent's, in the GLib file name encoding
21588 // <flags>: flags from #GSpawnFlags
21589 // <child_setup>: function to run in the child just before exec()
21590 // <user_data>: user data for @child_setup
21591 // <child_pid>: return location for child process ID, or %NULL
21592 // <standard_input>: return location for file descriptor to write to child's stdin, or %NULL
21593 // <standard_output>: return location for file descriptor to read child's stdout, or %NULL
21594 // <standard_error>: return location for file descriptor to read child's stderr, or %NULL
21595 static int spawn_async_with_pipes(AT0, AT1, AT2, AT3, AT4, AT5)(AT0 /*char*/ working_directory, AT1 /*char**/ argv, AT2 /*char**/ envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, AT3 /*void*/ user_data, /*out*/ AT4 /*Pid*/ child_pid, /*out*/ int* standard_input, /*out*/ int* standard_output, /*out*/ int* standard_error, AT5 /*GLib2.Error**/ error=null) nothrow {
21596 return g_spawn_async_with_pipes(toCString!(char*)(working_directory), toCString!(char**)(argv), toCString!(char**)(envp), flags, child_setup, UpCast!(void*)(user_data), UpCast!(Pid*)(child_pid), standard_input, standard_output, standard_error, UpCast!(GLib2.Error**)(error));
21600 // On some platforms, notably Windows, the #GPid type represents a resource
21601 // which must be closed to prevent resource leaking. g_spawn_close_pid()
21602 // is provided for this purpose. It should be used on all platforms, even
21603 // though it doesn't do anything under UNIX.
21604 // <pid>: The process reference to close
21605 static void spawn_close_pid()(Pid pid) nothrow {
21606 g_spawn_close_pid(pid);
21610 // A simple version of g_spawn_async() that parses a command line with
21611 // g_shell_parse_argv() and passes it to g_spawn_async(). Runs a
21612 // command line in the background. Unlike g_spawn_async(), the
21613 // %G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note
21614 // that %G_SPAWN_SEARCH_PATH can have security implications, so
21615 // consider using g_spawn_async() directly if appropriate. Possible
21616 // errors are those from g_shell_parse_argv() and g_spawn_async().
21618 // The same concerns on Windows apply as for g_spawn_command_line_sync().
21619 // RETURNS: %TRUE on success, %FALSE if error is set.
21620 // <command_line>: a command line
21621 static int spawn_command_line_async(AT0, AT1)(AT0 /*char*/ command_line, AT1 /*GLib2.Error**/ error=null) nothrow {
21622 return g_spawn_command_line_async(toCString!(char*)(command_line), UpCast!(GLib2.Error**)(error));
21626 // A simple version of g_spawn_sync() with little-used parameters
21627 // removed, taking a command line instead of an argument vector. See
21628 // g_spawn_sync() for full details. @command_line will be parsed by
21629 // g_shell_parse_argv(). Unlike g_spawn_sync(), the %G_SPAWN_SEARCH_PATH flag
21630 // is enabled. Note that %G_SPAWN_SEARCH_PATH can have security
21631 // implications, so consider using g_spawn_sync() directly if
21632 // appropriate. Possible errors are those from g_spawn_sync() and those
21633 // from g_shell_parse_argv().
21635 // If @exit_status is non-%NULL, the exit status of the child is stored there as
21636 // it would be returned by waitpid(); standard UNIX macros such as WIFEXITED()
21637 // and WEXITSTATUS() must be used to evaluate the exit status.
21639 // On Windows, please note the implications of g_shell_parse_argv()
21640 // parsing @command_line. Parsing is done according to Unix shell rules, not
21641 // Windows command interpreter rules.
21642 // Space is a separator, and backslashes are
21643 // special. Thus you cannot simply pass a @command_line containing
21644 // canonical Windows paths, like "c:\\program files\\app\\app.exe", as
21645 // the backslashes will be eaten, and the space will act as a
21646 // separator. You need to enclose such paths with single quotes, like
21647 // "'c:\\program files\\app\\app.exe' 'e:\\folder\\argument.txt'".
21648 // RETURNS: %TRUE on success, %FALSE if an error was set
21649 // <command_line>: a command line
21650 // <standard_output>: return location for child output
21651 // <standard_error>: return location for child errors
21652 // <exit_status>: return location for child exit status, as returned by waitpid()
21653 static int spawn_command_line_sync(AT0, AT1, AT2, AT3)(AT0 /*char*/ command_line, /*out*/ AT1 /*ubyte**/ standard_output, /*out*/ AT2 /*ubyte**/ standard_error, /*out*/ int* exit_status, AT3 /*GLib2.Error**/ error=null) nothrow {
21654 return g_spawn_command_line_sync(toCString!(char*)(command_line), UpCast!(ubyte**)(standard_output), UpCast!(ubyte**)(standard_error), exit_status, UpCast!(GLib2.Error**)(error));
21657 static Quark spawn_error_quark()() nothrow {
21658 return g_spawn_error_quark();
21662 // Executes a child synchronously (waits for the child to exit before returning).
21663 // All output from the child is stored in @standard_output and @standard_error,
21664 // if those parameters are non-%NULL. Note that you must set the
21665 // %G_SPAWN_STDOUT_TO_DEV_NULL and %G_SPAWN_STDERR_TO_DEV_NULL flags when
21666 // passing %NULL for @standard_output and @standard_error.
21667 // If @exit_status is non-%NULL, the exit status of the child is stored
21668 // there as it would be returned by waitpid(); standard UNIX macros such
21669 // as WIFEXITED() and WEXITSTATUS() must be used to evaluate the exit status.
21670 // Note that this function call waitpid() even if @exit_status is %NULL, and
21671 // does not accept the %G_SPAWN_DO_NOT_REAP_CHILD flag.
21672 // If an error occurs, no data is returned in @standard_output,
21673 // @standard_error, or @exit_status.
21675 // This function calls g_spawn_async_with_pipes() internally; see that
21676 // function for full details on the other parameters and details on
21677 // how these functions work on Windows.
21678 // RETURNS: %TRUE on success, %FALSE if an error was set.
21679 // <working_directory>: child's current working directory, or %NULL to inherit parent's
21680 // <argv>: child's argument vector
21681 // <envp>: child's environment, or %NULL to inherit parent's
21682 // <flags>: flags from #GSpawnFlags
21683 // <child_setup>: function to run in the child just before exec()
21684 // <user_data>: user data for @child_setup
21685 // <standard_output>: return location for child output, or %NULL
21686 // <standard_error>: return location for child error messages, or %NULL
21687 // <exit_status>: return location for child exit status, as returned by waitpid(), or %NULL
21688 static int spawn_sync(AT0, AT1, AT2, AT3, AT4, AT5, AT6)(AT0 /*char*/ working_directory, AT1 /*char**/ argv, AT2 /*char**/ envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, AT3 /*void*/ user_data, /*out*/ AT4 /*ubyte**/ standard_output, /*out*/ AT5 /*ubyte**/ standard_error, /*out*/ int* exit_status, AT6 /*GLib2.Error**/ error=null) nothrow {
21689 return g_spawn_sync(toCString!(char*)(working_directory), toCString!(char**)(argv), toCString!(char**)(envp), flags, child_setup, UpCast!(void*)(user_data), UpCast!(ubyte**)(standard_output), UpCast!(ubyte**)(standard_error), exit_status, UpCast!(GLib2.Error**)(error));
21693 // Unintrospectable function: sprintf() / g_sprintf()
21694 // VERSION: 2.2
21695 // An implementation of the standard sprintf() function which supports
21696 // positional parameters, as specified in the Single Unix Specification.
21698 // Note that it is usually better to use g_snprintf(), to avoid the
21699 // risk of buffer overflow.
21701 // See also g_strdup_printf().
21702 // RETURNS: the number of bytes printed.
21703 // <string>: A pointer to a memory buffer to contain the resulting string. It is up to the caller to ensure that the allocated buffer is large enough to hold the formatted result
21704 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
21705 alias g_sprintf sprintf; // Variadic
21708 // Copies a nul-terminated string into the dest buffer, include the
21709 // trailing nul, and return a pointer to the trailing nul byte.
21710 // This is useful for concatenating multiple strings together
21711 // without having to repeatedly scan for the end.
21712 // RETURNS: a pointer to trailing nul byte.
21713 // <dest>: destination buffer.
21714 // <src>: source string.
21715 static char* /*new*/ stpcpy(AT0, AT1)(AT0 /*char*/ dest, AT1 /*char*/ src) nothrow {
21716 return g_stpcpy(toCString!(char*)(dest), toCString!(char*)(src));
21720 // Compares two strings for byte-by-byte equality and returns %TRUE
21721 // if they are equal. It can be passed to g_hash_table_new() as the
21722 // @key_equal_func parameter, when using non-%NULL strings as keys in a
21723 // #GHashTable.
21725 // Note that this function is primarily meant as a hash table comparison
21726 // function. For a general-purpose, %NULL-safe string comparison function,
21727 // see g_strcmp0().
21728 // RETURNS: %TRUE if the two keys match
21729 // <v1>: a key
21730 // <v2>: a key to compare with @v1
21731 static int str_equal(AT0, AT1)(AT0 /*const(void)*/ v1, AT1 /*const(void)*/ v2) nothrow {
21732 return g_str_equal(UpCast!(const(void)*)(v1), UpCast!(const(void)*)(v2));
21736 // VERSION: 2.2
21737 // Looks whether the string @str begins with @prefix.
21738 // RETURNS: %TRUE if @str begins with @prefix, %FALSE otherwise.
21739 // <str>: a nul-terminated string
21740 // <prefix>: the nul-terminated prefix to look for
21741 static int str_has_prefix(AT0, AT1)(AT0 /*char*/ str, AT1 /*char*/ prefix) nothrow {
21742 return g_str_has_prefix(toCString!(char*)(str), toCString!(char*)(prefix));
21746 // VERSION: 2.2
21747 // Looks whether the string @str ends with @suffix.
21748 // RETURNS: %TRUE if @str end with @suffix, %FALSE otherwise.
21749 // <str>: a nul-terminated string
21750 // <suffix>: the nul-terminated suffix to look for
21751 static int str_has_suffix(AT0, AT1)(AT0 /*char*/ str, AT1 /*char*/ suffix) nothrow {
21752 return g_str_has_suffix(toCString!(char*)(str), toCString!(char*)(suffix));
21756 // Converts a string to a hash value.
21758 // This function implements the widely used "djb" hash apparently posted
21759 // by Daniel Bernstein to comp.lang.c some time ago. The 32 bit
21760 // unsigned hash value starts at 5381 and for each byte 'c' in the
21761 // string, is updated: <literal>hash = hash * 33 + c</literal>. This
21762 // function uses the signed value of each byte.
21764 // It can be passed to g_hash_table_new() as the @hash_func parameter,
21765 // when using non-%NULL strings as keys in a #GHashTable.
21766 // RETURNS: a hash value corresponding to the key
21767 // <v>: a string key
21768 static uint str_hash(AT0)(AT0 /*const(void)*/ v) nothrow {
21769 return g_str_hash(UpCast!(const(void)*)(v));
21773 // For each character in @string, if the character is not in
21774 // @valid_chars, replaces the character with @substitutor.
21775 // Modifies @string in place, and return @string itself, not
21776 // a copy. The return value is to allow nesting such as
21777 // |[
21778 // g_ascii_strup (g_strcanon (str, "abc", '?'))
21779 // ]|
21780 // RETURNS: @string
21781 // <string>: a nul-terminated array of bytes
21782 // <valid_chars>: bytes permitted in @string
21783 // <substitutor>: replacement character for disallowed bytes
21784 static char* /*new*/ strcanon(AT0, AT1)(AT0 /*char*/ string_, AT1 /*char*/ valid_chars, char substitutor) nothrow {
21785 return g_strcanon(toCString!(char*)(string_), toCString!(char*)(valid_chars), substitutor);
21789 // A case-insensitive string comparison, corresponding to the standard
21790 // strcasecmp() function on platforms which support it.
21792 // or a positive value if @s1 &gt; @s2.
21794 // Deprecated:2.2: See g_strncasecmp() for a discussion of why this function
21795 // is deprecated and how to replace it.
21796 // RETURNS: 0 if the strings match, a negative value if @s1 &lt; @s2,
21797 // <s1>: a string.
21798 // <s2>: a string to compare with @s1.
21799 static int strcasecmp(AT0, AT1)(AT0 /*char*/ s1, AT1 /*char*/ s2) nothrow {
21800 return g_strcasecmp(toCString!(char*)(s1), toCString!(char*)(s2));
21804 // Removes trailing whitespace from a string.
21806 // This function doesn't allocate or reallocate any memory;
21807 // it modifies @string in place. The pointer to @string is
21808 // returned to allow the nesting of functions.
21810 // Also see g_strchug() and g_strstrip().
21811 // RETURNS: @string.
21812 // <string>: a string to remove the trailing whitespace from
21813 static char* /*new*/ strchomp(AT0)(AT0 /*char*/ string_) nothrow {
21814 return g_strchomp(toCString!(char*)(string_));
21818 // Removes leading whitespace from a string, by moving the rest
21819 // of the characters forward.
21821 // This function doesn't allocate or reallocate any memory;
21822 // it modifies @string in place. The pointer to @string is
21823 // returned to allow the nesting of functions.
21825 // Also see g_strchomp() and g_strstrip().
21826 // RETURNS: @string
21827 // <string>: a string to remove the leading whitespace from
21828 static char* /*new*/ strchug(AT0)(AT0 /*char*/ string_) nothrow {
21829 return g_strchug(toCString!(char*)(string_));
21833 // VERSION: 2.16
21834 // Compares @str1 and @str2 like strcmp(). Handles %NULL
21835 // gracefully by sorting it before non-%NULL strings.
21836 // Comparing two %NULL pointers returns 0.
21837 // RETURNS: -1, 0 or 1, if @str1 is <, == or > than @str2.
21838 // <str1>: a C string or %NULL
21839 // <str2>: another C string or %NULL
21840 static int strcmp0(AT0, AT1)(AT0 /*char*/ str1, AT1 /*char*/ str2) nothrow {
21841 return g_strcmp0(toCString!(char*)(str1), toCString!(char*)(str2));
21845 // Replaces all escaped characters with their one byte equivalent.
21847 // This function does the reverse conversion of g_strescape().
21849 // character compressed
21850 // RETURNS: a newly-allocated copy of @source with all escaped
21851 // <source>: a string to compress
21852 static char* /*new*/ strcompress(AT0)(AT0 /*char*/ source) nothrow {
21853 return g_strcompress(toCString!(char*)(source));
21857 // Unintrospectable function: strconcat() / g_strconcat()
21858 // Concatenates all of the given strings into one long string.
21859 // The returned string should be freed with g_free() when no longer needed.
21861 // Note that this function is usually not the right function to use to
21862 // assemble a translated message from pieces, since proper translation
21863 // often requires the pieces to be reordered.
21865 // <warning><para>The variable argument list <emphasis>must</emphasis> end
21866 // with %NULL. If you forget the %NULL, g_strconcat() will start appending
21867 // random memory junk to your string.</para></warning>
21868 // RETURNS: a newly-allocated string containing all the string arguments
21869 // <string1>: the first string to add, which must not be %NULL
21870 alias g_strconcat strconcat; // Variadic
21873 // Converts any delimiter characters in @string to @new_delimiter.
21874 // Any characters in @string which are found in @delimiters are
21875 // changed to the @new_delimiter character. Modifies @string in place,
21876 // and returns @string itself, not a copy. The return value is to
21877 // allow nesting such as
21878 // |[
21879 // g_ascii_strup (g_strdelimit (str, "abc", '?'))
21880 // ]|
21881 // RETURNS: @string
21882 // <string>: the string to convert
21883 // <delimiters>: a string containing the current delimiters, or %NULL to use the standard delimiters defined in #G_STR_DELIMITERS
21884 // <new_delimiter>: the new delimiter character
21885 static char* /*new*/ strdelimit(AT0, AT1)(AT0 /*char*/ string_, AT1 /*char*/ delimiters, char new_delimiter) nothrow {
21886 return g_strdelimit(toCString!(char*)(string_), toCString!(char*)(delimiters), new_delimiter);
21890 // Converts a string to lower case.
21893 // Deprecated:2.2: This function is totally broken for the reasons discussed
21894 // in the g_strncasecmp() docs - use g_ascii_strdown() or g_utf8_strdown()
21895 // instead.
21896 // RETURNS: the string
21897 // <string>: the string to convert.
21898 static char* /*new*/ strdown(AT0)(AT0 /*char*/ string_) nothrow {
21899 return g_strdown(toCString!(char*)(string_));
21903 // Duplicates a string. If @str is %NULL it returns %NULL.
21904 // The returned string should be freed with g_free()
21905 // when no longer needed.
21906 // RETURNS: a newly-allocated copy of @str
21907 // <str>: the string to duplicate
21908 static char* /*new*/ strdup(AT0)(AT0 /*char*/ str) nothrow {
21909 return g_strdup(toCString!(char*)(str));
21913 // Unintrospectable function: strdup_printf() / g_strdup_printf()
21914 // Similar to the standard C sprintf() function but safer, since it
21915 // calculates the maximum space required and allocates memory to hold
21916 // the result. The returned string should be freed with g_free() when no
21917 // longer needed.
21918 // RETURNS: a newly-allocated string holding the result
21919 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>
21920 alias g_strdup_printf strdup_printf; // Variadic
21923 // Unintrospectable function: strdup_vprintf() / g_strdup_vprintf()
21924 // Similar to the standard C vsprintf() function but safer, since it
21925 // calculates the maximum space required and allocates memory to hold
21926 // the result. The returned string should be freed with g_free() when
21927 // no longer needed.
21929 // See also g_vasprintf(), which offers the same functionality, but
21930 // additionally returns the length of the allocated string.
21931 // RETURNS: a newly-allocated string holding the result
21932 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>
21933 // <args>: the list of parameters to insert into the format string
21934 static char* /*new*/ strdup_vprintf(AT0)(AT0 /*char*/ format, va_list args) nothrow {
21935 return g_strdup_vprintf(toCString!(char*)(format), args);
21939 // Unintrospectable function: strdupv() / g_strdupv()
21940 // Copies %NULL-terminated array of strings. The copy is a deep copy;
21941 // the new array should be freed by first freeing each string, then
21942 // the array itself. g_strfreev() does this for you. If called
21943 // on a %NULL value, g_strdupv() simply returns %NULL.
21944 // RETURNS: a new %NULL-terminated array of strings.
21945 // <str_array>: a %NULL-terminated array of strings
21946 static char** strdupv(AT0)(AT0 /*char**/ str_array) nothrow {
21947 return g_strdupv(toCString!(char**)(str_array));
21951 // Returns a string corresponding to the given error code, e.g.
21952 // "no such process". You should use this function in preference to
21953 // strerror(), because it returns a string in UTF-8 encoding, and since
21954 // not all platforms support the strerror() function.
21956 // is unknown, it returns "unknown error (&lt;code&gt;)".
21957 // RETURNS: a UTF-8 string describing the error code. If the error code
21958 // <errnum>: the system error number. See the standard C %errno documentation
21959 static char* strerror()(int errnum) nothrow {
21960 return g_strerror(errnum);
21964 // Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\v', '\'
21965 // and '&quot;' in the string @source by inserting a '\' before
21966 // them. Additionally all characters in the range 0x01-0x1F (everything
21967 // below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are
21968 // replaced with a '\' followed by their octal representation.
21969 // Characters supplied in @exceptions are not escaped.
21971 // g_strcompress() does the reverse conversion.
21973 // characters escaped. See above.
21974 // RETURNS: a newly-allocated copy of @source with certain
21975 // <source>: a string to escape
21976 // <exceptions>: a string of characters not to escape in @source
21977 static char* /*new*/ strescape(AT0, AT1)(AT0 /*char*/ source, AT1 /*char*/ exceptions) nothrow {
21978 return g_strescape(toCString!(char*)(source), toCString!(char*)(exceptions));
21981 // <str_array>: a %NULL-terminated array of strings to free Frees a %NULL-terminated array of strings, and the array itself. If called on a %NULL value, g_strfreev() simply returns.
21982 static void strfreev(AT0)(AT0 /*char**/ str_array) nothrow {
21983 g_strfreev(toCString!(char**)(str_array));
21987 // Creates a new #GString, initialized with the given string.
21988 // RETURNS: the new #GString
21989 // <init>: the initial text to copy into the string
21990 static String* /*new*/ string_new(AT0)(AT0 /*char*/ init) nothrow {
21991 return g_string_new(toCString!(char*)(init));
21995 // Creates a new #GString with @len bytes of the @init buffer.
21996 // Because a length is provided, @init need not be nul-terminated,
21997 // and can contain embedded nul bytes.
21999 // Since this function does not stop at nul bytes, it is the caller's
22000 // responsibility to ensure that @init has at least @len addressable
22001 // bytes.
22002 // RETURNS: a new #GString
22003 // <init>: initial contents of the string
22004 // <len>: length of @init to use
22005 static String* /*new*/ string_new_len(AT0)(AT0 /*char*/ init, ssize_t len) nothrow {
22006 return g_string_new_len(toCString!(char*)(init), len);
22010 // Creates a new #GString, with enough space for @dfl_size
22011 // bytes. This is useful if you are going to add a lot of
22012 // text to the string and don't want it to be reallocated
22013 // too often.
22014 // RETURNS: the new #GString
22015 // <dfl_size>: the default size of the space allocated to hold the string
22016 static String* /*new*/ string_sized_new()(size_t dfl_size) nothrow {
22017 return g_string_sized_new(dfl_size);
22021 // VERSION: 2.4
22022 // An auxiliary function for gettext() support (see Q_()).
22024 // and contains a '|' character, in which case a pointer to
22025 // the substring of msgid after the first '|' character is returned.
22026 // RETURNS: @msgval, unless @msgval is identical to @msgid
22027 // <msgid>: a string
22028 // <msgval>: another string
22029 static char* strip_context(AT0, AT1)(AT0 /*char*/ msgid, AT1 /*char*/ msgval) nothrow {
22030 return g_strip_context(toCString!(char*)(msgid), toCString!(char*)(msgval));
22034 // Unintrospectable function: strjoin() / g_strjoin()
22035 // Joins a number of strings together to form one long string, with the
22036 // optional @separator inserted between each of them. The returned string
22037 // should be freed with g_free().
22039 // together, with @separator between them
22040 // RETURNS: a newly-allocated string containing all of the strings joined
22041 // <separator>: a string to insert between each of the strings, or %NULL
22042 alias g_strjoin strjoin; // Variadic
22045 // Joins a number of strings together to form one long string, with the
22046 // optional @separator inserted between each of them. The returned string
22047 // should be freed with g_free().
22049 // together, with @separator between them
22050 // RETURNS: a newly-allocated string containing all of the strings joined
22051 // <separator>: a string to insert between each of the strings, or %NULL
22052 // <str_array>: a %NULL-terminated array of strings to join
22053 static char* /*new*/ strjoinv(AT0, AT1)(AT0 /*char*/ separator, AT1 /*char**/ str_array) nothrow {
22054 return g_strjoinv(toCString!(char*)(separator), toCString!(char**)(str_array));
22058 // Portability wrapper that calls strlcat() on systems which have it,
22059 // and emulates it otherwise. Appends nul-terminated @src string to @dest,
22060 // guaranteeing nul-termination for @dest. The total size of @dest won't
22061 // exceed @dest_size.
22063 // At most dest_size - 1 characters will be copied.
22064 // Unlike strncat, dest_size is the full size of dest, not the space left over.
22065 // This function does NOT allocate memory.
22066 // This always NUL terminates (unless siz == 0 or there were no NUL characters
22067 // in the dest_size characters of dest to start with).
22069 // <note><para>Caveat: this is supposedly a more secure alternative to
22070 // strcat() or strncat(), but for real security g_strconcat() is harder
22071 // to mess up.</para></note>
22073 // (original dest)) + strlen (src), so if retval >= dest_size,
22074 // truncation occurred.
22075 // RETURNS: size of attempted result, which is MIN (dest_size, strlen
22076 // <dest>: destination buffer, already containing one nul-terminated string
22077 // <src>: source buffer
22078 // <dest_size>: length of @dest buffer in bytes (not length of existing string inside @dest)
22079 static size_t strlcat(AT0, AT1)(AT0 /*char*/ dest, AT1 /*char*/ src, size_t dest_size) nothrow {
22080 return g_strlcat(toCString!(char*)(dest), toCString!(char*)(src), dest_size);
22084 // Portability wrapper that calls strlcpy() on systems which have it,
22085 // and emulates strlcpy() otherwise. Copies @src to @dest; @dest is
22086 // guaranteed to be nul-terminated; @src must be nul-terminated;
22087 // @dest_size is the buffer size, not the number of chars to copy.
22089 // At most dest_size - 1 characters will be copied. Always nul-terminates
22090 // (unless dest_size == 0). This function does <emphasis>not</emphasis>
22091 // allocate memory. Unlike strncpy(), this function doesn't pad dest (so
22092 // it's often faster). It returns the size of the attempted result,
22093 // strlen (src), so if @retval >= @dest_size, truncation occurred.
22095 // <note><para>Caveat: strlcpy() is supposedly more secure than
22096 // strcpy() or strncpy(), but if you really want to avoid screwups,
22097 // g_strdup() is an even better idea.</para></note>
22098 // RETURNS: length of @src
22099 // <dest>: destination buffer
22100 // <src>: source buffer
22101 // <dest_size>: length of @dest in bytes
22102 static size_t strlcpy(AT0, AT1)(AT0 /*char*/ dest, AT1 /*char*/ src, size_t dest_size) nothrow {
22103 return g_strlcpy(toCString!(char*)(dest), toCString!(char*)(src), dest_size);
22107 // A case-insensitive string comparison, corresponding to the standard
22108 // strncasecmp() function on platforms which support it.
22109 // It is similar to g_strcasecmp() except it only compares the first @n
22110 // characters of the strings.
22112 // or a positive value if @s1 &gt; @s2.
22114 // Deprecated:2.2: The problem with g_strncasecmp() is that it does the
22115 // comparison by calling toupper()/tolower(). These functions are
22116 // locale-specific and operate on single bytes. However, it is impossible
22117 // to handle things correctly from an I18N standpoint by operating on
22118 // bytes, since characters may be multibyte. Thus g_strncasecmp() is
22119 // broken if your string is guaranteed to be ASCII, since it's
22120 // locale-sensitive, and it's broken if your string is localized, since
22121 // it doesn't work on many encodings at all, including UTF-8, EUC-JP,
22122 // etc.
22124 // There are therefore two replacement functions: g_ascii_strncasecmp(),
22125 // which only works on ASCII and is not locale-sensitive, and
22126 // g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8.
22127 // RETURNS: 0 if the strings match, a negative value if @s1 &lt; @s2,
22128 // <s1>: a string.
22129 // <s2>: a string to compare with @s1.
22130 // <n>: the maximum number of characters to compare.
22131 static int strncasecmp(AT0, AT1)(AT0 /*char*/ s1, AT1 /*char*/ s2, uint n) nothrow {
22132 return g_strncasecmp(toCString!(char*)(s1), toCString!(char*)(s2), n);
22136 // Duplicates the first @n bytes of a string, returning a newly-allocated
22137 // buffer @n + 1 bytes long which will always be nul-terminated.
22138 // If @str is less than @n bytes long the buffer is padded with nuls.
22139 // If @str is %NULL it returns %NULL.
22140 // The returned value should be freed when no longer needed.
22142 // <note><para>
22143 // To copy a number of characters from a UTF-8 encoded string, use
22144 // g_utf8_strncpy() instead.
22145 // </para></note>
22147 // of @str, nul-terminated
22148 // RETURNS: a newly-allocated buffer containing the first @n bytes
22149 // <str>: the string to duplicate
22150 // <n>: the maximum number of bytes to copy from @str
22151 static char* /*new*/ strndup(AT0)(AT0 /*char*/ str, size_t n) nothrow {
22152 return g_strndup(toCString!(char*)(str), n);
22156 // Creates a new string @length bytes long filled with @fill_char.
22157 // The returned string should be freed when no longer needed.
22158 // RETURNS: a newly-allocated string filled the @fill_char
22159 // <length>: the length of the new string
22160 // <fill_char>: the byte to fill the string with
22161 static char* /*new*/ strnfill()(size_t length, char fill_char) nothrow {
22162 return g_strnfill(length, fill_char);
22166 // Reverses all of the bytes in a string. For example,
22167 // <literal>g_strreverse ("abcdef")</literal> will result
22168 // in "fedcba".
22170 // Note that g_strreverse() doesn't work on UTF-8 strings
22171 // containing multibyte characters. For that purpose, use
22172 // g_utf8_strreverse().
22173 // RETURNS: the same pointer passed in as @string
22174 // <string>: the string to reverse
22175 static char* /*new*/ strreverse(AT0)(AT0 /*char*/ string_) nothrow {
22176 return g_strreverse(toCString!(char*)(string_));
22180 // Searches the string @haystack for the last occurrence
22181 // of the string @needle.
22183 // %NULL if not found.
22184 // RETURNS: a pointer to the found occurrence, or
22185 // <haystack>: a nul-terminated string
22186 // <needle>: the nul-terminated string to search for
22187 static char* /*new*/ strrstr(AT0, AT1)(AT0 /*char*/ haystack, AT1 /*char*/ needle) nothrow {
22188 return g_strrstr(toCString!(char*)(haystack), toCString!(char*)(needle));
22192 // Searches the string @haystack for the last occurrence
22193 // of the string @needle, limiting the length of the search
22194 // to @haystack_len.
22196 // %NULL if not found.
22197 // RETURNS: a pointer to the found occurrence, or
22198 // <haystack>: a nul-terminated string
22199 // <haystack_len>: the maximum length of @haystack
22200 // <needle>: the nul-terminated string to search for
22201 static char* /*new*/ strrstr_len(AT0, AT1)(AT0 /*char*/ haystack, ssize_t haystack_len, AT1 /*char*/ needle) nothrow {
22202 return g_strrstr_len(toCString!(char*)(haystack), haystack_len, toCString!(char*)(needle));
22206 // Returns a string describing the given signal, e.g. "Segmentation fault".
22207 // You should use this function in preference to strsignal(), because it
22208 // returns a string in UTF-8 encoding, and since not all platforms support
22209 // the strsignal() function.
22211 // it returns "unknown signal (&lt;signum&gt;)".
22212 // RETURNS: a UTF-8 string describing the signal. If the signal is unknown,
22213 // <signum>: the signal number. See the <literal>signal</literal> documentation
22214 static char* strsignal()(int signum) nothrow {
22215 return g_strsignal(signum);
22219 // Unintrospectable function: strsplit() / g_strsplit()
22220 // Splits a string into a maximum of @max_tokens pieces, using the given
22221 // @delimiter. If @max_tokens is reached, the remainder of @string is
22222 // appended to the last token.
22224 // As a special case, the result of splitting the empty string "" is an empty
22225 // vector, not a vector containing a single string. The reason for this
22226 // special case is that being able to represent a empty vector is typically
22227 // more useful than consistent handling of empty elements. If you do need
22228 // to represent empty elements, you'll need to check for the empty string
22229 // before calling g_strsplit().
22231 // g_strfreev() to free it.
22232 // RETURNS: a newly-allocated %NULL-terminated array of strings. Use
22233 // <string>: a string to split
22234 // <delimiter>: a string which specifies the places at which to split the string. The delimiter is not included in any of the resulting strings, unless @max_tokens is reached.
22235 // <max_tokens>: the maximum number of pieces to split @string into. If this is less than 1, the string is split completely.
22236 static char** strsplit(AT0, AT1)(AT0 /*char*/ string_, AT1 /*char*/ delimiter, int max_tokens) nothrow {
22237 return g_strsplit(toCString!(char*)(string_), toCString!(char*)(delimiter), max_tokens);
22241 // Unintrospectable function: strsplit_set() / g_strsplit_set()
22242 // VERSION: 2.4
22243 // Splits @string into a number of tokens not containing any of the characters
22244 // in @delimiter. A token is the (possibly empty) longest string that does not
22245 // contain any of the characters in @delimiters. If @max_tokens is reached, the
22246 // remainder is appended to the last token.
22248 // For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
22249 // %NULL-terminated vector containing the three strings "abc", "def",
22250 // and "ghi".
22252 // The result if g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated
22253 // vector containing the four strings "", "def", "ghi", and "".
22255 // As a special case, the result of splitting the empty string "" is an empty
22256 // vector, not a vector containing a single string. The reason for this
22257 // special case is that being able to represent a empty vector is typically
22258 // more useful than consistent handling of empty elements. If you do need
22259 // to represent empty elements, you'll need to check for the empty string
22260 // before calling g_strsplit_set().
22262 // Note that this function works on bytes not characters, so it can't be used
22263 // to delimit UTF-8 strings for anything but ASCII characters.
22265 // g_strfreev() to free it.
22266 // RETURNS: a newly-allocated %NULL-terminated array of strings. Use
22267 // <string>: The string to be tokenized
22268 // <delimiters>: A nul-terminated string containing bytes that are used to split the string.
22269 // <max_tokens>: The maximum number of tokens to split @string into. If this is less than 1, the string is split completely
22270 static char** strsplit_set(AT0, AT1)(AT0 /*char*/ string_, AT1 /*char*/ delimiters, int max_tokens) nothrow {
22271 return g_strsplit_set(toCString!(char*)(string_), toCString!(char*)(delimiters), max_tokens);
22275 // Searches the string @haystack for the first occurrence
22276 // of the string @needle, limiting the length of the search
22277 // to @haystack_len.
22279 // %NULL if not found.
22280 // RETURNS: a pointer to the found occurrence, or
22281 // <haystack>: a string
22282 // <haystack_len>: the maximum length of @haystack. Note that -1 is a valid length, if @haystack is nul-terminated, meaning it will search through the whole string.
22283 // <needle>: the string to search for
22284 static char* /*new*/ strstr_len(AT0, AT1)(AT0 /*char*/ haystack, ssize_t haystack_len, AT1 /*char*/ needle) nothrow {
22285 return g_strstr_len(toCString!(char*)(haystack), haystack_len, toCString!(char*)(needle));
22289 // Converts a string to a #gdouble value.
22290 // It calls the standard strtod() function to handle the conversion, but
22291 // if the string is not completely converted it attempts the conversion
22292 // again with g_ascii_strtod(), and returns the best match.
22294 // This function should seldom be used. The normal situation when reading
22295 // numbers not for human consumption is to use g_ascii_strtod(). Only when
22296 // you know that you must expect both locale formatted and C formatted numbers
22297 // should you use this. Make sure that you don't pass strings such as comma
22298 // separated lists of values, since the commas may be interpreted as a decimal
22299 // point in some locales, causing unexpected results.
22300 // RETURNS: the #gdouble value.
22301 // <nptr>: the string to convert to a numeric value.
22302 // <endptr>: if non-%NULL, it returns the character after the last character used in the conversion.
22303 static double strtod(AT0, AT1)(AT0 /*char*/ nptr, AT1 /*char**/ endptr) nothrow {
22304 return g_strtod(toCString!(char*)(nptr), toCString!(char**)(endptr));
22308 // Converts a string to upper case.
22311 // Deprecated:2.2: This function is totally broken for the reasons discussed
22312 // in the g_strncasecmp() docs - use g_ascii_strup() or g_utf8_strup() instead.
22313 // RETURNS: the string
22314 // <string>: the string to convert.
22315 static char* /*new*/ strup(AT0)(AT0 /*char*/ string_) nothrow {
22316 return g_strup(toCString!(char*)(string_));
22319 static Type strv_get_type()() nothrow {
22320 return g_strv_get_type();
22324 // VERSION: 2.6
22325 // Returns the length of the given %NULL-terminated
22326 // string array @str_array.
22327 // RETURNS: length of @str_array.
22328 // <str_array>: a %NULL-terminated array of strings
22329 static uint strv_length(AT0)(AT0 /*char**/ str_array) nothrow {
22330 return g_strv_length(toCString!(char**)(str_array));
22334 // Unintrospectable function: test_add_data_func() / g_test_add_data_func()
22335 // VERSION: 2.16
22336 // Create a new test case, similar to g_test_create_case(). However
22337 // the test is assumed to use no fixture, and test suites are automatically
22338 // created on the fly and added to the root fixture, based on the
22339 // slash-separated portions of @testpath. The @test_data argument
22340 // will be passed as first argument to @test_func.
22341 // <testpath>: Slash-separated test case path name for the test.
22342 // <test_data>: Test data argument for the test function.
22343 // <test_func>: The test function to invoke for this test.
22344 static void test_add_data_func(AT0, AT1)(AT0 /*char*/ testpath, AT1 /*const(void)*/ test_data, TestDataFunc test_func) nothrow {
22345 g_test_add_data_func(toCString!(char*)(testpath), UpCast!(const(void)*)(test_data), test_func);
22349 // Unintrospectable function: test_add_func() / g_test_add_func()
22350 // VERSION: 2.16
22351 // Create a new test case, similar to g_test_create_case(). However
22352 // the test is assumed to use no fixture, and test suites are automatically
22353 // created on the fly and added to the root fixture, based on the
22354 // slash-separated portions of @testpath.
22355 // <testpath>: Slash-separated test case path name for the test.
22356 // <test_func>: The test function to invoke for this test.
22357 static void test_add_func(AT0)(AT0 /*char*/ testpath, TestFunc test_func) nothrow {
22358 g_test_add_func(toCString!(char*)(testpath), test_func);
22361 // Unintrospectable function: test_add_vtable() / g_test_add_vtable()
22362 static void test_add_vtable(AT0, AT1)(AT0 /*char*/ testpath, size_t data_size, AT1 /*const(void)*/ test_data, TestFixtureFunc data_setup, TestFixtureFunc data_test, TestFixtureFunc data_teardown) nothrow {
22363 g_test_add_vtable(toCString!(char*)(testpath), data_size, UpCast!(const(void)*)(test_data), data_setup, data_test, data_teardown);
22367 // VERSION: 2.16
22368 // This function adds a message to test reports that
22369 // associates a bug URI with a test case.
22370 // Bug URIs are constructed from a base URI set with g_test_bug_base()
22371 // and @bug_uri_snippet.
22372 // <bug_uri_snippet>: Bug specific bug tracker URI portion.
22373 static void test_bug(AT0)(AT0 /*char*/ bug_uri_snippet) nothrow {
22374 g_test_bug(toCString!(char*)(bug_uri_snippet));
22378 // VERSION: 2.16
22379 // Specify the base URI for bug reports.
22381 // The base URI is used to construct bug report messages for
22382 // g_test_message() when g_test_bug() is called.
22383 // Calling this function outside of a test case sets the
22384 // default base URI for all test cases. Calling it from within
22385 // a test case changes the base URI for the scope of the test
22386 // case only.
22387 // Bug URIs are constructed by appending a bug specific URI
22388 // portion to @uri_pattern, or by replacing the special string
22389 // '\%s' within @uri_pattern if that is present.
22390 // <uri_pattern>: the base pattern for bug URIs
22391 static void test_bug_base(AT0)(AT0 /*char*/ uri_pattern) nothrow {
22392 g_test_bug_base(toCString!(char*)(uri_pattern));
22396 // Unintrospectable function: test_create_case() / g_test_create_case()
22397 // VERSION: 2.16
22398 // Create a new #GTestCase, named @test_name, this API is fairly
22399 // low level, calling g_test_add() or g_test_add_func() is preferable.
22400 // When this test is executed, a fixture structure of size @data_size
22401 // will be allocated and filled with 0s. Then @data_setup is called
22402 // to initialize the fixture. After fixture setup, the actual test
22403 // function @data_test is called. Once the test run completed, the
22404 // fixture structure is torn down by calling @data_teardown and
22405 // after that the memory is released.
22407 // Splitting up a test run into fixture setup, test function and
22408 // fixture teardown is most usful if the same fixture is used for
22409 // multiple tests. In this cases, g_test_create_case() will be
22410 // called with the same fixture, but varying @test_name and
22411 // @data_test arguments.
22412 // RETURNS: a newly allocated #GTestCase.
22413 // <test_name>: the name for the test case
22414 // <data_size>: the size of the fixture data structure
22415 // <test_data>: test data argument for the test functions
22416 // <data_setup>: the function to set up the fixture data
22417 // <data_test>: the actual test function
22418 // <data_teardown>: the function to teardown the fixture data
22419 static TestCase* test_create_case(AT0, AT1)(AT0 /*char*/ test_name, size_t data_size, AT1 /*const(void)*/ test_data, TestFixtureFunc data_setup, TestFixtureFunc data_test, TestFixtureFunc data_teardown) nothrow {
22420 return g_test_create_case(toCString!(char*)(test_name), data_size, UpCast!(const(void)*)(test_data), data_setup, data_test, data_teardown);
22424 // Unintrospectable function: test_create_suite() / g_test_create_suite()
22425 // VERSION: 2.16
22426 // Create a new test suite with the name @suite_name.
22427 // RETURNS: A newly allocated #GTestSuite instance.
22428 // <suite_name>: a name for the suite
22429 static TestSuite* test_create_suite(AT0)(AT0 /*char*/ suite_name) nothrow {
22430 return g_test_create_suite(toCString!(char*)(suite_name));
22434 // VERSION: 2.30
22435 // Indicates that a test failed. This function can be called
22436 // multiple times from the same test. You can use this function
22437 // if your test failed in a recoverable way.
22439 // Do not use this function if the failure of a test could cause
22440 // other tests to malfunction.
22442 // Calling this function will not stop the test from running, you
22443 // need to return from the test function yourself. So you can
22444 // produce additional diagnostic messages or even continue running
22445 // the test.
22447 // If not called from inside a test, this function does nothing.
22448 static void test_fail()() nothrow {
22449 g_test_fail();
22453 // Unintrospectable function: test_get_root() / g_test_get_root()
22454 // VERSION: 2.16
22455 // Get the toplevel test suite for the test path API.
22456 // RETURNS: the toplevel #GTestSuite
22457 static TestSuite* test_get_root()() nothrow {
22458 return g_test_get_root();
22462 // Unintrospectable function: test_init() / g_test_init()
22463 // VERSION: 2.16
22464 // Initialize the GLib testing framework, e.g. by seeding the
22465 // test random number generator, the name for g_get_prgname()
22466 // and parsing test related command line args.
22467 // So far, the following arguments are understood:
22468 // <variablelist>
22469 // <varlistentry>
22470 // <term><option>-l</option></term>
22471 // <listitem><para>
22472 // list test cases available in a test executable.
22473 // </para></listitem>
22474 // </varlistentry>
22475 // <varlistentry>
22476 // <term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term>
22477 // <listitem><para>
22478 // provide a random seed to reproduce test runs using random numbers.
22479 // </para></listitem>
22480 // </varlistentry>
22481 // <varlistentry>
22482 // <term><option>--verbose</option></term>
22483 // <listitem><para>run tests verbosely.</para></listitem>
22484 // </varlistentry>
22485 // <varlistentry>
22486 // <term><option>-q</option>, <option>--quiet</option></term>
22487 // <listitem><para>run tests quietly.</para></listitem>
22488 // </varlistentry>
22489 // <varlistentry>
22490 // <term><option>-p <replaceable>TESTPATH</replaceable></option></term>
22491 // <listitem><para>
22492 // execute all tests matching <replaceable>TESTPATH</replaceable>.
22493 // </para></listitem>
22494 // </varlistentry>
22495 // <varlistentry>
22496 // <term><option>-m {perf|slow|thorough|quick|undefined|no-undefined}</option></term>
22497 // <listitem><para>
22498 // execute tests according to these test modes:
22499 // <variablelist>
22500 // <varlistentry>
22501 // <term>perf</term>
22502 // <listitem><para>
22503 // performance tests, may take long and report results.
22504 // </para></listitem>
22505 // </varlistentry>
22506 // <varlistentry>
22507 // <term>slow, thorough</term>
22508 // <listitem><para>
22509 // slow and thorough tests, may take quite long and
22510 // maximize coverage.
22511 // </para></listitem>
22512 // </varlistentry>
22513 // <varlistentry>
22514 // <term>quick</term>
22515 // <listitem><para>
22516 // quick tests, should run really quickly and give good coverage.
22517 // </para></listitem>
22518 // </varlistentry>
22519 // <varlistentry>
22520 // <term>undefined</term>
22521 // <listitem><para>
22522 // tests for undefined behaviour, may provoke programming errors
22523 // under g_test_trap_fork() to check that appropriate assertions
22524 // or warnings are given
22525 // </para></listitem>
22526 // </varlistentry>
22527 // <varlistentry>
22528 // <term>no-undefined</term>
22529 // <listitem><para>
22530 // avoid tests for undefined behaviour
22531 // </para></listitem>
22532 // </varlistentry>
22533 // </variablelist>
22534 // </para></listitem>
22535 // </varlistentry>
22536 // <varlistentry>
22537 // <term><option>--debug-log</option></term>
22538 // <listitem><para>debug test logging output.</para></listitem>
22539 // </varlistentry>
22540 // <varlistentry>
22541 // <term><option>-k</option>, <option>--keep-going</option></term>
22542 // <listitem><para>gtester-specific argument.</para></listitem>
22543 // </varlistentry>
22544 // <varlistentry>
22545 // <term><option>--GTestLogFD <replaceable>N</replaceable></option></term>
22546 // <listitem><para>gtester-specific argument.</para></listitem>
22547 // </varlistentry>
22548 // <varlistentry>
22549 // <term><option>--GTestSkipCount <replaceable>N</replaceable></option></term>
22550 // <listitem><para>gtester-specific argument.</para></listitem>
22551 // </varlistentry>
22552 // </variablelist>
22553 // <argc>: Address of the @argc parameter of the main() function. Changed if any arguments were handled.
22554 // <argv>: Address of the @argv parameter of main(). Any parameters understood by g_test_init() stripped before return.
22555 alias g_test_init test_init; // Variadic
22558 // Unintrospectable function: test_log_set_fatal_handler() / g_test_log_set_fatal_handler()
22559 // VERSION: 2.22
22560 // Installs a non-error fatal log handler which can be
22561 // used to decide whether log messages which are counted
22562 // as fatal abort the program.
22564 // The use case here is that you are running a test case
22565 // that depends on particular libraries or circumstances
22566 // and cannot prevent certain known critical or warning
22567 // messages. So you install a handler that compares the
22568 // domain and message to precisely not abort in such a case.
22570 // Note that the handler is reset at the beginning of
22571 // any test case, so you have to set it inside each test
22572 // function which needs the special behavior.
22574 // This handler has no effect on g_error messages.
22575 // <log_func>: the log handler function.
22576 // <user_data>: data passed to the log handler.
22577 static void test_log_set_fatal_handler(AT0)(TestLogFatalFunc log_func, AT0 /*void*/ user_data) nothrow {
22578 g_test_log_set_fatal_handler(log_func, UpCast!(void*)(user_data));
22581 static char* test_log_type_name()(TestLogType log_type) nothrow {
22582 return g_test_log_type_name(log_type);
22586 // Unintrospectable function: test_maximized_result() / g_test_maximized_result()
22587 // VERSION: 2.16
22588 // Report the result of a performance or measurement test.
22589 // The test should generally strive to maximize the reported
22590 // quantities (larger values are better than smaller ones),
22591 // this and @maximized_quantity can determine sorting
22592 // order for test result reports.
22593 // <maximized_quantity>: the reported value
22594 // <format>: the format string of the report message
22595 alias g_test_maximized_result test_maximized_result; // Variadic
22598 // Unintrospectable function: test_message() / g_test_message()
22599 // VERSION: 2.16
22600 // Add a message to the test report.
22601 // <format>: the format string
22602 alias g_test_message test_message; // Variadic
22605 // Unintrospectable function: test_minimized_result() / g_test_minimized_result()
22606 // VERSION: 2.16
22607 // Report the result of a performance or measurement test.
22608 // The test should generally strive to minimize the reported
22609 // quantities (smaller values are better than larger ones),
22610 // this and @minimized_quantity can determine sorting
22611 // order for test result reports.
22612 // <minimized_quantity>: the reported value
22613 // <format>: the format string of the report message
22614 alias g_test_minimized_result test_minimized_result; // Variadic
22617 // VERSION: 2.16
22618 // This function enqueus a callback @destroy_func to be executed
22619 // during the next test case teardown phase. This is most useful
22620 // to auto destruct allocted test resources at the end of a test run.
22621 // Resources are released in reverse queue order, that means enqueueing
22622 // callback A before callback B will cause B() to be called before
22623 // A() during teardown.
22624 // <destroy_func>: Destroy callback for teardown phase.
22625 // <destroy_data>: Destroy callback data.
22626 static void test_queue_destroy(AT0)(DestroyNotify destroy_func, AT0 /*void*/ destroy_data) nothrow {
22627 g_test_queue_destroy(destroy_func, UpCast!(void*)(destroy_data));
22631 // VERSION: 2.16
22632 // Enqueue a pointer to be released with g_free() during the next
22633 // teardown phase. This is equivalent to calling g_test_queue_destroy()
22634 // with a destroy callback of g_free().
22635 // <gfree_pointer>: the pointer to be stored.
22636 static void test_queue_free(AT0)(AT0 /*void*/ gfree_pointer) nothrow {
22637 g_test_queue_free(UpCast!(void*)(gfree_pointer));
22641 // VERSION: 2.16
22642 // Get a reproducible random floating point number,
22643 // see g_test_rand_int() for details on test case random numbers.
22644 // RETURNS: a random number from the seeded random number generator.
22645 static double test_rand_double()() nothrow {
22646 return g_test_rand_double();
22650 // VERSION: 2.16
22651 // Get a reproducible random floating pointer number out of a specified range,
22652 // see g_test_rand_int() for details on test case random numbers.
22653 // RETURNS: a number with @range_start <= number < @range_end.
22654 // <range_start>: the minimum value returned by this function
22655 // <range_end>: the minimum value not returned by this function
22656 static double test_rand_double_range()(double range_start, double range_end) nothrow {
22657 return g_test_rand_double_range(range_start, range_end);
22661 // VERSION: 2.16
22662 // Get a reproducible random integer number.
22664 // The random numbers generated by the g_test_rand_*() family of functions
22665 // change with every new test program start, unless the --seed option is
22666 // given when starting test programs.
22668 // For individual test cases however, the random number generator is
22669 // reseeded, to avoid dependencies between tests and to make --seed
22670 // effective for all test cases.
22671 // RETURNS: a random number from the seeded random number generator.
22672 static int test_rand_int()() nothrow {
22673 return g_test_rand_int();
22677 // VERSION: 2.16
22678 // Get a reproducible random integer number out of a specified range,
22679 // see g_test_rand_int() for details on test case random numbers.
22680 // RETURNS: a number with @begin <= number < @end.
22681 // <begin>: the minimum value returned by this function
22682 // <end>: the smallest value not to be returned by this function
22683 static int test_rand_int_range()(int begin, int end) nothrow {
22684 return g_test_rand_int_range(begin, end);
22688 // VERSION: 2.16
22689 // Runs all tests under the toplevel suite which can be retrieved
22690 // with g_test_get_root(). Similar to g_test_run_suite(), the test
22691 // cases to be run are filtered according to
22692 // test path arguments (-p <replaceable>testpath</replaceable>) as
22693 // parsed by g_test_init().
22694 // g_test_run_suite() or g_test_run() may only be called once
22695 // in a program.
22696 // RETURNS: 0 on success
22697 static int test_run()() nothrow {
22698 return g_test_run();
22702 // VERSION: 2.16
22703 // Execute the tests within @suite and all nested #GTestSuites.
22704 // The test suites to be executed are filtered according to
22705 // test path arguments (-p <replaceable>testpath</replaceable>)
22706 // as parsed by g_test_init().
22707 // g_test_run_suite() or g_test_run() may only be called once
22708 // in a program.
22709 // RETURNS: 0 on success
22710 // <suite>: a #GTestSuite
22711 static int test_run_suite(AT0)(AT0 /*TestSuite*/ suite) nothrow {
22712 return g_test_run_suite(UpCast!(TestSuite*)(suite));
22716 // VERSION: 2.16
22717 // Get the time since the last start of the timer with g_test_timer_start().
22718 // RETURNS: the time since the last start of the timer, as a double
22719 static double test_timer_elapsed()() nothrow {
22720 return g_test_timer_elapsed();
22724 // VERSION: 2.16
22725 // Report the last result of g_test_timer_elapsed().
22726 // RETURNS: the last result of g_test_timer_elapsed(), as a double
22727 static double test_timer_last()() nothrow {
22728 return g_test_timer_last();
22732 // VERSION: 2.16
22733 // Start a timing test. Call g_test_timer_elapsed() when the task is supposed
22734 // to be done. Call this function again to restart the timer.
22735 static void test_timer_start()() nothrow {
22736 g_test_timer_start();
22739 static void test_trap_assertions(AT0, AT1, AT2, AT3)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, ulong assertion_flags, AT3 /*char*/ pattern) nothrow {
22740 g_test_trap_assertions(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), assertion_flags, toCString!(char*)(pattern));
22744 // VERSION: 2.16
22745 // Fork the current test program to execute a test case that might
22746 // not return or that might abort. The forked test case is aborted
22747 // and considered failing if its run time exceeds @usec_timeout.
22749 // The forking behavior can be configured with the #GTestTrapFlags flags.
22751 // In the following example, the test code forks, the forked child
22752 // process produces some sample output and exits successfully.
22753 // The forking parent process then asserts successful child program
22754 // termination and validates child program outputs.
22756 // |[
22757 // static void
22758 // test_fork_patterns (void)
22759 // {
22760 // if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
22761 // {
22762 // g_print ("some stdout text: somagic17\n");
22763 // g_printerr ("some stderr text: semagic43\n");
22764 // exit (0); /&ast; successful test run &ast;/
22765 // }
22766 // g_test_trap_assert_passed();
22767 // g_test_trap_assert_stdout ("*somagic17*");
22768 // g_test_trap_assert_stderr ("*semagic43*");
22769 // }
22770 // ]|
22772 // This function is implemented only on Unix platforms.
22773 // RETURNS: %TRUE for the forked child and %FALSE for the executing parent process.
22774 // <usec_timeout>: Timeout for the forked test in micro seconds.
22775 // <test_trap_flags>: Flags to modify forking behaviour.
22776 static int test_trap_fork()(ulong usec_timeout, TestTrapFlags test_trap_flags) nothrow {
22777 return g_test_trap_fork(usec_timeout, test_trap_flags);
22781 // VERSION: 2.16
22782 // Check the result of the last g_test_trap_fork() call.
22783 // RETURNS: %TRUE if the last forked child terminated successfully.
22784 static int test_trap_has_passed()() nothrow {
22785 return g_test_trap_has_passed();
22789 // VERSION: 2.16
22790 // Check the result of the last g_test_trap_fork() call.
22791 // RETURNS: %TRUE if the last forked child got killed due to a fork timeout.
22792 static int test_trap_reached_timeout()() nothrow {
22793 return g_test_trap_reached_timeout();
22796 // MOVED TO: Thread.error_quark
22797 static Quark thread_error_quark()() nothrow {
22798 return g_thread_error_quark();
22802 // MOVED TO: Thread.exit
22803 // Terminates the current thread.
22805 // If another thread is waiting for us using g_thread_join() then the
22806 // waiting thread will be woken up and get @retval as the return value
22807 // of g_thread_join().
22809 // Calling <literal>g_thread_exit (retval)</literal> is equivalent to
22810 // returning @retval from the function @func, as given to g_thread_new().
22812 // <note><para>
22813 // You must only call g_thread_exit() from a thread that you created
22814 // yourself with g_thread_new() or related APIs. You must not call
22815 // this function from a thread created with another threading library
22816 // or or from within a #GThreadPool.
22817 // </para></note>
22818 // <retval>: the return value of this thread
22819 static void thread_exit(AT0)(AT0 /*void*/ retval) nothrow {
22820 g_thread_exit(UpCast!(void*)(retval));
22824 // VERSION: 2.10
22825 // MOVED TO: ThreadPool.get_max_idle_time
22826 // This function will return the maximum @interval that a
22827 // thread will wait in the thread pool for new tasks before
22828 // being stopped.
22830 // If this function returns 0, threads waiting in the thread
22831 // pool for new work are not stopped.
22833 // for new tasks in the thread pool before stopping the
22834 // thread
22835 // RETURNS: the maximum @interval (milliseconds) to wait
22836 static uint thread_pool_get_max_idle_time()() nothrow {
22837 return g_thread_pool_get_max_idle_time();
22841 // MOVED TO: ThreadPool.get_max_unused_threads
22842 // Returns the maximal allowed number of unused threads.
22843 // RETURNS: the maximal number of unused threads
22844 static int thread_pool_get_max_unused_threads()() nothrow {
22845 return g_thread_pool_get_max_unused_threads();
22849 // MOVED TO: ThreadPool.get_num_unused_threads
22850 // Returns the number of currently unused threads.
22851 // RETURNS: the number of currently unused threads
22852 static uint thread_pool_get_num_unused_threads()() nothrow {
22853 return g_thread_pool_get_num_unused_threads();
22857 // VERSION: 2.10
22858 // MOVED TO: ThreadPool.set_max_idle_time
22859 // This function will set the maximum @interval that a thread
22860 // waiting in the pool for new tasks can be idle for before
22861 // being stopped. This function is similar to calling
22862 // g_thread_pool_stop_unused_threads() on a regular timeout,
22863 // except this is done on a per thread basis.
22865 // By setting @interval to 0, idle threads will not be stopped.
22867 // This function makes use of g_async_queue_timed_pop () using
22868 // @interval.
22869 // <interval>: the maximum @interval (in milliseconds) a thread can be idle
22870 static void thread_pool_set_max_idle_time()(uint interval) nothrow {
22871 g_thread_pool_set_max_idle_time(interval);
22875 // MOVED TO: ThreadPool.set_max_unused_threads
22876 // Sets the maximal number of unused threads to @max_threads.
22877 // If @max_threads is -1, no limit is imposed on the number
22878 // of unused threads.
22879 // <max_threads>: maximal number of unused threads
22880 static void thread_pool_set_max_unused_threads()(int max_threads) nothrow {
22881 g_thread_pool_set_max_unused_threads(max_threads);
22885 // MOVED TO: ThreadPool.stop_unused_threads
22886 // Stops all currently unused threads. This does not change the
22887 // maximal number of unused threads. This function can be used to
22888 // regularly stop all unused threads e.g. from g_timeout_add().
22889 static void thread_pool_stop_unused_threads()() nothrow {
22890 g_thread_pool_stop_unused_threads();
22894 // MOVED TO: Thread.yield
22895 // Causes the calling thread to voluntarily relinquish the CPU, so
22896 // that other threads can run.
22898 // This function is often used as a method to make busy wait less evil.
22899 static void thread_yield()() nothrow {
22900 g_thread_yield();
22904 // VERSION: 2.12
22905 // MOVED TO: TimeVal.from_iso8601
22906 // Converts a string containing an ISO 8601 encoded date and time
22907 // to a #GTimeVal and puts it into @time_.
22909 // @iso_date must include year, month, day, hours, minutes, and
22910 // seconds. It can optionally include fractions of a second and a time
22911 // zone indicator. (In the absence of any time zone indication, the
22912 // timestamp is assumed to be in local time.)
22913 // RETURNS: %TRUE if the conversion was successful.
22914 // <iso_date>: an ISO 8601 encoded date string
22915 // <time_>: a #GTimeVal
22916 static int time_val_from_iso8601(AT0, AT1)(AT0 /*char*/ iso_date, /*out*/ AT1 /*TimeVal*/ time_) nothrow {
22917 return g_time_val_from_iso8601(toCString!(char*)(iso_date), UpCast!(TimeVal*)(time_));
22921 // Unintrospectable function: timeout_add() / g_timeout_add()
22922 // Sets a function to be called at regular intervals, with the default
22923 // priority, #G_PRIORITY_DEFAULT. The function is called repeatedly
22924 // until it returns %FALSE, at which point the timeout is automatically
22925 // destroyed and the function will not be called again. The first call
22926 // to the function will be at the end of the first @interval.
22928 // Note that timeout functions may be delayed, due to the processing of other
22929 // event sources. Thus they should not be relied on for precise timing.
22930 // After each call to the timeout function, the time of the next
22931 // timeout is recalculated based on the current time and the given interval
22932 // (it does not try to 'catch up' time lost in delays).
22934 // If you want to have a timer in the "seconds" range and do not care
22935 // about the exact time of the first call of the timer, use the
22936 // g_timeout_add_seconds() function; this function allows for more
22937 // optimizations and more efficient system power usage.
22939 // This internally creates a main loop source using g_timeout_source_new()
22940 // and attaches it to the main loop context using g_source_attach(). You can
22941 // do these steps manually if you need greater control.
22943 // The interval given is in terms of monotonic time, not wall clock
22944 // time. See g_get_monotonic_time().
22945 // RETURNS: the ID (greater than 0) of the event source.
22946 // <interval>: the time between calls to the function, in milliseconds (1/1000ths of a second)
22947 // <function>: function to call
22948 // <data>: data to pass to @function
22949 static uint timeout_add(AT0)(uint interval, SourceFunc function_, AT0 /*void*/ data) nothrow {
22950 return g_timeout_add(interval, function_, UpCast!(void*)(data));
22954 // Sets a function to be called at regular intervals, with the given
22955 // priority. The function is called repeatedly until it returns
22956 // %FALSE, at which point the timeout is automatically destroyed and
22957 // the function will not be called again. The @notify function is
22958 // called when the timeout is destroyed. The first call to the
22959 // function will be at the end of the first @interval.
22961 // Note that timeout functions may be delayed, due to the processing of other
22962 // event sources. Thus they should not be relied on for precise timing.
22963 // After each call to the timeout function, the time of the next
22964 // timeout is recalculated based on the current time and the given interval
22965 // (it does not try to 'catch up' time lost in delays).
22967 // This internally creates a main loop source using g_timeout_source_new()
22968 // and attaches it to the main loop context using g_source_attach(). You can
22969 // do these steps manually if you need greater control.
22971 // The interval given in terms of monotonic time, not wall clock time.
22972 // See g_get_monotonic_time().
22973 // RETURNS: the ID (greater than 0) of the event source.
22974 // <priority>: the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
22975 // <interval>: the time between calls to the function, in milliseconds (1/1000ths of a second)
22976 // <function>: function to call
22977 // <data>: data to pass to @function
22978 // <notify>: function to call when the timeout is removed, or %NULL
22979 static uint timeout_add_full(AT0)(int priority, uint interval, SourceFunc function_, AT0 /*void*/ data, DestroyNotify notify) nothrow {
22980 return g_timeout_add_full(priority, interval, function_, UpCast!(void*)(data), notify);
22984 // Unintrospectable function: timeout_add_seconds() / g_timeout_add_seconds()
22985 // VERSION: 2.14
22986 // Sets a function to be called at regular intervals with the default
22987 // priority, #G_PRIORITY_DEFAULT. The function is called repeatedly until
22988 // it returns %FALSE, at which point the timeout is automatically destroyed
22989 // and the function will not be called again.
22991 // This internally creates a main loop source using
22992 // g_timeout_source_new_seconds() and attaches it to the main loop context
22993 // using g_source_attach(). You can do these steps manually if you need
22994 // greater control. Also see g_timeout_add_seconds_full().
22996 // Note that the first call of the timer may not be precise for timeouts
22997 // of one second. If you need finer precision and have such a timeout,
22998 // you may want to use g_timeout_add() instead.
23000 // The interval given is in terms of monotonic time, not wall clock
23001 // time. See g_get_monotonic_time().
23002 // RETURNS: the ID (greater than 0) of the event source.
23003 // <interval>: the time between calls to the function, in seconds
23004 // <function>: function to call
23005 // <data>: data to pass to @function
23006 static uint timeout_add_seconds(AT0)(uint interval, SourceFunc function_, AT0 /*void*/ data) nothrow {
23007 return g_timeout_add_seconds(interval, function_, UpCast!(void*)(data));
23011 // VERSION: 2.14
23012 // Sets a function to be called at regular intervals, with @priority.
23013 // The function is called repeatedly until it returns %FALSE, at which
23014 // point the timeout is automatically destroyed and the function will
23015 // not be called again.
23017 // Unlike g_timeout_add(), this function operates at whole second granularity.
23018 // The initial starting point of the timer is determined by the implementation
23019 // and the implementation is expected to group multiple timers together so that
23020 // they fire all at the same time.
23021 // To allow this grouping, the @interval to the first timer is rounded
23022 // and can deviate up to one second from the specified interval.
23023 // Subsequent timer iterations will generally run at the specified interval.
23025 // Note that timeout functions may be delayed, due to the processing of other
23026 // event sources. Thus they should not be relied on for precise timing.
23027 // After each call to the timeout function, the time of the next
23028 // timeout is recalculated based on the current time and the given @interval
23030 // If you want timing more precise than whole seconds, use g_timeout_add()
23031 // instead.
23033 // The grouping of timers to fire at the same time results in a more power
23034 // and CPU efficient behavior so if your timer is in multiples of seconds
23035 // and you don't require the first timer exactly one second from now, the
23036 // use of g_timeout_add_seconds() is preferred over g_timeout_add().
23038 // This internally creates a main loop source using
23039 // g_timeout_source_new_seconds() and attaches it to the main loop context
23040 // using g_source_attach(). You can do these steps manually if you need
23041 // greater control.
23043 // The interval given is in terms of monotonic time, not wall clock
23044 // time. See g_get_monotonic_time().
23045 // RETURNS: the ID (greater than 0) of the event source.
23046 // <priority>: the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
23047 // <interval>: the time between calls to the function, in seconds
23048 // <function>: function to call
23049 // <data>: data to pass to @function
23050 // <notify>: function to call when the timeout is removed, or %NULL
23051 static uint timeout_add_seconds_full(AT0)(int priority, uint interval, SourceFunc function_, AT0 /*void*/ data, DestroyNotify notify) nothrow {
23052 return g_timeout_add_seconds_full(priority, interval, function_, UpCast!(void*)(data), notify);
23056 // Creates a new timeout source.
23058 // The source will not initially be associated with any #GMainContext
23059 // and must be added to one with g_source_attach() before it will be
23060 // executed.
23062 // The interval given is in terms of monotonic time, not wall clock
23063 // time. See g_get_monotonic_time().
23064 // RETURNS: the newly-created timeout source
23065 // <interval>: the timeout interval in milliseconds.
23066 static Source* /*new*/ timeout_source_new()(uint interval) nothrow {
23067 return g_timeout_source_new(interval);
23071 // VERSION: 2.14
23072 // Creates a new timeout source.
23074 // The source will not initially be associated with any #GMainContext
23075 // and must be added to one with g_source_attach() before it will be
23076 // executed.
23078 // The scheduling granularity/accuracy of this timeout source will be
23079 // in seconds.
23081 // The interval given in terms of monotonic time, not wall clock time.
23082 // See g_get_monotonic_time().
23083 // RETURNS: the newly-created timeout source
23084 // <interval>: the timeout interval in seconds
23085 static Source* /*new*/ timeout_source_new_seconds()(uint interval) nothrow {
23086 return g_timeout_source_new_seconds(interval);
23090 // MOVED TO: TrashStack.height
23091 // Returns the height of a #GTrashStack.
23093 // Note that execution of this function is of O(N) complexity
23094 // where N denotes the number of items on the stack.
23095 // RETURNS: the height of the stack
23096 // <stack_p>: a #GTrashStack
23097 static uint trash_stack_height(AT0)(AT0 /*TrashStack**/ stack_p) nothrow {
23098 return g_trash_stack_height(UpCast!(TrashStack**)(stack_p));
23102 // MOVED TO: TrashStack.push
23103 // Pushes a piece of memory onto a #GTrashStack.
23104 // <stack_p>: a #GTrashStack
23105 // <data_p>: the piece of memory to push on the stack
23106 static void trash_stack_push(AT0, AT1)(AT0 /*TrashStack**/ stack_p, AT1 /*void*/ data_p) nothrow {
23107 g_trash_stack_push(UpCast!(TrashStack**)(stack_p), UpCast!(void*)(data_p));
23111 // Unintrospectable function: try_malloc() / g_try_malloc()
23112 // Attempts to allocate @n_bytes, and returns %NULL on failure.
23113 // Contrast with g_malloc(), which aborts the program on failure.
23114 // RETURNS: the allocated memory, or %NULL.
23115 // <n_bytes>: number of bytes to allocate.
23116 static void* try_malloc()(size_t n_bytes) nothrow {
23117 return g_try_malloc(n_bytes);
23121 // Unintrospectable function: try_malloc0() / g_try_malloc0()
23122 // VERSION: 2.8
23123 // Attempts to allocate @n_bytes, initialized to 0's, and returns %NULL on
23124 // failure. Contrast with g_malloc0(), which aborts the program on failure.
23125 // RETURNS: the allocated memory, or %NULL
23126 // <n_bytes>: number of bytes to allocate
23127 static void* try_malloc0()(size_t n_bytes) nothrow {
23128 return g_try_malloc0(n_bytes);
23132 // Unintrospectable function: try_malloc0_n() / g_try_malloc0_n()
23133 // VERSION: 2.24
23134 // This function is similar to g_try_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes,
23135 // but care is taken to detect possible overflow during multiplication.
23136 // RETURNS: the allocated memory, or %NULL
23137 // <n_blocks>: the number of blocks to allocate
23138 // <n_block_bytes>: the size of each block in bytes
23139 static void* try_malloc0_n()(size_t n_blocks, size_t n_block_bytes) nothrow {
23140 return g_try_malloc0_n(n_blocks, n_block_bytes);
23144 // Unintrospectable function: try_malloc_n() / g_try_malloc_n()
23145 // VERSION: 2.24
23146 // This function is similar to g_try_malloc(), allocating (@n_blocks * @n_block_bytes) bytes,
23147 // but care is taken to detect possible overflow during multiplication.
23148 // RETURNS: the allocated memory, or %NULL.
23149 // <n_blocks>: the number of blocks to allocate
23150 // <n_block_bytes>: the size of each block in bytes
23151 static void* try_malloc_n()(size_t n_blocks, size_t n_block_bytes) nothrow {
23152 return g_try_malloc_n(n_blocks, n_block_bytes);
23156 // Unintrospectable function: try_realloc() / g_try_realloc()
23157 // Attempts to realloc @mem to a new size, @n_bytes, and returns %NULL
23158 // on failure. Contrast with g_realloc(), which aborts the program
23159 // on failure. If @mem is %NULL, behaves the same as g_try_malloc().
23160 // RETURNS: the allocated memory, or %NULL.
23161 // <mem>: previously-allocated memory, or %NULL.
23162 // <n_bytes>: number of bytes to allocate.
23163 static void* try_realloc(AT0)(AT0 /*void*/ mem, size_t n_bytes) nothrow {
23164 return g_try_realloc(UpCast!(void*)(mem), n_bytes);
23168 // Unintrospectable function: try_realloc_n() / g_try_realloc_n()
23169 // VERSION: 2.24
23170 // This function is similar to g_try_realloc(), allocating (@n_blocks * @n_block_bytes) bytes,
23171 // but care is taken to detect possible overflow during multiplication.
23172 // RETURNS: the allocated memory, or %NULL.
23173 // <mem>: previously-allocated memory, or %NULL.
23174 // <n_blocks>: the number of blocks to allocate
23175 // <n_block_bytes>: the size of each block in bytes
23176 static void* try_realloc_n(AT0)(AT0 /*void*/ mem, size_t n_blocks, size_t n_block_bytes) nothrow {
23177 return g_try_realloc_n(UpCast!(void*)(mem), n_blocks, n_block_bytes);
23181 // Convert a string from UCS-4 to UTF-16. A 0 character will be
23182 // added to the result after the converted text.
23184 // This value must be freed with g_free(). If an
23185 // error occurs, %NULL will be returned and
23186 // @error set.
23187 // RETURNS: a pointer to a newly allocated UTF-16 string.
23188 // <str>: a UCS-4 encoded string
23189 // <len>: the maximum length (number of characters) of @str to use. If @len < 0, then the string is nul-terminated.
23190 // <items_read>: location to store number of bytes read, or %NULL. If an error occurs then the index of the invalid input is stored here.
23191 // <items_written>: location to store number of <type>gunichar2</type> written, or %NULL. The value stored here does not include the trailing 0.
23192 static wchar* ucs4_to_utf16(AT0, AT1, AT2, AT3)(AT0 /*dchar*/ str, c_long len, AT1 /*c_long*/ items_read, AT2 /*c_long*/ items_written, AT3 /*GLib2.Error**/ error=null) nothrow {
23193 return g_ucs4_to_utf16(UpCast!(dchar*)(str), len, UpCast!(c_long*)(items_read), UpCast!(c_long*)(items_written), UpCast!(GLib2.Error**)(error));
23197 // Convert a string from a 32-bit fixed width representation as UCS-4.
23198 // to UTF-8. The result will be terminated with a 0 byte.
23200 // This value must be freed with g_free(). If an
23201 // error occurs, %NULL will be returned and
23202 // @error set. In that case, @items_read will be
23203 // set to the position of the first invalid input
23204 // character.
23205 // RETURNS: a pointer to a newly allocated UTF-8 string.
23206 // <str>: a UCS-4 encoded string
23207 // <len>: the maximum length (number of characters) of @str to use. If @len < 0, then the string is nul-terminated.
23208 // <items_read>: location to store number of characters read, or %NULL.
23209 // <items_written>: location to store number of bytes written or %NULL. The value here stored does not include the trailing 0 byte.
23210 static char* /*new*/ ucs4_to_utf8(AT0, AT1, AT2, AT3)(AT0 /*dchar*/ str, c_long len, AT1 /*c_long*/ items_read, AT2 /*c_long*/ items_written, AT3 /*GLib2.Error**/ error=null) nothrow {
23211 return g_ucs4_to_utf8(UpCast!(dchar*)(str), len, UpCast!(c_long*)(items_read), UpCast!(c_long*)(items_written), UpCast!(GLib2.Error**)(error));
23215 // Determines the break type of @c. @c should be a Unicode character
23216 // (to derive a character from UTF-8 encoded text, use
23217 // g_utf8_get_char()). The break type is used to find word and line
23218 // breaks ("text boundaries"), Pango implements the Unicode boundary
23219 // resolution algorithms and normally you would use a function such
23220 // as pango_break() instead of caring about break types yourself.
23221 // RETURNS: the break type of @c
23222 // <c>: a Unicode character
23223 static UnicodeBreakType unichar_break_type()(dchar c) nothrow {
23224 return g_unichar_break_type(c);
23228 // VERSION: 2.14
23229 // Determines the canonical combining class of a Unicode character.
23230 // RETURNS: the combining class of the character
23231 // <uc>: a Unicode character
23232 static int unichar_combining_class()(dchar uc) nothrow {
23233 return g_unichar_combining_class(uc);
23237 // VERSION: 2.30
23238 // Performs a single composition step of the
23239 // Unicode canonical composition algorithm.
23241 // This function includes algorithmic Hangul Jamo composition,
23242 // but it is not exactly the inverse of g_unichar_decompose().
23243 // No composition can have either of @a or @b equal to zero.
23244 // To be precise, this function composes if and only if
23245 // there exists a Primary Composite P which is canonically
23246 // equivalent to the sequence <@a,@b>. See the Unicode
23247 // Standard for the definition of Primary Composite.
23249 // If @a and @b do not compose a new character, @ch is set to zero.
23251 // See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
23252 // for details.
23253 // RETURNS: %TRUE if the characters could be composed
23254 // <a>: a Unicode character
23255 // <b>: a Unicode character
23256 // <ch>: return location for the composed character
23257 static int unichar_compose(AT0)(dchar a, dchar b, AT0 /*dchar*/ ch) nothrow {
23258 return g_unichar_compose(a, b, UpCast!(dchar*)(ch));
23262 // VERSION: 2.30
23263 // Performs a single decomposition step of the
23264 // Unicode canonical decomposition algorithm.
23266 // This function does not include compatibility
23267 // decompositions. It does, however, include algorithmic
23268 // Hangul Jamo decomposition, as well as 'singleton'
23269 // decompositions which replace a character by a single
23270 // other character. In the case of singletons *@b will
23271 // be set to zero.
23273 // If @ch is not decomposable, *@a is set to @ch and *@b
23274 // is set to zero.
23276 // Note that the way Unicode decomposition pairs are
23277 // defined, it is guaranteed that @b would not decompose
23278 // further, but @a may itself decompose. To get the full
23279 // canonical decomposition for @ch, one would need to
23280 // recursively call this function on @a. Or use
23281 // g_unichar_fully_decompose().
23283 // See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
23284 // for details.
23285 // RETURNS: %TRUE if the character could be decomposed
23286 // <ch>: a Unicode character
23287 // <a>: return location for the first component of @ch
23288 // <b>: return location for the second component of @ch
23289 static int unichar_decompose(AT0, AT1)(dchar ch, AT0 /*dchar*/ a, AT1 /*dchar*/ b) nothrow {
23290 return g_unichar_decompose(ch, UpCast!(dchar*)(a), UpCast!(dchar*)(b));
23294 // Determines the numeric value of a character as a decimal
23295 // digit.
23297 // g_unichar_isdigit()), its numeric value. Otherwise, -1.
23298 // RETURNS: If @c is a decimal digit (according to
23299 // <c>: a Unicode character
23300 static int unichar_digit_value()(dchar c) nothrow {
23301 return g_unichar_digit_value(c);
23305 // VERSION: 2.30
23306 // Computes the canonical or compatibility decomposition of a
23307 // Unicode character. For compatibility decomposition,
23308 // pass %TRUE for @compat; for canonical decomposition
23309 // pass %FALSE for @compat.
23311 // The decomposed sequence is placed in @result. Only up to
23312 // @result_len characters are written into @result. The length
23313 // of the full decomposition (irrespective of @result_len) is
23314 // returned by the function. For canonical decomposition,
23315 // currently all decompositions are of length at most 4, but
23316 // this may change in the future (very unlikely though).
23317 // At any rate, Unicode does guarantee that a buffer of length
23318 // 18 is always enough for both compatibility and canonical
23319 // decompositions, so that is the size recommended. This is provided
23320 // as %G_UNICHAR_MAX_DECOMPOSITION_LENGTH.
23322 // See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
23323 // for details.
23324 // RETURNS: the length of the full decomposition.
23325 // <ch>: a Unicode character.
23326 // <compat>: whether perform canonical or compatibility decomposition
23327 // <result>: location to store decomposed result, or %NULL
23328 // <result_len>: length of @result
23329 static size_t unichar_fully_decompose(AT0)(dchar ch, int compat, AT0 /*dchar*/ result, size_t result_len) nothrow {
23330 return g_unichar_fully_decompose(ch, compat, UpCast!(dchar*)(result), result_len);
23334 // VERSION: 2.4
23335 // In Unicode, some characters are <firstterm>mirrored</firstterm>. This
23336 // means that their images are mirrored horizontally in text that is laid
23337 // out from right to left. For instance, "(" would become its mirror image,
23338 // ")", in right-to-left text.
23340 // If @ch has the Unicode mirrored property and there is another unicode
23341 // character that typically has a glyph that is the mirror image of @ch's
23342 // glyph and @mirrored_ch is set, it puts that character in the address
23343 // pointed to by @mirrored_ch. Otherwise the original character is put.
23344 // RETURNS: %TRUE if @ch has a mirrored character, %FALSE otherwise
23345 // <ch>: a Unicode character
23346 // <mirrored_ch>: location to store the mirrored character
23347 static int unichar_get_mirror_char(AT0)(dchar ch, AT0 /*dchar*/ mirrored_ch) nothrow {
23348 return g_unichar_get_mirror_char(ch, UpCast!(dchar*)(mirrored_ch));
23352 // VERSION: 2.14
23353 // Looks up the #GUnicodeScript for a particular character (as defined
23354 // by Unicode Standard Annex \#24). No check is made for @ch being a
23355 // valid Unicode character; if you pass in invalid character, the
23356 // result is undefined.
23358 // This function is equivalent to pango_script_for_unichar() and the
23359 // two are interchangeable.
23360 // RETURNS: the #GUnicodeScript for the character.
23361 // <ch>: a Unicode character
23362 static UnicodeScript unichar_get_script()(dchar ch) nothrow {
23363 return g_unichar_get_script(ch);
23367 // Determines whether a character is alphanumeric.
23368 // Given some UTF-8 text, obtain a character value
23369 // with g_utf8_get_char().
23370 // RETURNS: %TRUE if @c is an alphanumeric character
23371 // <c>: a Unicode character
23372 static int unichar_isalnum()(dchar c) nothrow {
23373 return g_unichar_isalnum(c);
23377 // Determines whether a character is alphabetic (i.e. a letter).
23378 // Given some UTF-8 text, obtain a character value with
23379 // g_utf8_get_char().
23380 // RETURNS: %TRUE if @c is an alphabetic character
23381 // <c>: a Unicode character
23382 static int unichar_isalpha()(dchar c) nothrow {
23383 return g_unichar_isalpha(c);
23387 // Determines whether a character is a control character.
23388 // Given some UTF-8 text, obtain a character value with
23389 // g_utf8_get_char().
23390 // RETURNS: %TRUE if @c is a control character
23391 // <c>: a Unicode character
23392 static int unichar_iscntrl()(dchar c) nothrow {
23393 return g_unichar_iscntrl(c);
23397 // Determines if a given character is assigned in the Unicode
23398 // standard.
23399 // RETURNS: %TRUE if the character has an assigned value
23400 // <c>: a Unicode character
23401 static int unichar_isdefined()(dchar c) nothrow {
23402 return g_unichar_isdefined(c);
23406 // Determines whether a character is numeric (i.e. a digit). This
23407 // covers ASCII 0-9 and also digits in other languages/scripts. Given
23408 // some UTF-8 text, obtain a character value with g_utf8_get_char().
23409 // RETURNS: %TRUE if @c is a digit
23410 // <c>: a Unicode character
23411 static int unichar_isdigit()(dchar c) nothrow {
23412 return g_unichar_isdigit(c);
23416 // Determines whether a character is printable and not a space
23417 // (returns %FALSE for control characters, format characters, and
23418 // spaces). g_unichar_isprint() is similar, but returns %TRUE for
23419 // spaces. Given some UTF-8 text, obtain a character value with
23420 // g_utf8_get_char().
23421 // RETURNS: %TRUE if @c is printable unless it's a space
23422 // <c>: a Unicode character
23423 static int unichar_isgraph()(dchar c) nothrow {
23424 return g_unichar_isgraph(c);
23428 // Determines whether a character is a lowercase letter.
23429 // Given some UTF-8 text, obtain a character value with
23430 // g_utf8_get_char().
23431 // RETURNS: %TRUE if @c is a lowercase letter
23432 // <c>: a Unicode character
23433 static int unichar_islower()(dchar c) nothrow {
23434 return g_unichar_islower(c);
23438 // VERSION: 2.14
23439 // Determines whether a character is a mark (non-spacing mark,
23440 // combining mark, or enclosing mark in Unicode speak).
23441 // Given some UTF-8 text, obtain a character value
23442 // with g_utf8_get_char().
23444 // Note: in most cases where isalpha characters are allowed,
23445 // ismark characters should be allowed to as they are essential
23446 // for writing most European languages as well as many non-Latin
23447 // scripts.
23448 // RETURNS: %TRUE if @c is a mark character
23449 // <c>: a Unicode character
23450 static int unichar_ismark()(dchar c) nothrow {
23451 return g_unichar_ismark(c);
23455 // Determines whether a character is printable.
23456 // Unlike g_unichar_isgraph(), returns %TRUE for spaces.
23457 // Given some UTF-8 text, obtain a character value with
23458 // g_utf8_get_char().
23459 // RETURNS: %TRUE if @c is printable
23460 // <c>: a Unicode character
23461 static int unichar_isprint()(dchar c) nothrow {
23462 return g_unichar_isprint(c);
23466 // Determines whether a character is punctuation or a symbol.
23467 // Given some UTF-8 text, obtain a character value with
23468 // g_utf8_get_char().
23469 // RETURNS: %TRUE if @c is a punctuation or symbol character
23470 // <c>: a Unicode character
23471 static int unichar_ispunct()(dchar c) nothrow {
23472 return g_unichar_ispunct(c);
23476 // Determines whether a character is a space, tab, or line separator
23477 // (newline, carriage return, etc.). Given some UTF-8 text, obtain a
23478 // character value with g_utf8_get_char().
23480 // (Note: don't use this to do word breaking; you have to use
23481 // Pango or equivalent to get word breaking right, the algorithm
23482 // is fairly complex.)
23483 // RETURNS: %TRUE if @c is a space character
23484 // <c>: a Unicode character
23485 static int unichar_isspace()(dchar c) nothrow {
23486 return g_unichar_isspace(c);
23490 // Determines if a character is titlecase. Some characters in
23491 // Unicode which are composites, such as the DZ digraph
23492 // have three case variants instead of just two. The titlecase
23493 // form is used at the beginning of a word where only the
23494 // first letter is capitalized. The titlecase form of the DZ
23495 // digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.
23496 // RETURNS: %TRUE if the character is titlecase
23497 // <c>: a Unicode character
23498 static int unichar_istitle()(dchar c) nothrow {
23499 return g_unichar_istitle(c);
23503 // Determines if a character is uppercase.
23504 // RETURNS: %TRUE if @c is an uppercase character
23505 // <c>: a Unicode character
23506 static int unichar_isupper()(dchar c) nothrow {
23507 return g_unichar_isupper(c);
23511 // Determines if a character is typically rendered in a double-width
23512 // cell.
23513 // RETURNS: %TRUE if the character is wide
23514 // <c>: a Unicode character
23515 static int unichar_iswide()(dchar c) nothrow {
23516 return g_unichar_iswide(c);
23520 // VERSION: 2.12
23521 // Determines if a character is typically rendered in a double-width
23522 // cell under legacy East Asian locales. If a character is wide according to
23523 // g_unichar_iswide(), then it is also reported wide with this function, but
23524 // the converse is not necessarily true. See the
23525 // <ulink url="http://www.unicode.org/reports/tr11/">Unicode Standard
23526 // Annex #11</ulink> for details.
23528 // If a character passes the g_unichar_iswide() test then it will also pass
23529 // this test, but not the other way around. Note that some characters may
23530 // pas both this test and g_unichar_iszerowidth().
23531 // RETURNS: %TRUE if the character is wide in legacy East Asian locales
23532 // <c>: a Unicode character
23533 static int unichar_iswide_cjk()(dchar c) nothrow {
23534 return g_unichar_iswide_cjk(c);
23538 // Determines if a character is a hexidecimal digit.
23539 // RETURNS: %TRUE if the character is a hexadecimal digit
23540 // <c>: a Unicode character.
23541 static int unichar_isxdigit()(dchar c) nothrow {
23542 return g_unichar_isxdigit(c);
23546 // VERSION: 2.14
23547 // Determines if a given character typically takes zero width when rendered.
23548 // The return value is %TRUE for all non-spacing and enclosing marks
23549 // (e.g., combining accents), format characters, zero-width
23550 // space, but not U+00AD SOFT HYPHEN.
23552 // A typical use of this function is with one of g_unichar_iswide() or
23553 // g_unichar_iswide_cjk() to determine the number of cells a string occupies
23554 // when displayed on a grid display (terminals). However, note that not all
23555 // terminals support zero-width rendering of zero-width marks.
23556 // RETURNS: %TRUE if the character has zero width
23557 // <c>: a Unicode character
23558 static int unichar_iszerowidth()(dchar c) nothrow {
23559 return g_unichar_iszerowidth(c);
23563 // Converts a single character to UTF-8.
23564 // RETURNS: number of bytes written
23565 // <c>: a Unicode character code
23566 // <outbuf>: output buffer, must have at least 6 bytes of space. If %NULL, the length will be computed and returned and nothing will be written to @outbuf.
23567 static int unichar_to_utf8(AT0)(dchar c, AT0 /*char*/ outbuf) nothrow {
23568 return g_unichar_to_utf8(c, toCString!(char*)(outbuf));
23572 // Converts a character to lower case.
23574 // If @c is not an upperlower or titlecase character,
23575 // or has no lowercase equivalent @c is returned unchanged.
23576 // RETURNS: the result of converting @c to lower case.
23577 // <c>: a Unicode character.
23578 static dchar unichar_tolower()(dchar c) nothrow {
23579 return g_unichar_tolower(c);
23583 // Converts a character to the titlecase.
23585 // If @c is not an uppercase or lowercase character,
23586 // @c is returned unchanged.
23587 // RETURNS: the result of converting @c to titlecase.
23588 // <c>: a Unicode character
23589 static dchar unichar_totitle()(dchar c) nothrow {
23590 return g_unichar_totitle(c);
23594 // Converts a character to uppercase.
23596 // If @c is not an lowercase or titlecase character,
23597 // or has no upper case equivalent @c is returned unchanged.
23598 // RETURNS: the result of converting @c to uppercase.
23599 // <c>: a Unicode character
23600 static dchar unichar_toupper()(dchar c) nothrow {
23601 return g_unichar_toupper(c);
23605 // Classifies a Unicode character by type.
23606 // RETURNS: the type of the character.
23607 // <c>: a Unicode character
23608 static UnicodeType unichar_type()(dchar c) nothrow {
23609 return g_unichar_type(c);
23613 // Checks whether @ch is a valid Unicode character. Some possible
23614 // integer values of @ch will not be valid. 0 is considered a valid
23615 // character, though it's normally a string terminator.
23616 // RETURNS: %TRUE if @ch is a valid Unicode character
23617 // <ch>: a Unicode character
23618 static int unichar_validate()(dchar ch) nothrow {
23619 return g_unichar_validate(ch);
23623 // Determines the numeric value of a character as a hexidecimal
23624 // digit.
23626 // g_unichar_isxdigit()), its numeric value. Otherwise, -1.
23627 // RETURNS: If @c is a hex digit (according to
23628 // <c>: a Unicode character
23629 static int unichar_xdigit_value()(dchar c) nothrow {
23630 return g_unichar_xdigit_value(c);
23634 // DEPRECATED (v2.30) function: unicode_canonical_decomposition - Use the more flexible g_unichar_fully_decompose()
23635 // Computes the canonical decomposition of a Unicode character.
23637 // @result_len is set to the resulting length of the string.
23639 // instead.
23640 // RETURNS: a newly allocated string of Unicode characters.
23641 // <ch>: a Unicode character.
23642 // <result_len>: location to store the length of the return value.
23643 static dchar* unicode_canonical_decomposition(AT0)(dchar ch, AT0 /*size_t*/ result_len) nothrow {
23644 return g_unicode_canonical_decomposition(ch, UpCast!(size_t*)(result_len));
23648 // Computes the canonical ordering of a string in-place.
23649 // This rearranges decomposed characters in the string
23650 // according to their combining classes. See the Unicode
23651 // manual for more information.
23652 // <string>: a UCS-4 encoded string.
23653 // <len>: the maximum length of @string to use.
23654 static void unicode_canonical_ordering(AT0)(AT0 /*dchar*/ string_, size_t len) nothrow {
23655 g_unicode_canonical_ordering(UpCast!(dchar*)(string_), len);
23659 // VERSION: 2.30
23660 // Looks up the Unicode script for @iso15924. ISO 15924 assigns four-letter
23661 // codes to scripts. For example, the code for Arabic is 'Arab'.
23662 // This function accepts four letter codes encoded as a @guint32 in a
23663 // big-endian fashion. That is, the code expected for Arabic is
23664 // 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).
23666 // See <ulink url="http://unicode.org/iso15924/codelists.html">Codes for the
23667 // representation of names of scripts</ulink> for details.
23669 // of %G_UNICODE_SCRIPT_INVALID_CODE if @iso15924 is zero and
23670 // %G_UNICODE_SCRIPT_UNKNOWN if @iso15924 is unknown.
23671 // RETURNS: the Unicode script for @iso15924, or
23672 // <iso15924>: a Unicode script
23673 static UnicodeScript unicode_script_from_iso15924()(uint iso15924) nothrow {
23674 return g_unicode_script_from_iso15924(iso15924);
23678 // VERSION: 2.30
23679 // Looks up the ISO 15924 code for @script. ISO 15924 assigns four-letter
23680 // codes to scripts. For example, the code for Arabic is 'Arab'. The
23681 // four letter codes are encoded as a @guint32 by this function in a
23682 // big-endian fashion. That is, the code returned for Arabic is
23683 // 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).
23685 // See <ulink url="http://unicode.org/iso15924/codelists.html">Codes for the
23686 // representation of names of scripts</ulink> for details.
23688 // of zero if @script is %G_UNICODE_SCRIPT_INVALID_CODE or
23689 // ISO 15924 code 'Zzzz' (script code for UNKNOWN) if @script is not understood.
23690 // RETURNS: the ISO 15924 code for @script, encoded as an integer,
23691 // <script>: a Unicode script
23692 static uint unicode_script_to_iso15924()(UnicodeScript script) nothrow {
23693 return g_unicode_script_to_iso15924(script);
23697 // VERSION: 2.6
23698 // A wrapper for the POSIX unlink() function. The unlink() function
23699 // deletes a name from the filesystem. If this was the last link to the
23700 // file and no processes have it opened, the diskspace occupied by the
23701 // file is freed.
23703 // See your C library manual for more details about unlink(). Note
23704 // that on Windows, it is in general not possible to delete files that
23705 // are open to some process, or mapped into memory.
23707 // occurred
23708 // RETURNS: 0 if the name was successfully deleted, -1 if an error
23709 // <filename>: a pathname in the GLib file name encoding (UTF-8 on Windows)
23710 static int unlink(AT0)(AT0 /*char*/ filename) nothrow {
23711 return g_unlink(toCString!(char*)(filename));
23715 // VERSION: 2.4
23716 // Removes an environment variable from the environment.
23718 // Note that on some systems, when variables are overwritten, the
23719 // memory used for the previous variables and its value isn't reclaimed.
23721 // <warning><para>
23722 // Environment variable handling in UNIX is not thread-safe, and your
23723 // program may crash if one thread calls g_unsetenv() while another
23724 // thread is calling getenv(). (And note that many functions, such as
23725 // gettext(), call getenv() internally.) This function is only safe
23726 // to use at the very start of your program, before creating any other
23727 // threads (or creating objects that create worker threads of their
23728 // own).
23729 // </para><para>
23730 // If you need to set up the environment for a child process, you can
23731 // use g_get_environ() to get an environment array, modify that with
23732 // g_environ_setenv() and g_environ_unsetenv(), and then pass that
23733 // array directly to execvpe(), g_spawn_async(), or the like.
23734 // </para></warning>
23735 // <variable>: the environment variable to remove, must not contain '='
23736 static void unsetenv(AT0)(AT0 /*char*/ variable) nothrow {
23737 g_unsetenv(toCString!(char*)(variable));
23741 // VERSION: 2.16
23742 // Escapes a string for use in a URI.
23744 // Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
23745 // characters plus dash, dot, underscore and tilde) are escaped.
23746 // But if you specify characters in @reserved_chars_allowed they are not
23747 // escaped. This is useful for the "reserved" characters in the URI
23748 // specification, since those are allowed unescaped in some portions of
23749 // a URI.
23751 // freed when no longer needed.
23752 // RETURNS: an escaped version of @unescaped. The returned string should be
23753 // <unescaped>: the unescaped input string.
23754 // <reserved_chars_allowed>: a string of reserved characters that are allowed to be used, or %NULL.
23755 // <allow_utf8>: %TRUE if the result can include UTF-8 characters.
23756 static char* /*new*/ uri_escape_string(AT0, AT1)(AT0 /*char*/ unescaped, AT1 /*char*/ reserved_chars_allowed, int allow_utf8) nothrow {
23757 return g_uri_escape_string(toCString!(char*)(unescaped), toCString!(char*)(reserved_chars_allowed), allow_utf8);
23761 // Unintrospectable function: uri_list_extract_uris() / g_uri_list_extract_uris()
23762 // VERSION: 2.6
23763 // Splits an URI list conforming to the text/uri-list
23764 // mime type defined in RFC 2483 into individual URIs,
23765 // discarding any comments. The URIs are not validated.
23767 // strings holding the individual URIs. The array should
23768 // be freed with g_strfreev().
23769 // RETURNS: a newly allocated %NULL-terminated list of
23770 // <uri_list>: an URI list
23771 static char** uri_list_extract_uris(AT0)(AT0 /*char*/ uri_list) nothrow {
23772 return g_uri_list_extract_uris(toCString!(char*)(uri_list));
23776 // VERSION: 2.16
23777 // Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
23778 // <programlisting>
23779 // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
23780 // </programlisting>
23781 // Common schemes include "file", "http", "svn+ssh", etc.
23783 // The returned string should be freed when no longer needed.
23784 // RETURNS: The "Scheme" component of the URI, or %NULL on error.
23785 // <uri>: a valid URI.
23786 static char* /*new*/ uri_parse_scheme(AT0)(AT0 /*char*/ uri) nothrow {
23787 return g_uri_parse_scheme(toCString!(char*)(uri));
23791 // VERSION: 2.16
23792 // Unescapes a segment of an escaped string.
23794 // If any of the characters in @illegal_characters or the character zero appears
23795 // as an escaped character in @escaped_string then that is an error and %NULL
23796 // will be returned. This is useful it you want to avoid for instance having a
23797 // slash being expanded in an escaped path element, which might confuse pathname
23798 // handling.
23800 // The returned string should be freed when no longer needed. As a
23801 // special case if %NULL is given for @escaped_string, this function
23802 // will return %NULL.
23803 // RETURNS: an unescaped version of @escaped_string or %NULL on error.
23804 // <escaped_string>: A string, may be %NULL
23805 // <escaped_string_end>: Pointer to end of @escaped_string, may be %NULL
23806 // <illegal_characters>: An optional string of illegal characters not to be allowed, may be %NULL
23807 static char* /*new*/ uri_unescape_segment(AT0, AT1, AT2)(AT0 /*char*/ escaped_string=null, AT1 /*char*/ escaped_string_end=null, AT2 /*char*/ illegal_characters=null) nothrow {
23808 return g_uri_unescape_segment(toCString!(char*)(escaped_string), toCString!(char*)(escaped_string_end), toCString!(char*)(illegal_characters));
23812 // VERSION: 2.16
23813 // Unescapes a whole escaped string.
23815 // If any of the characters in @illegal_characters or the character zero appears
23816 // as an escaped character in @escaped_string then that is an error and %NULL
23817 // will be returned. This is useful it you want to avoid for instance having a
23818 // slash being expanded in an escaped path element, which might confuse pathname
23819 // handling.
23821 // should be freed when no longer needed.
23822 // RETURNS: an unescaped version of @escaped_string. The returned string
23823 // <escaped_string>: an escaped string to be unescaped.
23824 // <illegal_characters>: an optional string of illegal characters not to be allowed.
23825 static char* /*new*/ uri_unescape_string(AT0, AT1)(AT0 /*char*/ escaped_string, AT1 /*char*/ illegal_characters) nothrow {
23826 return g_uri_unescape_string(toCString!(char*)(escaped_string), toCString!(char*)(illegal_characters));
23830 // Pauses the current thread for the given number of microseconds.
23832 // There are 1 million microseconds per second (represented by the
23833 // #G_USEC_PER_SEC macro). g_usleep() may have limited precision,
23834 // depending on hardware and operating system; don't rely on the exact
23835 // length of the sleep.
23836 // <microseconds>: number of microseconds to pause
23837 static void usleep()(c_ulong microseconds) nothrow {
23838 g_usleep(microseconds);
23842 // Convert a string from UTF-16 to UCS-4. The result will be
23843 // nul-terminated.
23845 // This value must be freed with g_free(). If an
23846 // error occurs, %NULL will be returned and
23847 // @error set.
23848 // RETURNS: a pointer to a newly allocated UCS-4 string.
23849 // <str>: a UTF-16 encoded string
23850 // <len>: the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is nul-terminated.
23851 // <items_read>: location to store number of words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
23852 // <items_written>: location to store number of characters written, or %NULL. The value stored here does not include the trailing 0 character.
23853 static dchar* utf16_to_ucs4(AT0, AT1, AT2, AT3)(AT0 /*wchar*/ str, c_long len, AT1 /*c_long*/ items_read, AT2 /*c_long*/ items_written, AT3 /*GLib2.Error**/ error=null) nothrow {
23854 return g_utf16_to_ucs4(UpCast!(wchar*)(str), len, UpCast!(c_long*)(items_read), UpCast!(c_long*)(items_written), UpCast!(GLib2.Error**)(error));
23858 // Convert a string from UTF-16 to UTF-8. The result will be
23859 // terminated with a 0 byte.
23861 // Note that the input is expected to be already in native endianness,
23862 // an initial byte-order-mark character is not handled specially.
23863 // g_convert() can be used to convert a byte buffer of UTF-16 data of
23864 // ambiguous endianess.
23866 // Further note that this function does not validate the result
23867 // string; it may e.g. include embedded NUL characters. The only
23868 // validation done by this function is to ensure that the input can
23869 // be correctly interpreted as UTF-16, i.e. it doesn't contain
23870 // things unpaired surrogates.
23872 // This value must be freed with g_free(). If an
23873 // error occurs, %NULL will be returned and
23874 // @error set.
23875 // RETURNS: a pointer to a newly allocated UTF-8 string.
23876 // <str>: a UTF-16 encoded string
23877 // <len>: the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is nul-terminated.
23878 // <items_read>: location to store number of words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
23879 // <items_written>: location to store number of bytes written, or %NULL. The value stored here does not include the trailing 0 byte.
23880 static char* /*new*/ utf16_to_utf8(AT0, AT1, AT2, AT3)(AT0 /*wchar*/ str, c_long len, AT1 /*c_long*/ items_read, AT2 /*c_long*/ items_written, AT3 /*GLib2.Error**/ error=null) nothrow {
23881 return g_utf16_to_utf8(UpCast!(wchar*)(str), len, UpCast!(c_long*)(items_read), UpCast!(c_long*)(items_written), UpCast!(GLib2.Error**)(error));
23885 // Converts a string into a form that is independent of case. The
23886 // result will not correspond to any particular case, but can be
23887 // compared for equality or ordered with the results of calling
23888 // g_utf8_casefold() on other strings.
23890 // Note that calling g_utf8_casefold() followed by g_utf8_collate() is
23891 // only an approximation to the correct linguistic case insensitive
23892 // ordering, though it is a fairly good one. Getting this exactly
23893 // right would require a more sophisticated collation function that
23894 // takes case sensitivity into account. GLib does not currently
23895 // provide such a function.
23897 // case independent form of @str.
23898 // RETURNS: a newly allocated string, that is a
23899 // <str>: a UTF-8 encoded string
23900 // <len>: length of @str, in bytes, or -1 if @str is nul-terminated.
23901 static char* /*new*/ utf8_casefold(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
23902 return g_utf8_casefold(toCString!(char*)(str), len);
23906 // Compares two strings for ordering using the linguistically
23907 // correct rules for the <link linkend="setlocale">current locale</link>.
23908 // When sorting a large number of strings, it will be significantly
23909 // faster to obtain collation keys with g_utf8_collate_key() and
23910 // compare the keys with strcmp() when sorting instead of sorting
23911 // the original strings.
23913 // 0 if they compare equal, &gt; 0 if @str1 compares after @str2.
23914 // RETURNS: &lt; 0 if @str1 compares before @str2,
23915 // <str1>: a UTF-8 encoded string
23916 // <str2>: a UTF-8 encoded string
23917 static int utf8_collate(AT0, AT1)(AT0 /*char*/ str1, AT1 /*char*/ str2) nothrow {
23918 return g_utf8_collate(toCString!(char*)(str1), toCString!(char*)(str2));
23922 // Converts a string into a collation key that can be compared
23923 // with other collation keys produced by the same function using
23924 // strcmp().
23926 // The results of comparing the collation keys of two strings
23927 // with strcmp() will always be the same as comparing the two
23928 // original keys with g_utf8_collate().
23930 // Note that this function depends on the
23931 // <link linkend="setlocale">current locale</link>.
23933 // be freed with g_free() when you are done with it.
23934 // RETURNS: a newly allocated string. This string should
23935 // <str>: a UTF-8 encoded string.
23936 // <len>: length of @str, in bytes, or -1 if @str is nul-terminated.
23937 static char* /*new*/ utf8_collate_key(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
23938 return g_utf8_collate_key(toCString!(char*)(str), len);
23942 // VERSION: 2.8
23943 // Converts a string into a collation key that can be compared
23944 // with other collation keys produced by the same function using strcmp().
23946 // In order to sort filenames correctly, this function treats the dot '.'
23947 // as a special case. Most dictionary orderings seem to consider it
23948 // insignificant, thus producing the ordering "event.c" "eventgenerator.c"
23949 // "event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we
23950 // would like to treat numbers intelligently so that "file1" "file10" "file5"
23951 // is sorted as "file1" "file5" "file10".
23953 // Note that this function depends on the
23954 // <link linkend="setlocale">current locale</link>.
23956 // be freed with g_free() when you are done with it.
23957 // RETURNS: a newly allocated string. This string should
23958 // <str>: a UTF-8 encoded string.
23959 // <len>: length of @str, in bytes, or -1 if @str is nul-terminated.
23960 static char* /*new*/ utf8_collate_key_for_filename(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
23961 return g_utf8_collate_key_for_filename(toCString!(char*)(str), len);
23965 // Finds the start of the next UTF-8 character in the string after @p.
23967 // @p does not have to be at the beginning of a UTF-8 character. No check
23968 // is made to see if the character found is actually valid other than
23969 // it starts with an appropriate byte.
23970 // RETURNS: a pointer to the found character or %NULL
23971 // <p>: a pointer to a position within a UTF-8 encoded string
23972 // <end>: a pointer to the byte following the end of the string, or %NULL to indicate that the string is nul-terminated.
23973 static char* /*new*/ utf8_find_next_char(AT0, AT1)(AT0 /*char*/ p, AT1 /*char*/ end) nothrow {
23974 return g_utf8_find_next_char(toCString!(char*)(p), toCString!(char*)(end));
23978 // Given a position @p with a UTF-8 encoded string @str, find the start
23979 // of the previous UTF-8 character starting before @p. Returns %NULL if no
23980 // UTF-8 characters are present in @str before @p.
23982 // @p does not have to be at the beginning of a UTF-8 character. No check
23983 // is made to see if the character found is actually valid other than
23984 // it starts with an appropriate byte.
23985 // RETURNS: a pointer to the found character or %NULL.
23986 // <str>: pointer to the beginning of a UTF-8 encoded string
23987 // <p>: pointer to some position within @str
23988 static char* /*new*/ utf8_find_prev_char(AT0, AT1)(AT0 /*char*/ str, AT1 /*char*/ p) nothrow {
23989 return g_utf8_find_prev_char(toCString!(char*)(str), toCString!(char*)(p));
23993 // Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
23994 // If @p does not point to a valid UTF-8 encoded character, results are
23995 // undefined. If you are not sure that the bytes are complete
23996 // valid Unicode characters, you should use g_utf8_get_char_validated()
23997 // instead.
23998 // RETURNS: the resulting character
23999 // <p>: a pointer to Unicode character encoded as UTF-8
24000 static dchar utf8_get_char(AT0)(AT0 /*char*/ p) nothrow {
24001 return g_utf8_get_char(toCString!(char*)(p));
24005 // Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
24006 // This function checks for incomplete characters, for invalid characters
24007 // such as characters that are out of the range of Unicode, and for
24008 // overlong encodings of valid characters.
24010 // sequence at the end of a string that could begin a valid
24011 // character (or if @max_len is zero), returns (gunichar)-2;
24012 // otherwise, if @p does not point to a valid UTF-8 encoded
24013 // Unicode character, returns (gunichar)-1.
24014 // RETURNS: the resulting character. If @p points to a partial
24015 // <p>: a pointer to Unicode character encoded as UTF-8
24016 // <max_len>: the maximum number of bytes to read, or -1, for no maximum or if @p is nul-terminated
24017 static dchar utf8_get_char_validated(AT0)(AT0 /*char*/ p, ssize_t max_len) nothrow {
24018 return g_utf8_get_char_validated(toCString!(char*)(p), max_len);
24022 // Converts a string into canonical form, standardizing
24023 // such issues as whether a character with an accent
24024 // is represented as a base character and combining
24025 // accent or as a single precomposed character. The
24026 // string has to be valid UTF-8, otherwise %NULL is
24027 // returned. You should generally call g_utf8_normalize()
24028 // before comparing two Unicode strings.
24030 // The normalization mode %G_NORMALIZE_DEFAULT only
24031 // standardizes differences that do not affect the
24032 // text content, such as the above-mentioned accent
24033 // representation. %G_NORMALIZE_ALL also standardizes
24034 // the "compatibility" characters in Unicode, such
24035 // as SUPERSCRIPT THREE to the standard forms
24036 // (in this case DIGIT THREE). Formatting information
24037 // may be lost but for most text operations such
24038 // characters should be considered the same.
24040 // %G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE
24041 // are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL,
24042 // but returned a result with composed forms rather
24043 // than a maximally decomposed form. This is often
24044 // useful if you intend to convert the string to
24045 // a legacy encoding or pass it to a system with
24046 // less capable Unicode handling.
24048 // normalized form of @str, or %NULL if @str is not
24049 // valid UTF-8.
24050 // RETURNS: a newly allocated string, that is the
24051 // <str>: a UTF-8 encoded string.
24052 // <len>: length of @str, in bytes, or -1 if @str is nul-terminated.
24053 // <mode>: the type of normalization to perform.
24054 static char* /*new*/ utf8_normalize(AT0)(AT0 /*char*/ str, ssize_t len, NormalizeMode mode) nothrow {
24055 return g_utf8_normalize(toCString!(char*)(str), len, mode);
24059 // Converts from an integer character offset to a pointer to a position
24060 // within the string.
24062 // Since 2.10, this function allows to pass a negative @offset to
24063 // step backwards. It is usually worth stepping backwards from the end
24064 // instead of forwards if @offset is in the last fourth of the string,
24065 // since moving forward is about 3 times faster than moving backward.
24067 // <note><para>
24068 // This function doesn't abort when reaching the end of @str. Therefore
24069 // you should be sure that @offset is within string boundaries before
24070 // calling that function. Call g_utf8_strlen() when unsure.
24072 // This limitation exists as this function is called frequently during
24073 // text rendering and therefore has to be as fast as possible.
24074 // </para></note>
24075 // RETURNS: the resulting pointer
24076 // <str>: a UTF-8 encoded string
24077 // <offset>: a character offset within @str
24078 static char* /*new*/ utf8_offset_to_pointer(AT0)(AT0 /*char*/ str, c_long offset) nothrow {
24079 return g_utf8_offset_to_pointer(toCString!(char*)(str), offset);
24083 // Converts from a pointer to position within a string to a integer
24084 // character offset.
24086 // Since 2.10, this function allows @pos to be before @str, and returns
24087 // a negative offset in this case.
24088 // RETURNS: the resulting character offset
24089 // <str>: a UTF-8 encoded string
24090 // <pos>: a pointer to a position within @str
24091 static c_long utf8_pointer_to_offset(AT0, AT1)(AT0 /*char*/ str, AT1 /*char*/ pos) nothrow {
24092 return g_utf8_pointer_to_offset(toCString!(char*)(str), toCString!(char*)(pos));
24096 // Finds the previous UTF-8 character in the string before @p.
24098 // @p does not have to be at the beginning of a UTF-8 character. No check
24099 // is made to see if the character found is actually valid other than
24100 // it starts with an appropriate byte. If @p might be the first
24101 // character of the string, you must use g_utf8_find_prev_char() instead.
24102 // RETURNS: a pointer to the found character.
24103 // <p>: a pointer to a position within a UTF-8 encoded string
24104 static char* /*new*/ utf8_prev_char(AT0)(AT0 /*char*/ p) nothrow {
24105 return g_utf8_prev_char(toCString!(char*)(p));
24109 // Finds the leftmost occurrence of the given Unicode character
24110 // in a UTF-8 encoded string, while limiting the search to @len bytes.
24111 // If @len is -1, allow unbounded search.
24113 // otherwise, a pointer to the start of the leftmost occurrence of
24114 // the character in the string.
24115 // RETURNS: %NULL if the string does not contain the character,
24116 // <p>: a nul-terminated UTF-8 encoded string
24117 // <len>: the maximum length of @p
24118 // <c>: a Unicode character
24119 static char* /*new*/ utf8_strchr(AT0)(AT0 /*char*/ p, ssize_t len, dchar c) nothrow {
24120 return g_utf8_strchr(toCString!(char*)(p), len, c);
24124 // Converts all Unicode characters in the string that have a case
24125 // to lowercase. The exact manner that this is done depends
24126 // on the current locale, and may result in the number of
24127 // characters in the string changing.
24129 // converted to lowercase.
24130 // RETURNS: a newly allocated string, with all characters
24131 // <str>: a UTF-8 encoded string
24132 // <len>: length of @str, in bytes, or -1 if @str is nul-terminated.
24133 static char* /*new*/ utf8_strdown(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
24134 return g_utf8_strdown(toCString!(char*)(str), len);
24138 // Computes the length of the string in characters, not including
24139 // the terminating nul character. If the @max'th byte falls in the
24140 // middle of a character, the last (partial) character is not counted.
24141 // RETURNS: the length of the string in characters
24142 // <p>: pointer to the start of a UTF-8 encoded string
24143 // <max>: the maximum number of bytes to examine. If @max is less than 0, then the string is assumed to be nul-terminated. If @max is 0, @p will not be examined and may be %NULL. If @max is greater than 0, up to @max bytes are examined
24144 static c_long utf8_strlen(AT0)(AT0 /*char*/ p, ssize_t max) nothrow {
24145 return g_utf8_strlen(toCString!(char*)(p), max);
24149 // Like the standard C strncpy() function, but
24150 // copies a given number of characters instead of a given number of
24151 // bytes. The @src string must be valid UTF-8 encoded text.
24152 // (Use g_utf8_validate() on all text before trying to use UTF-8
24153 // utility functions with it.)
24154 // RETURNS: @dest
24155 // <dest>: buffer to fill with characters from @src
24156 // <src>: UTF-8 encoded string
24157 // <n>: character count
24158 static char* /*new*/ utf8_strncpy(AT0, AT1)(AT0 /*char*/ dest, AT1 /*char*/ src, size_t n) nothrow {
24159 return g_utf8_strncpy(toCString!(char*)(dest), toCString!(char*)(src), n);
24163 // Find the rightmost occurrence of the given Unicode character
24164 // in a UTF-8 encoded string, while limiting the search to @len bytes.
24165 // If @len is -1, allow unbounded search.
24167 // otherwise, a pointer to the start of the rightmost occurrence of the
24168 // character in the string.
24169 // RETURNS: %NULL if the string does not contain the character,
24170 // <p>: a nul-terminated UTF-8 encoded string
24171 // <len>: the maximum length of @p
24172 // <c>: a Unicode character
24173 static char* /*new*/ utf8_strrchr(AT0)(AT0 /*char*/ p, ssize_t len, dchar c) nothrow {
24174 return g_utf8_strrchr(toCString!(char*)(p), len, c);
24178 // VERSION: 2.2
24179 // Reverses a UTF-8 string. @str must be valid UTF-8 encoded text.
24180 // (Use g_utf8_validate() on all text before trying to use UTF-8
24181 // utility functions with it.)
24183 // This function is intended for programmatic uses of reversed strings.
24184 // It pays no attention to decomposed characters, combining marks, byte
24185 // order marks, directional indicators (LRM, LRO, etc) and similar
24186 // characters which might need special handling when reversing a string
24187 // for display purposes.
24189 // Note that unlike g_strreverse(), this function returns
24190 // newly-allocated memory, which should be freed with g_free() when
24191 // no longer needed.
24192 // RETURNS: a newly-allocated string which is the reverse of @str.
24193 // <str>: a UTF-8 encoded string
24194 // <len>: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
24195 static char* /*new*/ utf8_strreverse(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
24196 return g_utf8_strreverse(toCString!(char*)(str), len);
24200 // Converts all Unicode characters in the string that have a case
24201 // to uppercase. The exact manner that this is done depends
24202 // on the current locale, and may result in the number of
24203 // characters in the string increasing. (For instance, the
24204 // German ess-zet will be changed to SS.)
24206 // converted to uppercase.
24207 // RETURNS: a newly allocated string, with all characters
24208 // <str>: a UTF-8 encoded string
24209 // <len>: length of @str, in bytes, or -1 if @str is nul-terminated.
24210 static char* /*new*/ utf8_strup(AT0)(AT0 /*char*/ str, ssize_t len) nothrow {
24211 return g_utf8_strup(toCString!(char*)(str), len);
24215 // VERSION: 2.30
24216 // Copies a substring out of a UTF-8 encoded string.
24217 // The substring will contain @end_pos - @start_pos
24218 // characters.
24220 // substring. Free with g_free() when no longer needed.
24221 // RETURNS: a newly allocated copy of the requested
24222 // <str>: a UTF-8 encoded string
24223 // <start_pos>: a character offset within @str
24224 // <end_pos>: another character offset within @str
24225 static char* /*new*/ utf8_substring(AT0)(AT0 /*char*/ str, c_long start_pos, c_long end_pos) nothrow {
24226 return g_utf8_substring(toCString!(char*)(str), start_pos, end_pos);
24230 // Convert a string from UTF-8 to a 32-bit fixed width
24231 // representation as UCS-4. A trailing 0 character will be added to the
24232 // string after the converted text.
24234 // This value must be freed with g_free(). If an
24235 // error occurs, %NULL will be returned and
24236 // @error set.
24237 // RETURNS: a pointer to a newly allocated UCS-4 string.
24238 // <str>: a UTF-8 encoded string
24239 // <len>: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
24240 // <items_read>: location to store number of bytes read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
24241 // <items_written>: location to store number of characters written or %NULL. The value here stored does not include the trailing 0 character.
24242 static dchar* utf8_to_ucs4(AT0, AT1, AT2, AT3)(AT0 /*char*/ str, c_long len, AT1 /*c_long*/ items_read, AT2 /*c_long*/ items_written, AT3 /*GLib2.Error**/ error=null) nothrow {
24243 return g_utf8_to_ucs4(toCString!(char*)(str), len, UpCast!(c_long*)(items_read), UpCast!(c_long*)(items_written), UpCast!(GLib2.Error**)(error));
24247 // Convert a string from UTF-8 to a 32-bit fixed width
24248 // representation as UCS-4, assuming valid UTF-8 input.
24249 // This function is roughly twice as fast as g_utf8_to_ucs4()
24250 // but does no error checking on the input. A trailing 0 character
24251 // will be added to the string after the converted text.
24253 // This value must be freed with g_free().
24254 // RETURNS: a pointer to a newly allocated UCS-4 string.
24255 // <str>: a UTF-8 encoded string
24256 // <len>: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
24257 // <items_written>: location to store the number of characters in the result, or %NULL.
24258 static dchar* utf8_to_ucs4_fast(AT0, AT1)(AT0 /*char*/ str, c_long len, AT1 /*c_long*/ items_written) nothrow {
24259 return g_utf8_to_ucs4_fast(toCString!(char*)(str), len, UpCast!(c_long*)(items_written));
24263 // Convert a string from UTF-8 to UTF-16. A 0 character will be
24264 // added to the result after the converted text.
24266 // This value must be freed with g_free(). If an
24267 // error occurs, %NULL will be returned and
24268 // @error set.
24269 // RETURNS: a pointer to a newly allocated UTF-16 string.
24270 // <str>: a UTF-8 encoded string
24271 // <len>: the maximum length (number of bytes) of @str to use. If @len < 0, then the string is nul-terminated.
24272 // <items_read>: location to store number of bytes read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case @str contains a trailing partial character. If an error occurs then the index of the invalid input is stored here.
24273 // <items_written>: location to store number of <type>gunichar2</type> written, or %NULL. The value stored here does not include the trailing 0.
24274 static wchar* utf8_to_utf16(AT0, AT1, AT2, AT3)(AT0 /*char*/ str, c_long len, AT1 /*c_long*/ items_read, AT2 /*c_long*/ items_written, AT3 /*GLib2.Error**/ error=null) nothrow {
24275 return g_utf8_to_utf16(toCString!(char*)(str), len, UpCast!(c_long*)(items_read), UpCast!(c_long*)(items_written), UpCast!(GLib2.Error**)(error));
24279 // Validates UTF-8 encoded text. @str is the text to validate;
24280 // if @str is nul-terminated, then @max_len can be -1, otherwise
24281 // @max_len should be the number of bytes to validate.
24282 // If @end is non-%NULL, then the end of the valid range
24283 // will be stored there (i.e. the start of the first invalid
24284 // character if some bytes were invalid, or the end of the text
24285 // being validated otherwise).
24287 // Note that g_utf8_validate() returns %FALSE if @max_len is
24288 // positive and any of the @max_len bytes are NUL.
24290 // Returns %TRUE if all of @str was valid. Many GLib and GTK+
24291 // routines <emphasis>require</emphasis> valid UTF-8 as input;
24292 // so data read from a file or the network should be checked
24293 // with g_utf8_validate() before doing anything else with it.
24294 // RETURNS: %TRUE if the text was valid UTF-8
24295 // <str>: a pointer to character data
24296 // <max_len>: max bytes to validate, or -1 to go until NUL
24297 // <end>: return location for end of valid data
24298 static int utf8_validate(AT0, AT1)(AT0 /*char*/ str, ssize_t max_len, /*out*/ AT1 /*char**/ end=null) nothrow {
24299 return g_utf8_validate(toCString!(char*)(str), max_len, toCString!(char**)(end));
24302 static Type variant_get_gtype()() nothrow {
24303 return g_variant_get_gtype();
24307 // VERSION: 2.24
24308 // MOVED TO: Variant.is_object_path
24309 // Determines if a given string is a valid D-Bus object path. You
24310 // should ensure that a string is a valid D-Bus object path before
24311 // passing it to g_variant_new_object_path().
24313 // A valid object path starts with '/' followed by zero or more
24314 // sequences of characters separated by '/' characters. Each sequence
24315 // must contain only the characters "[A-Z][a-z][0-9]_". No sequence
24316 // (including the one following the final '/' character) may be empty.
24317 // RETURNS: %TRUE if @string is a D-Bus object path
24318 // <string>: a normal C nul-terminated string
24319 static int variant_is_object_path(AT0)(AT0 /*char*/ string_) nothrow {
24320 return g_variant_is_object_path(toCString!(char*)(string_));
24324 // VERSION: 2.24
24325 // MOVED TO: Variant.is_signature
24326 // Determines if a given string is a valid D-Bus type signature. You
24327 // should ensure that a string is a valid D-Bus type signature before
24328 // passing it to g_variant_new_signature().
24330 // D-Bus type signatures consist of zero or more definite #GVariantType
24331 // strings in sequence.
24332 // RETURNS: %TRUE if @string is a D-Bus type signature
24333 // <string>: a normal C nul-terminated string
24334 static int variant_is_signature(AT0)(AT0 /*char*/ string_) nothrow {
24335 return g_variant_is_signature(toCString!(char*)(string_));
24339 // MOVED TO: Variant.parse
24340 // Parses a #GVariant from a text representation.
24342 // A single #GVariant is parsed from the content of @text.
24344 // The format is described <link linkend='gvariant-text'>here</link>.
24346 // The memory at @limit will never be accessed and the parser behaves as
24347 // if the character at @limit is the nul terminator. This has the
24348 // effect of bounding @text.
24350 // If @endptr is non-%NULL then @text is permitted to contain data
24351 // following the value that this function parses and @endptr will be
24352 // updated to point to the first character past the end of the text
24353 // parsed by this function. If @endptr is %NULL and there is extra data
24354 // then an error is returned.
24356 // If @type is non-%NULL then the value will be parsed to have that
24357 // type. This may result in additional parse errors (in the case that
24358 // the parsed value doesn't fit the type) but may also result in fewer
24359 // errors (in the case that the type would have been ambiguous, such as
24360 // with empty arrays).
24362 // In the event that the parsing is successful, the resulting #GVariant
24363 // is returned.
24365 // In case of any error, %NULL will be returned. If @error is non-%NULL
24366 // then it will be set to reflect the error that occurred.
24368 // Officially, the language understood by the parser is "any string
24369 // produced by g_variant_print()".
24370 // <type>: a #GVariantType, or %NULL
24371 // <text>: a string containing a GVariant in text form
24372 // <limit>: a pointer to the end of @text, or %NULL
24373 // <endptr>: a location to store the end pointer, or %NULL
24374 static Variant* /*new*/ variant_parse(AT0, AT1, AT2, AT3, AT4)(AT0 /*VariantType*/ type, AT1 /*char*/ text, AT2 /*char*/ limit, AT3 /*char**/ endptr, AT4 /*GLib2.Error**/ error=null) nothrow {
24375 return g_variant_parse(UpCast!(VariantType*)(type), toCString!(char*)(text), toCString!(char*)(limit), toCString!(char**)(endptr), UpCast!(GLib2.Error**)(error));
24378 // MOVED TO: Variant.parser_get_error_quark
24379 static Quark variant_parser_get_error_quark()() nothrow {
24380 return g_variant_parser_get_error_quark();
24383 // MOVED TO: VariantType.checked_
24384 static VariantType* variant_type_checked_(AT0)(AT0 /*char*/ arg_a) nothrow {
24385 return g_variant_type_checked_(toCString!(char*)(arg_a));
24389 // MOVED TO: VariantType.string_is_valid
24390 // Checks if @type_string is a valid GVariant type string. This call is
24391 // equivalent to calling g_variant_type_string_scan() and confirming
24392 // that the following character is a nul terminator.
24395 // Since 2.24
24396 // RETURNS: %TRUE if @type_string is exactly one valid type string
24397 // <type_string>: a pointer to any string
24398 static int variant_type_string_is_valid(AT0)(AT0 /*char*/ type_string) nothrow {
24399 return g_variant_type_string_is_valid(toCString!(char*)(type_string));
24403 // VERSION: 2.24
24404 // MOVED TO: VariantType.string_scan
24405 // Scan for a single complete and valid GVariant type string in @string.
24406 // The memory pointed to by @limit (or bytes beyond it) is never
24407 // accessed.
24409 // If a valid type string is found, @endptr is updated to point to the
24410 // first character past the end of the string that was found and %TRUE
24411 // is returned.
24413 // If there is no valid type string starting at @string, or if the type
24414 // string does not end before @limit then %FALSE is returned.
24416 // For the simple case of checking if a string is a valid type string,
24417 // see g_variant_type_string_is_valid().
24418 // RETURNS: %TRUE if a valid type string was found
24419 // <string>: a pointer to any string
24420 // <limit>: the end of @string, or %NULL
24421 // <endptr>: location to store the end pointer, or %NULL
24422 static int variant_type_string_scan(AT0, AT1, AT2)(AT0 /*char*/ string_, AT1 /*char*/ limit=null, /*out*/ AT2 /*char**/ endptr=null) nothrow {
24423 return g_variant_type_string_scan(toCString!(char*)(string_), toCString!(char*)(limit), toCString!(char**)(endptr));
24427 // Unintrospectable function: vasprintf() / g_vasprintf()
24428 // VERSION: 2.4
24429 // An implementation of the GNU vasprintf() function which supports
24430 // positional parameters, as specified in the Single Unix Specification.
24431 // This function is similar to g_vsprintf(), except that it allocates a
24432 // string to hold the output, instead of putting the output in a buffer
24433 // you allocate in advance.
24434 // RETURNS: the number of bytes printed.
24435 // <string>: the return location for the newly-allocated string.
24436 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24437 // <args>: the list of arguments to insert in the output.
24438 static int vasprintf(AT0, AT1)(AT0 /*char**/ string_, AT1 /*char*/ format, va_list args) nothrow {
24439 return g_vasprintf(toCString!(char**)(string_), toCString!(char*)(format), args);
24443 // Unintrospectable function: vfprintf() / g_vfprintf()
24444 // VERSION: 2.2
24445 // An implementation of the standard fprintf() function which supports
24446 // positional parameters, as specified in the Single Unix Specification.
24447 // RETURNS: the number of bytes printed.
24448 // <file>: the stream to write to.
24449 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24450 // <args>: the list of arguments to insert in the output.
24451 static int vfprintf(AT0, AT1)(AT0 /*FILE*/ file, AT1 /*char*/ format, va_list args) nothrow {
24452 return g_vfprintf(UpCast!(FILE*)(file), toCString!(char*)(format), args);
24456 // Unintrospectable function: vprintf() / g_vprintf()
24457 // VERSION: 2.2
24458 // An implementation of the standard vprintf() function which supports
24459 // positional parameters, as specified in the Single Unix Specification.
24460 // RETURNS: the number of bytes printed.
24461 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24462 // <args>: the list of arguments to insert in the output.
24463 static int vprintf(AT0)(AT0 /*char*/ format, va_list args) nothrow {
24464 return g_vprintf(toCString!(char*)(format), args);
24468 // Unintrospectable function: vsnprintf() / g_vsnprintf()
24469 // A safer form of the standard vsprintf() function. The output is guaranteed
24470 // to not exceed @n characters (including the terminating nul character), so
24471 // it is easy to ensure that a buffer overflow cannot occur.
24473 // See also g_strdup_vprintf().
24475 // In versions of GLib prior to 1.2.3, this function may return -1 if the
24476 // output was truncated, and the truncated string may not be nul-terminated.
24477 // In versions prior to 1.3.12, this function returns the length of the output
24478 // string.
24480 // The return value of g_vsnprintf() conforms to the vsnprintf() function
24481 // as standardized in ISO C99. Note that this is different from traditional
24482 // vsnprintf(), which returns the length of the output string.
24484 // The format string may contain positional parameters, as specified in
24485 // the Single Unix Specification.
24487 // was large enough.
24488 // RETURNS: the number of bytes which would be produced if the buffer
24489 // <string>: the buffer to hold the output.
24490 // <n>: the maximum number of bytes to produce (including the terminating nul character).
24491 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24492 // <args>: the list of arguments to insert in the output.
24493 static int vsnprintf(AT0, AT1)(AT0 /*char*/ string_, c_ulong n, AT1 /*char*/ format, va_list args) nothrow {
24494 return g_vsnprintf(toCString!(char*)(string_), n, toCString!(char*)(format), args);
24498 // Unintrospectable function: vsprintf() / g_vsprintf()
24499 // VERSION: 2.2
24500 // An implementation of the standard vsprintf() function which supports
24501 // positional parameters, as specified in the Single Unix Specification.
24502 // RETURNS: the number of bytes printed.
24503 // <string>: the buffer to hold the output.
24504 // <format>: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24505 // <args>: the list of arguments to insert in the output.
24506 static int vsprintf(AT0, AT1)(AT0 /*char*/ string_, AT1 /*char*/ format, va_list args) nothrow {
24507 return g_vsprintf(toCString!(char*)(string_), toCString!(char*)(format), args);
24510 static void warn_message(AT0, AT1, AT2, AT3)(AT0 /*char*/ domain, AT1 /*char*/ file, int line, AT2 /*char*/ func, AT3 /*char*/ warnexpr) nothrow {
24511 g_warn_message(toCString!(char*)(domain), toCString!(char*)(file), line, toCString!(char*)(func), toCString!(char*)(warnexpr));
24515 // C prototypes:
24517 extern (C) {
24518 Array* g_array_append_vals(Array* array, const(void)* data, uint len) nothrow;
24519 char* /*new*/ g_array_free(Array* array, int free_segment) nothrow;
24520 uint g_array_get_element_size(Array* array) nothrow;
24521 Array* g_array_insert_vals(Array* array, uint index_, const(void)* data, uint len) nothrow;
24522 Array* g_array_new(int zero_terminated, int clear_, uint element_size) nothrow;
24523 Array* g_array_prepend_vals(Array* array, const(void)* data, uint len) nothrow;
24524 Array* g_array_ref(Array* array) nothrow;
24525 Array* g_array_remove_index(Array* array, uint index_) nothrow;
24526 Array* g_array_remove_index_fast(Array* array, uint index_) nothrow;
24527 Array* g_array_remove_range(Array* array, uint index_, uint length) nothrow;
24528 void g_array_set_clear_func(Array* array, DestroyNotify clear_func) nothrow;
24529 Array* g_array_set_size(Array* array, uint length) nothrow;
24530 Array* g_array_sized_new(int zero_terminated, int clear_, uint element_size, uint reserved_size) nothrow;
24531 void g_array_sort(Array* array, CompareFunc compare_func) nothrow;
24532 void g_array_sort_with_data(Array* array, CompareDataFunc compare_func, void* user_data) nothrow;
24533 void g_array_unref(Array* array) nothrow;
24534 int g_async_queue_length(AsyncQueue* this_) nothrow;
24535 int g_async_queue_length_unlocked(AsyncQueue* this_) nothrow;
24536 void g_async_queue_lock(AsyncQueue* this_) nothrow;
24537 void* g_async_queue_pop(AsyncQueue* this_) nothrow;
24538 void* g_async_queue_pop_unlocked(AsyncQueue* this_) nothrow;
24539 void g_async_queue_push(AsyncQueue* this_, void* data) nothrow;
24540 void g_async_queue_push_sorted(AsyncQueue* this_, void* data, CompareDataFunc func, void* user_data) nothrow;
24541 void g_async_queue_push_sorted_unlocked(AsyncQueue* this_, void* data, CompareDataFunc func, void* user_data) nothrow;
24542 void g_async_queue_push_unlocked(AsyncQueue* this_, void* data) nothrow;
24543 AsyncQueue* g_async_queue_ref(AsyncQueue* this_) nothrow;
24544 void g_async_queue_ref_unlocked(AsyncQueue* this_) nothrow;
24545 void g_async_queue_sort(AsyncQueue* this_, CompareDataFunc func, void* user_data) nothrow;
24546 void g_async_queue_sort_unlocked(AsyncQueue* this_, CompareDataFunc func, void* user_data) nothrow;
24547 void* g_async_queue_timed_pop(AsyncQueue* this_, TimeVal* end_time) nothrow;
24548 void* g_async_queue_timed_pop_unlocked(AsyncQueue* this_, TimeVal* end_time) nothrow;
24549 void* g_async_queue_timeout_pop(AsyncQueue* this_, ulong timeout) nothrow;
24550 void* g_async_queue_timeout_pop_unlocked(AsyncQueue* this_, ulong timeout) nothrow;
24551 void* g_async_queue_try_pop(AsyncQueue* this_) nothrow;
24552 void* g_async_queue_try_pop_unlocked(AsyncQueue* this_) nothrow;
24553 void g_async_queue_unlock(AsyncQueue* this_) nothrow;
24554 void g_async_queue_unref(AsyncQueue* this_) nothrow;
24555 void g_async_queue_unref_and_unlock(AsyncQueue* this_) nothrow;
24556 AsyncQueue* g_async_queue_new() nothrow;
24557 AsyncQueue* g_async_queue_new_full(DestroyNotify item_free_func) nothrow;
24558 void g_bookmark_file_add_application(BookmarkFile* this_, char* uri, char* name, char* exec) nothrow;
24559 void g_bookmark_file_add_group(BookmarkFile* this_, char* uri, char* group) nothrow;
24560 void g_bookmark_file_free(BookmarkFile* this_) nothrow;
24561 time_t g_bookmark_file_get_added(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24562 int g_bookmark_file_get_app_info(BookmarkFile* this_, char* uri, char* name, char** exec, uint* count, time_t* stamp, GLib2.Error** error) nothrow;
24563 char** g_bookmark_file_get_applications(BookmarkFile* this_, char* uri, size_t* length, GLib2.Error** error) nothrow;
24564 char* /*new*/ g_bookmark_file_get_description(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24565 char** g_bookmark_file_get_groups(BookmarkFile* this_, char* uri, size_t* length, GLib2.Error** error) nothrow;
24566 int g_bookmark_file_get_icon(BookmarkFile* this_, char* uri, char** href, char** mime_type, GLib2.Error** error) nothrow;
24567 int g_bookmark_file_get_is_private(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24568 char* /*new*/ g_bookmark_file_get_mime_type(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24569 time_t g_bookmark_file_get_modified(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24570 int g_bookmark_file_get_size(BookmarkFile* this_) nothrow;
24571 char* /*new*/ g_bookmark_file_get_title(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24572 char** g_bookmark_file_get_uris(BookmarkFile* this_, size_t* length) nothrow;
24573 time_t g_bookmark_file_get_visited(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24574 int g_bookmark_file_has_application(BookmarkFile* this_, char* uri, char* name, GLib2.Error** error) nothrow;
24575 int g_bookmark_file_has_group(BookmarkFile* this_, char* uri, char* group, GLib2.Error** error) nothrow;
24576 int g_bookmark_file_has_item(BookmarkFile* this_, char* uri) nothrow;
24577 int g_bookmark_file_load_from_data(BookmarkFile* this_, char* data, size_t length, GLib2.Error** error) nothrow;
24578 int g_bookmark_file_load_from_data_dirs(BookmarkFile* this_, char* file, char** full_path, GLib2.Error** error) nothrow;
24579 int g_bookmark_file_load_from_file(BookmarkFile* this_, char* filename, GLib2.Error** error) nothrow;
24580 int g_bookmark_file_move_item(BookmarkFile* this_, char* old_uri, char* new_uri, GLib2.Error** error) nothrow;
24581 int g_bookmark_file_remove_application(BookmarkFile* this_, char* uri, char* name, GLib2.Error** error) nothrow;
24582 int g_bookmark_file_remove_group(BookmarkFile* this_, char* uri, char* group, GLib2.Error** error) nothrow;
24583 int g_bookmark_file_remove_item(BookmarkFile* this_, char* uri, GLib2.Error** error) nothrow;
24584 void g_bookmark_file_set_added(BookmarkFile* this_, char* uri, time_t added) nothrow;
24585 int g_bookmark_file_set_app_info(BookmarkFile* this_, char* uri, char* name, char* exec, int count, time_t stamp, GLib2.Error** error) nothrow;
24586 void g_bookmark_file_set_description(BookmarkFile* this_, char* uri, char* description) nothrow;
24587 void g_bookmark_file_set_groups(BookmarkFile* this_, char* uri, char** groups, size_t length) nothrow;
24588 void g_bookmark_file_set_icon(BookmarkFile* this_, char* uri, char* href, char* mime_type) nothrow;
24589 void g_bookmark_file_set_is_private(BookmarkFile* this_, char* uri, int is_private) nothrow;
24590 void g_bookmark_file_set_mime_type(BookmarkFile* this_, char* uri, char* mime_type) nothrow;
24591 void g_bookmark_file_set_modified(BookmarkFile* this_, char* uri, time_t modified) nothrow;
24592 void g_bookmark_file_set_title(BookmarkFile* this_, char* uri, char* title) nothrow;
24593 void g_bookmark_file_set_visited(BookmarkFile* this_, char* uri, time_t visited) nothrow;
24594 char* /*new*/ g_bookmark_file_to_data(BookmarkFile* this_, size_t* length, GLib2.Error** error) nothrow;
24595 int g_bookmark_file_to_file(BookmarkFile* this_, char* filename, GLib2.Error** error) nothrow;
24596 Quark g_bookmark_file_error_quark() nothrow;
24597 BookmarkFile* g_bookmark_file_new() nothrow;
24598 ByteArray* g_byte_array_append(ByteArray* array, ubyte* data, uint len) nothrow;
24599 ubyte* g_byte_array_free(ByteArray* array, int free_segment) nothrow;
24600 Bytes* /*new*/ g_byte_array_free_to_bytes(ByteArray* array) nothrow;
24601 ByteArray* g_byte_array_new() nothrow;
24602 ByteArray* /*new*/ g_byte_array_new_take(ubyte* data, size_t len) nothrow;
24603 ByteArray* g_byte_array_prepend(ByteArray* array, ubyte* data, uint len) nothrow;
24604 ByteArray* g_byte_array_ref(ByteArray* array) nothrow;
24605 ByteArray* g_byte_array_remove_index(ByteArray* array, uint index_) nothrow;
24606 ByteArray* g_byte_array_remove_index_fast(ByteArray* array, uint index_) nothrow;
24607 ByteArray* g_byte_array_remove_range(ByteArray* array, uint index_, uint length) nothrow;
24608 ByteArray* g_byte_array_set_size(ByteArray* array, uint length) nothrow;
24609 ByteArray* g_byte_array_sized_new(uint reserved_size) nothrow;
24610 void g_byte_array_sort(ByteArray* array, CompareFunc compare_func) nothrow;
24611 void g_byte_array_sort_with_data(ByteArray* array, CompareDataFunc compare_func, void* user_data) nothrow;
24612 void g_byte_array_unref(ByteArray* array) nothrow;
24613 Bytes* /*new*/ g_bytes_new(const(void)* data, size_t size) nothrow;
24614 Bytes* /*new*/ g_bytes_new_static(const(void)* data, size_t size) nothrow;
24615 Bytes* /*new*/ g_bytes_new_take(void* data, size_t size) nothrow;
24616 Bytes* /*new*/ g_bytes_new_with_free_func(const(void)* data, size_t size, DestroyNotify free_func, void* user_data) nothrow;
24617 int g_bytes_compare(Bytes* this_, const(Bytes)* bytes2) nothrow;
24618 int g_bytes_equal(Bytes* this_, const(Bytes)* bytes2) nothrow;
24619 const(ubyte)* g_bytes_get_data(Bytes* this_, /*out*/ size_t* size=null) nothrow;
24620 size_t g_bytes_get_size(Bytes* this_) nothrow;
24621 uint g_bytes_hash(Bytes* this_) nothrow;
24622 Bytes* /*new*/ g_bytes_new_from_bytes(Bytes* this_, size_t offset, size_t length) nothrow;
24623 Bytes* /*new*/ g_bytes_ref(Bytes* this_) nothrow;
24624 void g_bytes_unref(Bytes* this_) nothrow;
24625 ByteArray* /*new*/ g_bytes_unref_to_array(Bytes* this_) nothrow;
24626 void* /*new*/ g_bytes_unref_to_data(Bytes* this_, size_t* size) nothrow;
24627 Checksum* g_checksum_copy(Checksum* this_) nothrow;
24628 void g_checksum_free(Checksum* this_) nothrow;
24629 void g_checksum_get_digest(Checksum* this_, ubyte* buffer, size_t* digest_len) nothrow;
24630 char* g_checksum_get_string(Checksum* this_) nothrow;
24631 void g_checksum_reset(Checksum* this_) nothrow;
24632 void g_checksum_update(Checksum* this_, ubyte* data, ssize_t length) nothrow;
24633 Checksum* g_checksum_new(ChecksumType checksum_type) nothrow;
24634 ssize_t g_checksum_type_get_length(ChecksumType checksum_type) nothrow;
24635 void g_cond_broadcast(Cond* this_) nothrow;
24636 void g_cond_clear(Cond* this_) nothrow;
24637 void g_cond_init(Cond* this_) nothrow;
24638 void g_cond_signal(Cond* this_) nothrow;
24639 void g_cond_wait(Cond* this_, Mutex* mutex) nothrow;
24640 int g_cond_wait_until(Cond* this_, Mutex* mutex, long end_time) nothrow;
24641 Date* /*new*/ g_date_new() nothrow;
24642 Date* /*new*/ g_date_new_dmy(DateDay day, DateMonth month, DateYear year) nothrow;
24643 Date* /*new*/ g_date_new_julian(uint julian_day) nothrow;
24644 void g_date_add_days(Date* this_, uint n_days) nothrow;
24645 void g_date_add_months(Date* this_, uint n_months) nothrow;
24646 void g_date_add_years(Date* this_, uint n_years) nothrow;
24647 void g_date_clamp(Date* this_, Date* min_date, Date* max_date) nothrow;
24648 void g_date_clear(Date* this_, uint n_dates) nothrow;
24649 int g_date_compare(Date* this_, Date* rhs) nothrow;
24650 int g_date_days_between(Date* this_, Date* date2) nothrow;
24651 void g_date_free(Date* this_) nothrow;
24652 DateDay g_date_get_day(Date* this_) nothrow;
24653 uint g_date_get_day_of_year(Date* this_) nothrow;
24654 uint g_date_get_iso8601_week_of_year(Date* this_) nothrow;
24655 uint g_date_get_julian(Date* this_) nothrow;
24656 uint g_date_get_monday_week_of_year(Date* this_) nothrow;
24657 DateMonth g_date_get_month(Date* this_) nothrow;
24658 uint g_date_get_sunday_week_of_year(Date* this_) nothrow;
24659 DateWeekday g_date_get_weekday(Date* this_) nothrow;
24660 DateYear g_date_get_year(Date* this_) nothrow;
24661 int g_date_is_first_of_month(Date* this_) nothrow;
24662 int g_date_is_last_of_month(Date* this_) nothrow;
24663 void g_date_order(Date* this_, Date* date2) nothrow;
24664 void g_date_set_day(Date* this_, DateDay day) nothrow;
24665 void g_date_set_dmy(Date* this_, DateDay day, DateMonth month, DateYear y) nothrow;
24666 void g_date_set_julian(Date* this_, uint julian_date) nothrow;
24667 void g_date_set_month(Date* this_, DateMonth month) nothrow;
24668 void g_date_set_parse(Date* this_, char* str) nothrow;
24669 void g_date_set_time(Date* this_, Time time_) nothrow;
24670 void g_date_set_time_t(Date* this_, time_t timet) nothrow;
24671 void g_date_set_time_val(Date* this_, TimeVal* timeval) nothrow;
24672 void g_date_set_year(Date* this_, DateYear year) nothrow;
24673 void g_date_subtract_days(Date* this_, uint n_days) nothrow;
24674 void g_date_subtract_months(Date* this_, uint n_months) nothrow;
24675 void g_date_subtract_years(Date* this_, uint n_years) nothrow;
24676 void g_date_to_struct_tm(Date* this_, void** tm) nothrow;
24677 int g_date_valid(Date* this_) nothrow;
24678 ubyte g_date_get_days_in_month(DateMonth month, DateYear year) nothrow;
24679 ubyte g_date_get_monday_weeks_in_year(DateYear year) nothrow;
24680 ubyte g_date_get_sunday_weeks_in_year(DateYear year) nothrow;
24681 int g_date_is_leap_year(DateYear year) nothrow;
24682 size_t g_date_strftime(char* s, size_t slen, char* format, Date* date) nothrow;
24683 int g_date_valid_day(DateDay day) nothrow;
24684 int g_date_valid_dmy(DateDay day, DateMonth month, DateYear year) nothrow;
24685 int g_date_valid_julian(uint julian_date) nothrow;
24686 int g_date_valid_month(DateMonth month) nothrow;
24687 int g_date_valid_weekday(DateWeekday weekday) nothrow;
24688 int g_date_valid_year(DateYear year) nothrow;
24689 DateTime* /*new*/ g_date_time_new(TimeZone* tz, int year, int month, int day, int hour, int minute, double seconds) nothrow;
24690 DateTime* /*new*/ g_date_time_new_from_timeval_local(TimeVal* tv) nothrow;
24691 DateTime* /*new*/ g_date_time_new_from_timeval_utc(TimeVal* tv) nothrow;
24692 DateTime* /*new*/ g_date_time_new_from_unix_local(long t) nothrow;
24693 DateTime* /*new*/ g_date_time_new_from_unix_utc(long t) nothrow;
24694 DateTime* /*new*/ g_date_time_new_local(int year, int month, int day, int hour, int minute, double seconds) nothrow;
24695 DateTime* /*new*/ g_date_time_new_now(TimeZone* tz) nothrow;
24696 DateTime* /*new*/ g_date_time_new_now_local() nothrow;
24697 DateTime* /*new*/ g_date_time_new_now_utc() nothrow;
24698 DateTime* /*new*/ g_date_time_new_utc(int year, int month, int day, int hour, int minute, double seconds) nothrow;
24699 DateTime* /*new*/ g_date_time_add(DateTime* this_, TimeSpan timespan) nothrow;
24700 DateTime* /*new*/ g_date_time_add_days(DateTime* this_, int days) nothrow;
24701 DateTime* /*new*/ g_date_time_add_full(DateTime* this_, int years, int months, int days, int hours, int minutes, double seconds) nothrow;
24702 DateTime* /*new*/ g_date_time_add_hours(DateTime* this_, int hours) nothrow;
24703 DateTime* /*new*/ g_date_time_add_minutes(DateTime* this_, int minutes) nothrow;
24704 DateTime* /*new*/ g_date_time_add_months(DateTime* this_, int months) nothrow;
24705 DateTime* /*new*/ g_date_time_add_seconds(DateTime* this_, double seconds) nothrow;
24706 DateTime* /*new*/ g_date_time_add_weeks(DateTime* this_, int weeks) nothrow;
24707 DateTime* /*new*/ g_date_time_add_years(DateTime* this_, int years) nothrow;
24708 TimeSpan g_date_time_difference(DateTime* this_, DateTime* begin) nothrow;
24709 char* /*new*/ g_date_time_format(DateTime* this_, char* format) nothrow;
24710 int g_date_time_get_day_of_month(DateTime* this_) nothrow;
24711 int g_date_time_get_day_of_week(DateTime* this_) nothrow;
24712 int g_date_time_get_day_of_year(DateTime* this_) nothrow;
24713 int g_date_time_get_hour(DateTime* this_) nothrow;
24714 int g_date_time_get_microsecond(DateTime* this_) nothrow;
24715 int g_date_time_get_minute(DateTime* this_) nothrow;
24716 int g_date_time_get_month(DateTime* this_) nothrow;
24717 int g_date_time_get_second(DateTime* this_) nothrow;
24718 double g_date_time_get_seconds(DateTime* this_) nothrow;
24719 char* g_date_time_get_timezone_abbreviation(DateTime* this_) nothrow;
24720 TimeSpan g_date_time_get_utc_offset(DateTime* this_) nothrow;
24721 int g_date_time_get_week_numbering_year(DateTime* this_) nothrow;
24722 int g_date_time_get_week_of_year(DateTime* this_) nothrow;
24723 int g_date_time_get_year(DateTime* this_) nothrow;
24724 void g_date_time_get_ymd(DateTime* this_, /*out*/ int* year, /*out*/ int* month, /*out*/ int* day) nothrow;
24725 int g_date_time_is_daylight_savings(DateTime* this_) nothrow;
24726 DateTime* /*new*/ g_date_time_ref(DateTime* this_) nothrow;
24727 DateTime* /*new*/ g_date_time_to_local(DateTime* this_) nothrow;
24728 int g_date_time_to_timeval(DateTime* this_, TimeVal* tv) nothrow;
24729 DateTime* /*new*/ g_date_time_to_timezone(DateTime* this_, TimeZone* tz) nothrow;
24730 long g_date_time_to_unix(DateTime* this_) nothrow;
24731 DateTime* /*new*/ g_date_time_to_utc(DateTime* this_) nothrow;
24732 void g_date_time_unref(DateTime* this_) nothrow;
24733 int g_date_time_compare(const(void)* dt1, const(void)* dt2) nothrow;
24734 int g_date_time_equal(const(void)* dt1, const(void)* dt2) nothrow;
24735 uint g_date_time_hash(const(void)* datetime) nothrow;
24736 void g_dir_close(Dir* this_) nothrow;
24737 char* g_dir_read_name(Dir* this_) nothrow;
24738 void g_dir_rewind(Dir* this_) nothrow;
24739 char* /*new*/ g_dir_make_tmp(char* tmpl, GLib2.Error** error) nothrow;
24740 Dir* g_dir_open(char* path, uint flags, GLib2.Error** error) nothrow;
24741 Error* /*new*/ g_error_new(Quark domain, int code, char* format, ...) nothrow;
24742 Error* /*new*/ g_error_new_literal(Quark domain, int code, char* message) nothrow;
24743 Error* /*new*/ g_error_new_valist(Quark domain, int code, char* format, va_list args) nothrow;
24744 Error* /*new*/ g_error_copy(Error* this_) nothrow;
24745 void g_error_free(Error* this_) nothrow;
24746 int g_error_matches(Error* this_, Quark domain, int code) nothrow;
24747 void g_hash_table_add(GLib2.HashTable* hash_table, void* key) nothrow;
24748 int g_hash_table_contains(GLib2.HashTable* hash_table, const(void)* key) nothrow;
24749 void g_hash_table_destroy(GLib2.HashTable* hash_table) nothrow;
24750 void* g_hash_table_find(GLib2.HashTable* hash_table, HRFunc predicate, void* user_data) nothrow;
24751 void g_hash_table_foreach(GLib2.HashTable* hash_table, HFunc func, void* user_data) nothrow;
24752 uint g_hash_table_foreach_remove(GLib2.HashTable* hash_table, HRFunc func, void* user_data) nothrow;
24753 uint g_hash_table_foreach_steal(GLib2.HashTable* hash_table, HRFunc func, void* user_data) nothrow;
24754 GLib2.List* g_hash_table_get_keys(GLib2.HashTable* hash_table) nothrow;
24755 GLib2.List* g_hash_table_get_values(GLib2.HashTable* hash_table) nothrow;
24756 void g_hash_table_insert(GLib2.HashTable* hash_table, void* key, void* value) nothrow;
24757 void* g_hash_table_lookup(GLib2.HashTable* hash_table, const(void)* key) nothrow;
24758 int g_hash_table_lookup_extended(GLib2.HashTable* hash_table, const(void)* lookup_key, void** orig_key=null, void** value=null) nothrow;
24759 GLib2.HashTable* g_hash_table_new(HashFunc hash_func, EqualFunc key_equal_func) nothrow;
24760 GLib2.HashTable* g_hash_table_new_full(HashFunc hash_func, EqualFunc key_equal_func, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func) nothrow;
24761 GLib2.HashTable* g_hash_table_ref(GLib2.HashTable* hash_table) nothrow;
24762 int g_hash_table_remove(GLib2.HashTable* hash_table, const(void)* key) nothrow;
24763 void g_hash_table_remove_all(GLib2.HashTable* hash_table) nothrow;
24764 void g_hash_table_replace(GLib2.HashTable* hash_table, void* key, void* value) nothrow;
24765 uint g_hash_table_size(GLib2.HashTable* hash_table) nothrow;
24766 int g_hash_table_steal(GLib2.HashTable* hash_table, const(void)* key) nothrow;
24767 void g_hash_table_steal_all(GLib2.HashTable* hash_table) nothrow;
24768 void g_hash_table_unref(GLib2.HashTable* hash_table) nothrow;
24769 GLib2.HashTable* g_hash_table_iter_get_hash_table(HashTableIter* this_) nothrow;
24770 void g_hash_table_iter_init(HashTableIter* this_, GLib2.HashTable* hash_table) nothrow;
24771 int g_hash_table_iter_next(HashTableIter* this_, void** key, void** value) nothrow;
24772 void g_hash_table_iter_remove(HashTableIter* this_) nothrow;
24773 void g_hash_table_iter_replace(HashTableIter* this_, void* value) nothrow;
24774 void g_hash_table_iter_steal(HashTableIter* this_) nothrow;
24775 Hmac* g_hmac_copy(Hmac* this_) nothrow;
24776 void g_hmac_get_digest(Hmac* this_, ubyte* buffer, size_t* digest_len) nothrow;
24777 char* g_hmac_get_string(Hmac* this_) nothrow;
24778 Hmac* g_hmac_ref(Hmac* this_) nothrow;
24779 void g_hmac_unref(Hmac* this_) nothrow;
24780 void g_hmac_update(Hmac* this_, ubyte* data, ssize_t length) nothrow;
24781 Hmac* g_hmac_new(ChecksumType digest_type, ubyte* key, size_t key_len) nothrow;
24782 int g_hook_compare_ids(Hook* this_, Hook* sibling) nothrow;
24783 Hook* g_hook_alloc(HookList* hook_list) nothrow;
24784 int g_hook_destroy(HookList* hook_list, c_ulong hook_id) nothrow;
24785 void g_hook_destroy_link(HookList* hook_list, Hook* hook) nothrow;
24786 Hook* g_hook_find(HookList* hook_list, int need_valids, HookFindFunc func, void* data) nothrow;
24787 Hook* g_hook_find_data(HookList* hook_list, int need_valids, void* data) nothrow;
24788 Hook* g_hook_find_func(HookList* hook_list, int need_valids, void* func) nothrow;
24789 Hook* g_hook_find_func_data(HookList* hook_list, int need_valids, void* func, void* data) nothrow;
24790 Hook* g_hook_first_valid(HookList* hook_list, int may_be_in_call) nothrow;
24791 void g_hook_free(HookList* hook_list, Hook* hook) nothrow;
24792 Hook* g_hook_get(HookList* hook_list, c_ulong hook_id) nothrow;
24793 void g_hook_insert_before(HookList* hook_list, Hook* sibling, Hook* hook) nothrow;
24794 void g_hook_insert_sorted(HookList* hook_list, Hook* hook, HookCompareFunc func) nothrow;
24795 Hook* g_hook_next_valid(HookList* hook_list, Hook* hook, int may_be_in_call) nothrow;
24796 void g_hook_prepend(HookList* hook_list, Hook* hook) nothrow;
24797 Hook* g_hook_ref(HookList* hook_list, Hook* hook) nothrow;
24798 void g_hook_unref(HookList* hook_list, Hook* hook) nothrow;
24799 void g_hook_list_clear(HookList* this_) nothrow;
24800 void g_hook_list_init(HookList* this_, uint hook_size) nothrow;
24801 void g_hook_list_invoke(HookList* this_, int may_recurse) nothrow;
24802 void g_hook_list_invoke_check(HookList* this_, int may_recurse) nothrow;
24803 void g_hook_list_marshal(HookList* this_, int may_recurse, HookMarshaller marshaller, void* marshal_data) nothrow;
24804 void g_hook_list_marshal_check(HookList* this_, int may_recurse, HookCheckMarshaller marshaller, void* marshal_data) nothrow;
24805 size_t g_iconv(IConv* this_, char** inbuf, size_t* inbytes_left, char** outbuf, size_t* outbytes_left) nothrow;
24806 int g_iconv_close(IConv* this_) nothrow;
24807 IConv g_iconv_open(char* to_codeset, char* from_codeset) nothrow;
24808 IOChannel* /*new*/ g_io_channel_new_file(char* filename, char* mode, GLib2.Error** error) nothrow;
24809 IOChannel* /*new*/ g_io_channel_unix_new(int fd) nothrow;
24810 void g_io_channel_close(IOChannel* this_) nothrow;
24811 IOStatus g_io_channel_flush(IOChannel* this_, GLib2.Error** error) nothrow;
24812 IOCondition g_io_channel_get_buffer_condition(IOChannel* this_) nothrow;
24813 size_t g_io_channel_get_buffer_size(IOChannel* this_) nothrow;
24814 int g_io_channel_get_buffered(IOChannel* this_) nothrow;
24815 int g_io_channel_get_close_on_unref(IOChannel* this_) nothrow;
24816 char* g_io_channel_get_encoding(IOChannel* this_) nothrow;
24817 IOFlags g_io_channel_get_flags(IOChannel* this_) nothrow;
24818 char* g_io_channel_get_line_term(IOChannel* this_, int* length) nothrow;
24819 void g_io_channel_init(IOChannel* this_) nothrow;
24820 IOError g_io_channel_read(IOChannel* this_, char* buf, size_t count, size_t* bytes_read) nothrow;
24821 IOStatus g_io_channel_read_chars(IOChannel* this_, char* buf, size_t count, size_t* bytes_read, GLib2.Error** error) nothrow;
24822 IOStatus g_io_channel_read_line(IOChannel* this_, char** str_return, size_t* length, size_t* terminator_pos, GLib2.Error** error) nothrow;
24823 IOStatus g_io_channel_read_line_string(IOChannel* this_, String* buffer, size_t* terminator_pos, GLib2.Error** error) nothrow;
24824 IOStatus g_io_channel_read_to_end(IOChannel* this_, char** str_return, size_t* length, GLib2.Error** error) nothrow;
24825 IOStatus g_io_channel_read_unichar(IOChannel* this_, dchar* thechar, GLib2.Error** error) nothrow;
24826 IOChannel* /*new*/ g_io_channel_ref(IOChannel* this_) nothrow;
24827 IOError g_io_channel_seek(IOChannel* this_, long offset, SeekType type) nothrow;
24828 IOStatus g_io_channel_seek_position(IOChannel* this_, long offset, SeekType type, GLib2.Error** error) nothrow;
24829 void g_io_channel_set_buffer_size(IOChannel* this_, size_t size) nothrow;
24830 void g_io_channel_set_buffered(IOChannel* this_, int buffered) nothrow;
24831 void g_io_channel_set_close_on_unref(IOChannel* this_, int do_close) nothrow;
24832 IOStatus g_io_channel_set_encoding(IOChannel* this_, char* encoding, GLib2.Error** error) nothrow;
24833 IOStatus g_io_channel_set_flags(IOChannel* this_, IOFlags flags, GLib2.Error** error) nothrow;
24834 void g_io_channel_set_line_term(IOChannel* this_, char* line_term, int length) nothrow;
24835 IOStatus g_io_channel_shutdown(IOChannel* this_, int flush, GLib2.Error** error) nothrow;
24836 int g_io_channel_unix_get_fd(IOChannel* this_) nothrow;
24837 void g_io_channel_unref(IOChannel* this_) nothrow;
24838 IOError g_io_channel_write(IOChannel* this_, char* buf, size_t count, size_t* bytes_written) nothrow;
24839 IOStatus g_io_channel_write_chars(IOChannel* this_, char* buf, ssize_t count, size_t* bytes_written, GLib2.Error** error) nothrow;
24840 IOStatus g_io_channel_write_unichar(IOChannel* this_, dchar thechar, GLib2.Error** error) nothrow;
24841 IOChannelError g_io_channel_error_from_errno(int en) nothrow;
24842 Quark g_io_channel_error_quark() nothrow;
24843 KeyFile* /*new*/ g_key_file_new() nothrow;
24844 void g_key_file_free(KeyFile* this_) nothrow;
24845 int g_key_file_get_boolean(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24846 int* /*new container*/ g_key_file_get_boolean_list(KeyFile* this_, char* group_name, char* key, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24847 char* /*new*/ g_key_file_get_comment(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24848 double g_key_file_get_double(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24849 double* /*new container*/ g_key_file_get_double_list(KeyFile* this_, char* group_name, char* key, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24850 char** /*new*/ g_key_file_get_groups(KeyFile* this_, /*out*/ size_t* length=null) nothrow;
24851 long g_key_file_get_int64(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24852 int g_key_file_get_integer(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24853 int* /*new container*/ g_key_file_get_integer_list(KeyFile* this_, char* group_name, char* key, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24854 char** /*new*/ g_key_file_get_keys(KeyFile* this_, char* group_name, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24855 char* /*new*/ g_key_file_get_locale_string(KeyFile* this_, char* group_name, char* key, char* locale, GLib2.Error** error) nothrow;
24856 char** /*new*/ g_key_file_get_locale_string_list(KeyFile* this_, char* group_name, char* key, char* locale, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24857 char* /*new*/ g_key_file_get_start_group(KeyFile* this_) nothrow;
24858 char* /*new*/ g_key_file_get_string(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24859 char** /*new*/ g_key_file_get_string_list(KeyFile* this_, char* group_name, char* key, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24860 ulong g_key_file_get_uint64(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24861 char* /*new*/ g_key_file_get_value(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24862 int g_key_file_has_group(KeyFile* this_, char* group_name) nothrow;
24863 int g_key_file_has_key(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24864 int g_key_file_load_from_data(KeyFile* this_, char* data, size_t length, KeyFileFlags flags, GLib2.Error** error) nothrow;
24865 int g_key_file_load_from_data_dirs(KeyFile* this_, char* file, /*out*/ char** full_path, KeyFileFlags flags, GLib2.Error** error) nothrow;
24866 int g_key_file_load_from_dirs(KeyFile* this_, char* file, char** search_dirs, /*out*/ char** full_path, KeyFileFlags flags, GLib2.Error** error) nothrow;
24867 int g_key_file_load_from_file(KeyFile* this_, char* file, KeyFileFlags flags, GLib2.Error** error) nothrow;
24868 KeyFile* /*new*/ g_key_file_ref(KeyFile* this_) nothrow;
24869 int g_key_file_remove_comment(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24870 int g_key_file_remove_group(KeyFile* this_, char* group_name, GLib2.Error** error) nothrow;
24871 int g_key_file_remove_key(KeyFile* this_, char* group_name, char* key, GLib2.Error** error) nothrow;
24872 void g_key_file_set_boolean(KeyFile* this_, char* group_name, char* key, int value) nothrow;
24873 void g_key_file_set_boolean_list(KeyFile* this_, char* group_name, char* key, int list, size_t length) nothrow;
24874 int g_key_file_set_comment(KeyFile* this_, char* group_name, char* key, char* comment, GLib2.Error** error) nothrow;
24875 void g_key_file_set_double(KeyFile* this_, char* group_name, char* key, double value) nothrow;
24876 void g_key_file_set_double_list(KeyFile* this_, char* group_name, char* key, double list, size_t length) nothrow;
24877 void g_key_file_set_int64(KeyFile* this_, char* group_name, char* key, long value) nothrow;
24878 void g_key_file_set_integer(KeyFile* this_, char* group_name, char* key, int value) nothrow;
24879 void g_key_file_set_integer_list(KeyFile* this_, char* group_name, char* key, int list, size_t length) nothrow;
24880 void g_key_file_set_list_separator(KeyFile* this_, char separator) nothrow;
24881 void g_key_file_set_locale_string(KeyFile* this_, char* group_name, char* key, char* locale, char* string_) nothrow;
24882 void g_key_file_set_locale_string_list(KeyFile* this_, char* group_name, char* key, char* locale, char* list, size_t length) nothrow;
24883 void g_key_file_set_string(KeyFile* this_, char* group_name, char* key, char* string_) nothrow;
24884 void g_key_file_set_string_list(KeyFile* this_, char* group_name, char* key, char* list, size_t length) nothrow;
24885 void g_key_file_set_uint64(KeyFile* this_, char* group_name, char* key, ulong value) nothrow;
24886 void g_key_file_set_value(KeyFile* this_, char* group_name, char* key, char* value) nothrow;
24887 char* /*new*/ g_key_file_to_data(KeyFile* this_, /*out*/ size_t* length, GLib2.Error** error) nothrow;
24888 void g_key_file_unref(KeyFile* this_) nothrow;
24889 Quark g_key_file_error_quark() nothrow;
24890 GLib2.List* g_list_alloc() nothrow;
24891 GLib2.List* g_list_append(GLib2.List* list, void* data) nothrow;
24892 GLib2.List* g_list_concat(GLib2.List* list1, GLib2.List* list2) nothrow;
24893 GLib2.List* g_list_copy(GLib2.List* list) nothrow;
24894 GLib2.List* g_list_delete_link(GLib2.List* list, GLib2.List* link_) nothrow;
24895 GLib2.List* g_list_find(GLib2.List* list, const(void)* data) nothrow;
24896 GLib2.List* g_list_find_custom(GLib2.List* list, const(void)* data, CompareFunc func) nothrow;
24897 GLib2.List* g_list_first(GLib2.List* list) nothrow;
24898 void g_list_foreach(GLib2.List* list, Func func, void* user_data) nothrow;
24899 void g_list_free(GLib2.List* list) nothrow;
24900 void g_list_free_1(GLib2.List* list) nothrow;
24901 void g_list_free_full(GLib2.List* list, DestroyNotify free_func) nothrow;
24902 int g_list_index(GLib2.List* list, const(void)* data) nothrow;
24903 GLib2.List* g_list_insert(GLib2.List* list, void* data, int position) nothrow;
24904 GLib2.List* g_list_insert_before(GLib2.List* list, GLib2.List* sibling, void* data) nothrow;
24905 GLib2.List* g_list_insert_sorted(GLib2.List* list, void* data, CompareFunc func) nothrow;
24906 GLib2.List* g_list_insert_sorted_with_data(GLib2.List* list, void* data, CompareDataFunc func, void* user_data) nothrow;
24907 GLib2.List* g_list_last(GLib2.List* list) nothrow;
24908 uint g_list_length(GLib2.List* list) nothrow;
24909 GLib2.List* g_list_nth(GLib2.List* list, uint n) nothrow;
24910 void* g_list_nth_data(GLib2.List* list, uint n) nothrow;
24911 GLib2.List* g_list_nth_prev(GLib2.List* list, uint n) nothrow;
24912 int g_list_position(GLib2.List* list, GLib2.List* llink) nothrow;
24913 GLib2.List* g_list_prepend(GLib2.List* list, void* data) nothrow;
24914 GLib2.List* g_list_remove(GLib2.List* list, const(void)* data) nothrow;
24915 GLib2.List* g_list_remove_all(GLib2.List* list, const(void)* data) nothrow;
24916 GLib2.List* g_list_remove_link(GLib2.List* list, GLib2.List* llink) nothrow;
24917 GLib2.List* g_list_reverse(GLib2.List* list) nothrow;
24918 GLib2.List* g_list_sort(GLib2.List* list, CompareFunc compare_func) nothrow;
24919 GLib2.List* g_list_sort_with_data(GLib2.List* list, CompareDataFunc compare_func, void* user_data) nothrow;
24920 MainContext* /*new*/ g_main_context_new() nothrow;
24921 int g_main_context_acquire(MainContext* this_) nothrow;
24922 void g_main_context_add_poll(MainContext* this_, PollFD* fd, int priority) nothrow;
24923 int g_main_context_check(MainContext* this_, int max_priority, PollFD* fds, int n_fds) nothrow;
24924 void g_main_context_dispatch(MainContext* this_) nothrow;
24925 Source* g_main_context_find_source_by_funcs_user_data(MainContext* this_, SourceFuncs* funcs, void* user_data) nothrow;
24926 Source* g_main_context_find_source_by_id(MainContext* this_, uint source_id) nothrow;
24927 Source* g_main_context_find_source_by_user_data(MainContext* this_, void* user_data) nothrow;
24928 PollFunc g_main_context_get_poll_func(MainContext* this_) nothrow;
24929 void g_main_context_invoke(MainContext* this_, SourceFunc function_, void* data) nothrow;
24930 void g_main_context_invoke_full(MainContext* this_, int priority, SourceFunc function_, void* data, DestroyNotify notify) nothrow;
24931 int g_main_context_is_owner(MainContext* this_) nothrow;
24932 int g_main_context_iteration(MainContext* this_, int may_block) nothrow;
24933 int g_main_context_pending(MainContext* this_) nothrow;
24934 void g_main_context_pop_thread_default(MainContext* this_) nothrow;
24935 int g_main_context_prepare(MainContext* this_, int* priority) nothrow;
24936 void g_main_context_push_thread_default(MainContext* this_) nothrow;
24937 int g_main_context_query(MainContext* this_, int max_priority, /*out*/ int* timeout_, /*out*/ PollFD* fds, /*out*/ int n_fds) nothrow;
24938 MainContext* /*new*/ g_main_context_ref(MainContext* this_) nothrow;
24939 void g_main_context_release(MainContext* this_) nothrow;
24940 void g_main_context_remove_poll(MainContext* this_, PollFD* fd) nothrow;
24941 void g_main_context_set_poll_func(MainContext* this_, PollFunc func) nothrow;
24942 void g_main_context_unref(MainContext* this_) nothrow;
24943 int g_main_context_wait(MainContext* this_, Cond* cond, Mutex* mutex) nothrow;
24944 void g_main_context_wakeup(MainContext* this_) nothrow;
24945 MainContext* g_main_context_default() nothrow;
24946 MainContext* g_main_context_get_thread_default() nothrow;
24947 MainContext* /*new*/ g_main_context_ref_thread_default() nothrow;
24948 MainLoop* /*new*/ g_main_loop_new(MainContext* context, int is_running) nothrow;
24949 MainContext* g_main_loop_get_context(MainLoop* this_) nothrow;
24950 int g_main_loop_is_running(MainLoop* this_) nothrow;
24951 void g_main_loop_quit(MainLoop* this_) nothrow;
24952 MainLoop* /*new*/ g_main_loop_ref(MainLoop* this_) nothrow;
24953 void g_main_loop_run(MainLoop* this_) nothrow;
24954 void g_main_loop_unref(MainLoop* this_) nothrow;
24955 void g_mapped_file_free(MappedFile* this_) nothrow;
24956 char* /*new*/ g_mapped_file_get_contents(MappedFile* this_) nothrow;
24957 size_t g_mapped_file_get_length(MappedFile* this_) nothrow;
24958 MappedFile* g_mapped_file_ref(MappedFile* this_) nothrow;
24959 void g_mapped_file_unref(MappedFile* this_) nothrow;
24960 MappedFile* g_mapped_file_new(char* filename, int writable, GLib2.Error** error) nothrow;
24961 MappedFile* g_mapped_file_new_from_fd(int fd, int writable, GLib2.Error** error) nothrow;
24962 int g_markup_parse_context_end_parse(MarkupParseContext* this_, GLib2.Error** error) nothrow;
24963 void g_markup_parse_context_free(MarkupParseContext* this_) nothrow;
24964 char* g_markup_parse_context_get_element(MarkupParseContext* this_) nothrow;
24965 GLib2.SList* g_markup_parse_context_get_element_stack(MarkupParseContext* this_) nothrow;
24966 void g_markup_parse_context_get_position(MarkupParseContext* this_, int* line_number=null, int* char_number=null) nothrow;
24967 void* g_markup_parse_context_get_user_data(MarkupParseContext* this_) nothrow;
24968 int g_markup_parse_context_parse(MarkupParseContext* this_, char* text, ssize_t text_len, GLib2.Error** error) nothrow;
24969 void* g_markup_parse_context_pop(MarkupParseContext* this_) nothrow;
24970 void g_markup_parse_context_push(MarkupParseContext* this_, MarkupParser* parser, void* user_data) nothrow;
24971 MarkupParseContext* g_markup_parse_context_new(MarkupParser* parser, MarkupParseFlags flags, void* user_data, DestroyNotify user_data_dnotify) nothrow;
24972 char* /*new*/ g_match_info_expand_references(MatchInfo* this_, char* string_to_expand, GLib2.Error** error) nothrow;
24973 char* /*new*/ g_match_info_fetch(MatchInfo* this_, int match_num) nothrow;
24974 char** g_match_info_fetch_all(MatchInfo* this_) nothrow;
24975 char* /*new*/ g_match_info_fetch_named(MatchInfo* this_, char* name) nothrow;
24976 int g_match_info_fetch_named_pos(MatchInfo* this_, char* name, /*out*/ int* start_pos=null, /*out*/ int* end_pos=null) nothrow;
24977 int g_match_info_fetch_pos(MatchInfo* this_, int match_num, /*out*/ int* start_pos=null, /*out*/ int* end_pos=null) nothrow;
24978 void g_match_info_free(MatchInfo* this_) nothrow;
24979 int g_match_info_get_match_count(MatchInfo* this_) nothrow;
24980 Regex* /*new*/ g_match_info_get_regex(MatchInfo* this_) nothrow;
24981 char* g_match_info_get_string(MatchInfo* this_) nothrow;
24982 int g_match_info_is_partial_match(MatchInfo* this_) nothrow;
24983 int g_match_info_matches(MatchInfo* this_) nothrow;
24984 int g_match_info_next(MatchInfo* this_, GLib2.Error** error) nothrow;
24985 MatchInfo* /*new*/ g_match_info_ref(MatchInfo* this_) nothrow;
24986 void g_match_info_unref(MatchInfo* this_) nothrow;
24987 void g_mutex_clear(Mutex* this_) nothrow;
24988 void g_mutex_init(Mutex* this_) nothrow;
24989 void g_mutex_lock(Mutex* this_) nothrow;
24990 int g_mutex_trylock(Mutex* this_) nothrow;
24991 void g_mutex_unlock(Mutex* this_) nothrow;
24992 int g_node_child_index(Node* this_, void* data) nothrow;
24993 int g_node_child_position(Node* this_, Node* child) nothrow;
24994 void g_node_children_foreach(Node* this_, TraverseFlags flags, NodeForeachFunc func, void* data) nothrow;
24995 Node* g_node_copy(Node* this_) nothrow;
24996 Node* g_node_copy_deep(Node* this_, CopyFunc copy_func, void* data) nothrow;
24997 uint g_node_depth(Node* this_) nothrow;
24998 void g_node_destroy(Node* this_) nothrow;
24999 Node* g_node_find(Node* this_, TraverseType order, TraverseFlags flags, void* data) nothrow;
25000 Node* g_node_find_child(Node* this_, TraverseFlags flags, void* data) nothrow;
25001 Node* g_node_first_sibling(Node* this_) nothrow;
25002 Node* g_node_get_root(Node* this_) nothrow;
25003 Node* g_node_insert(Node* this_, int position, Node* node) nothrow;
25004 Node* g_node_insert_after(Node* this_, Node* sibling, Node* node) nothrow;
25005 Node* g_node_insert_before(Node* this_, Node* sibling, Node* node) nothrow;
25006 int g_node_is_ancestor(Node* this_, Node* descendant) nothrow;
25007 Node* g_node_last_child(Node* this_) nothrow;
25008 Node* g_node_last_sibling(Node* this_) nothrow;
25009 uint g_node_max_height(Node* this_) nothrow;
25010 uint g_node_n_children(Node* this_) nothrow;
25011 uint g_node_n_nodes(Node* this_, TraverseFlags flags) nothrow;
25012 Node* g_node_nth_child(Node* this_, uint n) nothrow;
25013 Node* g_node_prepend(Node* this_, Node* node) nothrow;
25014 void g_node_reverse_children(Node* this_) nothrow;
25015 void g_node_traverse(Node* this_, TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func, void* data) nothrow;
25016 void g_node_unlink(Node* this_) nothrow;
25017 Node* g_node_new(void* data) nothrow;
25018 void* g_once_impl(Once* this_, ThreadFunc func, void* arg) nothrow;
25019 int g_once_init_enter(void* location) nothrow;
25020 void g_once_init_leave(void* location, size_t result) nothrow;
25021 void g_option_context_add_group(OptionContext* this_, OptionGroup* group) nothrow;
25022 void g_option_context_add_main_entries(OptionContext* this_, OptionEntry* entries, char* translation_domain) nothrow;
25023 void g_option_context_free(OptionContext* this_) nothrow;
25024 char* g_option_context_get_description(OptionContext* this_) nothrow;
25025 char* /*new*/ g_option_context_get_help(OptionContext* this_, int main_help, OptionGroup* group) nothrow;
25026 int g_option_context_get_help_enabled(OptionContext* this_) nothrow;
25027 int g_option_context_get_ignore_unknown_options(OptionContext* this_) nothrow;
25028 OptionGroup* g_option_context_get_main_group(OptionContext* this_) nothrow;
25029 char* g_option_context_get_summary(OptionContext* this_) nothrow;
25030 int g_option_context_parse(OptionContext* this_, /*inout*/ int* argc, /*inout*/ char*** argv, GLib2.Error** error) nothrow;
25031 void g_option_context_set_description(OptionContext* this_, char* description) nothrow;
25032 void g_option_context_set_help_enabled(OptionContext* this_, int help_enabled) nothrow;
25033 void g_option_context_set_ignore_unknown_options(OptionContext* this_, int ignore_unknown) nothrow;
25034 void g_option_context_set_main_group(OptionContext* this_, OptionGroup* group) nothrow;
25035 void g_option_context_set_summary(OptionContext* this_, char* summary) nothrow;
25036 void g_option_context_set_translate_func(OptionContext* this_, TranslateFunc func, void* data, DestroyNotify destroy_notify) nothrow;
25037 void g_option_context_set_translation_domain(OptionContext* this_, char* domain) nothrow;
25038 OptionContext* g_option_context_new(char* parameter_string) nothrow;
25039 void g_option_group_add_entries(OptionGroup* this_, OptionEntry* entries) nothrow;
25040 void g_option_group_free(OptionGroup* this_) nothrow;
25041 void g_option_group_set_error_hook(OptionGroup* this_, OptionErrorFunc error_func) nothrow;
25042 void g_option_group_set_parse_hooks(OptionGroup* this_, OptionParseFunc pre_parse_func, OptionParseFunc post_parse_func) nothrow;
25043 void g_option_group_set_translate_func(OptionGroup* this_, TranslateFunc func, void* data, DestroyNotify destroy_notify) nothrow;
25044 void g_option_group_set_translation_domain(OptionGroup* this_, char* domain) nothrow;
25045 OptionGroup* g_option_group_new(char* name, char* description, char* help_description, void* user_data, DestroyNotify destroy) nothrow;
25046 int g_pattern_spec_equal(PatternSpec* this_, PatternSpec* pspec2) nothrow;
25047 void g_pattern_spec_free(PatternSpec* this_) nothrow;
25048 PatternSpec* g_pattern_spec_new(char* pattern) nothrow;
25049 void* g_private_get(Private* this_) nothrow;
25050 void g_private_replace(Private* this_, void* value) nothrow;
25051 void g_private_set(Private* this_, void* value) nothrow;
25052 void g_ptr_array_add(PtrArray* array, void* data) nothrow;
25053 void g_ptr_array_foreach(PtrArray* array, Func func, void* user_data) nothrow;
25054 void** g_ptr_array_free(PtrArray* array, int free_seg) nothrow;
25055 PtrArray* g_ptr_array_new() nothrow;
25056 PtrArray* g_ptr_array_new_full(uint reserved_size, DestroyNotify element_free_func) nothrow;
25057 PtrArray* g_ptr_array_new_with_free_func(DestroyNotify element_free_func) nothrow;
25058 PtrArray* g_ptr_array_ref(PtrArray* array) nothrow;
25059 int g_ptr_array_remove(PtrArray* array, void* data) nothrow;
25060 int g_ptr_array_remove_fast(PtrArray* array, void* data) nothrow;
25061 void* g_ptr_array_remove_index(PtrArray* array, uint index_) nothrow;
25062 void* g_ptr_array_remove_index_fast(PtrArray* array, uint index_) nothrow;
25063 void g_ptr_array_remove_range(PtrArray* array, uint index_, uint length) nothrow;
25064 void g_ptr_array_set_free_func(PtrArray* array, DestroyNotify element_free_func) nothrow;
25065 void g_ptr_array_set_size(PtrArray* array, int length) nothrow;
25066 PtrArray* g_ptr_array_sized_new(uint reserved_size) nothrow;
25067 void g_ptr_array_sort(PtrArray* array, CompareFunc compare_func) nothrow;
25068 void g_ptr_array_sort_with_data(PtrArray* array, CompareDataFunc compare_func, void* user_data) nothrow;
25069 void g_ptr_array_unref(PtrArray* array) nothrow;
25070 void g_queue_clear(Queue* this_) nothrow;
25071 Queue* g_queue_copy(Queue* this_) nothrow;
25072 void g_queue_delete_link(Queue* this_, GLib2.List* link_) nothrow;
25073 GLib2.List* g_queue_find(Queue* this_, const(void)* data) nothrow;
25074 GLib2.List* g_queue_find_custom(Queue* this_, const(void)* data, CompareFunc func) nothrow;
25075 void g_queue_foreach(Queue* this_, Func func, void* user_data) nothrow;
25076 void g_queue_free(Queue* this_) nothrow;
25077 void g_queue_free_full(Queue* this_, DestroyNotify free_func) nothrow;
25078 uint g_queue_get_length(Queue* this_) nothrow;
25079 int g_queue_index(Queue* this_, const(void)* data) nothrow;
25080 void g_queue_init(Queue* this_) nothrow;
25081 void g_queue_insert_after(Queue* this_, GLib2.List* sibling, void* data) nothrow;
25082 void g_queue_insert_before(Queue* this_, GLib2.List* sibling, void* data) nothrow;
25083 void g_queue_insert_sorted(Queue* this_, void* data, CompareDataFunc func, void* user_data) nothrow;
25084 int g_queue_is_empty(Queue* this_) nothrow;
25085 int g_queue_link_index(Queue* this_, GLib2.List* link_) nothrow;
25086 void* g_queue_peek_head(Queue* this_) nothrow;
25087 GLib2.List* g_queue_peek_head_link(Queue* this_) nothrow;
25088 void* g_queue_peek_nth(Queue* this_, uint n) nothrow;
25089 GLib2.List* g_queue_peek_nth_link(Queue* this_, uint n) nothrow;
25090 void* g_queue_peek_tail(Queue* this_) nothrow;
25091 GLib2.List* g_queue_peek_tail_link(Queue* this_) nothrow;
25092 void* g_queue_pop_head(Queue* this_) nothrow;
25093 GLib2.List* g_queue_pop_head_link(Queue* this_) nothrow;
25094 void* g_queue_pop_nth(Queue* this_, uint n) nothrow;
25095 GLib2.List* g_queue_pop_nth_link(Queue* this_, uint n) nothrow;
25096 void* g_queue_pop_tail(Queue* this_) nothrow;
25097 GLib2.List* g_queue_pop_tail_link(Queue* this_) nothrow;
25098 void g_queue_push_head(Queue* this_, void* data) nothrow;
25099 void g_queue_push_head_link(Queue* this_, GLib2.List* link_) nothrow;
25100 void g_queue_push_nth(Queue* this_, void* data, int n) nothrow;
25101 void g_queue_push_nth_link(Queue* this_, int n, GLib2.List* link_) nothrow;
25102 void g_queue_push_tail(Queue* this_, void* data) nothrow;
25103 void g_queue_push_tail_link(Queue* this_, GLib2.List* link_) nothrow;
25104 int g_queue_remove(Queue* this_, const(void)* data) nothrow;
25105 uint g_queue_remove_all(Queue* this_, const(void)* data) nothrow;
25106 void g_queue_reverse(Queue* this_) nothrow;
25107 void g_queue_sort(Queue* this_, CompareDataFunc compare_func, void* user_data) nothrow;
25108 void g_queue_unlink(Queue* this_, GLib2.List* link_) nothrow;
25109 Queue* g_queue_new() nothrow;
25110 void g_rw_lock_clear(RWLock* this_) nothrow;
25111 void g_rw_lock_init(RWLock* this_) nothrow;
25112 void g_rw_lock_reader_lock(RWLock* this_) nothrow;
25113 int g_rw_lock_reader_trylock(RWLock* this_) nothrow;
25114 void g_rw_lock_reader_unlock(RWLock* this_) nothrow;
25115 void g_rw_lock_writer_lock(RWLock* this_) nothrow;
25116 int g_rw_lock_writer_trylock(RWLock* this_) nothrow;
25117 void g_rw_lock_writer_unlock(RWLock* this_) nothrow;
25118 Rand* g_rand_copy(Rand* this_) nothrow;
25119 double g_rand_double(Rand* this_) nothrow;
25120 double g_rand_double_range(Rand* this_, double begin, double end) nothrow;
25121 void g_rand_free(Rand* this_) nothrow;
25122 uint g_rand_int(Rand* this_) nothrow;
25123 int g_rand_int_range(Rand* this_, int begin, int end) nothrow;
25124 void g_rand_set_seed(Rand* this_, uint seed) nothrow;
25125 void g_rand_set_seed_array(Rand* this_, uint* seed, uint seed_length) nothrow;
25126 Rand* g_rand_new() nothrow;
25127 Rand* g_rand_new_with_seed(uint seed) nothrow;
25128 Rand* g_rand_new_with_seed_array(uint* seed, uint seed_length) nothrow;
25129 void g_rec_mutex_clear(RecMutex* this_) nothrow;
25130 void g_rec_mutex_init(RecMutex* this_) nothrow;
25131 void g_rec_mutex_lock(RecMutex* this_) nothrow;
25132 int g_rec_mutex_trylock(RecMutex* this_) nothrow;
25133 void g_rec_mutex_unlock(RecMutex* this_) nothrow;
25134 Regex* /*new*/ g_regex_new(char* pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options, GLib2.Error** error) nothrow;
25135 int g_regex_get_capture_count(Regex* this_) nothrow;
25136 RegexCompileFlags g_regex_get_compile_flags(Regex* this_) nothrow;
25137 RegexMatchFlags g_regex_get_match_flags(Regex* this_) nothrow;
25138 int g_regex_get_max_backref(Regex* this_) nothrow;
25139 char* g_regex_get_pattern(Regex* this_) nothrow;
25140 int g_regex_get_string_number(Regex* this_, char* name) nothrow;
25141 int g_regex_match(Regex* this_, char* string_, RegexMatchFlags match_options, /*out*/ MatchInfo** match_info=null) nothrow;
25142 int g_regex_match_all(Regex* this_, char* string_, RegexMatchFlags match_options, /*out*/ MatchInfo** match_info=null) nothrow;
25143 int g_regex_match_all_full(Regex* this_, char* string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, /*out*/ MatchInfo** match_info, GLib2.Error** error) nothrow;
25144 int g_regex_match_full(Regex* this_, char* string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, /*out*/ MatchInfo** match_info, GLib2.Error** error) nothrow;
25145 Regex* /*new*/ g_regex_ref(Regex* this_) nothrow;
25146 char* /*new*/ g_regex_replace(Regex* this_, char* string_, ssize_t string_len, int start_position, char* replacement, RegexMatchFlags match_options, GLib2.Error** error) nothrow;
25147 char* /*new*/ g_regex_replace_eval(Regex* this_, char* string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, RegexEvalCallback eval, void* user_data, GLib2.Error** error) nothrow;
25148 char* /*new*/ g_regex_replace_literal(Regex* this_, char* string_, ssize_t string_len, int start_position, char* replacement, RegexMatchFlags match_options, GLib2.Error** error) nothrow;
25149 char** g_regex_split(Regex* this_, char* string_, RegexMatchFlags match_options) nothrow;
25150 char** g_regex_split_full(Regex* this_, char* string_, ssize_t string_len, int start_position, RegexMatchFlags match_options, int max_tokens, GLib2.Error** error) nothrow;
25151 void g_regex_unref(Regex* this_) nothrow;
25152 int g_regex_check_replacement(char* replacement, /*out*/ int* has_references, GLib2.Error** error) nothrow;
25153 Quark g_regex_error_quark() nothrow;
25154 char* /*new*/ g_regex_escape_nul(char* string_, int length) nothrow;
25155 char* /*new*/ g_regex_escape_string(char* string_, int length) nothrow;
25156 int g_regex_match_simple(char* pattern, char* string_, RegexCompileFlags compile_options, RegexMatchFlags match_options) nothrow;
25157 char** g_regex_split_simple(char* pattern, char* string_, RegexCompileFlags compile_options, RegexMatchFlags match_options) nothrow;
25158 GLib2.SList* g_slist_alloc() nothrow;
25159 GLib2.SList* g_slist_append(GLib2.SList* list, void* data) nothrow;
25160 GLib2.SList* g_slist_concat(GLib2.SList* list1, GLib2.SList* list2) nothrow;
25161 GLib2.SList* g_slist_copy(GLib2.SList* list) nothrow;
25162 GLib2.SList* g_slist_delete_link(GLib2.SList* list, GLib2.SList* link_) nothrow;
25163 GLib2.SList* g_slist_find(GLib2.SList* list, const(void)* data) nothrow;
25164 GLib2.SList* g_slist_find_custom(GLib2.SList* list, const(void)* data, CompareFunc func) nothrow;
25165 void g_slist_foreach(GLib2.SList* list, Func func, void* user_data) nothrow;
25166 void g_slist_free(GLib2.SList* list) nothrow;
25167 void g_slist_free_1(GLib2.SList* list) nothrow;
25168 void g_slist_free_full(GLib2.SList* list, DestroyNotify free_func) nothrow;
25169 int g_slist_index(GLib2.SList* list, const(void)* data) nothrow;
25170 GLib2.SList* g_slist_insert(GLib2.SList* list, void* data, int position) nothrow;
25171 GLib2.SList* g_slist_insert_before(GLib2.SList* slist, GLib2.SList* sibling, void* data) nothrow;
25172 GLib2.SList* g_slist_insert_sorted(GLib2.SList* list, void* data, CompareFunc func) nothrow;
25173 GLib2.SList* g_slist_insert_sorted_with_data(GLib2.SList* list, void* data, CompareDataFunc func, void* user_data) nothrow;
25174 GLib2.SList* g_slist_last(GLib2.SList* list) nothrow;
25175 uint g_slist_length(GLib2.SList* list) nothrow;
25176 GLib2.SList* g_slist_nth(GLib2.SList* list, uint n) nothrow;
25177 void* g_slist_nth_data(GLib2.SList* list, uint n) nothrow;
25178 int g_slist_position(GLib2.SList* list, GLib2.SList* llink) nothrow;
25179 GLib2.SList* g_slist_prepend(GLib2.SList* list, void* data) nothrow;
25180 GLib2.SList* g_slist_remove(GLib2.SList* list, const(void)* data) nothrow;
25181 GLib2.SList* g_slist_remove_all(GLib2.SList* list, const(void)* data) nothrow;
25182 GLib2.SList* g_slist_remove_link(GLib2.SList* list, GLib2.SList* link_) nothrow;
25183 GLib2.SList* g_slist_reverse(GLib2.SList* list) nothrow;
25184 GLib2.SList* g_slist_sort(GLib2.SList* list, CompareFunc compare_func) nothrow;
25185 GLib2.SList* g_slist_sort_with_data(GLib2.SList* list, CompareDataFunc compare_func, void* user_data) nothrow;
25186 uint g_scanner_cur_line(Scanner* this_) nothrow;
25187 uint g_scanner_cur_position(Scanner* this_) nothrow;
25188 TokenType g_scanner_cur_token(Scanner* this_) nothrow;
25189 TokenValue g_scanner_cur_value(Scanner* this_) nothrow;
25190 void g_scanner_destroy(Scanner* this_) nothrow;
25191 int g_scanner_eof(Scanner* this_) nothrow;
25192 void g_scanner_error(Scanner* this_, char* format, ...) nothrow;
25193 TokenType g_scanner_get_next_token(Scanner* this_) nothrow;
25194 void g_scanner_input_file(Scanner* this_, int input_fd) nothrow;
25195 void g_scanner_input_text(Scanner* this_, char* text, uint text_len) nothrow;
25196 void* g_scanner_lookup_symbol(Scanner* this_, char* symbol) nothrow;
25197 TokenType g_scanner_peek_next_token(Scanner* this_) nothrow;
25198 void g_scanner_scope_add_symbol(Scanner* this_, uint scope_id, char* symbol, void* value) nothrow;
25199 void g_scanner_scope_foreach_symbol(Scanner* this_, uint scope_id, HFunc func, void* user_data) nothrow;
25200 void* g_scanner_scope_lookup_symbol(Scanner* this_, uint scope_id, char* symbol) nothrow;
25201 void g_scanner_scope_remove_symbol(Scanner* this_, uint scope_id, char* symbol) nothrow;
25202 uint g_scanner_set_scope(Scanner* this_, uint scope_id) nothrow;
25203 void g_scanner_sync_file_offset(Scanner* this_) nothrow;
25204 void g_scanner_unexp_token(Scanner* this_, TokenType expected_token, char* identifier_spec, char* symbol_spec, char* symbol_name, char* message, int is_error) nothrow;
25205 void g_scanner_warn(Scanner* this_, char* format, ...) nothrow;
25206 Scanner* g_scanner_new(ScannerConfig* config_templ) nothrow;
25207 SequenceIter* g_sequence_append(Sequence* this_, void* data) nothrow;
25208 void g_sequence_foreach(Sequence* this_, Func func, void* user_data) nothrow;
25209 void g_sequence_free(Sequence* this_) nothrow;
25210 SequenceIter* g_sequence_get_begin_iter(Sequence* this_) nothrow;
25211 SequenceIter* g_sequence_get_end_iter(Sequence* this_) nothrow;
25212 SequenceIter* g_sequence_get_iter_at_pos(Sequence* this_, int pos) nothrow;
25213 int g_sequence_get_length(Sequence* this_) nothrow;
25214 SequenceIter* g_sequence_insert_sorted(Sequence* this_, void* data, CompareDataFunc cmp_func, void* cmp_data) nothrow;
25215 SequenceIter* g_sequence_insert_sorted_iter(Sequence* this_, void* data, SequenceIterCompareFunc iter_cmp, void* cmp_data) nothrow;
25216 SequenceIter* g_sequence_lookup(Sequence* this_, void* data, CompareDataFunc cmp_func, void* cmp_data) nothrow;
25217 SequenceIter* g_sequence_lookup_iter(Sequence* this_, void* data, SequenceIterCompareFunc iter_cmp, void* cmp_data) nothrow;
25218 SequenceIter* g_sequence_prepend(Sequence* this_, void* data) nothrow;
25219 SequenceIter* g_sequence_search(Sequence* this_, void* data, CompareDataFunc cmp_func, void* cmp_data) nothrow;
25220 SequenceIter* g_sequence_search_iter(Sequence* this_, void* data, SequenceIterCompareFunc iter_cmp, void* cmp_data) nothrow;
25221 void g_sequence_sort(Sequence* this_, CompareDataFunc cmp_func, void* cmp_data) nothrow;
25222 void g_sequence_sort_iter(Sequence* this_, SequenceIterCompareFunc cmp_func, void* cmp_data) nothrow;
25223 void g_sequence_foreach_range(SequenceIter* begin, SequenceIter* end, Func func, void* user_data) nothrow;
25224 void* g_sequence_get(SequenceIter* iter) nothrow;
25225 SequenceIter* g_sequence_insert_before(SequenceIter* iter, void* data) nothrow;
25226 void g_sequence_move(SequenceIter* src, SequenceIter* dest) nothrow;
25227 void g_sequence_move_range(SequenceIter* dest, SequenceIter* begin, SequenceIter* end) nothrow;
25228 Sequence* g_sequence_new(DestroyNotify data_destroy) nothrow;
25229 SequenceIter* g_sequence_range_get_midpoint(SequenceIter* begin, SequenceIter* end) nothrow;
25230 void g_sequence_remove(SequenceIter* iter) nothrow;
25231 void g_sequence_remove_range(SequenceIter* begin, SequenceIter* end) nothrow;
25232 void g_sequence_set(SequenceIter* iter, void* data) nothrow;
25233 void g_sequence_sort_changed(SequenceIter* iter, CompareDataFunc cmp_func, void* cmp_data) nothrow;
25234 void g_sequence_sort_changed_iter(SequenceIter* iter, SequenceIterCompareFunc iter_cmp, void* cmp_data) nothrow;
25235 void g_sequence_swap(SequenceIter* a, SequenceIter* b) nothrow;
25236 int g_sequence_iter_compare(SequenceIter* this_, SequenceIter* b) nothrow;
25237 int g_sequence_iter_get_position(SequenceIter* this_) nothrow;
25238 Sequence* g_sequence_iter_get_sequence(SequenceIter* this_) nothrow;
25239 int g_sequence_iter_is_begin(SequenceIter* this_) nothrow;
25240 int g_sequence_iter_is_end(SequenceIter* this_) nothrow;
25241 SequenceIter* g_sequence_iter_move(SequenceIter* this_, int delta) nothrow;
25242 SequenceIter* g_sequence_iter_next(SequenceIter* this_) nothrow;
25243 SequenceIter* g_sequence_iter_prev(SequenceIter* this_) nothrow;
25244 Source* /*new*/ g_source_new(SourceFuncs* source_funcs, uint struct_size) nothrow;
25245 void g_source_add_child_source(Source* this_, Source* child_source) nothrow;
25246 void g_source_add_poll(Source* this_, PollFD* fd) nothrow;
25247 uint g_source_attach(Source* this_, MainContext* context=null) nothrow;
25248 void g_source_destroy(Source* this_) nothrow;
25249 int g_source_get_can_recurse(Source* this_) nothrow;
25250 MainContext* g_source_get_context(Source* this_) nothrow;
25251 void g_source_get_current_time(Source* this_, TimeVal* timeval) nothrow;
25252 uint g_source_get_id(Source* this_) nothrow;
25253 char* g_source_get_name(Source* this_) nothrow;
25254 int g_source_get_priority(Source* this_) nothrow;
25255 long g_source_get_time(Source* this_) nothrow;
25256 int g_source_is_destroyed(Source* this_) nothrow;
25257 Source* /*new*/ g_source_ref(Source* this_) nothrow;
25258 void g_source_remove_child_source(Source* this_, Source* child_source) nothrow;
25259 void g_source_remove_poll(Source* this_, PollFD* fd) nothrow;
25260 void g_source_set_callback(Source* this_, SourceFunc func, void* data, DestroyNotify notify) nothrow;
25261 void g_source_set_callback_indirect(Source* this_, void* callback_data, SourceCallbackFuncs* callback_funcs) nothrow;
25262 void g_source_set_can_recurse(Source* this_, int can_recurse) nothrow;
25263 void g_source_set_funcs(Source* this_, SourceFuncs* funcs) nothrow;
25264 void g_source_set_name(Source* this_, char* name) nothrow;
25265 void g_source_set_priority(Source* this_, int priority) nothrow;
25266 void g_source_unref(Source* this_) nothrow;
25267 int g_source_remove(uint tag) nothrow;
25268 int g_source_remove_by_funcs_user_data(SourceFuncs* funcs, void* user_data) nothrow;
25269 int g_source_remove_by_user_data(void* user_data) nothrow;
25270 void g_source_set_name_by_id(uint tag, char* name) nothrow;
25271 String* /*new*/ g_string_append(String* this_, char* val) nothrow;
25272 String* /*new*/ g_string_append_c(String* this_, char c) nothrow;
25273 String* /*new*/ g_string_append_len(String* this_, char* val, ssize_t len) nothrow;
25274 void g_string_append_printf(String* this_, char* format, ...) nothrow;
25275 String* /*new*/ g_string_append_unichar(String* this_, dchar wc) nothrow;
25276 String* /*new*/ g_string_append_uri_escaped(String* this_, char* unescaped, char* reserved_chars_allowed, int allow_utf8) nothrow;
25277 void g_string_append_vprintf(String* this_, char* format, va_list args) nothrow;
25278 String* /*new*/ g_string_ascii_down(String* this_) nothrow;
25279 String* /*new*/ g_string_ascii_up(String* this_) nothrow;
25280 String* /*new*/ g_string_assign(String* this_, char* rval) nothrow;
25281 String* /*new*/ g_string_down(String* this_) nothrow;
25282 int g_string_equal(String* this_, String* v2) nothrow;
25283 String* /*new*/ g_string_erase(String* this_, ssize_t pos, ssize_t len) nothrow;
25284 char* /*new*/ g_string_free(String* this_, int free_segment) nothrow;
25285 uint g_string_hash(String* this_) nothrow;
25286 String* /*new*/ g_string_insert(String* this_, ssize_t pos, char* val) nothrow;
25287 String* /*new*/ g_string_insert_c(String* this_, ssize_t pos, char c) nothrow;
25288 String* /*new*/ g_string_insert_len(String* this_, ssize_t pos, char* val, ssize_t len) nothrow;
25289 String* /*new*/ g_string_insert_unichar(String* this_, ssize_t pos, dchar wc) nothrow;
25290 String* /*new*/ g_string_overwrite(String* this_, size_t pos, char* val) nothrow;
25291 String* /*new*/ g_string_overwrite_len(String* this_, size_t pos, char* val, ssize_t len) nothrow;
25292 String* /*new*/ g_string_prepend(String* this_, char* val) nothrow;
25293 String* /*new*/ g_string_prepend_c(String* this_, char c) nothrow;
25294 String* /*new*/ g_string_prepend_len(String* this_, char* val, ssize_t len) nothrow;
25295 String* /*new*/ g_string_prepend_unichar(String* this_, dchar wc) nothrow;
25296 void g_string_printf(String* this_, char* format, ...) nothrow;
25297 String* /*new*/ g_string_set_size(String* this_, size_t len) nothrow;
25298 String* /*new*/ g_string_truncate(String* this_, size_t len) nothrow;
25299 String* /*new*/ g_string_up(String* this_) nothrow;
25300 void g_string_vprintf(String* this_, char* format, va_list args) nothrow;
25301 void g_string_chunk_clear(StringChunk* this_) nothrow;
25302 void g_string_chunk_free(StringChunk* this_) nothrow;
25303 char* /*new*/ g_string_chunk_insert(StringChunk* this_, char* string_) nothrow;
25304 char* /*new*/ g_string_chunk_insert_const(StringChunk* this_, char* string_) nothrow;
25305 char* /*new*/ g_string_chunk_insert_len(StringChunk* this_, char* string_, ssize_t len) nothrow;
25306 StringChunk* g_string_chunk_new(size_t size) nothrow;
25307 void g_test_log_buffer_free(TestLogBuffer* this_) nothrow;
25308 TestLogMsg* g_test_log_buffer_pop(TestLogBuffer* this_) nothrow;
25309 void g_test_log_buffer_push(TestLogBuffer* this_, uint n_bytes, ubyte* bytes) nothrow;
25310 TestLogBuffer* g_test_log_buffer_new() nothrow;
25311 void g_test_log_msg_free(TestLogMsg* this_) nothrow;
25312 void g_test_suite_add(TestSuite* this_, TestCase* test_case) nothrow;
25313 void g_test_suite_add_suite(TestSuite* this_, TestSuite* nestedsuite) nothrow;
25314 void* g_thread_join(Thread* this_) nothrow;
25315 Thread* g_thread_ref(Thread* this_) nothrow;
25316 void g_thread_unref(Thread* this_) nothrow;
25317 Quark g_thread_error_quark() nothrow;
25318 void g_thread_exit(void* retval) nothrow;
25319 Thread* g_thread_new(char* name, ThreadFunc func, void* data) nothrow;
25320 Thread* g_thread_self() nothrow;
25321 Thread* g_thread_try_new(char* name, ThreadFunc func, void* data, GLib2.Error** error) nothrow;
25322 void g_thread_yield() nothrow;
25323 void g_thread_pool_free(ThreadPool* this_, int immediate, int wait_) nothrow;
25324 int g_thread_pool_get_max_threads(ThreadPool* this_) nothrow;
25325 uint g_thread_pool_get_num_threads(ThreadPool* this_) nothrow;
25326 int g_thread_pool_push(ThreadPool* this_, void* data, GLib2.Error** error) nothrow;
25327 int g_thread_pool_set_max_threads(ThreadPool* this_, int max_threads, GLib2.Error** error) nothrow;
25328 void g_thread_pool_set_sort_function(ThreadPool* this_, CompareDataFunc func, void* user_data) nothrow;
25329 uint g_thread_pool_unprocessed(ThreadPool* this_) nothrow;
25330 uint g_thread_pool_get_max_idle_time() nothrow;
25331 int g_thread_pool_get_max_unused_threads() nothrow;
25332 uint g_thread_pool_get_num_unused_threads() nothrow;
25333 ThreadPool* g_thread_pool_new(Func func, void* user_data, int max_threads, int exclusive, GLib2.Error** error) nothrow;
25334 void g_thread_pool_set_max_idle_time(uint interval) nothrow;
25335 void g_thread_pool_set_max_unused_threads(int max_threads) nothrow;
25336 void g_thread_pool_stop_unused_threads() nothrow;
25337 void g_time_val_add(TimeVal* this_, c_long microseconds) nothrow;
25338 char* /*new*/ g_time_val_to_iso8601(TimeVal* this_) nothrow;
25339 int g_time_val_from_iso8601(char* iso_date, /*out*/ TimeVal* time_) nothrow;
25340 int g_time_zone_adjust_time(TimeZone* this_, TimeType type, long* time_) nothrow;
25341 int g_time_zone_find_interval(TimeZone* this_, TimeType type, long time_) nothrow;
25342 char* g_time_zone_get_abbreviation(TimeZone* this_, int interval) nothrow;
25343 int g_time_zone_get_offset(TimeZone* this_, int interval) nothrow;
25344 int g_time_zone_is_dst(TimeZone* this_, int interval) nothrow;
25345 TimeZone* g_time_zone_ref(TimeZone* this_) nothrow;
25346 void g_time_zone_unref(TimeZone* this_) nothrow;
25347 TimeZone* g_time_zone_new(char* identifier=null) nothrow;
25348 TimeZone* g_time_zone_new_local() nothrow;
25349 TimeZone* g_time_zone_new_utc() nothrow;
25350 void g_timer_continue(Timer* this_) nothrow;
25351 void g_timer_destroy(Timer* this_) nothrow;
25352 double g_timer_elapsed(Timer* this_, c_ulong* microseconds) nothrow;
25353 void g_timer_reset(Timer* this_) nothrow;
25354 void g_timer_start(Timer* this_) nothrow;
25355 void g_timer_stop(Timer* this_) nothrow;
25356 Timer* g_timer_new() nothrow;
25357 uint g_trash_stack_height(TrashStack** stack_p) nothrow;
25358 void* g_trash_stack_peek(TrashStack** stack_p) nothrow;
25359 void* g_trash_stack_pop(TrashStack** stack_p) nothrow;
25360 void g_trash_stack_push(TrashStack** stack_p, void* data_p) nothrow;
25361 void g_tree_destroy(Tree* this_) nothrow;
25362 void g_tree_foreach(Tree* this_, TraverseFunc func, void* user_data) nothrow;
25363 int g_tree_height(Tree* this_) nothrow;
25364 void g_tree_insert(Tree* this_, void* key, void* value) nothrow;
25365 void* g_tree_lookup(Tree* this_, const(void)* key) nothrow;
25366 int g_tree_lookup_extended(Tree* this_, const(void)* lookup_key, void** orig_key, void** value) nothrow;
25367 int g_tree_nnodes(Tree* this_) nothrow;
25368 Tree* g_tree_ref(Tree* this_) nothrow;
25369 int g_tree_remove(Tree* this_, const(void)* key) nothrow;
25370 void g_tree_replace(Tree* this_, void* key, void* value) nothrow;
25371 void* g_tree_search(Tree* this_, CompareFunc search_func, const(void)* user_data) nothrow;
25372 int g_tree_steal(Tree* this_, const(void)* key) nothrow;
25373 void g_tree_traverse(Tree* this_, TraverseFunc traverse_func, TraverseType traverse_type, void* user_data) nothrow;
25374 void g_tree_unref(Tree* this_) nothrow;
25375 Tree* g_tree_new(CompareFunc key_compare_func) nothrow;
25376 Tree* g_tree_new_full(CompareDataFunc key_compare_func, void* key_compare_data, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func) nothrow;
25377 Tree* g_tree_new_with_data(CompareDataFunc key_compare_func, void* key_compare_data) nothrow;
25378 Variant* /*new*/ g_variant_new(char* format_string, ...) nothrow;
25379 Variant* g_variant_new_array(VariantType* child_type, Variant** children, size_t n_children) nothrow;
25380 Variant* g_variant_new_boolean(int value) nothrow;
25381 Variant* g_variant_new_byte(ubyte value) nothrow;
25382 Variant* g_variant_new_bytestring(ubyte* string_) nothrow;
25383 Variant* g_variant_new_bytestring_array(char** strv, ssize_t length) nothrow;
25384 Variant* g_variant_new_dict_entry(Variant* key, Variant* value) nothrow;
25385 Variant* g_variant_new_double(double value) nothrow;
25386 Variant* g_variant_new_fixed_array(VariantType* element_type, const(void)* elements, size_t n_elements, size_t element_size) nothrow;
25387 Variant* g_variant_new_from_data(VariantType* type, const(ubyte)* data, size_t size, int trusted, DestroyNotify notify, void* user_data) nothrow;
25388 Variant* g_variant_new_handle(int value) nothrow;
25389 Variant* g_variant_new_int16(short value) nothrow;
25390 Variant* g_variant_new_int32(int value) nothrow;
25391 Variant* g_variant_new_int64(long value) nothrow;
25392 Variant* g_variant_new_maybe(VariantType* child_type=null, Variant* child=null) nothrow;
25393 Variant* g_variant_new_object_path(char* object_path) nothrow;
25394 Variant* g_variant_new_objv(char** strv, ssize_t length) nothrow;
25395 Variant* /*new*/ g_variant_new_parsed(char* format, ...) nothrow;
25396 Variant* /*new*/ g_variant_new_parsed_va(char* format, va_list* app) nothrow;
25397 Variant* g_variant_new_signature(char* signature) nothrow;
25398 Variant* g_variant_new_string(char* string_) nothrow;
25399 Variant* g_variant_new_strv(char** strv, ssize_t length) nothrow;
25400 Variant* g_variant_new_tuple(Variant** children, size_t n_children) nothrow;
25401 Variant* g_variant_new_uint16(ushort value) nothrow;
25402 Variant* g_variant_new_uint32(uint value) nothrow;
25403 Variant* g_variant_new_uint64(ulong value) nothrow;
25404 Variant* /*new*/ g_variant_new_va(char* format_string, char** endptr, va_list* app) nothrow;
25405 Variant* g_variant_new_variant(Variant* value) nothrow;
25406 Variant* /*new*/ g_variant_byteswap(Variant* this_) nothrow;
25407 VariantClass g_variant_classify(Variant* this_) nothrow;
25408 int g_variant_compare(Variant* this_, const(Variant)* two) nothrow;
25409 char* /*new*/ g_variant_dup_bytestring(Variant* this_, /*out*/ size_t* length=null) nothrow;
25410 char** /*new*/ g_variant_dup_bytestring_array(Variant* this_, /*out*/ size_t* length=null) nothrow;
25411 char** /*new*/ g_variant_dup_objv(Variant* this_, /*out*/ size_t* length=null) nothrow;
25412 char* /*new*/ g_variant_dup_string(Variant* this_, /*out*/ size_t* length) nothrow;
25413 char** /*new*/ g_variant_dup_strv(Variant* this_, /*out*/ size_t* length=null) nothrow;
25414 int g_variant_equal(Variant* this_, const(Variant)* two) nothrow;
25415 void g_variant_get(Variant* this_, char* format_string, ...) nothrow;
25416 int g_variant_get_boolean(Variant* this_) nothrow;
25417 ubyte g_variant_get_byte(Variant* this_) nothrow;
25418 ubyte* g_variant_get_bytestring(Variant* this_) nothrow;
25419 char** /*new container*/ g_variant_get_bytestring_array(Variant* this_, /*out*/ size_t* length=null) nothrow;
25420 void g_variant_get_child(Variant* this_, size_t index_, char* format_string, ...) nothrow;
25421 Variant* /*new*/ g_variant_get_child_value(Variant* this_, size_t index_) nothrow;
25422 const(void)* g_variant_get_data(Variant* this_) nothrow;
25423 double g_variant_get_double(Variant* this_) nothrow;
25424 const(void)* g_variant_get_fixed_array(Variant* this_, /*out*/ size_t* n_elements, size_t element_size) nothrow;
25425 int g_variant_get_handle(Variant* this_) nothrow;
25426 short g_variant_get_int16(Variant* this_) nothrow;
25427 int g_variant_get_int32(Variant* this_) nothrow;
25428 long g_variant_get_int64(Variant* this_) nothrow;
25429 Variant* /*new*/ g_variant_get_maybe(Variant* this_) nothrow;
25430 Variant* /*new*/ g_variant_get_normal_form(Variant* this_) nothrow;
25431 char** /*new container*/ g_variant_get_objv(Variant* this_, /*out*/ size_t* length=null) nothrow;
25432 size_t g_variant_get_size(Variant* this_) nothrow;
25433 char* g_variant_get_string(Variant* this_, /*out*/ size_t* length=null) nothrow;
25434 char** /*new container*/ g_variant_get_strv(Variant* this_, /*out*/ size_t* length=null) nothrow;
25435 VariantType* g_variant_get_type(Variant* this_) nothrow;
25436 char* g_variant_get_type_string(Variant* this_) nothrow;
25437 ushort g_variant_get_uint16(Variant* this_) nothrow;
25438 uint g_variant_get_uint32(Variant* this_) nothrow;
25439 ulong g_variant_get_uint64(Variant* this_) nothrow;
25440 void g_variant_get_va(Variant* this_, char* format_string, char** endptr, va_list* app) nothrow;
25441 Variant* /*new*/ g_variant_get_variant(Variant* this_) nothrow;
25442 uint g_variant_hash(Variant* this_) nothrow;
25443 int g_variant_is_container(Variant* this_) nothrow;
25444 int g_variant_is_floating(Variant* this_) nothrow;
25445 int g_variant_is_normal_form(Variant* this_) nothrow;
25446 int g_variant_is_of_type(Variant* this_, VariantType* type) nothrow;
25447 VariantIter* /*new*/ g_variant_iter_new(Variant* this_) nothrow;
25448 int g_variant_lookup(Variant* this_, char* key, char* format_string, ...) nothrow;
25449 Variant* /*new*/ g_variant_lookup_value(Variant* this_, char* key, VariantType* expected_type=null) nothrow;
25450 size_t g_variant_n_children(Variant* this_) nothrow;
25451 char* /*new*/ g_variant_print(Variant* this_, int type_annotate) nothrow;
25452 String* /*new*/ g_variant_print_string(Variant* this_, String* string_, int type_annotate) nothrow;
25453 Variant* /*new*/ g_variant_ref(Variant* this_) nothrow;
25454 Variant* /*new*/ g_variant_ref_sink(Variant* this_) nothrow;
25455 void g_variant_store(Variant* this_, void* data) nothrow;
25456 Variant* /*new*/ g_variant_take_ref(Variant* this_) nothrow;
25457 void g_variant_unref(Variant* this_) nothrow;
25458 int g_variant_is_object_path(char* string_) nothrow;
25459 int g_variant_is_signature(char* string_) nothrow;
25460 Variant* /*new*/ g_variant_parse(VariantType* type, char* text, char* limit, char** endptr, GLib2.Error** error) nothrow;
25461 Quark g_variant_parser_get_error_quark() nothrow;
25462 VariantBuilder* /*new*/ g_variant_builder_new(VariantType* type) nothrow;
25463 void g_variant_builder_add(VariantBuilder* this_, char* format_string, ...) nothrow;
25464 void g_variant_builder_add_parsed(VariantBuilder* this_, char* format, ...) nothrow;
25465 void g_variant_builder_add_value(VariantBuilder* this_, Variant* value) nothrow;
25466 void g_variant_builder_clear(VariantBuilder* this_) nothrow;
25467 void g_variant_builder_close(VariantBuilder* this_) nothrow;
25468 Variant* g_variant_builder_end(VariantBuilder* this_) nothrow;
25469 void g_variant_builder_init(VariantBuilder* this_, VariantType* type) nothrow;
25470 void g_variant_builder_open(VariantBuilder* this_, VariantType* type) nothrow;
25471 VariantBuilder* /*new*/ g_variant_builder_ref(VariantBuilder* this_) nothrow;
25472 void g_variant_builder_unref(VariantBuilder* this_) nothrow;
25473 VariantIter* /*new*/ g_variant_iter_copy(VariantIter* this_) nothrow;
25474 void g_variant_iter_free(VariantIter* this_) nothrow;
25475 size_t g_variant_iter_init(VariantIter* this_, Variant* value) nothrow;
25476 int g_variant_iter_loop(VariantIter* this_, char* format_string, ...) nothrow;
25477 size_t g_variant_iter_n_children(VariantIter* this_) nothrow;
25478 int g_variant_iter_next(VariantIter* this_, char* format_string, ...) nothrow;
25479 Variant* /*new*/ g_variant_iter_next_value(VariantIter* this_) nothrow;
25480 VariantType* /*new*/ g_variant_type_new(char* type_string) nothrow;
25481 VariantType* /*new*/ g_variant_type_new_tuple(VariantType** items, int length) nothrow;
25482 VariantType* /*new*/ g_variant_type_copy(VariantType* this_) nothrow;
25483 char* /*new*/ g_variant_type_dup_string(VariantType* this_) nothrow;
25484 VariantType* g_variant_type_element(VariantType* this_) nothrow;
25485 int g_variant_type_equal(VariantType* this_, const(VariantType)* type2) nothrow;
25486 VariantType* g_variant_type_first(VariantType* this_) nothrow;
25487 void g_variant_type_free(VariantType* this_) nothrow;
25488 size_t g_variant_type_get_string_length(VariantType* this_) nothrow;
25489 uint g_variant_type_hash(VariantType* this_) nothrow;
25490 int g_variant_type_is_array(VariantType* this_) nothrow;
25491 int g_variant_type_is_basic(VariantType* this_) nothrow;
25492 int g_variant_type_is_container(VariantType* this_) nothrow;
25493 int g_variant_type_is_definite(VariantType* this_) nothrow;
25494 int g_variant_type_is_dict_entry(VariantType* this_) nothrow;
25495 int g_variant_type_is_maybe(VariantType* this_) nothrow;
25496 int g_variant_type_is_subtype_of(VariantType* this_, VariantType* supertype) nothrow;
25497 int g_variant_type_is_tuple(VariantType* this_) nothrow;
25498 int g_variant_type_is_variant(VariantType* this_) nothrow;
25499 VariantType* g_variant_type_key(VariantType* this_) nothrow;
25500 size_t g_variant_type_n_items(VariantType* this_) nothrow;
25501 VariantType* /*new*/ g_variant_type_new_array(VariantType* this_) nothrow;
25502 VariantType* /*new*/ g_variant_type_new_dict_entry(VariantType* this_, VariantType* value) nothrow;
25503 VariantType* /*new*/ g_variant_type_new_maybe(VariantType* this_) nothrow;
25504 VariantType* g_variant_type_next(VariantType* this_) nothrow;
25505 char* g_variant_type_peek_string(VariantType* this_) nothrow;
25506 VariantType* g_variant_type_value(VariantType* this_) nothrow;
25507 VariantType* g_variant_type_checked_(char* arg_a) nothrow;
25508 int g_variant_type_string_is_valid(char* type_string) nothrow;
25509 int g_variant_type_string_scan(char* string_, char* limit=null, /*out*/ char** endptr=null) nothrow;
25510 int g_access(char* filename, int mode) nothrow;
25511 int g_ascii_digit_value(char c) nothrow;
25512 char* /*new*/ g_ascii_dtostr(char* buffer, int buf_len, double d) nothrow;
25513 char* /*new*/ g_ascii_formatd(char* buffer, int buf_len, char* format, double d) nothrow;
25514 int g_ascii_strcasecmp(char* s1, char* s2) nothrow;
25515 char* /*new*/ g_ascii_strdown(char* str, ssize_t len) nothrow;
25516 int g_ascii_strncasecmp(char* s1, char* s2, size_t n) nothrow;
25517 double g_ascii_strtod(char* nptr, char** endptr) nothrow;
25518 long g_ascii_strtoll(char* nptr, char** endptr, uint base) nothrow;
25519 ulong g_ascii_strtoull(char* nptr, char** endptr, uint base) nothrow;
25520 char* /*new*/ g_ascii_strup(char* str, ssize_t len) nothrow;
25521 char g_ascii_tolower(char c) nothrow;
25522 char g_ascii_toupper(char c) nothrow;
25523 int g_ascii_xdigit_value(char c) nothrow;
25524 void g_assert_warning(char* log_domain, char* file, int line, char* pretty_function, char* expression) nothrow;
25525 void g_assertion_message(char* domain, char* file, int line, char* func, char* message) nothrow;
25526 void g_assertion_message_cmpnum(char* domain, char* file, int line, char* func, char* expr, real arg1, char* cmp, real arg2, char numtype) nothrow;
25527 void g_assertion_message_cmpstr(char* domain, char* file, int line, char* func, char* expr, char* arg1, char* cmp, char* arg2) nothrow;
25528 void g_assertion_message_error(char* domain, char* file, int line, char* func, char* expr, Error* error, Quark error_domain, int error_code) nothrow;
25529 void g_assertion_message_expr(char* domain, char* file, int line, char* func, char* expr) nothrow;
25530 void g_atexit(VoidFunc func) nothrow;
25531 int g_atomic_int_add(int* atomic, int val) nothrow;
25532 uint g_atomic_int_and(uint* atomic, uint val) nothrow;
25533 int g_atomic_int_compare_and_exchange(int* atomic, int oldval, int newval) nothrow;
25534 int g_atomic_int_dec_and_test(int* atomic) nothrow;
25535 int g_atomic_int_exchange_and_add(int* atomic, int val) nothrow;
25536 int g_atomic_int_get(int* atomic) nothrow;
25537 void g_atomic_int_inc(int* atomic) nothrow;
25538 uint g_atomic_int_or(uint* atomic, uint val) nothrow;
25539 void g_atomic_int_set(int* atomic, int newval) nothrow;
25540 uint g_atomic_int_xor(uint* atomic, uint val) nothrow;
25541 ssize_t g_atomic_pointer_add(void* atomic, ssize_t val) nothrow;
25542 size_t g_atomic_pointer_and(void* atomic, size_t val) nothrow;
25543 int g_atomic_pointer_compare_and_exchange(void* atomic, void* oldval, void* newval) nothrow;
25544 void* g_atomic_pointer_get(void* atomic) nothrow;
25545 size_t g_atomic_pointer_or(void* atomic, size_t val) nothrow;
25546 void g_atomic_pointer_set(void* atomic, void* newval) nothrow;
25547 size_t g_atomic_pointer_xor(void* atomic, size_t val) nothrow;
25548 ubyte* /*new*/ g_base64_decode(char* text, /*out*/ size_t* out_len) nothrow;
25549 ubyte* g_base64_decode_inplace(/*inout*/ ubyte* text, /*inout*/ size_t* out_len) nothrow;
25550 size_t g_base64_decode_step(ubyte* in_, size_t len, /*out*/ ubyte* out_, /*inout*/ int* state, /*inout*/ uint* save) nothrow;
25551 char* /*new*/ g_base64_encode(ubyte* data, size_t len) nothrow;
25552 size_t g_base64_encode_close(int break_lines, /*out*/ ubyte* out_, /*inout*/ int* state, /*inout*/ int* save) nothrow;
25553 size_t g_base64_encode_step(ubyte* in_, size_t len, int break_lines, /*out*/ ubyte* out_, /*inout*/ int* state, /*inout*/ int* save) nothrow;
25554 char* g_basename(char* file_name) nothrow;
25555 void g_bit_lock(int* address, int lock_bit) nothrow;
25556 int g_bit_nth_lsf(c_ulong mask, int nth_bit) nothrow;
25557 int g_bit_nth_msf(c_ulong mask, int nth_bit) nothrow;
25558 uint g_bit_storage(c_ulong number) nothrow;
25559 int g_bit_trylock(int* address, int lock_bit) nothrow;
25560 void g_bit_unlock(int* address, int lock_bit) nothrow;
25561 char* /*new*/ g_build_filename(char* first_element, ...) nothrow;
25562 char* /*new*/ g_build_filenamev(char** args) nothrow;
25563 char* /*new*/ g_build_path(char* separator, char* first_element, ...) nothrow;
25564 char* /*new*/ g_build_pathv(char* separator, char** args) nothrow;
25565 int g_chdir(char* path) nothrow;
25566 char* glib_check_version(uint required_major, uint required_minor, uint required_micro) nothrow;
25567 uint g_child_watch_add(Pid pid, ChildWatchFunc function_, void* data) nothrow;
25568 uint g_child_watch_add_full(int priority, Pid pid, ChildWatchFunc function_, void* data, DestroyNotify notify) nothrow;
25569 Source* /*new*/ g_child_watch_source_new(Pid pid) nothrow;
25570 void g_clear_error(GLib2.Error** error) nothrow;
25571 char* /*new*/ g_compute_checksum_for_data(ChecksumType checksum_type, ubyte* data, size_t length) nothrow;
25572 char* /*new*/ g_compute_checksum_for_string(ChecksumType checksum_type, char* str, ssize_t length) nothrow;
25573 char* /*new*/ g_compute_hmac_for_data(ChecksumType digest_type, ubyte* key, size_t key_len, ubyte* data, size_t length) nothrow;
25574 char* /*new*/ g_compute_hmac_for_string(ChecksumType digest_type, ubyte* key, size_t key_len, char* str, ssize_t length) nothrow;
25575 char* /*new*/ g_convert(char* str, ssize_t len, char* to_codeset, char* from_codeset, /*out*/ size_t* bytes_read, /*out*/ size_t* bytes_written, GLib2.Error** error) nothrow;
25576 Quark g_convert_error_quark() nothrow;
25577 char* /*new*/ g_convert_with_fallback(char* str, ssize_t len, char* to_codeset, char* from_codeset, char* fallback, size_t* bytes_read, size_t* bytes_written, GLib2.Error** error) nothrow;
25578 char* /*new*/ g_convert_with_iconv(char* str, ssize_t len, IConv converter, size_t* bytes_read, size_t* bytes_written, GLib2.Error** error) nothrow;
25579 void g_datalist_clear(Data** datalist) nothrow;
25580 void g_datalist_foreach(Data** datalist, DataForeachFunc func, void* user_data) nothrow;
25581 void* g_datalist_get_data(Data** datalist, char* key) nothrow;
25582 uint g_datalist_get_flags(Data** datalist) nothrow;
25583 void* g_datalist_id_get_data(Data** datalist, Quark key_id) nothrow;
25584 void* g_datalist_id_remove_no_notify(Data** datalist, Quark key_id) nothrow;
25585 void g_datalist_id_set_data_full(Data** datalist, Quark key_id, void* data, DestroyNotify destroy_func) nothrow;
25586 void g_datalist_init(Data** datalist) nothrow;
25587 void g_datalist_set_flags(Data** datalist, uint flags) nothrow;
25588 void g_datalist_unset_flags(Data** datalist, uint flags) nothrow;
25589 void g_dataset_destroy(const(void)* dataset_location) nothrow;
25590 void g_dataset_foreach(const(void)* dataset_location, DataForeachFunc func, void* user_data) nothrow;
25591 void* g_dataset_id_get_data(const(void)* dataset_location, Quark key_id) nothrow;
25592 void* g_dataset_id_remove_no_notify(const(void)* dataset_location, Quark key_id) nothrow;
25593 void g_dataset_id_set_data_full(const(void)* dataset_location, Quark key_id, void* data, DestroyNotify destroy_func) nothrow;
25594 char* g_dcgettext(char* domain, char* msgid, int category) nothrow;
25595 char* g_dgettext(char* domain, char* msgid) nothrow;
25596 int g_direct_equal(const(void)* v1=null, const(void)* v2=null) nothrow;
25597 uint g_direct_hash(const(void)* v=null) nothrow;
25598 char* g_dngettext(char* domain, char* msgid, char* msgid_plural, c_ulong n) nothrow;
25599 int g_double_equal(const(void)* v1, const(void)* v2) nothrow;
25600 uint g_double_hash(const(void)* v) nothrow;
25601 char* g_dpgettext(char* domain, char* msgctxtid, size_t msgidoffset) nothrow;
25602 char* g_dpgettext2(char* domain, char* context, char* msgid) nothrow;
25603 char* g_environ_getenv(char** envp, char* variable) nothrow;
25604 char** /*new*/ g_environ_setenv(char** envp, char* variable, char* value, int overwrite) nothrow;
25605 char** /*new*/ g_environ_unsetenv(char** envp, char* variable) nothrow;
25606 FileError g_file_error_from_errno(int err_no) nothrow;
25607 Quark g_file_error_quark() nothrow;
25608 int g_file_get_contents(char* filename, /*out*/ ubyte** contents, /*out*/ size_t* length, GLib2.Error** error) nothrow;
25609 int g_file_open_tmp(char* tmpl, /*out*/ char** name_used, GLib2.Error** error) nothrow;
25610 char* /*new*/ g_file_read_link(char* filename, GLib2.Error** error) nothrow;
25611 int g_file_set_contents(char* filename, ubyte* contents, ssize_t length, GLib2.Error** error) nothrow;
25612 int g_file_test(char* filename, FileTest test) nothrow;
25613 char* /*new*/ g_filename_display_basename(char* filename) nothrow;
25614 char* /*new*/ g_filename_display_name(char* filename) nothrow;
25615 char* /*new*/ g_filename_from_uri(char* uri, char** hostname, GLib2.Error** error) nothrow;
25616 char* /*new*/ g_filename_from_utf8(char* utf8string, ssize_t len, size_t* bytes_read, size_t* bytes_written, GLib2.Error** error) nothrow;
25617 char* /*new*/ g_filename_to_uri(char* filename, char* hostname, GLib2.Error** error) nothrow;
25618 char* /*new*/ g_filename_to_utf8(char* opsysstring, ssize_t len, size_t* bytes_read, size_t* bytes_written, GLib2.Error** error) nothrow;
25619 char* /*new*/ g_find_program_in_path(char* program) nothrow;
25620 char* /*new*/ g_format_size(ulong size) nothrow;
25621 char* /*new*/ g_format_size_for_display(long size) nothrow;
25622 char* /*new*/ g_format_size_full(ulong size, FormatSizeFlags flags) nothrow;
25623 int g_fprintf(FILE* file, char* format, ...) nothrow;
25624 void g_free(void* mem) nothrow;
25625 char* g_get_application_name() nothrow;
25626 int g_get_charset(char** charset) nothrow;
25627 char* /*new*/ g_get_codeset() nothrow;
25628 char* /*new*/ g_get_current_dir() nothrow;
25629 void g_get_current_time(TimeVal* result) nothrow;
25630 char** /*new*/ g_get_environ() nothrow;
25631 int g_get_filename_charsets(char*** charsets) nothrow;
25632 char* g_get_home_dir() nothrow;
25633 char* g_get_host_name() nothrow;
25634 char** g_get_language_names() nothrow;
25635 char** /*new*/ g_get_locale_variants(char* locale) nothrow;
25636 long g_get_monotonic_time() nothrow;
25637 char* /*new*/ g_get_prgname() nothrow;
25638 char* g_get_real_name() nothrow;
25639 long g_get_real_time() nothrow;
25640 char** g_get_system_config_dirs() nothrow;
25641 char** g_get_system_data_dirs() nothrow;
25642 char* g_get_tmp_dir() nothrow;
25643 char* g_get_user_cache_dir() nothrow;
25644 char* g_get_user_config_dir() nothrow;
25645 char* g_get_user_data_dir() nothrow;
25646 char* g_get_user_name() nothrow;
25647 char* g_get_user_runtime_dir() nothrow;
25648 char* g_get_user_special_dir(UserDirectory directory) nothrow;
25649 char* g_getenv(char* variable) nothrow;
25650 int g_hostname_is_ascii_encoded(char* hostname) nothrow;
25651 int g_hostname_is_ip_address(char* hostname) nothrow;
25652 int g_hostname_is_non_ascii(char* hostname) nothrow;
25653 char* /*new*/ g_hostname_to_ascii(char* hostname) nothrow;
25654 char* /*new*/ g_hostname_to_unicode(char* hostname) nothrow;
25655 uint g_idle_add(SourceFunc function_, void* data) nothrow;
25656 uint g_idle_add_full(int priority, SourceFunc function_, void* data, DestroyNotify notify) nothrow;
25657 int g_idle_remove_by_data(void* data) nothrow;
25658 Source* /*new*/ g_idle_source_new() nothrow;
25659 int g_int64_equal(const(void)* v1, const(void)* v2) nothrow;
25660 uint g_int64_hash(const(void)* v) nothrow;
25661 int g_int_equal(const(void)* v1, const(void)* v2) nothrow;
25662 uint g_int_hash(const(void)* v) nothrow;
25663 char* g_intern_static_string(char* string_=null) nothrow;
25664 char* g_intern_string(char* string_=null) nothrow;
25665 uint g_io_add_watch(IOChannel* channel, IOCondition condition, IOFunc func, void* user_data) nothrow;
25666 uint g_io_add_watch_full(IOChannel* channel, int priority, IOCondition condition, IOFunc func, void* user_data, DestroyNotify notify) nothrow;
25667 Source* /*new*/ g_io_create_watch(IOChannel* channel, IOCondition condition) nothrow;
25668 char** /*new*/ g_listenv() nothrow;
25669 char* /*new*/ g_locale_from_utf8(char* utf8string, ssize_t len, size_t* bytes_read, size_t* bytes_written, GLib2.Error** error) nothrow;
25670 char* /*new*/ g_locale_to_utf8(char* opsysstring, ssize_t len, size_t* bytes_read, size_t* bytes_written, GLib2.Error** error) nothrow;
25671 void g_log(char* log_domain, LogLevelFlags log_level, char* format, ...) nothrow;
25672 void g_log_default_handler(char* log_domain, LogLevelFlags log_level, char* message, void* unused_data) nothrow;
25673 void g_log_remove_handler(char* log_domain, uint handler_id) nothrow;
25674 LogLevelFlags g_log_set_always_fatal(LogLevelFlags fatal_mask) nothrow;
25675 LogFunc g_log_set_default_handler(LogFunc log_func, void* user_data) nothrow;
25676 LogLevelFlags g_log_set_fatal_mask(char* log_domain, LogLevelFlags fatal_mask) nothrow;
25677 uint g_log_set_handler(char* log_domain, LogLevelFlags log_levels, LogFunc log_func, void* user_data) nothrow;
25678 void g_logv(char* log_domain, LogLevelFlags log_level, char* format, va_list args) nothrow;
25679 Source* g_main_current_source() nothrow;
25680 int g_main_depth() nothrow;
25681 void* g_malloc(size_t n_bytes) nothrow;
25682 void* g_malloc0(size_t n_bytes) nothrow;
25683 void* g_malloc0_n(size_t n_blocks, size_t n_block_bytes) nothrow;
25684 void* g_malloc_n(size_t n_blocks, size_t n_block_bytes) nothrow;
25685 int g_markup_collect_attributes(char* element_name, char** attribute_names, char** attribute_values, Error** error, MarkupCollectType first_type, char* first_attr, ...) nothrow;
25686 Quark g_markup_error_quark() nothrow;
25687 char* /*new*/ g_markup_escape_text(char* text, ssize_t length) nothrow;
25688 char* /*new*/ g_markup_printf_escaped(char* format, ...) nothrow;
25689 char* /*new*/ g_markup_vprintf_escaped(char* format, va_list args) nothrow;
25690 int g_mem_is_system_malloc() nothrow;
25691 void g_mem_profile() nothrow;
25692 void g_mem_set_vtable(MemVTable* vtable) nothrow;
25693 void* g_memdup(const(void)* mem, uint byte_size) nothrow;
25694 int g_mkdir_with_parents(char* pathname, int mode) nothrow;
25695 char* /*new*/ g_mkdtemp(char* tmpl) nothrow;
25696 char* /*new*/ g_mkdtemp_full(char* tmpl, int mode) nothrow;
25697 int g_mkstemp(char* tmpl) nothrow;
25698 int g_mkstemp_full(char* tmpl, int flags, int mode) nothrow;
25699 void g_nullify_pointer(void** nullify_location) nothrow;
25700 void g_on_error_query(char* prg_name) nothrow;
25701 void g_on_error_stack_trace(char* prg_name) nothrow;
25702 Quark g_option_error_quark() nothrow;
25703 uint g_parse_debug_string(char* string_, DebugKey* keys, uint nkeys) nothrow;
25704 char* /*new*/ g_path_get_basename(char* file_name) nothrow;
25705 char* /*new*/ g_path_get_dirname(char* file_name) nothrow;
25706 int g_path_is_absolute(char* file_name) nothrow;
25707 char* g_path_skip_root(char* file_name) nothrow;
25708 int g_pattern_match(PatternSpec* pspec, uint string_length, char* string_, char* string_reversed) nothrow;
25709 int g_pattern_match_simple(char* pattern, char* string_) nothrow;
25710 int g_pattern_match_string(PatternSpec* pspec, char* string_) nothrow;
25711 void g_pointer_bit_lock(void* address, int lock_bit) nothrow;
25712 int g_pointer_bit_trylock(void* address, int lock_bit) nothrow;
25713 void g_pointer_bit_unlock(void* address, int lock_bit) nothrow;
25714 int g_poll(PollFD* fds, uint nfds, int timeout) nothrow;
25715 void g_prefix_error(Error** err, char* format, ...) nothrow;
25716 void g_print(char* format, ...) nothrow;
25717 void g_printerr(char* format, ...) nothrow;
25718 int g_printf(char* format, ...) nothrow;
25719 size_t g_printf_string_upper_bound(char* format, va_list args) nothrow;
25720 void g_propagate_error(Error** dest, Error* src) nothrow;
25721 void g_propagate_prefixed_error(Error** dest, Error* src, char* format, ...) nothrow;
25722 void g_qsort_with_data(const(void)* pbase, int total_elems, size_t size, CompareDataFunc compare_func, void* user_data) nothrow;
25723 Quark g_quark_from_static_string(char* string_=null) nothrow;
25724 Quark g_quark_from_string(char* string_=null) nothrow;
25725 char* g_quark_to_string(Quark quark) nothrow;
25726 Quark g_quark_try_string(char* string_=null) nothrow;
25727 double g_random_double() nothrow;
25728 double g_random_double_range(double begin, double end) nothrow;
25729 uint g_random_int() nothrow;
25730 int g_random_int_range(int begin, int end) nothrow;
25731 void g_random_set_seed(uint seed) nothrow;
25732 void* g_realloc(void* mem, size_t n_bytes) nothrow;
25733 void* g_realloc_n(void* mem, size_t n_blocks, size_t n_block_bytes) nothrow;
25734 void g_reload_user_special_dirs_cache() nothrow;
25735 void g_return_if_fail_warning(char* log_domain, char* pretty_function, char* expression) nothrow;
25736 int g_rmdir(char* filename) nothrow;
25737 void g_set_application_name(char* application_name) nothrow;
25738 void g_set_error(Error** err, Quark domain, int code, char* format, ...) nothrow;
25739 void g_set_error_literal(Error** err, Quark domain, int code, char* message) nothrow;
25740 void g_set_prgname(char* prgname) nothrow;
25741 PrintFunc g_set_print_handler(PrintFunc func) nothrow;
25742 PrintFunc g_set_printerr_handler(PrintFunc func) nothrow;
25743 int g_setenv(char* variable, char* value, int overwrite) nothrow;
25744 Quark g_shell_error_quark() nothrow;
25745 int g_shell_parse_argv(char* command_line, /*out*/ int* argcp, /*out*/ char*** argvp, GLib2.Error** error) nothrow;
25746 char* /*new*/ g_shell_quote(char* unquoted_string) nothrow;
25747 char* /*new*/ g_shell_unquote(char* quoted_string, GLib2.Error** error) nothrow;
25748 void* g_slice_alloc(size_t block_size) nothrow;
25749 void* g_slice_alloc0(size_t block_size) nothrow;
25750 void* g_slice_copy(size_t block_size, const(void)* mem_block) nothrow;
25751 void g_slice_free1(size_t block_size, void* mem_block) nothrow;
25752 void g_slice_free_chain_with_offset(size_t block_size, void* mem_chain, size_t next_offset) nothrow;
25753 long g_slice_get_config(SliceConfig ckey) nothrow;
25754 long* g_slice_get_config_state(SliceConfig ckey, long address, uint* n_values) nothrow;
25755 void g_slice_set_config(SliceConfig ckey, long value) nothrow;
25756 int g_snprintf(char* string_, c_ulong n, char* format, ...) nothrow;
25757 uint g_spaced_primes_closest(uint num) nothrow;
25758 int g_spawn_async(char* working_directory, char** argv, char** envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, void* user_data, /*out*/ Pid* child_pid, GLib2.Error** error) nothrow;
25759 int g_spawn_async_with_pipes(char* working_directory, char** argv, char** envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, void* user_data, /*out*/ Pid* child_pid, /*out*/ int* standard_input, /*out*/ int* standard_output, /*out*/ int* standard_error, GLib2.Error** error) nothrow;
25760 void g_spawn_close_pid(Pid pid) nothrow;
25761 int g_spawn_command_line_async(char* command_line, GLib2.Error** error) nothrow;
25762 int g_spawn_command_line_sync(char* command_line, /*out*/ ubyte** standard_output, /*out*/ ubyte** standard_error, /*out*/ int* exit_status, GLib2.Error** error) nothrow;
25763 Quark g_spawn_error_quark() nothrow;
25764 int g_spawn_sync(char* working_directory, char** argv, char** envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, void* user_data, /*out*/ ubyte** standard_output, /*out*/ ubyte** standard_error, /*out*/ int* exit_status, GLib2.Error** error) nothrow;
25765 int g_sprintf(char* string_, char* format, ...) nothrow;
25766 char* /*new*/ g_stpcpy(char* dest, char* src) nothrow;
25767 int g_str_equal(const(void)* v1, const(void)* v2) nothrow;
25768 int g_str_has_prefix(char* str, char* prefix) nothrow;
25769 int g_str_has_suffix(char* str, char* suffix) nothrow;
25770 uint g_str_hash(const(void)* v) nothrow;
25771 char* /*new*/ g_strcanon(char* string_, char* valid_chars, char substitutor) nothrow;
25772 int g_strcasecmp(char* s1, char* s2) nothrow;
25773 char* /*new*/ g_strchomp(char* string_) nothrow;
25774 char* /*new*/ g_strchug(char* string_) nothrow;
25775 int g_strcmp0(char* str1, char* str2) nothrow;
25776 char* /*new*/ g_strcompress(char* source) nothrow;
25777 char* /*new*/ g_strconcat(char* string1, ...) nothrow;
25778 char* /*new*/ g_strdelimit(char* string_, char* delimiters, char new_delimiter) nothrow;
25779 char* /*new*/ g_strdown(char* string_) nothrow;
25780 char* /*new*/ g_strdup(char* str) nothrow;
25781 char* /*new*/ g_strdup_printf(char* format, ...) nothrow;
25782 char* /*new*/ g_strdup_vprintf(char* format, va_list args) nothrow;
25783 char** g_strdupv(char** str_array) nothrow;
25784 char* g_strerror(int errnum) nothrow;
25785 char* /*new*/ g_strescape(char* source, char* exceptions) nothrow;
25786 void g_strfreev(char** str_array) nothrow;
25787 String* /*new*/ g_string_new(char* init) nothrow;
25788 String* /*new*/ g_string_new_len(char* init, ssize_t len) nothrow;
25789 String* /*new*/ g_string_sized_new(size_t dfl_size) nothrow;
25790 char* g_strip_context(char* msgid, char* msgval) nothrow;
25791 char* /*new*/ g_strjoin(char* separator, ...) nothrow;
25792 char* /*new*/ g_strjoinv(char* separator, char** str_array) nothrow;
25793 size_t g_strlcat(char* dest, char* src, size_t dest_size) nothrow;
25794 size_t g_strlcpy(char* dest, char* src, size_t dest_size) nothrow;
25795 int g_strncasecmp(char* s1, char* s2, uint n) nothrow;
25796 char* /*new*/ g_strndup(char* str, size_t n) nothrow;
25797 char* /*new*/ g_strnfill(size_t length, char fill_char) nothrow;
25798 char* /*new*/ g_strreverse(char* string_) nothrow;
25799 char* /*new*/ g_strrstr(char* haystack, char* needle) nothrow;
25800 char* /*new*/ g_strrstr_len(char* haystack, ssize_t haystack_len, char* needle) nothrow;
25801 char* g_strsignal(int signum) nothrow;
25802 char** g_strsplit(char* string_, char* delimiter, int max_tokens) nothrow;
25803 char** g_strsplit_set(char* string_, char* delimiters, int max_tokens) nothrow;
25804 char* /*new*/ g_strstr_len(char* haystack, ssize_t haystack_len, char* needle) nothrow;
25805 double g_strtod(char* nptr, char** endptr) nothrow;
25806 char* /*new*/ g_strup(char* string_) nothrow;
25807 Type g_strv_get_type() nothrow;
25808 uint g_strv_length(char** str_array) nothrow;
25809 void g_test_add_data_func(char* testpath, const(void)* test_data, TestDataFunc test_func) nothrow;
25810 void g_test_add_func(char* testpath, TestFunc test_func) nothrow;
25811 void g_test_add_vtable(char* testpath, size_t data_size, const(void)* test_data, TestFixtureFunc data_setup, TestFixtureFunc data_test, TestFixtureFunc data_teardown) nothrow;
25812 void g_test_bug(char* bug_uri_snippet) nothrow;
25813 void g_test_bug_base(char* uri_pattern) nothrow;
25814 TestCase* g_test_create_case(char* test_name, size_t data_size, const(void)* test_data, TestFixtureFunc data_setup, TestFixtureFunc data_test, TestFixtureFunc data_teardown) nothrow;
25815 TestSuite* g_test_create_suite(char* suite_name) nothrow;
25816 void g_test_fail() nothrow;
25817 TestSuite* g_test_get_root() nothrow;
25818 void g_test_init(int* argc, char*** argv, ...) nothrow;
25819 void g_test_log_set_fatal_handler(TestLogFatalFunc log_func, void* user_data) nothrow;
25820 char* g_test_log_type_name(TestLogType log_type) nothrow;
25821 void g_test_maximized_result(double maximized_quantity, char* format, ...) nothrow;
25822 void g_test_message(char* format, ...) nothrow;
25823 void g_test_minimized_result(double minimized_quantity, char* format, ...) nothrow;
25824 void g_test_queue_destroy(DestroyNotify destroy_func, void* destroy_data) nothrow;
25825 void g_test_queue_free(void* gfree_pointer) nothrow;
25826 double g_test_rand_double() nothrow;
25827 double g_test_rand_double_range(double range_start, double range_end) nothrow;
25828 int g_test_rand_int() nothrow;
25829 int g_test_rand_int_range(int begin, int end) nothrow;
25830 int g_test_run() nothrow;
25831 int g_test_run_suite(TestSuite* suite) nothrow;
25832 double g_test_timer_elapsed() nothrow;
25833 double g_test_timer_last() nothrow;
25834 void g_test_timer_start() nothrow;
25835 void g_test_trap_assertions(char* domain, char* file, int line, char* func, ulong assertion_flags, char* pattern) nothrow;
25836 int g_test_trap_fork(ulong usec_timeout, TestTrapFlags test_trap_flags) nothrow;
25837 int g_test_trap_has_passed() nothrow;
25838 int g_test_trap_reached_timeout() nothrow;
25839 uint g_timeout_add(uint interval, SourceFunc function_, void* data) nothrow;
25840 uint g_timeout_add_full(int priority, uint interval, SourceFunc function_, void* data, DestroyNotify notify) nothrow;
25841 uint g_timeout_add_seconds(uint interval, SourceFunc function_, void* data) nothrow;
25842 uint g_timeout_add_seconds_full(int priority, uint interval, SourceFunc function_, void* data, DestroyNotify notify) nothrow;
25843 Source* /*new*/ g_timeout_source_new(uint interval) nothrow;
25844 Source* /*new*/ g_timeout_source_new_seconds(uint interval) nothrow;
25845 void* g_try_malloc(size_t n_bytes) nothrow;
25846 void* g_try_malloc0(size_t n_bytes) nothrow;
25847 void* g_try_malloc0_n(size_t n_blocks, size_t n_block_bytes) nothrow;
25848 void* g_try_malloc_n(size_t n_blocks, size_t n_block_bytes) nothrow;
25849 void* g_try_realloc(void* mem, size_t n_bytes) nothrow;
25850 void* g_try_realloc_n(void* mem, size_t n_blocks, size_t n_block_bytes) nothrow;
25851 wchar* g_ucs4_to_utf16(dchar* str, c_long len, c_long* items_read, c_long* items_written, GLib2.Error** error) nothrow;
25852 char* /*new*/ g_ucs4_to_utf8(dchar* str, c_long len, c_long* items_read, c_long* items_written, GLib2.Error** error) nothrow;
25853 UnicodeBreakType g_unichar_break_type(dchar c) nothrow;
25854 int g_unichar_combining_class(dchar uc) nothrow;
25855 int g_unichar_compose(dchar a, dchar b, dchar* ch) nothrow;
25856 int g_unichar_decompose(dchar ch, dchar* a, dchar* b) nothrow;
25857 int g_unichar_digit_value(dchar c) nothrow;
25858 size_t g_unichar_fully_decompose(dchar ch, int compat, dchar* result, size_t result_len) nothrow;
25859 int g_unichar_get_mirror_char(dchar ch, dchar* mirrored_ch) nothrow;
25860 UnicodeScript g_unichar_get_script(dchar ch) nothrow;
25861 int g_unichar_isalnum(dchar c) nothrow;
25862 int g_unichar_isalpha(dchar c) nothrow;
25863 int g_unichar_iscntrl(dchar c) nothrow;
25864 int g_unichar_isdefined(dchar c) nothrow;
25865 int g_unichar_isdigit(dchar c) nothrow;
25866 int g_unichar_isgraph(dchar c) nothrow;
25867 int g_unichar_islower(dchar c) nothrow;
25868 int g_unichar_ismark(dchar c) nothrow;
25869 int g_unichar_isprint(dchar c) nothrow;
25870 int g_unichar_ispunct(dchar c) nothrow;
25871 int g_unichar_isspace(dchar c) nothrow;
25872 int g_unichar_istitle(dchar c) nothrow;
25873 int g_unichar_isupper(dchar c) nothrow;
25874 int g_unichar_iswide(dchar c) nothrow;
25875 int g_unichar_iswide_cjk(dchar c) nothrow;
25876 int g_unichar_isxdigit(dchar c) nothrow;
25877 int g_unichar_iszerowidth(dchar c) nothrow;
25878 int g_unichar_to_utf8(dchar c, char* outbuf) nothrow;
25879 dchar g_unichar_tolower(dchar c) nothrow;
25880 dchar g_unichar_totitle(dchar c) nothrow;
25881 dchar g_unichar_toupper(dchar c) nothrow;
25882 UnicodeType g_unichar_type(dchar c) nothrow;
25883 int g_unichar_validate(dchar ch) nothrow;
25884 int g_unichar_xdigit_value(dchar c) nothrow;
25885 dchar* g_unicode_canonical_decomposition(dchar ch, size_t* result_len) nothrow;
25886 void g_unicode_canonical_ordering(dchar* string_, size_t len) nothrow;
25887 UnicodeScript g_unicode_script_from_iso15924(uint iso15924) nothrow;
25888 uint g_unicode_script_to_iso15924(UnicodeScript script) nothrow;
25889 int g_unlink(char* filename) nothrow;
25890 void g_unsetenv(char* variable) nothrow;
25891 char* /*new*/ g_uri_escape_string(char* unescaped, char* reserved_chars_allowed, int allow_utf8) nothrow;
25892 char** g_uri_list_extract_uris(char* uri_list) nothrow;
25893 char* /*new*/ g_uri_parse_scheme(char* uri) nothrow;
25894 char* /*new*/ g_uri_unescape_segment(char* escaped_string=null, char* escaped_string_end=null, char* illegal_characters=null) nothrow;
25895 char* /*new*/ g_uri_unescape_string(char* escaped_string, char* illegal_characters) nothrow;
25896 void g_usleep(c_ulong microseconds) nothrow;
25897 dchar* g_utf16_to_ucs4(wchar* str, c_long len, c_long* items_read, c_long* items_written, GLib2.Error** error) nothrow;
25898 char* /*new*/ g_utf16_to_utf8(wchar* str, c_long len, c_long* items_read, c_long* items_written, GLib2.Error** error) nothrow;
25899 char* /*new*/ g_utf8_casefold(char* str, ssize_t len) nothrow;
25900 int g_utf8_collate(char* str1, char* str2) nothrow;
25901 char* /*new*/ g_utf8_collate_key(char* str, ssize_t len) nothrow;
25902 char* /*new*/ g_utf8_collate_key_for_filename(char* str, ssize_t len) nothrow;
25903 char* /*new*/ g_utf8_find_next_char(char* p, char* end) nothrow;
25904 char* /*new*/ g_utf8_find_prev_char(char* str, char* p) nothrow;
25905 dchar g_utf8_get_char(char* p) nothrow;
25906 dchar g_utf8_get_char_validated(char* p, ssize_t max_len) nothrow;
25907 char* /*new*/ g_utf8_normalize(char* str, ssize_t len, NormalizeMode mode) nothrow;
25908 char* /*new*/ g_utf8_offset_to_pointer(char* str, c_long offset) nothrow;
25909 c_long g_utf8_pointer_to_offset(char* str, char* pos) nothrow;
25910 char* /*new*/ g_utf8_prev_char(char* p) nothrow;
25911 char* /*new*/ g_utf8_strchr(char* p, ssize_t len, dchar c) nothrow;
25912 char* /*new*/ g_utf8_strdown(char* str, ssize_t len) nothrow;
25913 c_long g_utf8_strlen(char* p, ssize_t max) nothrow;
25914 char* /*new*/ g_utf8_strncpy(char* dest, char* src, size_t n) nothrow;
25915 char* /*new*/ g_utf8_strrchr(char* p, ssize_t len, dchar c) nothrow;
25916 char* /*new*/ g_utf8_strreverse(char* str, ssize_t len) nothrow;
25917 char* /*new*/ g_utf8_strup(char* str, ssize_t len) nothrow;
25918 char* /*new*/ g_utf8_substring(char* str, c_long start_pos, c_long end_pos) nothrow;
25919 dchar* g_utf8_to_ucs4(char* str, c_long len, c_long* items_read, c_long* items_written, GLib2.Error** error) nothrow;
25920 dchar* g_utf8_to_ucs4_fast(char* str, c_long len, c_long* items_written) nothrow;
25921 wchar* g_utf8_to_utf16(char* str, c_long len, c_long* items_read, c_long* items_written, GLib2.Error** error) nothrow;
25922 int g_utf8_validate(char* str, ssize_t max_len, /*out*/ char** end=null) nothrow;
25923 Type g_variant_get_gtype() nothrow;
25924 int g_vasprintf(char** string_, char* format, va_list args) nothrow;
25925 int g_vfprintf(FILE* file, char* format, va_list args) nothrow;
25926 int g_vprintf(char* format, va_list args) nothrow;
25927 int g_vsnprintf(char* string_, c_ulong n, char* format, va_list args) nothrow;
25928 int g_vsprintf(char* string_, char* format, va_list args) nothrow;
25929 void g_warn_message(char* domain, char* file, int line, char* func, char* warnexpr) nothrow;