diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-20 19:28:50 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-20 19:28:50 (GMT) |
commit | c1ebae519210cd4d09eb63bde593d48e769ad7ca (patch) | |
tree | 488cfd8056c2e727a7b49882c2f3d46240d00998 /src/uscxml/plugins/ioprocessor/modality | |
parent | 26609f8b8097b21e952835e7064bc938c8542d93 (diff) | |
download | uscxml-c1ebae519210cd4d09eb63bde593d48e769ad7ca.zip uscxml-c1ebae519210cd4d09eb63bde593d48e769ad7ca.tar.gz uscxml-c1ebae519210cd4d09eb63bde593d48e769ad7ca.tar.bz2 |
Support for event.raw and more XPath datamodel refactorings
Diffstat (limited to 'src/uscxml/plugins/ioprocessor/modality')
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIComponent.h | 4 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp | 40 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIMessages.h | 40 |
3 files changed, 42 insertions, 42 deletions
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h index bee568b..ba3f2c8 100644 --- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h +++ b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h @@ -19,7 +19,7 @@ public: virtual std::set<std::string> getNames() { return std::set<std::string>(); }; - + virtual Data getDataModelVariables(); virtual void send(const SendRequest& req); @@ -37,7 +37,7 @@ public: virtual NewContextResponse newContext(const NewContextRequest&); virtual DoneNotification done(const DoneNotification&); // virtual ExtensionNotification extension(const ExtensionNotification&); - + }; diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp index ed92fac..717e174 100644 --- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp +++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp @@ -24,14 +24,14 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() { if (data.size() > 0) { Element<std::string> dataElem = doc.createElementNS(nameSpace, "data"); - + // try to parse content std::stringstream* ss = new std::stringstream(); (*ss) << data; std::auto_ptr<std::istream> ssPtr(ss); Arabica::SAX::InputSource<std::string> inputSource; inputSource.setByteStream(ssPtr); - + Arabica::SAX2DOM::Parser<std::string> parser; if(parser.parse(inputSource)) { Node<std::string> importedNode = doc.importNode(parser.getDocument().getDocumentElement(), true); @@ -40,9 +40,9 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() { Text<std::string> textElem = doc.createTextNode(data); dataElem.appendChild(textElem); } - msgElem.appendChild(dataElem); + msgElem.appendChild(dataElem); } - + mmiElem.appendChild(msgElem); doc.appendChild(mmiElem); std::cout << doc; @@ -67,7 +67,7 @@ Arabica::DOM::Document<std::string> ContentRequest::toXML() { contentURLElem.setAttributeNS(nameSpace, "max-age", contentURL.maxAge); msgElem.appendChild(contentURLElem); } - + if (content.size() > 0) { Element<std::string> contentElem = doc.createElementNS(nameSpace, "content"); @@ -77,7 +77,7 @@ Arabica::DOM::Document<std::string> ContentRequest::toXML() { std::auto_ptr<std::istream> ssPtr(ss); Arabica::SAX::InputSource<std::string> inputSource; inputSource.setByteStream(ssPtr); - + Arabica::SAX2DOM::Parser<std::string> parser; if(parser.parse(inputSource)) { Node<std::string> importedNode = doc.importNode(parser.getDocument().getDocumentElement(), true); @@ -117,12 +117,12 @@ Arabica::DOM::Document<std::string> StatusResponse::toXML() { Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() { Document<std::string> doc = StatusResponse::toXML(); Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild()); - + Element<std::string> statusInfoElem = doc.createElementNS(nameSpace, "StatusInfo"); Text<std::string> statusInfoText = doc.createTextNode(statusInfo); statusInfoElem.appendChild(statusInfoText); msgElem.appendChild(statusInfoElem); - + return doc; } @@ -135,7 +135,7 @@ Arabica::DOM::Document<std::string> StatusRequest::toXML() { } else { msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "false"); } - + return doc; } @@ -153,14 +153,14 @@ MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) { // msg.data = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Data"); msg.requestId = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestID"); msg.tagName = msgElem.getLocalName(); - + Element<std::string> dataElem; node = msgElem.getFirstChild(); while (node) { if (node.getNodeType() == Node_base::ELEMENT_NODE) dataElem = Element<std::string>(node); - if (dataElem && boost::iequals(dataElem.getLocalName(), "data")) - break; + if (dataElem && boost::iequals(dataElem.getLocalName(), "data")) + break; node = node.getNextSibling(); } @@ -176,7 +176,7 @@ MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) { } msg.data = ss.str(); } - + return msg; } @@ -203,13 +203,13 @@ ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string> } Element<std::string> msgElem(node); Element<std::string> contentElem; - + node = msgElem.getFirstChild(); while (node) { if (node.getNodeType() == Node_base::ELEMENT_NODE) { contentElem = Element<std::string>(node); if (boost::iequals(contentElem.getLocalName(), "content") || - boost::iequals(contentElem.getLocalName(), "contentURL")) + boost::iequals(contentElem.getLocalName(), "contentURL")) break; } node = node.getNextSibling(); @@ -233,7 +233,7 @@ ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string> msg.contentURL.fetchTimeout = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "fetchtimeout"); } } - + //msg.content = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context"); return msg; } @@ -294,7 +294,7 @@ StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std: } node = node.getNextSibling(); } - + if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo")) { node = statusInfoElem.getFirstChild(); while (node) { @@ -305,11 +305,11 @@ StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std: node = node.getNextSibling(); } } - + return msg; } - + StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) { StatusRequest msg(ContextualizedRequest::fromXML(doc)); Node<std::string> node = doc.getDocumentElement().getFirstChild(); @@ -320,7 +320,7 @@ StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>& } Element<std::string> msgElem(node); std::string autoUpdate = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestAutomaticUpdate"); - + if (boost::iequals(autoUpdate, "true")) { msg.automaticUpdate = true; } else if(boost::iequals(autoUpdate, "on")) { diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h index af31efe..a5328ac 100644 --- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h +++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h @@ -18,11 +18,11 @@ public: std::string tagName; static std::string nameSpace; - + protected: MMIMessage() {} }; - + class NewContextRequest : public MMIMessage { public: NewContextRequest() { @@ -56,7 +56,7 @@ public: return ContextualizedRequest::fromXML(doc); } }; -class ResumeRequest : public ContextualizedRequest { +class ResumeRequest : public ContextualizedRequest { public: ResumeRequest() { tagName = "ResumeRequest"; @@ -67,7 +67,7 @@ public: } }; -class CancelRequest : public ContextualizedRequest { +class CancelRequest : public ContextualizedRequest { public: CancelRequest() { tagName = "CancelRequest"; @@ -78,7 +78,7 @@ public: } }; -class ClearContextRequest : public ContextualizedRequest { +class ClearContextRequest : public ContextualizedRequest { public: ClearContextRequest() { tagName = "ClearContextRequest"; @@ -89,7 +89,7 @@ public: } }; -class StatusRequest : public ContextualizedRequest { +class StatusRequest : public ContextualizedRequest { public: StatusRequest() { tagName = "StatusRequest"; @@ -109,7 +109,7 @@ public: std::string maxAge; std::string fetchTimeout; }; - + virtual Arabica::DOM::Document<std::string> toXML(); static ContentRequest fromXML(const Arabica::DOM::Document<std::string>& doc); std::string content; @@ -119,7 +119,7 @@ protected: ContentRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {} }; -class PrepareRequest : public ContentRequest { +class PrepareRequest : public ContentRequest { public: PrepareRequest() { tagName = "PrepareRequest"; @@ -130,7 +130,7 @@ public: } }; -class StartRequest : public ContentRequest { +class StartRequest : public ContentRequest { public: StartRequest() { tagName = "StartRequest"; @@ -159,10 +159,10 @@ protected: class StatusResponse : public ContextualizedRequest { public: enum Status { - ALIVE = 0, - DEAD = 1, - SUCCESS = 2, - FAILURE = 3 + ALIVE = 0, + DEAD = 1, + SUCCESS = 2, + FAILURE = 3 }; StatusResponse() { @@ -196,7 +196,7 @@ public: return StatusInfoResponse::fromXML(doc); } }; - + class StartResponse : public StatusInfoResponse { public: StartResponse() { @@ -207,7 +207,7 @@ public: return StatusInfoResponse::fromXML(doc); } }; - + class CancelResponse : public StatusInfoResponse { public: CancelResponse() { @@ -218,7 +218,7 @@ public: return StatusInfoResponse::fromXML(doc); } }; - + class PauseResponse : public StatusInfoResponse { public: PauseResponse() { @@ -229,7 +229,7 @@ public: return StatusInfoResponse::fromXML(doc); } }; - + class ResumeResponse : public StatusInfoResponse { public: ResumeResponse() { @@ -240,7 +240,7 @@ public: return StatusInfoResponse::fromXML(doc); } }; - + class ClearContextResponse : public StatusInfoResponse { public: ClearContextResponse() { @@ -251,7 +251,7 @@ public: return StatusInfoResponse::fromXML(doc); } }; - + class NewContextResponse : public StatusInfoResponse { public: NewContextResponse() { @@ -263,7 +263,7 @@ public: } }; - + class DoneNotification : public StatusInfoResponse { public: DoneNotification() { |