![]() |
Public Member Functions | |
| KeyFile () | |
| Creates a new, empty KeyFile object. | |
| ~KeyFile () | |
| Destructor. | |
| KeyFile (GKeyFile* castitem, bool takes_ownership=false) | |
| Creates a glibmm KeyFile wrapper for a GKeyFile object. | |
| bool | load_from_file (const std::string& filename, KeyFileFlags flags=Glib::KEY_FILE_NONE) |
| Loads a key file into an empty G::KeyFile structure. | |
| bool | load_from_data (const Glib::ustring& data, KeyFileFlags flags=Glib::KEY_FILE_NONE) |
| Loads a KeyFile from memory. | |
| bool | load_from_data_dirs (const std::string& file, std::string& full_path, KeyFileFlags flags=Glib::KEY_FILE_NONE) |
| Looks for a KeyFile named file in the paths returned from g_get_user_data_dir() and g_get_system_data_dirs() and loads them into the keyfile object, placing the full path to the file in full_path. | |
| Glib::ustring | to_data () |
| Outputs the KeyFile as a string. | |
| Glib::ustring | get_start_group () const |
| Returns the name of the start group of the file. | |
| Glib::ArrayHandle<Glib::ustring> | get_groups () const |
| Gets a list of all groups in the KeyFile. | |
| Glib::ArrayHandle<Glib::ustring> | get_keys (const Glib::ustring& group_name) const |
| Gets a list of all keys from the group group_name. | |
| bool | has_group (const Glib::ustring& group_name) const |
| Looks whether the key file has the group group_name . | |
| bool | has_key (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Looks whether the key file has the key key in the group group_name . | |
| Glib::ustring | get_value (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the value associated with key under group_name . | |
| Glib::ustring | get_string (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the value associated with key under group_name . | |
| Glib::ustring | get_locale_string (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Gets the value associated with key under group_name translated into the current locale. | |
| Glib::ustring | get_locale_string (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const |
| Returns the value associated with key under group_name translated in the given locale if available. | |
| bool | get_boolean (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the value associated with key under group_name as a boolean. | |
| int | get_integer (const Glib::ustring& key) const |
| Gets the value in the first group, under key, interpreting it as an integer. | |
| int | get_integer (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the value associated with key under group_name as an integer. | |
| Glib::ArrayHandle<Glib::ustring> | get_string_list (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the values associated with key under group_name. | |
| Glib::ArrayHandle<Glib::ustring> | get_locale_string_list (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the values associated with key under group_name translated into the current locale, if available. | |
| Glib::ArrayHandle<Glib::ustring> | get_locale_string_list (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const |
| Returns the values associated with key under group_name translated into locale, if available. | |
| Glib::ArrayHandle<bool> | get_boolean_list (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the values associated with key under group_name. | |
| Glib::ArrayHandle<int> | get_integer_list (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Returns the values associated with key under group_name. | |
| Glib::ustring | get_comment () const |
| Get comment from top of file. | |
| Glib::ustring | get_comment (const Glib::ustring& group_name) const |
| Get comment from above a group. | |
| Glib::ustring | get_comment (const Glib::ustring& group_name, const Glib::ustring& key) const |
| Retrieves a comment above key from group_name . | |
| void | set_list_separator (gchar separator) |
| Sets the character which is used to separate values in lists. | |
| void | set_value (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& value) |
| Associates a new value with key under group_name . | |
| void | set_string (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& string) |
| Associates a new string value with key under group_name . | |
| void | set_locale_string (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, const Glib::ustring& string) |
| Associates a string value for key and locale under group_name . | |
| void | set_boolean (const Glib::ustring& group_name, const Glib::ustring& key, bool value) |
| Associates a new boolean value with key under group_name . | |
| void | set_integer (const Glib::ustring& group_name, const Glib::ustring& key, int value) |
| Associates a new integer value with key under group_name . | |
| void | set_string_list (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle<Glib::ustring>& list) |
| Sets a list of string values for key under group_name. | |
| void | set_locale_string_list (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, const Glib::ArrayHandle<Glib::ustring>& list) |
| Sets a list of string values for the key under group_name and marks them as being for locale. | |
| void | set_boolean_list (const Glib::ustring& group_name, const Glib::ustring& key, Glib::ArrayHandle<bool>& list) |
| Sets a list of booleans for the key under group_name. | |
| void | set_integer_list (const Glib::ustring& group_name, const Glib::ustring& key, Glib::ArrayHandle<int>& list) |
| Sets a list of integers for the key under group_name. | |
| void | set_comment (const Glib::ustring& comment) |
| Places comment at the start of the file, before the first group. | |
| void | set_comment (const Glib::ustring& group_name, const Glib::ustring& comment) |
| Places comment above group_name. | |
| void | set_comment (const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& comment) |
| Places a comment above key from group_name . | |
| void | remove_comment (const Glib::ustring& group_name, const Glib::ustring& key) |
| Removes a comment above key from group_name . | |
| void | remove_key (const Glib::ustring& group_name, const Glib::ustring& key) |
| Removes key in group_name from the key file. | |
| void | remove_group (const Glib::ustring& group_name) |
| Removes the specified group, group_name , from the key file. | |
| GKeyFile* | gobj () |
| const GKeyFile* | gobj () const |
Protected Attributes | |
| GKeyFile* | gobject_ |
| bool | owns_gobject_ |
| Glib::KeyFile::KeyFile | ( | ) |
Creates a new, empty KeyFile object.
| Glib::KeyFile::~KeyFile | ( | ) |
Destructor.
| Glib::KeyFile::KeyFile | ( | GKeyFile * | castitem, | |
| bool | takes_ownership = false | |||
| ) |
Creates a glibmm KeyFile wrapper for a GKeyFile object.
Note, when using this that when the wrapper is deleted, it will not automatically deleted the GKeyFile unless you set the delete_c_instance boolean to true.
| castitem | The C instance to wrap | |
| delete_c_instance | If the C instance should be deleted when the wrapper is deleted. |
| bool Glib::KeyFile::load_from_file | ( | const std::string & | filename, | |
| KeyFileFlags | flags = Glib::KEY_FILE_NONE | |||
| ) |
Loads a key file into an empty G::KeyFile structure.
If the file could not be loaded then error is set to either a G::FileError or G::KeyFileError.
| file | The path of a filename to load, in the GLib file name encoding. | |
| flags | Flags from G::KeyFileFlags. | |
| error | Return location for a G::Error, or 0. |
true if a key file could be loaded, false othewise | bool Glib::KeyFile::load_from_data | ( | const Glib::ustring& | data, | |
| KeyFileFlags | flags = Glib::KEY_FILE_NONE | |||
| ) |
Loads a KeyFile from memory.
| data | The data to use as a KeyFile | |
| flags | Bitwise combination of the flags to use for the KeyFile |
| Glib::KeyFileError |
| bool Glib::KeyFile::load_from_data_dirs | ( | const std::string & | file, | |
| std::string & | full_path, | |||
| KeyFileFlags | flags = Glib::KEY_FILE_NONE | |||
| ) |
Looks for a KeyFile named file in the paths returned from g_get_user_data_dir() and g_get_system_data_dirs() and loads them into the keyfile object, placing the full path to the file in full_path.
| file | The file to search for | |
| full_path | Return location for a string containing the full path of the file | |
| flags | Bitwise combination of the flags to use for the KeyFile |
| Glib::KeyFileError | ||
| Glib::FileError |
| Glib::ustring Glib::KeyFile::to_data | ( | ) |
| Glib::ustring Glib::KeyFile::get_start_group | ( | ) | const |
Returns the name of the start group of the file.
| Glib::ArrayHandle<Glib::ustring> Glib::KeyFile::get_groups | ( | ) | const |
| Glib::ArrayHandle<Glib::ustring> Glib::KeyFile::get_keys | ( | const Glib::ustring& | group_name | ) | const |
Gets a list of all keys from the group group_name.
| group_name | The name of a group |
| bool Glib::KeyFile::has_group | ( | const Glib::ustring& | group_name | ) | const |
Looks whether the key file has the group group_name .
| group_name | A group name. |
true if group_name is a part of key_file , false otherwise. | bool Glib::KeyFile::has_key | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Looks whether the key file has the key key in the group group_name .
| group_name | A group name. | |
| key | A key name. | |
| error | Return location for a G::Error. |
true if key is a part of group_name , false otherwise.| Glib::ustring Glib::KeyFile::get_value | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the value associated with key under group_name .
In the event the key cannot be found, 0 is returned and error is set to G::KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be found, 0 is returned and error is set to G::KEY_FILE_ERROR_GROUP_NOT_FOUND.
| group_name | A group name. | |
| key | A key. | |
| error | Return location for a G::Error, or 0. |
0 if the specified key cannot be found.| Glib::ustring Glib::KeyFile::get_string | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the value associated with key under group_name .
In the event the key cannot be found, 0 is returned and error is set to G::KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be found, 0 is returned and error is set to G::KEY_FILE_ERROR_GROUP_NOT_FOUND.
| group_name | A group name. | |
| key | A key. | |
| error | Return location for a G::Error, or 0. |
0 if the specified key cannot be found.| Glib::ustring Glib::KeyFile::get_locale_string | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Gets the value associated with key under group_name translated into the current locale.
| Glib::ustring Glib::KeyFile::get_locale_string | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | locale | |||
| ) | const |
Returns the value associated with key under group_name translated in the given locale if available.
If locale is 0 then the current locale is assumed.
If key cannot be found then 0 is returned and error is set to G::KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated with key cannot be interpreted or no suitable translation can be found then the untranslated value is returned.
| group_name | A group name. | |
| key | A key. | |
| locale | A locale or 0. | |
| error | Return location for a G::Error, or 0. |
0 if the specified key cannot be found.| bool Glib::KeyFile::get_boolean | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the value associated with key under group_name as a boolean.
If key cannot be found then the return value is undefined and error is set to G::KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with key cannot be interpreted as a boolean then the return value is also undefined and error is set to G::KEY_FILE_ERROR_INVALID_VALUE.
| group_name | A group name. | |
| key | A key. | |
| error | Return location for a G::Error. |
| int Glib::KeyFile::get_integer | ( | const Glib::ustring& | key | ) | const |
Gets the value in the first group, under key, interpreting it as an integer.
| key | The name of the key |
| Glib::KeyFileError |
| int Glib::KeyFile::get_integer | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the value associated with key under group_name as an integer.
If group_name is 0, the start_group is used.
If key cannot be found then the return value is undefined and error is set to G::KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with key cannot be interpreted as an integer then the return value is also undefined and error is set to G::KEY_FILE_ERROR_INVALID_VALUE.
| group_name | A group name. | |
| key | A key. | |
| error | Return location for a G::Error. |
| Glib::ArrayHandle<Glib::ustring> Glib::KeyFile::get_string_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the values associated with key under group_name.
| group_name | The name of a group | |
| key | The name of a key |
| Glib::KeyFileError |
| Glib::ArrayHandle<Glib::ustring> Glib::KeyFile::get_locale_string_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the values associated with key under group_name translated into the current locale, if available.
| group_name | The name of a group | |
| key | The name of a key |
| Glib::KeyFileError |
| Glib::ArrayHandle<Glib::ustring> Glib::KeyFile::get_locale_string_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | locale | |||
| ) | const |
Returns the values associated with key under group_name translated into locale, if available.
| group_name | The name of a group | |
| key | The name of a key | |
| locale | The name of a locale |
| Glib::KeyFileError |
| Glib::ArrayHandle<bool> Glib::KeyFile::get_boolean_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the values associated with key under group_name.
| group_name | The name of a group | |
| key | The name of a key |
| Glib::KeyFileError |
| Glib::ArrayHandle<int> Glib::KeyFile::get_integer_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Returns the values associated with key under group_name.
| group_name | The name of a group | |
| key | The name of a key |
| Glib::KeyFileError |
| Glib::ustring Glib::KeyFile::get_comment | ( | ) | const |
Get comment from top of file.
| Glib::ustring Glib::KeyFile::get_comment | ( | const Glib::ustring& | group_name | ) | const |
Get comment from above a group.
| group_name | The group |
| Glib::ustring Glib::KeyFile::get_comment | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) | const |
Retrieves a comment above key from group_name .
group_name . If key is 0 then comment will be read from above group_name . If both key and group_name are 0, then comment will be read from above the first group in the file.
| group_name | A group name, or 0. | |
| key | A key. | |
| error | Return location for a G::Error. |
| void Glib::KeyFile::set_list_separator | ( | gchar | separator | ) |
Sets the character which is used to separate values in lists.
Typically ';' or ',' are used as separators. The default list separator is ';'.
| separator | The separator. |
| void Glib::KeyFile::set_value | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | value | |||
| ) |
Associates a new 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.
| group_name | A group name. | |
| key | A key. | |
| value | A string. |
| void Glib::KeyFile::set_string | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | 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.
| group_name | A group name. | |
| key | A key. | |
| string | A string. |
| void Glib::KeyFile::set_locale_string | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | locale, | |||
| const Glib::ustring& | string | |||
| ) |
Associates a string value for key and locale under group_name .
If the translation for key cannot be found then it is created.
| group_name | A group name. | |
| key | A key. | |
| locale | A locale. | |
| string | A string. |
| void Glib::KeyFile::set_boolean | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| bool | value | |||
| ) |
Associates a new boolean value with key under group_name .
If key cannot be found then it is created.
| group_name | A group name. | |
| key | A key. | |
| value | true or false. |
| void Glib::KeyFile::set_integer | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| int | value | |||
| ) |
Associates a new integer value with key under group_name .
If key cannot be found then it is created.
| group_name | A group name. | |
| key | A key. | |
| value | An integer value. |
| void Glib::KeyFile::set_string_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ArrayHandle<Glib::ustring>& | list | |||
| ) |
Sets a list of string values for key under group_name.
If key cannot be found it is created. If group_name cannot be found it is created.
| group_name | The name of a group | |
| key | The name of a key | |
| list | A list holding objects of type Glib::ustring |
| void Glib::KeyFile::set_locale_string_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | locale, | |||
| const Glib::ArrayHandle<Glib::ustring>& | list | |||
| ) |
Sets a list of string values for the key under group_name and marks them as being for locale.
If the key or group_name cannot be found, they are created.
| group_name | The name of a group | |
| key | The name of a key | |
| locale | A locale | |
| list | A list holding objects of type Glib::ustring |
| void Glib::KeyFile::set_boolean_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| Glib::ArrayHandle<bool>& | list | |||
| ) |
Sets a list of booleans for the key under group_name.
If either the key or group_name cannot be found they are created
| group_name | The name of a group | |
| key | The name of a key | |
| list | A list holding object of type bool |
| void Glib::KeyFile::set_integer_list | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| Glib::ArrayHandle<int>& | list | |||
| ) |
Sets a list of integers for the key under group_name.
If either the key or group_name cannot be found they are created
| group_name | The name of a group | |
| key | The name of a key | |
| list | A list holding object of type int |
| void Glib::KeyFile::set_comment | ( | const Glib::ustring& | comment | ) |
Places comment at the start of the file, before the first group.
| comment | The Comment |
| void Glib::KeyFile::set_comment | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | comment | |||
| ) |
Places comment above group_name.
| group_name | The Group the comment should be above | |
| comment | The comment |
| void Glib::KeyFile::set_comment | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key, | |||
| const Glib::ustring& | comment | |||
| ) |
Places a comment above key from group_name .
group_name . If key is 0 then comment will be written above group_name . If both key and group_name are 0, then comment will be written above the first group in the file.
| group_name | A group name, or 0. | |
| key | A key. | |
| comment | A comment. | |
| error | Return location for a G::Error. |
| void Glib::KeyFile::remove_comment | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) |
Removes a comment above key from group_name .
group_name . If key is 0 then comment will be written above group_name . If both key and group_name are 0, then comment will be written above the first group in the file.
| group_name | A group name, or 0. | |
| key | A key. | |
| error | Return location for a G::Error. |
| void Glib::KeyFile::remove_key | ( | const Glib::ustring& | group_name, | |
| const Glib::ustring& | key | |||
| ) |
Removes key in group_name from the key file.
| group_name | A group name. | |
| key | A key name to remove. | |
| error | Return location for a G::Error or 0. |
| void Glib::KeyFile::remove_group | ( | const Glib::ustring& | group_name | ) |
Removes the specified group, group_name , from the key file.
| group_name | A group name. | |
| error | Return location for a G::Error or 0. |
| GKeyFile* Glib::KeyFile::gobj | ( | ) | [inline] |
| const GKeyFile* Glib::KeyFile::gobj | ( | ) | const [inline] |
GKeyFile* Glib::KeyFile::gobject_ [protected] |
bool Glib::KeyFile::owns_gobject_ [protected] |