From 625269764ebbe8d0b566e6ef5fc26a6bccd4181d Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 13 Jul 2014 14:04:45 +0200 Subject: init --- test_jsonxx.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test_jsonxx.cc (limited to 'test_jsonxx.cc') diff --git a/test_jsonxx.cc b/test_jsonxx.cc new file mode 100644 index 0000000..d06640e --- /dev/null +++ b/test_jsonxx.cc @@ -0,0 +1,35 @@ +#include +#include +#include + +/* + * https://github.com/hjiang/jsonxx + * + */ +#include "jsonxx/jsonxx.h" + +using namespace std; + + +int +main(int argc, char** argv) +{ + ifstream ifs(argv[1]); + string json_str((istreambuf_iterator(ifs)), + (istreambuf_iterator())); + + jsonxx::Object o; + o.parse(json_str); + jsonxx::Array edges = o.get("edges"); + jsonxx::Array::container::const_iterator it = edges.values().begin(), end = edges.values().end(); + while (it != end) { + jsonxx::Object e = (*it)->get(); + string s = e.get("rule").substr(1, 4); + if (s == "Goal") + cerr << s << endl; + ++it; + } + + return 0; +} + -- cgit v1.2.3