diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-04-28 07:18:24 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-04-28 07:18:24 (GMT) |
commit | af6ec49c899ce26a0e07761b0e42200248808e21 (patch) | |
tree | c2c826e5db487de375dd312b3166b02396854aea /src/uscxml | |
parent | dfaff1e3e310cb0201a05915de23a893956b0609 (diff) | |
download | uscxml-af6ec49c899ce26a0e07761b0e42200248808e21.zip uscxml-af6ec49c899ce26a0e07761b0e42200248808e21.tar.gz uscxml-af6ec49c899ce26a0e07761b0e42200248808e21.tar.bz2 |
Implemented empty finalize (Spec 6.5.2)
Diffstat (limited to 'src/uscxml')
-rw-r--r-- | src/uscxml/Interpreter.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 12f1c32..596bf20 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -2695,7 +2695,30 @@ void InterpreterImpl::finalizeAndAutoForwardCurrentEvent() { Arabica::XPath::NodeSet<std::string> finalizes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invokeIter->second.getElement()); for (size_t k = 0; k < finalizes.size(); k++) { Element<std::string> finalizeElem = Element<std::string>(finalizes[k]); - executeContent(finalizeElem); + + bool hasChildElems = false; + Node<std::string> child = finalizeElem.getFirstChild(); + while(child) { + if (child.getNodeType() == Node_base::ELEMENT_NODE) { + hasChildElems = true; + break; + } + child = child.getNextSibling(); + } + + if (hasChildElems) { + executeContent(finalizeElem); + } else { + // Specification 6.5.2: http://www.w3.org/TR/scxml/#N110EF + if (HAS_ATTR(invokeIter->second.getElement(), "namelist")) { + std::list<std::string> names = tokenize(ATTR(invokeIter->second.getElement(), "namelist")); + for (std::list<std::string>::iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) { + if (_currEvent.data.compound.find(*nameIter) != _currEvent.data.compound.end()) { + _dataModel.assign(*nameIter, _currEvent.data.compound[*nameIter]); + } + } + } + } } } if (HAS_ATTR(invokeIter->second.getElement(), "autoforward") && stringIsTrue(ATTR(invokeIter->second.getElement(), "autoforward"))) { |