diff options
Diffstat (limited to 'cpp/examples')
-rw-r--r-- | cpp/examples/read_conf.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cpp/examples/read_conf.cpp b/cpp/examples/read_conf.cpp new file mode 100644 index 0000000..0a7ef51 --- /dev/null +++ b/cpp/examples/read_conf.cpp @@ -0,0 +1,15 @@ +#include <pom.hpp> +#include <iostream> + +int main(void) { + try { + pom::Configuration conf = pom::Configuration("conf.pom"); + auto indentation_type = conf.get("indentation-type"); + if (indentation_type.has_value()) + std::cout << "Indenting with " << indentation_type.value() << "\n"; + else + std::cout << "No indentation type set!\n"; + } catch (pom::Error &error) { + std::cerr << error.what() << "\n"; + } +} |