diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-07-09 16:34:23 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-07-09 16:34:23 +0100 |
| commit | 06c6f158088ce9132375cfe7f5c27f7c200b44dc (patch) | |
| tree | fa1f90f9a3d5eab842638a6b009f817f10f481b6 /rotord/graph.cpp | |
| parent | 1f7aeab37ebe41d57972f429fc0884d2de7eab4d (diff) | |
load graph from body
Diffstat (limited to 'rotord/graph.cpp')
| -rw-r--r-- | rotord/graph.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/rotord/graph.cpp b/rotord/graph.cpp index e3b0669..74fadb8 100644 --- a/rotord/graph.cpp +++ b/rotord/graph.cpp @@ -55,11 +55,22 @@ bool Graph::set_resolution(int w,int h){ } else return false; } -bool Graph::load(string &filename){ +bool Graph::load(string data){ + if (xml.loadFromBuffer(data)){ + return parseXml(); + } + return false; +} +bool Graph::loadFile(string &filename){ loaded=false; printf("loading graph: %s\n",filename.c_str()); if(xml.loadFile(filename) ){ - init(xml.getAttribute("patchbay","ID","",0),xml.getValue("patchbay","",0)); + return parseXml(); + } + else return false; +} +bool Graph::parseXml(){ + init(xml.getAttribute("patchbay","ID","",0),xml.getValue("patchbay","",0)); if(xml.pushTag("patchbay")) { int n1=xml.getNumTags("node"); for (int i1=0;i1<n1;i1++){ @@ -136,6 +147,4 @@ bool Graph::load(string &filename){ } loaded=true; return true; - } - else return false; }
\ No newline at end of file |
