diff options
Diffstat (limited to 'rotord/src/graph.cpp')
| -rw-r--r-- | rotord/src/graph.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index 026325f..b799a59 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -66,12 +66,31 @@ bool Graph::load(string data,string media_path){ return false; } bool Graph::loadFile(string &filename,string media_path){ - if (loaded) - printf("loading graph: %s\n",filename.c_str()); - if(xml.loadFile(filename) ){ - return parseXml(media_path); + //if (loaded) + printf("loading graph: %s\n",(filename).c_str()); + + //if(xml.loadFile(filename) ){ + // return parseXml(media_path); + //} + Poco::FileInputStream fis(filename); + std::string read; + cerr<<fis; + cerr<<read.size()<<" json chars found"<<endl; + return false; +} +bool Graph::parseJson(string &data,string &media_path){ + Json::Value root; // will contains the root value after parsing. + Json::Reader reader; + bool parsingSuccessful = reader.parse( data, root ); + if ( !parsingSuccessful ) + { + // report to the user the failure and their locations in the document. + std::cout << "Failed to parse configuration\n" + << reader.getFormattedErrorMessages(); + return false; } - else return false; + cerr<<root["audio"]<<endl; + return true; } bool Graph::parseXml(string media_path){ if (loaded) nodes.clear(); |
