diff options
author | Patrick Simianer <p@simianer.de> | 2014-08-16 21:25:52 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-08-16 21:25:52 +0100 |
commit | 9a0859212de4d1304f9392fe910921227421c8c3 (patch) | |
tree | 1b1276312c83415d7d7d3838ce0347441b71951a /test_sajson.cc | |
parent | 3ba77e3474e39d7970784812f6851a726572f7c7 (diff) |
cleanup
Diffstat (limited to 'test_sajson.cc')
-rw-r--r-- | test_sajson.cc | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/test_sajson.cc b/test_sajson.cc deleted file mode 100644 index 4081d43..0000000 --- a/test_sajson.cc +++ /dev/null @@ -1,32 +0,0 @@ -#include <iostream> -#include <fstream> -#include <string> -#include <string.h> - -/* - * https://github.com/chadaustin/sajson - * - */ -#include "sajson/include/sajson.h" - -using namespace std; - - -int -main(int argc, char** argv) -{ - ifstream ifs(argv[1]); - string json_str((istreambuf_iterator<char>(ifs)), - (istreambuf_iterator<char>())); - - const sajson::document& document = sajson::parse(sajson::literal(json_str.c_str())); - size_t index_a = document.get_root().find_object_key(sajson::literal("edges")); - const sajson::value& edges = document.get_root().get_object_value(index_a); - const sajson::value& last_edge = edges.get_array_element(edges.get_length()-1); - size_t index_r = last_edge.find_object_key(sajson::literal("rule")); - const sajson::value& r = last_edge.get_object_value(index_r); - cerr << r.as_string().substr(1, 4) << endl; - - return 0; -} - |