summaryrefslogtreecommitdiff
path: root/test_jsonxx.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-07-13 14:04:45 +0200
committerPatrick Simianer <p@simianer.de>2014-07-13 14:04:45 +0200
commit625269764ebbe8d0b566e6ef5fc26a6bccd4181d (patch)
tree70c54cb1dae9afddaefd7f0824427e95dd688081 /test_jsonxx.cc
init
Diffstat (limited to 'test_jsonxx.cc')
-rw-r--r--test_jsonxx.cc35
1 files changed, 35 insertions, 0 deletions
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 <iostream>
+#include <fstream>
+#include <string>
+
+/*
+ * 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<char>(ifs)),
+ (istreambuf_iterator<char>()));
+
+ jsonxx::Object o;
+ o.parse(json_str);
+ jsonxx::Array edges = o.get<jsonxx::Array>("edges");
+ jsonxx::Array::container::const_iterator it = edges.values().begin(), end = edges.values().end();
+ while (it != end) {
+ jsonxx::Object e = (*it)->get<jsonxx::Object>();
+ string s = e.get<string>("rule").substr(1, 4);
+ if (s == "Goal")
+ cerr << s << endl;
+ ++it;
+ }
+
+ return 0;
+}
+