diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-05-22 19:17:48 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2017-05-22 19:17:48 (GMT) |
commit | 9a70ea561fecf533451f08ee3a490e2a5ba21372 (patch) | |
tree | 6ca253c6aa8640d50ca93d104a19421ec8ec2e3f /src/uscxml/interpreter | |
parent | ecdefbdbb55c800f9ceed67f77592b5d64927225 (diff) | |
download | uscxml-9a70ea561fecf533451f08ee3a490e2a5ba21372.zip uscxml-9a70ea561fecf533451f08ee3a490e2a5ba21372.tar.gz uscxml-9a70ea561fecf533451f08ee3a490e2a5ba21372.tar.bz2 |
Fixed issue 135 custom executable content
Diffstat (limited to 'src/uscxml/interpreter')
-rw-r--r-- | src/uscxml/interpreter/BasicContentExecutor.cpp | 17 | ||||
-rw-r--r-- | src/uscxml/interpreter/BasicContentExecutor.h | 2 | ||||
-rw-r--r-- | src/uscxml/interpreter/ContentExecutorImpl.h | 3 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterImpl.h | 6 |
4 files changed, 28 insertions, 0 deletions
diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp index 696b575..8d278ec 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.cpp +++ b/src/uscxml/interpreter/BasicContentExecutor.cpp @@ -369,6 +369,23 @@ void BasicContentExecutor::process(XERCESC_NS::DOMElement* block) { processLog(block); } else if (iequals(tagName, xmlPrefix + "script")) { processScript(block); + } else if (Factory::getInstance()->hasExecutableContent(LOCALNAME(block), X(block->getNamespaceURI()))) { + // custom executable content, ask the factory about it! + if (_customExecContent.find(block) == _customExecContent.end()) { + _customExecContent[block] = _callbacks->createExecutableContent(LOCALNAME(block), X(block->getNamespaceURI())); + } + _customExecContent[block].enterElement(block); + + // process custom element's children? + if (_customExecContent[block].processChildren()) { + std::list<DOMNode*> childElems = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, block, false); + if(childElems.size() > 0) { + for(auto elemIter = childElems.begin(); elemIter != childElems.end(); elemIter++) { + process(static_cast<DOMElement*>(*elemIter)); + } + } + } + _customExecContent[block].exitElement(block); } else { LOG(_callbacks->getLogger(), USCXML_ERROR) << tagName << std::endl; assert(false); diff --git a/src/uscxml/interpreter/BasicContentExecutor.h b/src/uscxml/interpreter/BasicContentExecutor.h index 9019b23..469c28e 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.h +++ b/src/uscxml/interpreter/BasicContentExecutor.h @@ -21,6 +21,7 @@ #define BASICCONTENTEXECUTOR_H_B873199D #include "ContentExecutorImpl.h" +#include "uscxml/plugins/ExecutableContent.h" namespace uscxml { @@ -58,6 +59,7 @@ protected: void processNameLists(std::map<std::string, Data>& nameMap, XERCESC_NS::DOMElement* element); void processParams(std::multimap<std::string, Data>& paramMap, XERCESC_NS::DOMElement* element); + std::map<XERCESC_NS::DOMElement*, ExecutableContent> _customExecContent; }; } diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h index 5b39108..d837273 100644 --- a/src/uscxml/interpreter/ContentExecutorImpl.h +++ b/src/uscxml/interpreter/ContentExecutorImpl.h @@ -25,6 +25,7 @@ #include "uscxml/messages/Event.h" #include "uscxml/interpreter/InterpreterMonitor.h" #include "uscxml/interpreter/Logging.h" +#include "uscxml/plugins/ExecutableContent.h" #include <string> #include <set> @@ -78,6 +79,8 @@ public: virtual Interpreter getInterpreter() = 0; virtual Logger getLogger() = 0; + virtual ExecutableContent createExecutableContent(const std::string& localName, const std::string& nameSpace) = 0; + }; /** diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h index fd6d393..42d61f2 100644 --- a/src/uscxml/interpreter/InterpreterImpl.h +++ b/src/uscxml/interpreter/InterpreterImpl.h @@ -33,6 +33,7 @@ #include "uscxml/plugins/DataModelImpl.h" #include "uscxml/plugins/IOProcessorImpl.h" #include "uscxml/plugins/InvokerImpl.h" +#include "uscxml/plugins/ExecutableContent.h" #include "uscxml/interpreter/MicroStepImpl.h" #include "uscxml/interpreter/ContentExecutorImpl.h" #include "uscxml/interpreter/EventQueue.h" @@ -213,6 +214,11 @@ public: return _currEvent; } + virtual ExecutableContent createExecutableContent(const std::string& localName, const std::string& nameSpace) { + return Factory::getInstance()->createExecutableContent(localName, nameSpace, this); + } + + /** IOProcessorCallbacks */ |