KeyFile

The GKeyFile struct contains only private data and should not be accessed directly.

class KeyFile {}

Constructors

this
this(GKeyFile* gKeyFile, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new empty #GKeyFile object. Use g_key_file_load_from_file(), g_key_file_load_from_data(), g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to read an existing key file.

Members

Functions

doref
KeyFile doref()

Increases the reference count of @key_file.

free
void free()

Clears all keys and groups from @key_file, and decreases the reference count by 1. If the reference count reaches zero, frees the key file and all its allocated memory.

getBoolean
bool getBoolean(string groupName, string key)

Returns the value associated with @key under @group_name as a boolean.

getBooleanList
bool[] getBooleanList(string groupName, string key)

Returns the values associated with @key under @group_name as booleans.

getComment
string getComment(string groupName, string key)

Retrieves a comment above @key from @group_name. If @key is %NULL then @comment will be read from above @group_name. If both @key and @group_name are %NULL, then @comment will be read from above the first group in the file.

getDouble
double getDouble(string groupName, string key)

Returns the value associated with @key under @group_name as a double. If @group_name is %NULL, the start_group is used.

getDoubleList
double[] getDoubleList(string groupName, string key)

Returns the values associated with @key under @group_name as doubles.

getGroups
string[] getGroups(size_t length)

Returns all groups in the key file loaded with @key_file. The array of returned groups will be %NULL-terminated, so @length may optionally be %NULL.

getInt64
long getInt64(string groupName, string key)

Returns the value associated with @key under @group_name as a signed 64-bit integer. This is similar to g_key_file_get_integer() but can return 64-bit results without truncation.

getInteger
int getInteger(string groupName, string key)

Returns the value associated with @key under @group_name as an integer.

getIntegerList
int[] getIntegerList(string groupName, string key)

Returns the values associated with @key under @group_name as integers.

getKeyFileStruct
GKeyFile* getKeyFileStruct()

Get the main Gtk struct

getKeys
string[] getKeys(string groupName, size_t length)

Returns all keys for the group name @group_name. The array of returned keys will be %NULL-terminated, so @length may optionally be %NULL. In the event that the @group_name cannot be found, %NULL is returned and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.

getLocaleString
string getLocaleString(string groupName, string key, string locale)

Returns the value associated with @key under @group_name translated in the given @locale if available. If @locale is %NULL then the current locale is assumed.

getLocaleStringList
string[] getLocaleStringList(string groupName, string key, string locale)

Returns the values associated with @key under @group_name translated in the given @locale if available. If @locale is %NULL then the current locale is assumed.

getStartGroup
string getStartGroup()

Returns the name of the start group of the file.

getString
string getString(string groupName, string key)

Returns the string value associated with @key under @group_name. Unlike g_key_file_get_value(), this function handles escape sequences like \s.

getStringList
string[] getStringList(string groupName, string key)

Returns the values associated with @key under @group_name.

getStruct
void* getStruct()

the main Gtk struct as a void*

getUint64
ulong getUint64(string groupName, string key)

Returns the value associated with @key under @group_name as an unsigned 64-bit integer. This is similar to g_key_file_get_integer() but can return large positive results without truncation.

getValue
string getValue(string groupName, string key)

Returns the raw value associated with @key under @group_name. Use g_key_file_get_string() to retrieve an unescaped UTF-8 string.

hasGroup
bool hasGroup(string groupName)

Looks whether the key file has the group @group_name.

hasKey
bool hasKey(string groupName, string key)

Looks whether the key file has the key @key in the group @group_name.

loadFromBytes
bool loadFromBytes(Bytes bytes, GKeyFileFlags flags)

Loads a key file from the data in @bytes into an empty #GKeyFile structure. If the object cannot be created then %error is set to a #GKeyFileError.

loadFromData
bool loadFromData(string data, size_t length, GKeyFileFlags flags)

Loads a key file from memory into an empty #GKeyFile structure. If the object cannot be created then %error is set to a #GKeyFileError.

loadFromDataDirs
bool loadFromDataDirs(string file, string fullPath, GKeyFileFlags flags)

This function looks for a key file named @file in the paths returned from g_get_user_data_dir() and g_get_system_data_dirs(), loads the file into @key_file and returns the file's full path in @full_path. If the file could not be loaded then an %error is set to either a #GFileError or #GKeyFileError.

loadFromDirs
bool loadFromDirs(string file, string[] searchDirs, string fullPath, GKeyFileFlags flags)

This function looks for a key file named @file in the paths specified in @search_dirs, loads the file into @key_file and returns the file's full path in @full_path. If the file could not be loaded then an %error is set to either a #GFileError or #GKeyFileError.

loadFromFile
bool loadFromFile(string file, GKeyFileFlags flags)

Loads a key file into an empty #GKeyFile structure. If the file could not be loaded then @error is set to either a #GFileError or #GKeyFileError.

removeComment
bool removeComment(string groupName, string key)

Removes a comment above @key from @group_name. If @key is %NULL then @comment will be removed above @group_name. If both @key and @group_name are %NULL, then @comment will be removed above the first group in the file.

removeGroup
bool removeGroup(string groupName)

Removes the specified group, @group_name, from the key file.

removeKey
bool removeKey(string groupName, string key)

Removes @key in @group_name from the key file.

saveToFile
bool saveToFile(string filename)

Writes the contents of @key_file to @filename using g_file_set_contents().

setBoolean
void setBoolean(string groupName, string key, bool value)

Associates a new boolean value with @key under @group_name. If @key cannot be found then it is created.

setBooleanList
void setBooleanList(string groupName, string key, bool[] list)

Associates a list of boolean values with @key under @group_name. If @key cannot be found then it is created. If @group_name is %NULL, the start_group is used.

setComment
bool setComment(string groupName, string key, string comment)

Places a comment above @key from @group_name.

setDouble
void setDouble(string groupName, string key, double value)

Associates a new double value with @key under @group_name. If @key cannot be found then it is created.

setDoubleList
void setDoubleList(string groupName, string key, double[] list)

Associates a list of double values with @key under @group_name. If @key cannot be found then it is created.

setInt64
void setInt64(string groupName, string key, long value)

Associates a new integer value with @key under @group_name. If @key cannot be found then it is created.

setInteger
void setInteger(string groupName, string key, int value)

Associates a new integer value with @key under @group_name. If @key cannot be found then it is created.

setIntegerList
void setIntegerList(string groupName, string key, int[] list)

Associates a list of integer values with @key under @group_name. If @key cannot be found then it is created.

setListSeparator
void setListSeparator(char separator)

Sets the character which is used to separate values in lists. Typically ';' or ',' are used as separators. The default list separator is ';'.

setLocaleString
void setLocaleString(string groupName, string key, string locale, string str)

Associates a string value for @key and @locale under @group_name. If the translation for @key cannot be found then it is created.

setLocaleStringList
void setLocaleStringList(string groupName, string key, string locale, string list)

Associates a list of string values for @key and @locale under @group_name. If the translation for @key cannot be found then it is created.

setString
void setString(string groupName, string key, string str)

Associates a new string value with @key under @group_name. If @key cannot be found then it is created. If @group_name cannot be found then it is created. Unlike g_key_file_set_value(), this function handles characters that need escaping, such as newlines.

setStringList
void setStringList(string groupName, string key, string[] list)

Associates a list of string values for @key under @group_name. If @key cannot be found then it is created. If @group_name cannot be found then it is created.

setUint64
void setUint64(string groupName, string key, ulong value)

Associates a new integer value with @key under @group_name. If @key cannot be found then it is created.

setValue
void setValue(string groupName, string key, string value)

Associates a new value with @key under @group_name.

toData
string toData(size_t length)

This function outputs @key_file as a string.

unref
void unref()

Decreases the reference count of @key_file by 1. If the reference count reaches zero, frees the key file and all its allocated memory.

Static functions

errorQuark
GQuark errorQuark()

Variables

gKeyFile
GKeyFile* gKeyFile;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta