1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = glib-Key-value-file-parser.html
27  * outPack = glib
28  * outFile = KeyFile
29  * strct   = GKeyFile
30  * realStrct=
31  * ctorStrct=
32  * clss    = KeyFile
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_key_file_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.ErrorG
47  * 	- glib.GException
48  * 	- glib.Str
49  * 	- gtkc.paths
50  * 	- gtkc.Loader
51  * structWrap:
52  * 	- GKeyFile* -> KeyFile
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module glib.KeyFile;
59 
60 public  import gtkc.glibtypes;
61 
62 private import gtkc.glib;
63 private import glib.ConstructionException;
64 
65 
66 private import glib.ErrorG;
67 private import glib.GException;
68 private import glib.Str;
69 private import gtkc.paths;
70 private import gtkc.Loader;
71 
72 
73 
74 
75 /**
76  * GKeyFile lets you parse, edit or create files containing groups of
77  * key-value pairs, which we call key files for
78  * lack of a better name. Several freedesktop.org specifications use
79  * key files now, e.g the
80  * Desktop
81  * Entry Specification and the
82  * Icon
83  * Theme Specification.
84  *
85  * The syntax of key files is described in detail in the
86  * Desktop
87  * Entry Specification, here is a quick summary: Key files
88  * consists of groups of key-value pairs, interspersed with comments.
89  *
90  * $(DDOC_COMMENT example)
91  *
92  * Lines beginning with a '#' and blank lines are considered comments.
93  *
94  * Groups are started by a header line containing the group name enclosed
95  * in '[' and ']', and ended implicitly by the start of the next group or
96  * the end of the file. Each key-value pair must be contained in a group.
97  *
98  * Key-value pairs generally have the form key=value,
99  * with the exception of localized strings, which have the form
100  * key[locale]=value, with a locale identifier of the
101  * form lang_COUNTRYMODIFIER where
102  * COUNTRY and MODIFIER are optional.
103  * Space before and after the '=' character are ignored. Newline, tab,
104  * carriage return and backslash characters in value are escaped as \n,
105  * \t, \r, and \\, respectively. To preserve leading spaces in values,
106  * these can also be escaped as \s.
107  *
108  * Key files can store strings (possibly with localized variants), integers,
109  * booleans and lists of these. Lists are separated by a separator character,
110  * typically ';' or ','. To use the list separator character in a value in
111  * a list, it has to be escaped by prefixing it with a backslash.
112  *
113  * This syntax is obviously inspired by the .ini files commonly met
114  * on Windows, but there are some important differences:
115  *
116  * .ini files use the ';' character to begin comments,
117  *  key files use the '#' character.
118  * Key files do not allow for ungrouped keys meaning only
119  *  comments can precede the first group.
120  * Key files are always encoded in UTF-8.
121  * Key and Group names are case-sensitive. For example, a
122  *  group called [GROUP] is a different from
123  *  [group].
124  * .ini files don't have a strongly typed boolean entry type,
125  *  they only have GetProfileInt(). In key files, only
126  *  true and false (in lower case)
127  *  are allowed.
128  *
129  * Note that in contrast to the
130  * Desktop
131  * Entry Specification, groups in key files may contain the same
132  * key multiple times; the last entry wins. Key files may also contain
133  * multiple groups with the same name; they are merged together.
134  * Another difference is that keys and group names in key files are not
135  * restricted to ASCII characters.
136  */
137 public class KeyFile
138 {
139 	
140 	/** the main Gtk struct */
141 	protected GKeyFile* gKeyFile;
142 	
143 	
144 	public GKeyFile* getKeyFileStruct()
145 	{
146 		return gKeyFile;
147 	}
148 	
149 	
150 	/** the main Gtk struct as a void* */
151 	protected void* getStruct()
152 	{
153 		return cast(void*)gKeyFile;
154 	}
155 	
156 	/**
157 	 * Sets our main struct and passes it to the parent class
158 	 */
159 	public this (GKeyFile* gKeyFile)
160 	{
161 		this.gKeyFile = gKeyFile;
162 	}
163 	
164 	~this ()
165 	{
166 		if (  Linker.isLoaded(LIBRARY.GLIB) && gKeyFile !is null )
167 		{
168 			g_key_file_unref(gKeyFile);
169 		}
170 	}
171 	
172 	/**
173 	 */
174 	
175 	/**
176 	 * Creates a new empty GKeyFile object. Use
177 	 * g_key_file_load_from_file(), g_key_file_load_from_data(),
178 	 * g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to
179 	 * read an existing key file.
180 	 * Since 2.6
181 	 * Throws: ConstructionException GTK+ fails to create the object.
182 	 */
183 	public this ()
184 	{
185 		// GKeyFile * g_key_file_new (void);
186 		auto p = g_key_file_new();
187 		if(p is null)
188 		{
189 			throw new ConstructionException("null returned by g_key_file_new()");
190 		}
191 		this(cast(GKeyFile*) p);
192 	}
193 	
194 	/**
195 	 * Clears all keys and groups from key_file, and decreases the
196 	 * reference count by 1. If the reference count reaches zero,
197 	 * frees the key file and all its allocated memory.
198 	 * Since 2.6
199 	 */
200 	public void free()
201 	{
202 		// void g_key_file_free (GKeyFile *key_file);
203 		g_key_file_free(gKeyFile);
204 	}
205 	
206 	/**
207 	 * Increases the reference count of key_file.
208 	 * Since 2.32
209 	 * Returns: the same key_file.
210 	 */
211 	public KeyFile doref()
212 	{
213 		// GKeyFile * g_key_file_ref (GKeyFile *key_file);
214 		auto p = g_key_file_ref(gKeyFile);
215 		
216 		if(p is null)
217 		{
218 			return null;
219 		}
220 		
221 		return new KeyFile(cast(GKeyFile*) p);
222 	}
223 	
224 	/**
225 	 * Decreases the reference count of key_file by 1. If the reference count
226 	 * reaches zero, frees the key file and all its allocated memory.
227 	 * Since 2.32
228 	 */
229 	public void unref()
230 	{
231 		// void g_key_file_unref (GKeyFile *key_file);
232 		g_key_file_unref(gKeyFile);
233 	}
234 	
235 	/**
236 	 * Sets the character which is used to separate
237 	 * values in lists. Typically ';' or ',' are used
238 	 * as separators. The default list separator is ';'.
239 	 * Since 2.6
240 	 * Params:
241 	 * separator = the separator
242 	 */
243 	public void setListSeparator(char separator)
244 	{
245 		// void g_key_file_set_list_separator (GKeyFile *key_file,  gchar separator);
246 		g_key_file_set_list_separator(gKeyFile, separator);
247 	}
248 	
249 	/**
250 	 * Loads a key file into an empty GKeyFile structure.
251 	 * If the file could not be loaded then error is set to
252 	 * either a GFileError or GKeyFileError.
253 	 * Since 2.6
254 	 * Params:
255 	 * file = the path of a filename to load, in the GLib filename encoding. [type filename]
256 	 * flags = flags from GKeyFileFlags
257 	 * Returns: TRUE if a key file could be loaded, FALSE otherwise
258 	 * Throws: GException on failure.
259 	 */
260 	public int loadFromFile(string file, GKeyFileFlags flags)
261 	{
262 		// gboolean g_key_file_load_from_file (GKeyFile *key_file,  const gchar *file,  GKeyFileFlags flags,  GError **error);
263 		GError* err = null;
264 		
265 		auto p = g_key_file_load_from_file(gKeyFile, Str.toStringz(file), flags, &err);
266 		
267 		if (err !is null)
268 		{
269 			throw new GException( new ErrorG(err) );
270 		}
271 		
272 		return p;
273 	}
274 	
275 	/**
276 	 * Loads a key file from memory into an empty GKeyFile structure.
277 	 * If the object cannot be created then error is set to a GKeyFileError.
278 	 * Since 2.6
279 	 * Params:
280 	 * data = key file loaded in memory
281 	 * flags = flags from GKeyFileFlags
282 	 * Returns: TRUE if a key file could be loaded, FALSE otherwise
283 	 * Throws: GException on failure.
284 	 */
285 	public int loadFromData(string data, GKeyFileFlags flags)
286 	{
287 		// gboolean g_key_file_load_from_data (GKeyFile *key_file,  const gchar *data,  gsize length,  GKeyFileFlags flags,  GError **error);
288 		GError* err = null;
289 		
290 		auto p = g_key_file_load_from_data(gKeyFile, cast(char*)data.ptr, cast(int) data.length, flags, &err);
291 		
292 		if (err !is null)
293 		{
294 			throw new GException( new ErrorG(err) );
295 		}
296 		
297 		return p;
298 	}
299 	
300 	/**
301 	 * This function looks for a key file named file in the paths
302 	 * returned from g_get_user_data_dir() and g_get_system_data_dirs(),
303 	 * loads the file into key_file and returns the file's full path in
304 	 * full_path. If the file could not be loaded then an error is
305 	 * set to either a GFileError or GKeyFileError.
306 	 * Since 2.6
307 	 * Params:
308 	 * file = a relative path to a filename to open and parse. [type filename]
309 	 * fullPath = return location for a string containing the full path
310 	 * of the file, or NULL. [out][type filename][allow-none]
311 	 * flags = flags from GKeyFileFlags
312 	 * Returns: TRUE if a key file could be loaded, FALSE othewise
313 	 * Throws: GException on failure.
314 	 */
315 	public int loadFromDataDirs(string file, out string fullPath, GKeyFileFlags flags)
316 	{
317 		// gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,  const gchar *file,  gchar **full_path,  GKeyFileFlags flags,  GError **error);
318 		char* outfullPath = null;
319 		GError* err = null;
320 		
321 		auto p = g_key_file_load_from_data_dirs(gKeyFile, Str.toStringz(file), &outfullPath, flags, &err);
322 		
323 		if (err !is null)
324 		{
325 			throw new GException( new ErrorG(err) );
326 		}
327 		
328 		fullPath = Str.toString(outfullPath);
329 		return p;
330 	}
331 	
332 	/**
333 	 * This function looks for a key file named file in the paths
334 	 * specified in search_dirs, loads the file into key_file and
335 	 * returns the file's full path in full_path. If the file could not
336 	 * be loaded then an error is set to either a GFileError or
337 	 * GKeyFileError.
338 	 * Since 2.14
339 	 * Params:
340 	 * file = a relative path to a filename to open and parse. [type filename]
341 	 * searchDirs = NULL-terminated array of directories to search. [array zero-terminated=1][element-type filename]
342 	 * fullPath = return location for a string containing the full path
343 	 * of the file, or NULL. [out][type filename][allow-none]
344 	 * flags = flags from GKeyFileFlags
345 	 * Returns: TRUE if a key file could be loaded, FALSE otherwise
346 	 * Throws: GException on failure.
347 	 */
348 	public int loadFromDirs(string file, string[] searchDirs, out string fullPath, GKeyFileFlags flags)
349 	{
350 		// gboolean g_key_file_load_from_dirs (GKeyFile *key_file,  const gchar *file,  const gchar **search_dirs,  gchar **full_path,  GKeyFileFlags flags,  GError **error);
351 		char* outfullPath = null;
352 		GError* err = null;
353 		
354 		auto p = g_key_file_load_from_dirs(gKeyFile, Str.toStringz(file), Str.toStringzArray(searchDirs), &outfullPath, flags, &err);
355 		
356 		if (err !is null)
357 		{
358 			throw new GException( new ErrorG(err) );
359 		}
360 		
361 		fullPath = Str.toString(outfullPath);
362 		return p;
363 	}
364 	
365 	/**
366 	 * This function outputs key_file as a string.
367 	 * Note that this function never reports an error,
368 	 * so it is safe to pass NULL as error.
369 	 * Since 2.6
370 	 * Returns: a newly allocated string holding the contents of the GKeyFile
371 	 * Throws: GException on failure.
372 	 */
373 	public string toData()
374 	{
375 		// gchar * g_key_file_to_data (GKeyFile *key_file,  gsize *length,  GError **error);
376 		gsize length;
377 		GError* err = null;
378 		
379 		auto p = g_key_file_to_data(gKeyFile, &length, &err);
380 		
381 		if (err !is null)
382 		{
383 			throw new GException( new ErrorG(err) );
384 		}
385 		
386 		return Str.toString(p, length);
387 	}
388 	
389 	/**
390 	 * Returns the name of the start group of the file.
391 	 * Since 2.6
392 	 * Returns: The start group of the key file.
393 	 */
394 	public string getStartGroup()
395 	{
396 		// gchar * g_key_file_get_start_group (GKeyFile *key_file);
397 		return Str.toString(g_key_file_get_start_group(gKeyFile));
398 	}
399 	
400 	/**
401 	 * Returns all groups in the key file loaded with key_file.
402 	 * The array of returned groups will be NULL-terminated, so
403 	 * length may optionally be NULL.
404 	 * Since 2.6
405 	 * Returns: a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it. [array zero-terminated=1][transfer full]
406 	 */
407 	public string[] getGroups()
408 	{
409 		// gchar ** g_key_file_get_groups (GKeyFile *key_file,  gsize *length);
410 		gsize length;
411 		auto p = g_key_file_get_groups(gKeyFile, &length);
412 		
413 		string[] strArray = null;
414 		foreach ( cstr; p[0 .. length] )
415 		{
416 			strArray ~= Str.toString(cstr);
417 		}
418 		
419 		return strArray;
420 	}
421 	
422 	/**
423 	 * Returns all keys for the group name group_name. The array of
424 	 * returned keys will be NULL-terminated, so length may
425 	 * optionally be NULL. In the event that the group_name cannot
426 	 * be found, NULL is returned and error is set to
427 	 * G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
428 	 * Since 2.6
429 	 * Params:
430 	 * groupName = a group name
431 	 * Returns: a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it. [array zero-terminated=1][transfer full]
432 	 * Throws: GException on failure.
433 	 */
434 	public string[] getKeys(string groupName)
435 	{
436 		// gchar ** g_key_file_get_keys (GKeyFile *key_file,  const gchar *group_name,  gsize *length,  GError **error);
437 		gsize length;
438 		GError* err = null;
439 		
440 		auto p = g_key_file_get_keys(gKeyFile, Str.toStringz(groupName), &length, &err);
441 		
442 		if (err !is null)
443 		{
444 			throw new GException( new ErrorG(err) );
445 		}
446 		
447 		
448 		string[] strArray = null;
449 		foreach ( cstr; p[0 .. length] )
450 		{
451 			strArray ~= Str.toString(cstr);
452 		}
453 		
454 		return strArray;
455 	}
456 	
457 	/**
458 	 * Looks whether the key file has the group group_name.
459 	 * Since 2.6
460 	 * Params:
461 	 * groupName = a group name
462 	 * Returns: TRUE if group_name is a part of key_file, FALSE otherwise.
463 	 */
464 	public int hasGroup(string groupName)
465 	{
466 		// gboolean g_key_file_has_group (GKeyFile *key_file,  const gchar *group_name);
467 		return g_key_file_has_group(gKeyFile, Str.toStringz(groupName));
468 	}
469 	
470 	/**
471 	 * Looks whether the key file has the key key in the group
472 	 * group_name.
473 	 * Note
474 	 * This function does not follow the rules for GError strictly;
475 	 * the return value both carries meaning and signals an error. To use
476 	 * this function, you must pass a GError pointer in error, and check
477 	 * whether it is not NULL to see if an error occurred.
478 	 * Language bindings should use g_key_file_get_value() to test whether
479 	 * or not a key exists.
480 	 * Since 2.6
481 	 * Params:
482 	 * groupName = a group name
483 	 * key = a key name
484 	 * Returns: TRUE if key is a part of group_name, FALSE otherwise.
485 	 * Throws: GException on failure.
486 	 */
487 	public int hasKey(string groupName, string key)
488 	{
489 		// gboolean g_key_file_has_key (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
490 		GError* err = null;
491 		
492 		auto p = g_key_file_has_key(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
493 		
494 		if (err !is null)
495 		{
496 			throw new GException( new ErrorG(err) );
497 		}
498 		
499 		return p;
500 	}
501 	
502 	/**
503 	 * Returns the raw value associated with key under group_name.
504 	 * Use g_key_file_get_string() to retrieve an unescaped UTF-8 string.
505 	 * In the event the key cannot be found, NULL is returned and
506 	 * error is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
507 	 * event that the group_name cannot be found, NULL is returned
508 	 * and error is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
509 	 * Since 2.6
510 	 * Params:
511 	 * groupName = a group name
512 	 * key = a key
513 	 * Returns: a newly allocated string or NULL if the specified key cannot be found.
514 	 * Throws: GException on failure.
515 	 */
516 	public string getValue(string groupName, string key)
517 	{
518 		// gchar * g_key_file_get_value (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
519 		GError* err = null;
520 		
521 		auto p = g_key_file_get_value(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
522 		
523 		if (err !is null)
524 		{
525 			throw new GException( new ErrorG(err) );
526 		}
527 		
528 		return Str.toString(p);
529 	}
530 	
531 	/**
532 	 * Returns the string value associated with key under group_name.
533 	 * Unlike g_key_file_get_value(), this function handles escape sequences
534 	 * like \s.
535 	 * In the event the key cannot be found, NULL is returned and
536 	 * error is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
537 	 * event that the group_name cannot be found, NULL is returned
538 	 * and error is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
539 	 * Since 2.6
540 	 * Params:
541 	 * groupName = a group name
542 	 * key = a key
543 	 * Returns: a newly allocated string or NULL if the specified key cannot be found.
544 	 * Throws: GException on failure.
545 	 */
546 	public string getString(string groupName, string key)
547 	{
548 		// gchar * g_key_file_get_string (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
549 		GError* err = null;
550 		
551 		auto p = g_key_file_get_string(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
552 		
553 		if (err !is null)
554 		{
555 			throw new GException( new ErrorG(err) );
556 		}
557 		
558 		return Str.toString(p);
559 	}
560 	
561 	/**
562 	 * Returns the value associated with key under group_name
563 	 * translated in the given locale if available. If locale is
564 	 * NULL then the current locale is assumed.
565 	 * If key cannot be found then NULL is returned and error is set
566 	 * to G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated
567 	 * with key cannot be interpreted or no suitable translation can
568 	 * be found then the untranslated value is returned.
569 	 * Since 2.6
570 	 * Params:
571 	 * groupName = a group name
572 	 * key = a key
573 	 * locale = a locale identifier or NULL. [allow-none]
574 	 * Returns: a newly allocated string or NULL if the specified key cannot be found.
575 	 * Throws: GException on failure.
576 	 */
577 	public string getLocaleString(string groupName, string key, string locale)
578 	{
579 		// gchar * g_key_file_get_locale_string (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *locale,  GError **error);
580 		GError* err = null;
581 		
582 		auto p = g_key_file_get_locale_string(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(locale), &err);
583 		
584 		if (err !is null)
585 		{
586 			throw new GException( new ErrorG(err) );
587 		}
588 		
589 		return Str.toString(p);
590 	}
591 	
592 	/**
593 	 * Returns the value associated with key under group_name as a
594 	 * boolean.
595 	 * If key cannot be found then FALSE is returned and error is set
596 	 * to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value
597 	 * associated with key cannot be interpreted as a boolean then FALSE
598 	 * is returned and error is set to G_KEY_FILE_ERROR_INVALID_VALUE.
599 	 * Since 2.6
600 	 * Params:
601 	 * groupName = a group name
602 	 * key = a key
603 	 * Returns: the value associated with the key as a boolean, or FALSE if the key was not found or could not be parsed.
604 	 * Throws: GException on failure.
605 	 */
606 	public int getBoolean(string groupName, string key)
607 	{
608 		// gboolean g_key_file_get_boolean (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
609 		GError* err = null;
610 		
611 		auto p = g_key_file_get_boolean(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
612 		
613 		if (err !is null)
614 		{
615 			throw new GException( new ErrorG(err) );
616 		}
617 		
618 		return p;
619 	}
620 	
621 	/**
622 	 * Returns the value associated with key under group_name as an
623 	 * integer.
624 	 * If key cannot be found then 0 is returned and error is set to
625 	 * G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
626 	 * with key cannot be interpreted as an integer then 0 is returned
627 	 * and error is set to G_KEY_FILE_ERROR_INVALID_VALUE.
628 	 * Since 2.6
629 	 * Params:
630 	 * groupName = a group name
631 	 * key = a key
632 	 * Returns: the value associated with the key as an integer, or 0 if the key was not found or could not be parsed.
633 	 * Throws: GException on failure.
634 	 */
635 	public int getInteger(string groupName, string key)
636 	{
637 		// gint g_key_file_get_integer (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
638 		GError* err = null;
639 		
640 		auto p = g_key_file_get_integer(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
641 		
642 		if (err !is null)
643 		{
644 			throw new GException( new ErrorG(err) );
645 		}
646 		
647 		return p;
648 	}
649 	
650 	/**
651 	 * Returns the value associated with key under group_name as a signed
652 	 * 64-bit integer. This is similar to g_key_file_get_integer() but can return
653 	 * 64-bit results without truncation.
654 	 * Since 2.26
655 	 * Params:
656 	 * groupName = a non-NULL group name
657 	 * key = a non-NULL key
658 	 * Returns: the value associated with the key as a signed 64-bit integer, or 0 if the key was not found or could not be parsed.
659 	 * Throws: GException on failure.
660 	 */
661 	public long getInt64(string groupName, string key)
662 	{
663 		// gint64 g_key_file_get_int64 (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
664 		GError* err = null;
665 		
666 		auto p = g_key_file_get_int64(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
667 		
668 		if (err !is null)
669 		{
670 			throw new GException( new ErrorG(err) );
671 		}
672 		
673 		return p;
674 	}
675 	
676 	/**
677 	 * Returns the value associated with key under group_name as an unsigned
678 	 * 64-bit integer. This is similar to g_key_file_get_integer() but can return
679 	 * large positive results without truncation.
680 	 * Since 2.26
681 	 * Params:
682 	 * groupName = a non-NULL group name
683 	 * key = a non-NULL key
684 	 * Returns: the value associated with the key as an unsigned 64-bit integer, or 0 if the key was not found or could not be parsed.
685 	 * Throws: GException on failure.
686 	 */
687 	public ulong getUint64(string groupName, string key)
688 	{
689 		// guint64 g_key_file_get_uint64 (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
690 		GError* err = null;
691 		
692 		auto p = g_key_file_get_uint64(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
693 		
694 		if (err !is null)
695 		{
696 			throw new GException( new ErrorG(err) );
697 		}
698 		
699 		return p;
700 	}
701 	
702 	/**
703 	 * Returns the value associated with key under group_name as a
704 	 * double. If group_name is NULL, the start_group is used.
705 	 * If key cannot be found then 0.0 is returned and error is set to
706 	 * G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
707 	 * with key cannot be interpreted as a double then 0.0 is returned
708 	 * and error is set to G_KEY_FILE_ERROR_INVALID_VALUE.
709 	 * Since 2.12
710 	 * Params:
711 	 * groupName = a group name
712 	 * key = a key
713 	 * Returns: the value associated with the key as a double, or 0.0 if the key was not found or could not be parsed.
714 	 * Throws: GException on failure.
715 	 */
716 	public double getDouble(string groupName, string key)
717 	{
718 		// gdouble g_key_file_get_double (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
719 		GError* err = null;
720 		
721 		auto p = g_key_file_get_double(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
722 		
723 		if (err !is null)
724 		{
725 			throw new GException( new ErrorG(err) );
726 		}
727 		
728 		return p;
729 	}
730 	
731 	/**
732 	 * Returns the values associated with key under group_name.
733 	 * In the event the key cannot be found, NULL is returned and
734 	 * error is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
735 	 * event that the group_name cannot be found, NULL is returned
736 	 * and error is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
737 	 * Since 2.6
738 	 * Params:
739 	 * groupName = a group name
740 	 * key = a key
741 	 * Returns: a NULL-terminated string array or NULL if the specified key cannot be found. The array should be freed with g_strfreev(). [array zero-terminated=1 length=length][element-type utf8][transfer full]
742 	 * Throws: GException on failure.
743 	 */
744 	public string[] getStringList(string groupName, string key)
745 	{
746 		// gchar ** g_key_file_get_string_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gsize *length,  GError **error);
747 		gsize length;
748 		GError* err = null;
749 		
750 		auto p = g_key_file_get_string_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &length, &err);
751 		
752 		if (err !is null)
753 		{
754 			throw new GException( new ErrorG(err) );
755 		}
756 		
757 		
758 		string[] strArray = null;
759 		foreach ( cstr; p[0 .. length] )
760 		{
761 			strArray ~= Str.toString(cstr);
762 		}
763 		
764 		return strArray;
765 	}
766 	
767 	/**
768 	 * Returns the values associated with key under group_name
769 	 * translated in the given locale if available. If locale is
770 	 * NULL then the current locale is assumed.
771 	 * If key cannot be found then NULL is returned and error is set
772 	 * to G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated
773 	 * with key cannot be interpreted or no suitable translations
774 	 * can be found then the untranslated values are returned. The
775 	 * returned array is NULL-terminated, so length may optionally
776 	 * be NULL.
777 	 * Since 2.6
778 	 * Params:
779 	 * groupName = a group name
780 	 * key = a key
781 	 * locale = a locale identifier or NULL. [allow-none]
782 	 * Returns: a newly allocated NULL-terminated string array or NULL if the key isn't found. The string array should be freed with g_strfreev(). [array zero-terminated=1 length=length][element-type utf8][transfer full]
783 	 * Throws: GException on failure.
784 	 */
785 	public string[] getLocaleStringList(string groupName, string key, string locale)
786 	{
787 		// gchar ** g_key_file_get_locale_string_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *locale,  gsize *length,  GError **error);
788 		gsize length;
789 		GError* err = null;
790 		
791 		auto p = g_key_file_get_locale_string_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(locale), &length, &err);
792 		
793 		if (err !is null)
794 		{
795 			throw new GException( new ErrorG(err) );
796 		}
797 		
798 		
799 		string[] strArray = null;
800 		foreach ( cstr; p[0 .. length] )
801 		{
802 			strArray ~= Str.toString(cstr);
803 		}
804 		
805 		return strArray;
806 	}
807 	
808 	/**
809 	 * Returns the values associated with key under group_name as
810 	 * booleans.
811 	 * If key cannot be found then NULL is returned and error is set to
812 	 * G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
813 	 * with key cannot be interpreted as booleans then NULL is returned
814 	 * and error is set to G_KEY_FILE_ERROR_INVALID_VALUE.
815 	 * Since 2.6
816 	 * Params:
817 	 * groupName = a group name
818 	 * key = a key
819 	 * Returns: the values associated with the key as a list of booleans, or NULL if the key was not found or could not be parsed. The returned list of booleans should be freed with g_free() when no longer needed. [array length=length][element-type gboolean][transfer container]
820 	 * Throws: GException on failure.
821 	 */
822 	public int[] getBooleanList(string groupName, string key)
823 	{
824 		// gboolean * g_key_file_get_boolean_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gsize *length,  GError **error);
825 		gsize length;
826 		GError* err = null;
827 		
828 		auto p = g_key_file_get_boolean_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &length, &err);
829 		
830 		if (err !is null)
831 		{
832 			throw new GException( new ErrorG(err) );
833 		}
834 		
835 		
836 		if(p is null)
837 		{
838 			return null;
839 		}
840 		
841 		return p[0 .. length];
842 	}
843 	
844 	/**
845 	 * Returns the values associated with key under group_name as
846 	 * integers.
847 	 * If key cannot be found then NULL is returned and error is set to
848 	 * G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
849 	 * with key cannot be interpreted as integers then NULL is returned
850 	 * and error is set to G_KEY_FILE_ERROR_INVALID_VALUE.
851 	 * Since 2.6
852 	 * Params:
853 	 * groupName = a group name
854 	 * key = a key
855 	 * Returns: the values associated with the key as a list of integers, or NULL if the key was not found or could not be parsed. The returned list of integers should be freed with g_free() when no longer needed. [array length=length][element-type gint][transfer container]
856 	 * Throws: GException on failure.
857 	 */
858 	public int[] getIntegerList(string groupName, string key)
859 	{
860 		// gint * g_key_file_get_integer_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gsize *length,  GError **error);
861 		gsize length;
862 		GError* err = null;
863 		
864 		auto p = g_key_file_get_integer_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &length, &err);
865 		
866 		if (err !is null)
867 		{
868 			throw new GException( new ErrorG(err) );
869 		}
870 		
871 		
872 		if(p is null)
873 		{
874 			return null;
875 		}
876 		
877 		return p[0 .. length];
878 	}
879 	
880 	/**
881 	 * Returns the values associated with key under group_name as
882 	 * doubles.
883 	 * If key cannot be found then NULL is returned and error is set to
884 	 * G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
885 	 * with key cannot be interpreted as doubles then NULL is returned
886 	 * and error is set to G_KEY_FILE_ERROR_INVALID_VALUE.
887 	 * Since 2.12
888 	 * Params:
889 	 * groupName = a group name
890 	 * key = a key
891 	 * Returns: the values associated with the key as a list of doubles, or NULL if the key was not found or could not be parsed. The returned list of doubles should be freed with g_free() when no longer needed. [array length=length][element-type gdouble][transfer container]
892 	 * Throws: GException on failure.
893 	 */
894 	public double[] getDoubleList(string groupName, string key)
895 	{
896 		// gdouble * g_key_file_get_double_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gsize *length,  GError **error);
897 		gsize length;
898 		GError* err = null;
899 		
900 		auto p = g_key_file_get_double_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &length, &err);
901 		
902 		if (err !is null)
903 		{
904 			throw new GException( new ErrorG(err) );
905 		}
906 		
907 		
908 		if(p is null)
909 		{
910 			return null;
911 		}
912 		
913 		return p[0 .. length];
914 	}
915 	
916 	/**
917 	 * Retrieves a comment above key from group_name.
918 	 * If key is NULL then comment will be read from above
919 	 * group_name. If both key and group_name are NULL, then
920 	 * comment will be read from above the first group in the file.
921 	 * Since 2.6
922 	 * Params:
923 	 * groupName = a group name, or NULL. [allow-none]
924 	 * key = a key
925 	 * Returns: a comment that should be freed with g_free()
926 	 * Throws: GException on failure.
927 	 */
928 	public string getComment(string groupName, string key)
929 	{
930 		// gchar * g_key_file_get_comment (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
931 		GError* err = null;
932 		
933 		auto p = g_key_file_get_comment(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
934 		
935 		if (err !is null)
936 		{
937 			throw new GException( new ErrorG(err) );
938 		}
939 		
940 		return Str.toString(p);
941 	}
942 	
943 	/**
944 	 * Associates a new value with key under group_name.
945 	 * If key cannot be found then it is created. If group_name cannot
946 	 * be found then it is created. To set an UTF-8 string which may contain
947 	 * characters that need escaping (such as newlines or spaces), use
948 	 * g_key_file_set_string().
949 	 * Since 2.6
950 	 * Params:
951 	 * groupName = a group name
952 	 * key = a key
953 	 * value = a string
954 	 */
955 	public void setValue(string groupName, string key, string value)
956 	{
957 		// void g_key_file_set_value (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *value);
958 		g_key_file_set_value(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(value));
959 	}
960 	
961 	/**
962 	 * Associates a new string value with key under group_name.
963 	 * If key cannot be found then it is created.
964 	 * If group_name cannot be found then it is created.
965 	 * Unlike g_key_file_set_value(), this function handles characters
966 	 * that need escaping, such as newlines.
967 	 * Since 2.6
968 	 * Params:
969 	 * groupName = a group name
970 	 * key = a key
971 	 * string = a string
972 	 */
973 	public void setString(string groupName, string key, string string)
974 	{
975 		// void g_key_file_set_string (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *string);
976 		g_key_file_set_string(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(string));
977 	}
978 	
979 	/**
980 	 * Associates a string value for key and locale under group_name.
981 	 * If the translation for key cannot be found then it is created.
982 	 * Since 2.6
983 	 * Params:
984 	 * groupName = a group name
985 	 * key = a key
986 	 * locale = a locale identifier
987 	 * string = a string
988 	 */
989 	public void setLocaleString(string groupName, string key, string locale, string string)
990 	{
991 		// void g_key_file_set_locale_string (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *locale,  const gchar *string);
992 		g_key_file_set_locale_string(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(locale), Str.toStringz(string));
993 	}
994 	
995 	/**
996 	 * Associates a new boolean value with key under group_name.
997 	 * If key cannot be found then it is created.
998 	 * Since 2.6
999 	 * Params:
1000 	 * groupName = a group name
1001 	 * key = a key
1002 	 * value = TRUE or FALSE
1003 	 */
1004 	public void setBoolean(string groupName, string key, int value)
1005 	{
1006 		// void g_key_file_set_boolean (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gboolean value);
1007 		g_key_file_set_boolean(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), value);
1008 	}
1009 	
1010 	/**
1011 	 * Associates a new integer value with key under group_name.
1012 	 * If key cannot be found then it is created.
1013 	 * Since 2.6
1014 	 * Params:
1015 	 * groupName = a group name
1016 	 * key = a key
1017 	 * value = an integer value
1018 	 */
1019 	public void setInteger(string groupName, string key, int value)
1020 	{
1021 		// void g_key_file_set_integer (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gint value);
1022 		g_key_file_set_integer(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), value);
1023 	}
1024 	
1025 	/**
1026 	 * Associates a new integer value with key under group_name.
1027 	 * If key cannot be found then it is created.
1028 	 * Since 2.26
1029 	 * Params:
1030 	 * groupName = a group name
1031 	 * key = a key
1032 	 * value = an integer value
1033 	 */
1034 	public void setInt64(string groupName, string key, long value)
1035 	{
1036 		// void g_key_file_set_int64 (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gint64 value);
1037 		g_key_file_set_int64(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), value);
1038 	}
1039 	
1040 	/**
1041 	 * Associates a new integer value with key under group_name.
1042 	 * If key cannot be found then it is created.
1043 	 * Since 2.26
1044 	 * Params:
1045 	 * groupName = a group name
1046 	 * key = a key
1047 	 * value = an integer value
1048 	 */
1049 	public void setUint64(string groupName, string key, ulong value)
1050 	{
1051 		// void g_key_file_set_uint64 (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  guint64 value);
1052 		g_key_file_set_uint64(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), value);
1053 	}
1054 	
1055 	/**
1056 	 * Associates a new double value with key under group_name.
1057 	 * If key cannot be found then it is created.
1058 	 * Since 2.12
1059 	 * Params:
1060 	 * groupName = a group name
1061 	 * key = a key
1062 	 * value = an double value
1063 	 */
1064 	public void setDouble(string groupName, string key, double value)
1065 	{
1066 		// void g_key_file_set_double (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gdouble value);
1067 		g_key_file_set_double(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), value);
1068 	}
1069 	
1070 	/**
1071 	 * Associates a list of string values for key under group_name.
1072 	 * If key cannot be found then it is created.
1073 	 * If group_name cannot be found then it is created.
1074 	 * Since 2.6
1075 	 * Params:
1076 	 * groupName = a group name
1077 	 * key = a key
1078 	 * list = an array of string values. [array zero-terminated=1 length=length][element-type utf8]
1079 	 */
1080 	public void setStringList(string groupName, string key, string[] list)
1081 	{
1082 		// void g_key_file_set_string_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar * const list[],  gsize length);
1083 		g_key_file_set_string_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringzArray(list), cast(int) list.length);
1084 	}
1085 	
1086 	/**
1087 	 * Associates a list of string values for key and locale under
1088 	 * group_name. If the translation for key cannot be found then
1089 	 * it is created.
1090 	 * Since 2.6
1091 	 * Params:
1092 	 * groupName = a group name
1093 	 * key = a key
1094 	 * locale = a locale identifier
1095 	 * list = a NULL-terminated array of locale string values. [array zero-terminated=1 length=length]
1096 	 */
1097 	public void setLocaleStringList(string groupName, string key, string locale, string[] list)
1098 	{
1099 		// void g_key_file_set_locale_string_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *locale,  const gchar * const list[],  gsize length);
1100 		g_key_file_set_locale_string_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(locale), Str.toStringzArray(list), cast(int) list.length);
1101 	}
1102 	
1103 	/**
1104 	 * Associates a list of boolean values with key under group_name.
1105 	 * If key cannot be found then it is created.
1106 	 * If group_name is NULL, the start_group is used.
1107 	 * Since 2.6
1108 	 * Params:
1109 	 * groupName = a group name
1110 	 * key = a key
1111 	 * list = an array of boolean values. [array length=length]
1112 	 */
1113 	public void setBooleanList(string groupName, string key, int[] list)
1114 	{
1115 		// void g_key_file_set_boolean_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gboolean list[],  gsize length);
1116 		g_key_file_set_boolean_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), list.ptr, cast(int) list.length);
1117 	}
1118 	
1119 	/**
1120 	 * Associates a list of integer values with key under group_name.
1121 	 * If key cannot be found then it is created.
1122 	 * Since 2.6
1123 	 * Params:
1124 	 * groupName = a group name
1125 	 * key = a key
1126 	 * list = an array of integer values. [array length=length]
1127 	 */
1128 	public void setIntegerList(string groupName, string key, int[] list)
1129 	{
1130 		// void g_key_file_set_integer_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gint list[],  gsize length);
1131 		g_key_file_set_integer_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), list.ptr, cast(int) list.length);
1132 	}
1133 	
1134 	/**
1135 	 * Associates a list of double values with key under
1136 	 * group_name. If key cannot be found then it is created.
1137 	 * Since 2.12
1138 	 * Params:
1139 	 * groupName = a group name
1140 	 * key = a key
1141 	 * list = an array of double values. [array length=length]
1142 	 */
1143 	public void setDoubleList(string groupName, string key, double[] list)
1144 	{
1145 		// void g_key_file_set_double_list (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  gdouble list[],  gsize length);
1146 		g_key_file_set_double_list(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), list.ptr, cast(int) list.length);
1147 	}
1148 	
1149 	/**
1150 	 * Places a comment above key from group_name.
1151 	 * If key is NULL then comment will be written above group_name.
1152 	 * If both key and group_name are NULL, then comment will be
1153 	 * written above the first group in the file.
1154 	 * Since 2.6
1155 	 * Params:
1156 	 * groupName = a group name, or NULL. [allow-none]
1157 	 * key = a key. [allow-none]
1158 	 * comment = a comment
1159 	 * Returns: TRUE if the comment was written, FALSE otherwise
1160 	 * Throws: GException on failure.
1161 	 */
1162 	public int setComment(string groupName, string key, string comment)
1163 	{
1164 		// gboolean g_key_file_set_comment (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  const gchar *comment,  GError **error);
1165 		GError* err = null;
1166 		
1167 		auto p = g_key_file_set_comment(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), Str.toStringz(comment), &err);
1168 		
1169 		if (err !is null)
1170 		{
1171 			throw new GException( new ErrorG(err) );
1172 		}
1173 		
1174 		return p;
1175 	}
1176 	
1177 	/**
1178 	 * Removes the specified group, group_name,
1179 	 * from the key file.
1180 	 * Since 2.6
1181 	 * Params:
1182 	 * groupName = a group name
1183 	 * Returns: TRUE if the group was removed, FALSE otherwise
1184 	 * Throws: GException on failure.
1185 	 */
1186 	public int removeGroup(string groupName)
1187 	{
1188 		// gboolean g_key_file_remove_group (GKeyFile *key_file,  const gchar *group_name,  GError **error);
1189 		GError* err = null;
1190 		
1191 		auto p = g_key_file_remove_group(gKeyFile, Str.toStringz(groupName), &err);
1192 		
1193 		if (err !is null)
1194 		{
1195 			throw new GException( new ErrorG(err) );
1196 		}
1197 		
1198 		return p;
1199 	}
1200 	
1201 	/**
1202 	 * Removes key in group_name from the key file.
1203 	 * Since 2.6
1204 	 * Params:
1205 	 * groupName = a group name
1206 	 * key = a key name to remove
1207 	 * Returns: TRUE if the key was removed, FALSE otherwise
1208 	 * Throws: GException on failure.
1209 	 */
1210 	public int removeKey(string groupName, string key)
1211 	{
1212 		// gboolean g_key_file_remove_key (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
1213 		GError* err = null;
1214 		
1215 		auto p = g_key_file_remove_key(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
1216 		
1217 		if (err !is null)
1218 		{
1219 			throw new GException( new ErrorG(err) );
1220 		}
1221 		
1222 		return p;
1223 	}
1224 	
1225 	/**
1226 	 * Removes a comment above key from group_name.
1227 	 * If key is NULL then comment will be removed above group_name.
1228 	 * If both key and group_name are NULL, then comment will
1229 	 * be removed above the first group in the file.
1230 	 * Since 2.6
1231 	 * Params:
1232 	 * groupName = a group name, or NULL. [allow-none]
1233 	 * key = a key. [allow-none]
1234 	 * Returns: TRUE if the comment was removed, FALSE otherwise
1235 	 * Throws: GException on failure.
1236 	 */
1237 	public int removeComment(string groupName, string key)
1238 	{
1239 		// gboolean g_key_file_remove_comment (GKeyFile *key_file,  const gchar *group_name,  const gchar *key,  GError **error);
1240 		GError* err = null;
1241 		
1242 		auto p = g_key_file_remove_comment(gKeyFile, Str.toStringz(groupName), Str.toStringz(key), &err);
1243 		
1244 		if (err !is null)
1245 		{
1246 			throw new GException( new ErrorG(err) );
1247 		}
1248 		
1249 		return p;
1250 	}
1251 }