diff options
author | bapt <bapt@FreeBSD.org> | 2015-10-27 21:24:09 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-10-27 21:24:09 +0000 |
commit | 1db684f7ee1410ba0acf51937dc2748211c38efa (patch) | |
tree | 9b000a9777302debbb64fb5d2b8670bf0685b757 /contrib/libucl/examples/ucl_cpp.cc | |
parent | f4de602b0d1cd88f3d73de6148c83c4158e58a15 (diff) | |
parent | bf66c97c4a64e64410bf0223d221a54ca9555f52 (diff) | |
download | FreeBSD-src-1db684f7ee1410ba0acf51937dc2748211c38efa.zip FreeBSD-src-1db684f7ee1410ba0acf51937dc2748211c38efa.tar.gz |
Update libucl to latest git snapshot (20151027)
Diffstat (limited to 'contrib/libucl/examples/ucl_cpp.cc')
-rw-r--r-- | contrib/libucl/examples/ucl_cpp.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/libucl/examples/ucl_cpp.cc b/contrib/libucl/examples/ucl_cpp.cc new file mode 100644 index 0000000..2d15d84 --- /dev/null +++ b/contrib/libucl/examples/ucl_cpp.cc @@ -0,0 +1,26 @@ +#include <iostream> +#include <string> +#include "ucl++.h" + +int main(int argc, char **argv) +{ + std::string input, err; + + input.assign((std::istreambuf_iterator<char>(std::cin)), + std::istreambuf_iterator<char>()); + + 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; + } +} |