From 4e2fa78ea36ec2cf6583bc025b4127c5ea238fd2 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 27 Oct 2015 21:19:11 +0000 Subject: Update libucl to git snapshot 20151027 (77d9d33) --- examples/ucl_cpp.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 examples/ucl_cpp.cc (limited to 'examples/ucl_cpp.cc') diff --git a/examples/ucl_cpp.cc b/examples/ucl_cpp.cc new file mode 100644 index 000000000000..2d15d84a6c8d --- /dev/null +++ b/examples/ucl_cpp.cc @@ -0,0 +1,26 @@ +#include +#include +#include "ucl++.h" + +int main(int argc, char **argv) +{ + std::string input, err; + + input.assign((std::istreambuf_iterator(std::cin)), + std::istreambuf_iterator()); + + auto obj = ucl::Ucl::parse(input, err); + + if (obj) { + std::cout << obj.dump(UCL_EMIT_CONFIG) << std::endl; + + for (const auto &o : obj) { + std::cout << o.dump(UCL_EMIT_CONFIG) << std::endl; + } + } + else { + std::cerr << "Error: " << err << std::endl; + + return 1; + } +} -- cgit v1.3