diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-03-08 12:56:55 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-03-08 12:56:55 +0000 |
| commit | 8c4c5e62552dff244d2444a9d5d3a4585c89bc0a (patch) | |
| tree | a8511f871a339078f1dedd8bf7427c43bd84bd78 | |
| parent | 20eaa8e39617cc22147b82d678b72ded2dd5fe27 (diff) | |
making styles valid xml
| -rw-r--r-- | rotord/rotor.cpp | 2 | ||||
| -rwxr-xr-x | rotord/rotor.h | 26 | ||||
| -rwxr-xr-x | rotord/rotord.cpp | 2 |
3 files changed, 13 insertions, 17 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 3e7dc2f..4a3d6c9 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -76,7 +76,7 @@ Command_response Render_context::session_command(const std::vector<std::string>& if (state==IDLE) { //check file exists //Poco::File f=Poco::File(command[3]); - std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(command[3])); + //std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(command[3])); /* if (f.exists()) { diff --git a/rotord/rotor.h b/rotord/rotor.h index 346158e..cd83676 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -57,15 +57,11 @@ next - build signal_output and make a working chain with dummy data #include "Poco/Random.h" #include "Poco/AutoPtr.h" #include "Poco/File.h" -#include "Poco/Net/HTTPStreamFactory.h" -#include "Poco/URIStreamOpener.h" -#include <memory> #include <iostream> using Poco::UUID; using Poco::UUIDGenerator; using Poco::Net::HTTPResponse; -using Poco::URIStreamOpener; #include "vampHost.h" #include "xmlIO.h" @@ -121,7 +117,7 @@ namespace Rotor { }; class Node{ public: - Node(){type="node";}; + Node(){}; virtual ~Node() {}; Node(map<string,string> &settings){ cerr << "Node:"; @@ -129,7 +125,7 @@ namespace Rotor { cerr << it->first << "," << it->second << " "; } cerr << endl; - description=settings["description"];output_type=settings["output"];ID=settings["ID"]; + description=settings["description"];type=settings["type"];output_type=settings["output"];ID=settings["ID"]; }; UUID uid; //every usable node has a UUID int id; @@ -179,7 +175,7 @@ namespace Rotor { //actual nodes------------------------------------------------- class Audio_analysis: public Node { public: - Audio_analysis(){type="audio_analysis";}; + Audio_analysis(){}; Audio_analysis(map<string,string> &settings) { cerr << "Audio analysis:"; for (map<string,string>::iterator it=settings.begin();it!=settings.end();++it) { @@ -198,7 +194,7 @@ namespace Rotor { //for now, assume 25 //what to cache? for now, don't cache public: - Is_new_integer(){type="is_new_integer";}; + Is_new_integer(){}; Is_new_integer(map<string,string> &settings) { cerr << "Is new integer:"; for (map<string,string>::iterator it=settings.begin();it!=settings.end();++it) { @@ -214,14 +210,14 @@ namespace Rotor { }; class Signal_output: public Node { public: - Signal_output(){type="signal_output";}; + Signal_output(){}; Signal_output(map<string,string> &settings) { cerr << "Signal output:"; for (map<string,string>::iterator it=settings.begin();it!=settings.end();++it) { cerr << it->first << "," << it->second << " "; } cerr << endl; - + description=settings["description"];type=settings["type"];output_type=settings["output"];ID=settings["ID"]; }; bool render(const float duration, const float framerate,string &xml_out); @@ -231,16 +227,15 @@ namespace Rotor { public: Node_factory(); template <typename T> - Node* clone(T *proto,map<string,string> &settings) { - cerr << "Factory creating a " << proto->type << ", settings: "; + T* clone(T* proto,map<string,string> &settings) { + cerr << "Factory settings: "; for (map<string,string>::iterator it=settings.begin();it!=settings.end();++it) { cerr << it->first << "," << it->second << " "; } cerr << endl; return new T(settings); - }; - template <typename T> - void add_type(string type,T *proto){ + } + void add_type(string type,Node* proto){ type_map[type]=proto; }; Node* create(map<string,string> &settings){ @@ -262,7 +257,6 @@ namespace Rotor { std::unordered_map<string,Node*> nodes; Node* find(const string &type){ for (std::unordered_map<string,Node*>::iterator it=nodes.begin();it!=nodes.end();++it) { - cerr << "checking a " << it->second->type << " looking for a " << type << endl; if (it->second->type==type) return it->second; } return NULL; diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp index 74a9ae7..b69ea4a 100755 --- a/rotord/rotord.cpp +++ b/rotord/rotord.cpp @@ -179,6 +179,7 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS //a bit of weirdness here: prefer to just get whole file to a string. if (request.getMethod()=="GET") { std::vector<std::string> styles = {"style01.xml","style02.xml" }; //c++11 STL initialiser list + content+="<styles>\n"; for (auto &style: styles) { Poco::File f=Poco::File(style); if (f.exists()) { @@ -192,6 +193,7 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS content +="\n"; } } + content+="</styles>\n"; status=HTTPResponse::HTTP_OK; } } |
