summaryrefslogtreecommitdiff
path: root/src/test_jsonxx.cc
blob: d06640e71ab51e867f5b91bc9e4f2fa9e37f2c65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}