diff options
author | Patrick Simianer <p@simianer.de> | 2014-07-13 14:04:45 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-07-13 14:04:45 +0200 |
commit | 625269764ebbe8d0b566e6ef5fc26a6bccd4181d (patch) | |
tree | 70c54cb1dae9afddaefd7f0824427e95dd688081 /test_nosjob.cc |
init
Diffstat (limited to 'test_nosjob.cc')
-rw-r--r-- | test_nosjob.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test_nosjob.cc b/test_nosjob.cc new file mode 100644 index 0000000..cf8891f --- /dev/null +++ b/test_nosjob.cc @@ -0,0 +1,32 @@ +#include <iostream> +#include <fstream> +#include <string> + +/* + * http://fossil.wanderinghorse.net/repos/nosjob/index.cgi/index + * + */ +#include "nosjob-e1d67401fcda6e05/include/wh/nosjob/nosjob.hpp" + +using namespace std; + + +int +main(int argc, char** argv) +{ + ifstream ifs(argv[1]); + string json_str((istreambuf_iterator<char>(ifs)), + (istreambuf_iterator<char>())); + + nosjob::Atom root = nosjob::JsonParser().parse(json_str); + nosjob::Object o = nosjob::Object::cast(root); + nosjob::Atom edges = o.get(nosjob::Utf8String("edges")); + nosjob::Array a = nosjob::Array::cast(edges); + nosjob::Object last_edge = nosjob::Object::cast(a.get(a.size()-1)); + nosjob::Utf8String s = nosjob::Utf8String::cast(last_edge.get(nosjob::Utf8String("rule"))); + string t((char*)s.c_str()); + cerr << t.substr(1, 4) << endl; + + return 0; +} + |