summaryrefslogtreecommitdiff
path: root/examples/keyfile/main.cc
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-02-02 10:08:42 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-02-02 10:08:42 +0100
commit0cd517399a4fafa6578b63ba45cee8968b317058 (patch)
treef1101da6dc3772ed762a25cc6893d438940e3177 /examples/keyfile/main.cc
parent203063d1b7a8bcc9bb0ffb9e8bbbfe5d5832a944 (diff)
downloadglibmm-0cd517399a4fafa6578b63ba45cee8968b317058.tar.gz
Glib::KeyFile: Make it a _CLASS_OPAQUE_REFCOUNTED
* examples/keyfile/main.cc: * gio/src/desktopappinfo.hg: Store KeyFile in a RefPtr. * glib/src/keyfile.[ccg|hg]: Replace _CLASS_GENERIC by _CLASS_OPAQUE_REFCOUNTED. Remove handcoded methods that are now generated by gmmproc. * tools/m4/convert_glib.m4: Update conversion for KeyFile. GKeyFile is refcounted since 2009.
Diffstat (limited to 'examples/keyfile/main.cc')
-rw-r--r--examples/keyfile/main.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/keyfile/main.cc b/examples/keyfile/main.cc
index c75719d0..a1b61556 100644
--- a/examples/keyfile/main.cc
+++ b/examples/keyfile/main.cc
@@ -24,12 +24,12 @@ main(int, char**)
const std::string filepath = "./example.ini";
- Glib::KeyFile keyfile;
+ auto keyfile = Glib::KeyFile::create();
// An exception will be thrown if the file is not there, or if the file is incorrectly formatted:
try
{
- keyfile.load_from_file(filepath);
+ keyfile->load_from_file(filepath);
}
catch (const Glib::Error& ex)
{
@@ -41,7 +41,7 @@ main(int, char**)
// An exception will be thrown if the value is not in the file:
try
{
- const Glib::ustring value = keyfile.get_value("somegroup", "somekey");
+ const Glib::ustring value = keyfile->get_value("somegroup", "somekey");
std::cout << "somekey value=" << value << std::endl;
}
catch (const Glib::KeyFileError& ex)
@@ -53,7 +53,7 @@ main(int, char**)
// An exception will be thrown if the value is not in the file:
try
{
- const Glib::ustring value = keyfile.get_value("First Group", "Welcome");
+ const Glib::ustring value = keyfile->get_value("First Group", "Welcome");
std::cout << "Welcome value=" << value << std::endl;
}
catch (const Glib::KeyFileError& ex)
@@ -65,7 +65,7 @@ main(int, char**)
// An exception will be thrown if the value is not in the file:
try
{
- const auto values = keyfile.get_integer_list("Another Group", "Numbers");
+ const auto values = keyfile->get_integer_list("Another Group", "Numbers");
for (const auto& p : values)
std::cout << "Number list value: item=" << p << std::endl;