summaryrefslogtreecommitdiff
path: root/rotord/src/graph.cpp
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-08-22 09:51:50 +0100
committerComment <tim@gray.(none)>2013-08-22 09:51:50 +0100
commit3ca766e0a5a9472000d463ce9edbb6c5abcc8565 (patch)
tree94e3cfaf308c1eab25e4eb3275b2dab253f37cf2 /rotord/src/graph.cpp
parent2abcafea32611988168f119bd7687dca5278dd9b (diff)
working on json loader
Diffstat (limited to 'rotord/src/graph.cpp')
-rw-r--r--rotord/src/graph.cpp29
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();