aboutsummaryrefslogtreecommitdiffstats
path: root/samples/c++/sample3.cpp
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2011-12-01 23:47:41 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2011-12-01 23:47:41 +0000
commit1eaceca55c7e62892fd28bfbb5fc03240a48cee3 (patch)
tree7243fcd09c57e06e72b15f0044fd2c77babd7843 /samples/c++/sample3.cpp
parentd4b5ddf4bcacd692011f5a597025c38a1262d6ca (diff)
parent429e46051dba814e7d6c74368eb1bba550222cbe (diff)
downloadlibconfig-1eaceca55c7e62892fd28bfbb5fc03240a48cee3.tar.gz
Merge commit 'upstream/1.4.8'
Conflicts: debian/changelog debian/control debian/libconfig++9-dev.install debian/libconfig8.install debian/libconfig9-dev.install debian/rules
Diffstat (limited to 'samples/c++/sample3.cpp')
-rw-r--r--samples/c++/sample3.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/samples/c++/sample3.cpp b/samples/c++/sample3.cpp
deleted file mode 100644
index da1de79..0000000
--- a/samples/c++/sample3.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- ** Sample3
- ** Load sample.cfg and try to add a setting "foo"..
- ** on success save to testfoo.cfg
- *************************************************************************/
-
-#include <iostream>
-#include <libconfig.h++>
-
-using namespace libconfig;
-using namespace std;
-
-/***************************************************************************/
-
-int main()
-{
- Config cfg;
- try
- {
- /* Load the configuration.. */
- cout << "loading [sample.cfg]...";
- cfg.readFile("sample.cfg");
- cout << "ok" << endl;
-
- /* Add setting "foo" */
- cout << "add setting \"foo\"/...";
- Setting &root = cfg.getRoot();
- Setting &foo = root.add("foo", Setting::TypeInt);
- foo = 1234;
- cout << "ok" << endl;
-
- /** Look up an array element */
- cout << "looking up array element...";
- Setting &elem = cfg.lookup("arrays.values.[0]");
- int val = elem;
- std::cout << "value is: " << val << std::endl;
- std::cout << "path is: " << elem.getPath() << std::endl;
-
- /* Save to "samplefoo.cfg" */
- cout << "saving [samplefoo.cfg]...";
- cfg.writeFile("samplefoo.cfg");
- cout << "ok" << endl;
-
- cout << "Done!" << endl;
- }
- catch (...)
- {
- cout << "failed" << endl;
- }
-
- return 0;
-}
-
-/***************************************************************************/