Struct

GLibKeyFile

Description

struct GKeyFile {
  /* No available fields */
}

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

Constructors

g_key_file_new

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.

since: 2.6

Functions

g_key_file_error_quark
No description available.

Instance methods

g_key_file_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.

since: 2.6

g_key_file_get_boolean

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

since: 2.6

g_key_file_get_boolean_list

Returns the values associated with key under group_name as booleans.

since: 2.6

g_key_file_get_comment

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.

since: 2.6

g_key_file_get_double

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

since: 2.12

g_key_file_get_double_list

Returns the values associated with key under group_name as doubles.

since: 2.12

g_key_file_get_groups

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.

since: 2.6

g_key_file_get_int64

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.

since: 2.26

g_key_file_get_integer

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

since: 2.6

g_key_file_get_integer_list

Returns the values associated with key under group_name as integers.

since: 2.6

g_key_file_get_keys

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.

since: 2.6

g_key_file_get_locale_for_key

Returns the actual locale which the result of g_key_file_get_locale_string() or g_key_file_get_locale_string_list() came from.

since: 2.56

g_key_file_get_locale_string

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.

since: 2.6

g_key_file_get_locale_string_list

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.

since: 2.6

g_key_file_get_start_group

Returns the name of the start group of the file.

since: 2.6

g_key_file_get_string

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

since: 2.6

g_key_file_get_string_list

Returns the values associated with key under group_name.

since: 2.6

g_key_file_get_uint64

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.

since: 2.26

g_key_file_get_value

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

since: 2.6

g_key_file_has_group

Looks whether the key file has the group group_name.

since: 2.6

g_key_file_has_key

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

since: 2.6

g_key_file_load_from_bytes

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.

since: 2.50

g_key_file_load_from_data

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

since: 2.6

g_key_file_load_from_data_dirs

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.

since: 2.6

g_key_file_load_from_dirs

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.

since: 2.14

g_key_file_load_from_file

Loads a key file into an empty GKeyFile structure.

since: 2.6

g_key_file_ref

Increases the reference count of key_file.

since: 2.32

g_key_file_remove_comment

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.

since: 2.6

g_key_file_remove_group

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

since: 2.6

g_key_file_remove_key

Removes key in group_name from the key file.

since: 2.6

g_key_file_save_to_file

Writes the contents of key_file to filename using g_file_set_contents(). If you need stricter guarantees about durability of the written file than are provided by g_file_set_contents(), use g_file_set_contents_full() with the return value of g_key_file_to_data().

since: 2.40

g_key_file_set_boolean

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

since: 2.6

g_key_file_set_boolean_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.

since: 2.6

g_key_file_set_comment

Places a comment above key from group_name.

since: 2.6

g_key_file_set_double

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

since: 2.12

g_key_file_set_double_list

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

since: 2.12

g_key_file_set_int64

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

since: 2.26

g_key_file_set_integer

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

since: 2.6

g_key_file_set_integer_list

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

since: 2.6

g_key_file_set_list_separator

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

since: 2.6

g_key_file_set_locale_string

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

since: 2.6

g_key_file_set_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.

since: 2.6

g_key_file_set_string

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.

since: 2.6

g_key_file_set_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.

since: 2.6

g_key_file_set_uint64

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

since: 2.26

g_key_file_set_value

Associates a new value with key under group_name.

since: 2.6

g_key_file_to_data

This function outputs key_file as a string.

since: 2.6

g_key_file_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.

since: 2.32