From 45ba8b93098f4f64a2dbc1e0a4c15c5ddb1d6559 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Sun, 27 Oct 2013 01:47:24 +0200 Subject: Performance: replaced boost::iequals for strings by inline function --- src/uscxml/Convenience.h | 1 + src/uscxml/Interpreter.cpp | 112 ++++++++++----------- src/uscxml/URL.cpp | 8 +- src/uscxml/debug/SCXMLDotWriter.cpp | 28 +++--- src/uscxml/interpreter/InterpreterDraft6.cpp | 18 ++-- src/uscxml/interpreter/InterpreterDraft7.cpp | 2 +- .../plugins/datamodel/prolog/swi/SWIDataModel.cpp | 10 +- .../plugins/datamodel/xpath/XPathDataModel.cpp | 18 ++-- src/uscxml/plugins/element/fetch/FetchElement.cpp | 16 +-- src/uscxml/plugins/element/file/FileElement.cpp | 16 +-- .../plugins/element/postpone/PostponeElement.cpp | 6 +- src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp | 18 ++-- .../plugins/invoker/ffmpeg/FFMPEGInvoker.cpp | 8 +- .../invoker/filesystem/dirmon/DirMonInvoker.cpp | 8 +- .../invoker/graphics/openscenegraph/OSGInvoker.cpp | 32 +++--- .../openscenegraph/converter/OSGConverter.cpp | 6 +- .../plugins/invoker/heartbeat/HeartbeatInvoker.cpp | 8 +- src/uscxml/plugins/invoker/im/IMInvoker.cpp | 2 +- .../plugins/invoker/miles/MilesSessionInvoker.cpp | 6 +- src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp | 8 +- .../plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp | 4 +- src/uscxml/server/HTTPServer.cpp | 10 +- test/src/test-w3c.cpp | 2 +- 23 files changed, 174 insertions(+), 173 deletions(-) diff --git a/src/uscxml/Convenience.h b/src/uscxml/Convenience.h index 1ecc8b0..64abbda 100644 --- a/src/uscxml/Convenience.h +++ b/src/uscxml/Convenience.h @@ -47,6 +47,7 @@ inline bool isNumeric( const char* pszInput, int nNumberBase) { } inline bool iequals(const std::string& a, const std::string& b) { + // this impementation beats boost::iequals 2700ms vs 2100ms for test-performance.scxml unsigned int size = a.size(); if (b.size() != size) return false; diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index d7d9ba7..fe8f3c7 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -283,12 +283,12 @@ Interpreter Interpreter::fromURI(const std::string& uri) { Interpreter interpreter; - if (boost::iequals(absUrl.scheme(), "file")) { + if (iequals(absUrl.scheme(), "file")) { Arabica::SAX::InputSource inputSource; inputSource.setSystemId(absUrl.asString()); interpreter = fromInputSource(inputSource); #if 0 - } else if (boost::iequals(absUrl.scheme(), "http")) { + } else if (iequals(absUrl.scheme(), "http")) { // handle http per arabica - this will not follow redirects Arabica::SAX::InputSource inputSource; inputSource.setSystemId(absUrl.asString()); @@ -350,7 +350,7 @@ void InterpreterImpl::setNameSpaceInfo(const std::map while(nsIter != namespaceInfo.end()) { std::string uri = nsIter->first; std::string prefix = nsIter->second; - if (boost::iequals(uri, "http://www.w3.org/2005/07/scxml")) { + if (iequals(uri, "http://www.w3.org/2005/07/scxml")) { _nsURL = uri; if (prefix.size() == 0) { // LOG(INFO) << "Mapped default namespace to 'scxml:'"; @@ -867,9 +867,9 @@ void InterpreterImpl::send(const Arabica::DOM::Node& element) { boost::trim(delay); NumAttr delayAttr(delay); - if (boost::iequals(delayAttr.unit, "ms")) { + if (iequals(delayAttr.unit, "ms")) { sendReq.delayMs = strTo(delayAttr.value); - } else if (boost::iequals(delayAttr.unit, "s")) { + } else if (iequals(delayAttr.unit, "s")) { sendReq.delayMs = strTo(delayAttr.value); sendReq.delayMs *= 1000; } else { @@ -1035,7 +1035,7 @@ void InterpreterImpl::invoke(const Arabica::DOM::Node& element) { // autoforward if (HAS_ATTR(element, "autoforward")) { - if (boost::iequals(ATTR(element, "autoforward"), "true")) { + if (iequals(ATTR(element, "autoforward"), "true")) { invokeReq.autoForward = true; } } else { @@ -1147,7 +1147,7 @@ bool InterpreterImpl::nameMatch(const std::string& transitionEvent, const std::s return false; // naive case of single descriptor and exact match - if (boost::iequals(transitionEvent, event)) + if (iequals(transitionEvent, event)) return true; boost::char_separator sep(" "); @@ -1168,7 +1168,7 @@ bool InterpreterImpl::nameMatch(const std::string& transitionEvent, const std::s return true; // are they already equal? - if (boost::iequals(eventDesc, event)) + if (iequals(eventDesc, event)) return true; // eventDesc has to be a real prefix of event now and therefore shorter @@ -1232,21 +1232,21 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont return; if (false) { - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "onentry") || - boost::iequals(TAGNAME(content), _xmlNSPrefix + "onexit") || - boost::iequals(TAGNAME(content), _xmlNSPrefix + "finalize") || - boost::iequals(TAGNAME(content), _xmlNSPrefix + "transition")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "onentry") || + iequals(TAGNAME(content), _xmlNSPrefix + "onexit") || + iequals(TAGNAME(content), _xmlNSPrefix + "finalize") || + iequals(TAGNAME(content), _xmlNSPrefix + "transition")) { // --- CONVENIENCE LOOP -------------------------- NodeList executable = content.getChildNodes(); for (int i = 0; i < executable.getLength(); i++) { executeContent(executable.item(i), rethrow); } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "raise")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "raise")) { // --- RAISE -------------------------- if (HAS_ATTR(content, "event")) { receiveInternal(Event(ATTR(content, "event"))); } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "if")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "if")) { // --- IF / ELSEIF / ELSE -------------- Arabica::DOM::Element ifElem = (Arabica::DOM::Element)content; #if 0 @@ -1263,8 +1263,8 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont for (unsigned int i = 0; i < childs.getLength(); i++) { if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE) continue; - if (boost::iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "elseif") || - boost::iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "else")) { + if (iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "elseif") || + iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "else")) { if (blockIsTrue) { // last block was true, break here break; @@ -1279,11 +1279,11 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont } } } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "elseif")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "elseif")) { std::cerr << "Found single elsif to evaluate!" << std::endl; - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "else")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "else")) { std::cerr << "Found single else to evaluate!" << std::endl; - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "foreach")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "foreach")) { // --- FOREACH -------------------------- if (_dataModel) { if (HAS_ATTR(content, "array") && HAS_ATTR(content, "item")) { @@ -1313,7 +1313,7 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont LOG(ERROR) << "Expected array and item attributes with foreach element!" << std::endl; } } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "log")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "log")) { // --- LOG -------------------------- Arabica::DOM::Element logElem = (Arabica::DOM::Element)content; if (logElem.hasAttribute("label")) @@ -1327,7 +1327,7 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont if (logElem.hasAttribute("label")) std::cout << std::endl; } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "assign")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "assign")) { // --- ASSIGN -------------------------- if (_dataModel && HAS_ATTR(content, "location")) { try { @@ -1344,14 +1344,14 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont } CATCH_AND_DISTRIBUTE("Syntax error in attributes of assign element:") } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "validate")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "validate")) { // --- VALIDATE -------------------------- if (_dataModel) { std::string location = (HAS_ATTR(content, "location") ? ATTR(content, "location") : ""); std::string schema = (HAS_ATTR(content, "schema") ? ATTR(content, "schema") : ""); _dataModel.validate(location, schema); } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "script")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "script")) { // --- SCRIPT -------------------------- if (_dataModel) { if (HAS_ATTR(content, "src")) { @@ -1399,13 +1399,13 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont } } } - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "send")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "send")) { // --- SEND -------------------------- try { send(content); } CATCH_AND_DISTRIBUTE("Error while sending content") - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "cancel")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "cancel")) { // --- CANCEL -------------------------- std::string sendId; try { @@ -1421,7 +1421,7 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node& cont } CATCH_AND_DISTRIBUTE("Syntax error while executing cancel element") - } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "invoke")) { + } else if (iequals(TAGNAME(content), _xmlNSPrefix + "invoke")) { // --- INVOKE -------------------------- } else { // --- Custom Executable Content @@ -1461,7 +1461,7 @@ void InterpreterImpl::returnDoneEvent(const Arabica::DOM::Node& sta bool InterpreterImpl::parentIsScxmlState(const Arabica::DOM::Node& state) { Arabica::DOM::Element stateElem = (Arabica::DOM::Element)state; Arabica::DOM::Element parentElem = (Arabica::DOM::Element)state.getParentNode(); - if (boost::iequals(TAGNAME(parentElem), _xmlNSPrefix + "scxml")) + if (iequals(TAGNAME(parentElem), _xmlNSPrefix + "scxml")) return true; return false; } @@ -1516,7 +1516,7 @@ Arabica::DOM::Node InterpreterImpl::getAncestorElement(const Arabic Arabica::DOM::Node parent = node.getParentNode(); while(parent) { if (parent.getNodeType() == Node_base::ELEMENT_NODE && - boost::iequals(TAGNAME(parent), tagName)) { + iequals(TAGNAME(parent), tagName)) { return parent; } parent = parent.getParentNode(); @@ -1622,7 +1622,7 @@ FOUND: } Arabica::DOM::Node InterpreterImpl::getSourceState(const Arabica::DOM::Node& transition) { - if (boost::iequals(TAGNAME(transition.getParentNode()), _xmlNSPrefix + "initial")) + if (iequals(TAGNAME(transition.getParentNode()), _xmlNSPrefix + "initial")) return transition.getParentNode().getParentNode(); return transition.getParentNode(); } @@ -1653,7 +1653,7 @@ Arabica::XPath::NodeSet InterpreterImpl::getInitialStates(Arabica:: // initial element as child - but not the implicit generated one NodeSet initElems = filterChildElements(_xmlNSPrefix + "initial", state); - if(initElems.size() == 1 && !boost::iequals(ATTR(initElems[0], "generated"), "true")) { + if(initElems.size() == 1 && !iequals(ATTR(initElems[0], "generated"), "true")) { NodeSet initTrans = filterChildElements(_xmlNSPrefix + "transition", initElems[0]); return getTargetStates(initTrans[0]); } @@ -1678,10 +1678,10 @@ NodeSet InterpreterImpl::getTargetStates(const Arabica::DOM::Node childs = transition.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { - if (childs.item(i).getNodeType() == Node_base::ELEMENT_NODE && boost::iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "transition")) { + if (childs.item(i).getNodeType() == Node_base::ELEMENT_NODE && iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "transition")) { targetStates.push_back(getTargetStates(childs.item(i))); } } @@ -1742,7 +1742,7 @@ NodeSet InterpreterImpl::filterChildElements(const std::string& tag NodeList childs = node.getChildNodes(); for (unsigned int i = 0; i < childs.getLength(); i++) { if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE || - !boost::iequals(TAGNAME(childs.item(i)), tagName)) + !iequals(TAGNAME(childs.item(i)), tagName)) continue; filteredChildElems.push_back(childs.item(i)); } @@ -1757,9 +1757,9 @@ NodeSet InterpreterImpl::getProperAncestors(const Arabica::DOM::Nod while((node = node.getParentNode())) { if (!isState(node)) break; - if (boost::iequals(TAGNAME(node), _xmlNSPrefix + "scxml")) // do not return scxml root itself - this is somewhat ill-defined + if (iequals(TAGNAME(node), _xmlNSPrefix + "scxml")) // do not return scxml root itself - this is somewhat ill-defined break; - if (!boost::iequals(TAGNAME(node), _xmlNSPrefix + "parallel") && !boost::iequals(TAGNAME(node), _xmlNSPrefix + "state") && !boost::iequals(TAGNAME(node), _xmlNSPrefix + "scxml")) + if (!iequals(TAGNAME(node), _xmlNSPrefix + "parallel") && !iequals(TAGNAME(node), _xmlNSPrefix + "state") && !iequals(TAGNAME(node), _xmlNSPrefix + "scxml")) break; if (node == s2) break; @@ -1795,24 +1795,24 @@ bool InterpreterImpl::isState(const Arabica::DOM::Node& state) { return false; std::string tagName = LOCALNAME(state); - if (boost::iequals("state", tagName)) + if (iequals("state", tagName)) return true; - if (boost::iequals("scxml", tagName)) + if (iequals("scxml", tagName)) return true; - if (boost::iequals("parallel", tagName)) + if (iequals("parallel", tagName)) return true; -// if (boost::iequals("history", tagName)) // this is no state, see mail to W3C list +// if (iequals("history", tagName)) // this is no state, see mail to W3C list // return true; - if (boost::iequals("final", tagName)) + if (iequals("final", tagName)) return true; return false; } bool InterpreterImpl::isFinal(const Arabica::DOM::Node& state) { std::string tagName = LOCALNAME(state); - if (boost::iequals("final", tagName)) + if (iequals("final", tagName)) return true; - if (HAS_ATTR(state, "final") && boost::iequals("true", ATTR(state, "final"))) + if (HAS_ATTR(state, "final") && iequals("true", ATTR(state, "final"))) return true; return false; } @@ -1824,7 +1824,7 @@ bool InterpreterImpl::isInEmbeddedDocument(const Node& node) { if(parent == _scxml) { return false; } - if(boost::iequals(parent.getLocalName(), "content")) { + if(iequals(parent.getLocalName(), "content")) { return true; } parent = parent.getParentNode(); @@ -1848,22 +1848,22 @@ bool InterpreterImpl::isInitial(const Arabica::DOM::Node& state) { bool InterpreterImpl::isPseudoState(const Arabica::DOM::Node& state) { std::string tagName = LOCALNAME(state); - if (boost::iequals("initial", tagName)) + if (iequals("initial", tagName)) return true; - if (boost::iequals("history", tagName)) + if (iequals("history", tagName)) return true; return false; } bool InterpreterImpl::isTransitionTarget(const Arabica::DOM::Node& elem) { - return (isState(elem) || boost::iequals(LOCALNAME(elem), "history")); + return (isState(elem) || iequals(LOCALNAME(elem), "history")); } bool InterpreterImpl::isAtomic(const Arabica::DOM::Node& state) { - if (boost::iequals("final", LOCALNAME(state))) + if (iequals("final", LOCALNAME(state))) return true; - if (boost::iequals("parallel", LOCALNAME(state))) + if (iequals("parallel", LOCALNAME(state))) return false; Arabica::DOM::NodeList childs = state.getChildNodes(); @@ -1875,7 +1875,7 @@ bool InterpreterImpl::isAtomic(const Arabica::DOM::Node& state) { } bool InterpreterImpl::isHistory(const Arabica::DOM::Node& state) { - if (boost::iequals("history", LOCALNAME(state))) + if (iequals("history", LOCALNAME(state))) return true; return false; } @@ -1883,7 +1883,7 @@ bool InterpreterImpl::isHistory(const Arabica::DOM::Node& state) { bool InterpreterImpl::isParallel(const Arabica::DOM::Node& state) { if (!isState(state)) return false; - if (boost::iequals("parallel", LOCALNAME(state))) + if (iequals("parallel", LOCALNAME(state))) return true; return false; } @@ -1893,7 +1893,7 @@ bool InterpreterImpl::isCompound(const Arabica::DOM::Node& state) { if (!isState(state)) return false; - if (boost::iequals(LOCALNAME(state), "parallel")) // parallel is no compound state + if (iequals(LOCALNAME(state), "parallel")) // parallel is no compound state return false; Arabica::DOM::NodeList childs = state.getChildNodes(); @@ -1909,11 +1909,11 @@ void InterpreterImpl::setupIOProcessors() { std::map ioProcs = _factory->getIOProcessors(); std::map::iterator ioProcIter = ioProcs.begin(); while(ioProcIter != ioProcs.end()) { - if (boost::iequals(ioProcIter->first, "basichttp") && !(_capabilities & CAN_BASIC_HTTP)) { + if (iequals(ioProcIter->first, "basichttp") && !(_capabilities & CAN_BASIC_HTTP)) { ioProcIter++; continue; } - if (boost::iequals(ioProcIter->first, "http") && !(_capabilities & CAN_GENERIC_HTTP)) { + if (iequals(ioProcIter->first, "http") && !(_capabilities & CAN_GENERIC_HTTP)) { ioProcIter++; continue; } @@ -1922,7 +1922,7 @@ void InterpreterImpl::setupIOProcessors() { _ioProcessors[ioProcIter->first].setType(ioProcIter->first); _ioProcessors[ioProcIter->first].setInterpreter(this); - if (boost::iequals(ioProcIter->first, "http")) { + if (iequals(ioProcIter->first, "http")) { // this is somewhat ugly _httpServlet = static_cast(_ioProcessors[ioProcIter->first]._impl.get()); } @@ -2036,8 +2036,8 @@ bool InterpreterImpl::isLegalConfiguration(const NodeSet& config) { Node parent = config[i]; while((parent = parent.getParentNode())) { if (isState(parent) && - (boost::iequals(LOCALNAME(parent), "state") || - boost::iequals(LOCALNAME(parent), "parallel"))) { + (iequals(LOCALNAME(parent), "state") || + iequals(LOCALNAME(parent), "parallel"))) { if (!isMember(parent, config)) return false; } diff --git a/src/uscxml/URL.cpp b/src/uscxml/URL.cpp index 19a6db7..9721562 100644 --- a/src/uscxml/URL.cpp +++ b/src/uscxml/URL.cpp @@ -247,7 +247,7 @@ void URLImpl::downloadStarted() { void URLImpl::downloadCompleted() { tthread::lock_guard lock(_mutex); - if (boost::iequals(scheme(), "http")) { + if (iequals(scheme(), "http")) { // process header fields std::string line; while (std::getline(_rawInHeader, line)) { @@ -367,7 +367,7 @@ const void URLImpl::download(bool blocking) { exception.data.compound["reason"] = Data(_error, Data::VERBATIM); throw exception; } - if (boost::iequals(scheme(), "http")) { + if (iequals(scheme(), "http")) { if (_statusCode.size() > 0 && boost::lexical_cast(_statusCode) > 400) { Event exception; exception.name = "error.communication"; @@ -574,7 +574,7 @@ void URLFetcher::fetchURL(URL& url) { (curlError = curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true)) == CURLE_OK || LOG(ERROR) << "Cannot enable follow redirects: " << curl_easy_strerror(curlError); - if (boost::iequals(url._impl->_requestType, "post")) { + if (iequals(url._impl->_requestType, "post")) { (curlError = curl_easy_setopt(handle, CURLOPT_POST, 1)) == CURLE_OK || LOG(ERROR) << "Cannot set request type to post for " << url.asString() << ": " << curl_easy_strerror(curlError); @@ -602,7 +602,7 @@ void URLFetcher::fetchURL(URL& url) { //curl_slist_free_all(headers); - } else if (boost::iequals(url._impl->_requestType, "get")) { + } else if (iequals(url._impl->_requestType, "get")) { (curlError = curl_easy_setopt(handle, CURLOPT_HTTPGET, 1)) == CURLE_OK || LOG(ERROR) << "Cannot set request type to get for " << url.asString() << ": " << curl_easy_strerror(curlError); } diff --git a/src/uscxml/debug/SCXMLDotWriter.cpp b/src/uscxml/debug/SCXMLDotWriter.cpp index 4c5b20b..e2d21a7 100644 --- a/src/uscxml/debug/SCXMLDotWriter.cpp +++ b/src/uscxml/debug/SCXMLDotWriter.cpp @@ -165,7 +165,7 @@ void SCXMLDotWriter::writeStateElement(std::ostream& os, const Arabica::DOM::Ele // } for (int i = 0; i < childElems.getLength(); i++) { - if (childElems.item(i).getNodeType() == Node_base::ELEMENT_NODE && boost::iequals(TAGNAME(childElems.item(i)), "transition")) { + if (childElems.item(i).getNodeType() == Node_base::ELEMENT_NODE && iequals(TAGNAME(childElems.item(i)), "transition")) { writeTransitionElement(os, (Arabica::DOM::Element)childElems.item(i)); bool active = Interpreter::isMember(childElems.item(i), _transitions); os << getPrefix() << "\"" << elemId << "\" -> \"" << idForNode(childElems.item(i)) << "\" [arrowhead=none" << std::endl; @@ -178,10 +178,10 @@ void SCXMLDotWriter::writeStateElement(std::ostream& os, const Arabica::DOM::Ele if (Interpreter::isState(childElems.item(i))) { writeStateElement(os, (Arabica::DOM::Element)childElems.item(i)); } - if (childElems.item(i).getNodeType() == Node_base::ELEMENT_NODE && boost::iequals(TAGNAME(childElems.item(i)), "initial")) { + if (childElems.item(i).getNodeType() == Node_base::ELEMENT_NODE && iequals(TAGNAME(childElems.item(i)), "initial")) { NodeList grandChildElems = childElems.item(i).getChildNodes(); for (int j = 0; j < grandChildElems.getLength(); j++) { - if (grandChildElems.item(j).getNodeType() == Node_base::ELEMENT_NODE && boost::iequals(TAGNAME(grandChildElems.item(j)), "transition")) { + if (grandChildElems.item(j).getNodeType() == Node_base::ELEMENT_NODE && iequals(TAGNAME(grandChildElems.item(j)), "transition")) { writeTransitionElement(os, (Arabica::DOM::Element)grandChildElems.item(j)); os << getPrefix() << "\"" << elemId << "\" -> \"" << idForNode(grandChildElems.item(j)) << "\"" << std::endl; } @@ -256,8 +256,8 @@ std::string SCXMLDotWriter::getDetailedLabel(const Arabica::DOM::Element finalizes = filterChildElements(_xmlNSPrefix + "finalize", invokeElem); for (int k = 0; k < finalizes.size(); k++) { @@ -338,7 +338,7 @@ void InterpreterDraft6::mainEventLoop() { } } - if (boost::iequals(autoForward, "true")) { + if (iequals(autoForward, "true")) { try { // do not autoforward to invokers that send to #_parent from the SCXML IO Processor! // Yes do so, see test229! @@ -592,7 +592,7 @@ bool InterpreterDraft6::isWithinParallel(const Node& transition) { return false; Node source; - if (HAS_ATTR(transition, "type") && boost::iequals(ATTR(transition, "type"), "internal")) { + if (HAS_ATTR(transition, "type") && iequals(ATTR(transition, "type"), "internal")) { source = getSourceState(transition); } else { source = getSourceState(transition).getParentNode(); @@ -681,7 +681,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet& e Node source = getSourceState(t); // std::cout << t << std::endl << TAGNAME(t) << std::endl; NodeSet tStates = getTargetStates(t); - bool isInternal = (HAS_ATTR(t, "type") && boost::iequals(ATTR(t, "type"), "internal")); // external is default + bool isInternal = (HAS_ATTR(t, "type") && iequals(ATTR(t, "type"), "internal")); // external is default bool allDescendants = true; for (int j = 0; j < tStates.size(); j++) { if (!isDescendant(tStates[j], source)) { @@ -756,7 +756,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet& e std::string historyType = (historyElem.hasAttribute("type") ? historyElem.getAttribute("type") : "shallow"); NodeSet historyNodes; for (int k = 0; k < _configuration.size(); k++) { - if (boost::iequals(historyType, "deep")) { + if (iequals(historyType, "deep")) { if (isAtomic(_configuration[k]) && isDescendant(_configuration[k], statesToExit[i])) historyNodes.push_back(_configuration[k]); } else { @@ -831,7 +831,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet& for (int i = 0; i < enabledTransitions.size(); i++) { Element transition = ((Element)enabledTransitions[i]); if (!isTargetless(transition)) { - std::string transitionType = (boost::iequals(transition.getAttribute("type"), "internal") ? "internal" : "external"); + std::string transitionType = (iequals(transition.getAttribute("type"), "internal") ? "internal" : "external"); NodeSet tStates = getTargetStates(transition); #if VERBOSE @@ -856,7 +856,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet& break; } } - if (boost::iequals(transitionType, "internal") && + if (iequals(transitionType, "internal") && isCompound(source) && allDescendants) { ancestor = source; diff --git a/src/uscxml/interpreter/InterpreterDraft7.cpp b/src/uscxml/interpreter/InterpreterDraft7.cpp index a8544fa..cc54bc0 100644 --- a/src/uscxml/interpreter/InterpreterDraft7.cpp +++ b/src/uscxml/interpreter/InterpreterDraft7.cpp @@ -75,7 +75,7 @@ void InterpreterDraft7::interpret() { setupIOProcessors(); _running = true; - _binding = (HAS_ATTR(_scxml, "binding") && boost::iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY); + _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY); // @TODO: Reread http://www.w3.org/TR/scxml/#DataBinding diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index 5391d68..1c50e1d 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -351,7 +351,7 @@ void SWIDataModel::setForeach(const std::string& item, void SWIDataModel::eval(const Element& scriptElem, const std::string& expr) { SET_PL_CONTEXT - if (scriptElem && HAS_ATTR(scriptElem, "type") && boost::iequals(ATTR(scriptElem, "type"), "query")) { + if (scriptElem && HAS_ATTR(scriptElem, "type") && iequals(ATTR(scriptElem, "type"), "query")) { evalAsBool(expr); } else { URL localPLFile = URL::toLocalFile(expr, ".pl"); @@ -451,9 +451,9 @@ void SWIDataModel::assign(const Element& assignElem, std::string type; if (HAS_ATTR(assignElem, "type")) { type = ATTR(assignElem, "type"); - if(boost::iequals(type, "append")) { + if(iequals(type, "append")) { callAssert = "assertz"; - } else if(boost::iequals(type, "prepend")) { + } else if(iequals(type, "prepend")) { callAssert = "asserta"; } } @@ -471,13 +471,13 @@ void SWIDataModel::assign(const Element& assignElem, child = node.getNextSibling(); } domUrl = URL::toLocalFile(xmlDoc.str(), ".pl"); - if (boost::iequals(type, "retract")) + if (iequals(type, "retract")) PlCall("retractall", PlCompound(predicate.c_str(), 1)); dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), " << callAssert << "(" << predicate << "(DATA))"; PlCall(dataInitStr.str().c_str()); } else if (json) { std::stringstream dataInitStr; - if (boost::iequals(type, "retract")) + if (iequals(type, "retract")) PlCall("retractall", PlCompound(predicate.c_str(), 1)); dataInitStr << "json_to_prolog(" << expr << ", JSON), assert(" << predicate << "(JSON))"; PlCall(dataInitStr.str().c_str()); diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index 35f46ef..9f8ff90 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -208,7 +208,7 @@ void XPathDataModel::setEvent(const Event& event) { Node oldEventElem = _datamodel.getFirstChild(); while(oldEventElem) { if (oldEventElem.getNodeType() == Node_base::ELEMENT_NODE) { - if (HAS_ATTR(oldEventElem, "id") && boost::iequals(ATTR(oldEventElem, "id"), "_event")) + if (HAS_ATTR(oldEventElem, "id") && iequals(ATTR(oldEventElem, "id"), "_event")) break; } oldEventElem = oldEventElem.getNextSibling(); @@ -640,7 +640,7 @@ void XPathDataModel::assign(const NodeSet& key, } case Node_base::ELEMENT_NODE: { Element element(node); - if (HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "addattribute")) { + if (HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "addattribute")) { // addattribute: Add an attribute with the name specified by 'attr' // and value specified by 'expr' to the node specified by 'location'. if (!HAS_ATTR(assignElem, "attr")) @@ -703,19 +703,19 @@ void XPathDataModel::assign(const Element& key, return; if (false) { - } else if (assignElem && HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "firstchild")) { + } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "firstchild")) { // firstchild: Insert the value specified by 'expr' before all of the children at 'location'. for (int i = value.size(); i; i--) { Node importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true)); element.insertBefore(importedNode, element.getFirstChild()); } - } else if (assignElem && HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "lastchild")) { + } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "lastchild")) { // lastchild: Insert the value specified by 'expr' after all of the children at 'location'. for (int i = 0; i < value.size(); i++) { Node importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true)); element.appendChild(importedNode); } - } else if (assignElem && HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "previoussibling")) { + } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "previoussibling")) { // previoussibling: Insert the value specified by 'expr' before the // node specified by 'location', keeping the same parent. Node parent = element.getParentNode(); @@ -725,7 +725,7 @@ void XPathDataModel::assign(const Element& key, Node importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true)); parent.insertBefore(importedNode, element); } - } else if (assignElem && HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "nextsibling")) { + } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "nextsibling")) { // nextsibling: Insert the value specified by 'expr' after the node // specified by 'location', keeping the same parent. Node parent = element.getParentNode(); @@ -740,7 +740,7 @@ void XPathDataModel::assign(const Element& key, parent.appendChild(importedNode); } } - } else if (assignElem && HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "replace")) { + } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "replace")) { // replace: Replace the node specified by 'location' by the value specified by 'expr'. Node parent = element.getParentNode(); if (!parent) @@ -749,7 +749,7 @@ void XPathDataModel::assign(const Element& key, throw Event("error.execution", Event::PLATFORM); Node importedNode = (value[0].getOwnerDocument() == _doc ? value[0].cloneNode(true) : _doc.importNode(value[0], true)); parent.replaceChild(importedNode, element); - } else if (assignElem && HAS_ATTR(assignElem, "type") && boost::iequals(ATTR(assignElem, "type"), "delete")) { + } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "delete")) { // delete: Delete the node specified by 'location'. ('expr' is ignored.). Node parent = element.getParentNode(); if (!parent) @@ -819,7 +819,7 @@ XPathFunction* XPathFunctionResolver::resolveFunction(const std::string& namespace_uri, const std::string& name, const std::vector >& argExprs) const { - if (boost::iequals(name, "in")) { + if (iequals(name, "in")) { return new XPathFunctionIn(1, -1, argExprs, _interpreter); } return _xpathFuncRes.resolveFunction(namespace_uri, name, argExprs); diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp index da64bcf..37dd6c0 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.cpp +++ b/src/uscxml/plugins/element/fetch/FetchElement.cpp @@ -57,13 +57,13 @@ void FetchElement::downloadCompleted(const URL& url) { std::map headerFields = url.getInHeaderFields(); if (false) { - } else if (boost::iequals(_type, "text")) { + } else if (iequals(_type, "text")) { event.data.atom = content; event.data.type = Data::VERBATIM; - } else if (boost::iequals(_type, "url")) { - } else if (boost::iequals(_type, "json")) { + } else if (iequals(_type, "url")) { + } else if (iequals(_type, "json")) { event.data = Data::fromJSON(content); - } else if (boost::iequals(_type, "xml")) { + } else if (iequals(_type, "xml")) { event = Event::fromXML(content); } @@ -101,10 +101,10 @@ void FetchElement::enterElement(const Arabica::DOM::Node& node) { _callback = (HAS_ATTR(node, "callback") ? ATTR(node, "callback") : _interpreter->getDataModel().evalAsString(ATTR(node, "callbackexpr"))); _type = (HAS_ATTR(node, "type") ? ATTR(node, "type") : "text"); - if (!boost::iequals(_type, "text") && - !boost::iequals(_type, "url") && - !boost::iequals(_type, "json") && - !boost::iequals(_type, "xml")) { + if (!iequals(_type, "text") && + !iequals(_type, "url") && + !iequals(_type, "json") && + !iequals(_type, "xml")) { LOG(ERROR) << "Fetch element type attribute not one of text, url, json, xml."; return; } diff --git a/src/uscxml/plugins/element/file/FileElement.cpp b/src/uscxml/plugins/element/file/FileElement.cpp index 8a2ca8f..346c75d 100644 --- a/src/uscxml/plugins/element/file/FileElement.cpp +++ b/src/uscxml/plugins/element/file/FileElement.cpp @@ -55,17 +55,17 @@ void FileElement::enterElement(const Arabica::DOM::Node& node) { _givenUrl = (HAS_ATTR(node, "url") ? ATTR(node, "url") : _interpreter->getDataModel().evalAsString(ATTR(node, "urlexpr"))); std::string sandBoxStr = (HAS_ATTR(node, "sandbox") ? ATTR(node, "sandbox") : "on"); - if (boost::iequals(sandBoxStr, "off") || boost::iequals(sandBoxStr, "false") || boost::iequals(sandBoxStr, "no")) { + if (iequals(sandBoxStr, "off") || iequals(sandBoxStr, "false") || iequals(sandBoxStr, "no")) { _sandBoxed = false; } if (HAS_ATTR(node, "operation")) { std::string operation = ATTR(node, "operation"); - if (boost::iequals(operation, "read") || boost::iequals(operation, "load")) { + if (iequals(operation, "read") || iequals(operation, "load")) { _operation = READ; - } else if(boost::iequals(operation, "write")) { + } else if(iequals(operation, "write")) { _operation = WRITE; - } else if(boost::iequals(operation, "append")) { + } else if(iequals(operation, "append")) { _operation = APPEND; } else { LOG(ERROR) << "File element operation attribute not one of read, write or append."; @@ -112,13 +112,13 @@ void FileElement::enterElement(const Arabica::DOM::Node& node) { } else if(HAS_ATTR(node, "typeexpr")) { type = _interpreter->getDataModel().evalAsString(ATTR(node, "typeexpr")); } - if (boost::iequals(type, "text")) { + if (iequals(type, "text")) { _type = TEXT; - } else if (boost::iequals(type, "json")) { + } else if (iequals(type, "json")) { _type = JSON; - } else if (boost::iequals(type, "binary")) { + } else if (iequals(type, "binary")) { _type = BINARY; - } else if(boost::iequals(type, "xml")) { + } else if(iequals(type, "xml")) { _type = XML; } else { LOG(ERROR) << "File element type attribute not one of text, json, xml or binary."; diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.cpp b/src/uscxml/plugins/element/postpone/PostponeElement.cpp index de2426c..f9ddd5f 100644 --- a/src/uscxml/plugins/element/postpone/PostponeElement.cpp +++ b/src/uscxml/plugins/element/postpone/PostponeElement.cpp @@ -64,7 +64,7 @@ void PostponeElement::enterElement(const Arabica::DOM::Node& node) // chaining causes the event to fire if the condition was true since postponing bool chained = false; if (HAS_ATTR(node, "chaining")) { - chained = boost::iequals(ATTR(node, "chaining"), "true"); + chained = iequals(ATTR(node, "chaining"), "true"); } // when will we refire the event? @@ -102,9 +102,9 @@ void PostponeElement::enterElement(const Arabica::DOM::Node& node) uint64_t timeout = 0; NumAttr timeoutAttr(timeoutStr); - if (boost::iequals(timeoutAttr.unit, "s")) { + if (iequals(timeoutAttr.unit, "s")) { timeout = strTo(timeoutAttr.value) * 1000; - } else if (boost::iequals(timeoutAttr.unit, "ms")) { + } else if (iequals(timeoutAttr.unit, "ms")) { timeout = strTo(timeoutAttr.value); } if (timeout > 0) { diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp index c4e7cf3..004eb84 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp +++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp @@ -88,7 +88,7 @@ void OpenALInvoker::send(const SendRequest& req) { if (!_isStarted) start(); - if (boost::iequals(req.name, "play")) { + if (iequals(req.name, "play")) { if (req.params.find("src") == req.params.end()) { LOG(ERROR) << "Sent event play with no src URL"; } @@ -100,7 +100,7 @@ void OpenALInvoker::send(const SendRequest& req) { } _sources[req.sendid] = new OpenALSource(); - _sources[req.sendid]->loop = req.params.find("loop") != req.params.end() && boost::iequals(req.params.find("loop")->second.atom, "true"); + _sources[req.sendid]->loop = req.params.find("loop") != req.params.end() && iequals(req.params.find("loop")->second.atom, "true"); _sources[req.sendid]->file = srcURL; #ifdef LIBSNDFILE_FOUND _sources[req.sendid]->transform = new LibSoundFile(srcURL.asLocalFile(".audio")); @@ -142,7 +142,7 @@ void OpenALInvoker::send(const SendRequest& req) { _sourcesAvailable.notify_all(); } - if (boost::iequals(req.name, "move.source")) { + if (iequals(req.name, "move.source")) { std::string sourceId; if (req.params.find("source") == req.params.end()) { LOG(WARNING) << "Cannot move source with no source given in parameters"; @@ -163,7 +163,7 @@ void OpenALInvoker::send(const SendRequest& req) { } } - if (boost::iequals(req.name, "move.listener")) { + if (iequals(req.name, "move.listener")) { getPosFromParams(req.params, _listenerPos); try { @@ -284,11 +284,11 @@ void OpenALInvoker::invoke(const InvokeRequest& req) { std::multimap::const_iterator paramIter = req.params.begin(); while(paramIter != req.params.end()) { - if (boost::iequals(paramIter->first, "maxX")) + if (iequals(paramIter->first, "maxX")) _maxPos[0] = strTo(paramIter->second.atom); - if (boost::iequals(paramIter->first, "maxY")) + if (iequals(paramIter->first, "maxY")) _maxPos[1] = strTo(paramIter->second.atom); - if (boost::iequals(paramIter->first, "maxZ")) + if (iequals(paramIter->first, "maxZ")) _maxPos[2] = strTo(paramIter->second.atom); paramIter++; } @@ -384,7 +384,7 @@ float OpenALInvoker::posToRadian(const std::string& pos) { std::string trimmedPos = boost::trim_copy(pos); float rad = 0; - if (trimmedPos.size() > 3 && boost::iequals("deg", trimmedPos.substr(trimmedPos.length() - 3, 3))) { + if (trimmedPos.size() > 3 && iequals("deg", trimmedPos.substr(trimmedPos.length() - 3, 3))) { rad = boost::lexical_cast(trimmedPos.substr(0, trimmedPos.size() - 3)); rad = fmodf(rad, 360); // into range [0-360] rad /= 180; // into range [0-2] @@ -392,7 +392,7 @@ float OpenALInvoker::posToRadian(const std::string& pos) { rad -= M_PI_2; // 0 to top; rad *= -1; // make clockwise rad += 2 * M_PI; // make positive - } else if (trimmedPos.size() > 3 && boost::iequals("rad", trimmedPos.substr(trimmedPos.length() - 3, 3))) { + } else if (trimmedPos.size() > 3 && iequals("rad", trimmedPos.substr(trimmedPos.length() - 3, 3))) { rad = boost::lexical_cast(trimmedPos.substr(0, trimmedPos.size() - 3)); rad = fmodf(rad, M_PI * 2); // into range [0-2*PI] } else { diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp index 67c338d..f43e406 100644 --- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp +++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp @@ -101,7 +101,7 @@ void FFMPEGInvoker::invoke(const InvokeRequest& req) { void FFMPEGInvoker::send(const SendRequest& req) { SendRequest reqCopy = req; - if (boost::iequals(req.name, "render.start")) { + if (iequals(req.name, "render.start")) { // create a new encoding context int ret; EncodingContext* ctx = new EncodingContext(); @@ -167,9 +167,9 @@ void FFMPEGInvoker::send(const SendRequest& req) { ctx->frame->pts = 0; _encoders[context] = ctx; - } else if(boost::iequals(req.name, "render.frame")) { + } else if(iequals(req.name, "render.frame")) { _workQueue.push(req); - } else if(boost::iequals(req.name, "render.end")) { + } else if(iequals(req.name, "render.end")) { _workQueue.push(req); } } @@ -242,7 +242,7 @@ void FFMPEGInvoker::process(const SendRequest& req) { tthread::lock_guard lock(ctx->mutex); // finish encoding and return - if(boost::iequals(req.name, "render.end")) { + if(iequals(req.name, "render.end")) { finish(ctx, req); delete _encoders[context]; _encoders.erase(context); diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp index 07f5fcd..902b825 100644 --- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp @@ -107,13 +107,13 @@ void DirMonInvoker::invoke(const InvokeRequest& req) { } if (req.params.find("reportexisting") != req.params.end() && - boost::iequals(req.params.find("reportexisting")->second.atom, "false")) + iequals(req.params.find("reportexisting")->second.atom, "false")) _reportExisting = false; if (req.params.find("recurse") != req.params.end() && - boost::iequals(req.params.find("recurse")->second.atom, "true")) + iequals(req.params.find("recurse")->second.atom, "true")) _recurse = true; if (req.params.find("reporthidden") != req.params.end() && - boost::iequals(req.params.find("reporthidden")->second.atom, "true")) + iequals(req.params.find("reporthidden")->second.atom, "true")) _reportHidden = true; std::string suffixList; @@ -138,7 +138,7 @@ void DirMonInvoker::invoke(const InvokeRequest& req) { while(dirIter != req.params.upper_bound("dir")) { // this is simplified - Data might be more elaborate than a simple string atom URL url(dirIter->second.atom); - if (!url.toAbsolute(_interpreter->getBaseURI()) || !boost::iequals(url.scheme(), "file")) { + if (!url.toAbsolute(_interpreter->getBaseURI()) || !iequals(url.scheme(), "file")) { LOG(ERROR) << "Given directory '" << dirIter->second << "' cannot be transformed to absolute path"; } else { _dir = url.path(); diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp index 63eb970..d615238 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp @@ -65,7 +65,7 @@ bool pluginConnect(pluma::Host& host) { #endif #define OSG_TAG_HANDLE(tagName, procFunc) \ -} else if (boost::iequals(LOCALNAME(childs.item(i)), tagName) && \ +} else if (iequals(LOCALNAME(childs.item(i)), tagName) && \ validChildren.find(tagName) != validChildren.end()) { \ procFunc(childs.item(i));\ @@ -88,7 +88,7 @@ Data OSGInvoker::getDataModelVariables() { } void OSGInvoker::send(const SendRequest& req) { - if (boost::iequals(req.name, "intersect")) { + if (iequals(req.name, "intersect")) { } } @@ -114,7 +114,7 @@ void OSGInvoker::invoke(const InvokeRequest& req) { validChilds.insert("display"); // this is somewhat unfortunate, if content contains a single child, we will get that, otherwise its parent () - if (boost::iequals(LOCALNAME(req.dom), "display")) { + if (iequals(LOCALNAME(req.dom), "display")) { processChildren(validChilds, req.dom.getParentNode()); } else { processChildren(validChilds, req.dom); @@ -160,7 +160,7 @@ void OSGInvoker::handleEvent(Arabica::DOM::Events::Event& event) { if (_nodes.find(node) != _nodes.end()) { osg::ref_ptr osgNode = _nodes[node]; if (false) { - } else if (boost::iequals(LOCALNAME(node), "rotation")) { + } else if (iequals(LOCALNAME(node), "rotation")) { updateRotation(osgNode, event); } } @@ -294,7 +294,7 @@ void OSGInvoker::processRotation(const Arabica::DOM::Node& element) void OSGInvoker::updateRotation(osg::ref_ptr node, Arabica::DOM::Events::Event& event) { osg::ref_ptr transform = static_cast(node->asTransform()); if (false) { - } else if (boost::iequals(event.getType(), "DOMAttrModified")) { + } else if (iequals(event.getType(), "DOMAttrModified")) { osg::Matrix rotation = rotationFromElement(Arabica::DOM::Node(event.getTarget())); transform->setMatrix(rotation); } @@ -304,9 +304,9 @@ osg::Matrix OSGInvoker::rotationFromElement(const Arabica::DOM::Node(pitchAttr.value)); - } else if (boost::iequals(pitchAttr.unit, "%")) { + } else if (iequals(pitchAttr.unit, "%")) { pitch = osg::DegreesToRadians((strTo(pitchAttr.value) * 360) / 100); } else { pitch = strTo(pitchAttr.value); @@ -314,9 +314,9 @@ osg::Matrix OSGInvoker::rotationFromElement(const Arabica::DOM::Node(rollAttr.value)); - } else if (boost::iequals(rollAttr.unit, "%")) { + } else if (iequals(rollAttr.unit, "%")) { roll = osg::DegreesToRadians((strTo(rollAttr.value) * 360) / 100); } else { roll = strTo(rollAttr.value); @@ -324,9 +324,9 @@ osg::Matrix OSGInvoker::rotationFromElement(const Arabica::DOM::Node(yawAttr.value)); - } else if (boost::iequals(yawAttr.unit, "%")) { + } else if (iequals(yawAttr.unit, "%")) { yaw = osg::DegreesToRadians((strTo(yawAttr.value) * 360) / 100); } else { yaw = strTo(yawAttr.value); @@ -683,32 +683,32 @@ void OSGInvoker::getViewport(const Arabica::DOM::Node& element, if (HAS_ATTR(element, "x")) { NumAttr xAttr = NumAttr(ATTR(element, "x")); x = strTo(xAttr.value); - if (boost::iequals(xAttr.unit, "%")) + if (iequals(xAttr.unit, "%")) x = (x * fullWidth) / 100; } if (HAS_ATTR(element, "y")) { NumAttr yAttr = NumAttr(ATTR(element, "y")); y = strTo(yAttr.value); - if (boost::iequals(yAttr.unit, "%")) + if (iequals(yAttr.unit, "%")) y = (y * fullHeight) / 100; } if (HAS_ATTR(element, "width")) { NumAttr widthAttr = NumAttr(ATTR(element, "width")); width = strTo(widthAttr.value); - if (boost::iequals(widthAttr.unit, "%")) + if (iequals(widthAttr.unit, "%")) width = (width * fullWidth) / 100; } if (HAS_ATTR(element, "height")) { NumAttr heightAttr = NumAttr(ATTR(element, "height")); height = strTo(heightAttr.value); - if (boost::iequals(heightAttr.unit, "%")) + if (iequals(heightAttr.unit, "%")) height = (height * fullHeight) / 100; } } osgViewer::View* OSGInvoker::getView(const Arabica::DOM::Node& element) { Arabica::DOM::Node curr = element; - while(curr && !boost::iequals(LOCALNAME(curr), "viewport")) { + while(curr && !iequals(LOCALNAME(curr), "viewport")) { curr = curr.getParentNode(); } if (curr && _views.find(curr) != _views.end()) diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp index 7be93f3..f25d0b9 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp @@ -213,9 +213,9 @@ void OSGConverter::process(const SendRequest& req) { bool autoRotate = true; if (req.params.find("autorotate") != req.params.end()) { - if (boost::iequals(req.params.find("autorotate")->second.atom, "off") || - boost::iequals(req.params.find("autorotate")->second.atom, "0") || - boost::iequals(req.params.find("autorotate")->second.atom, "false")) { + if (iequals(req.params.find("autorotate")->second.atom, "off") || + iequals(req.params.find("autorotate")->second.atom, "0") || + iequals(req.params.find("autorotate")->second.atom, "false")) { autoRotate = false; } } diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp index 498292c..cee98bd 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp @@ -69,20 +69,20 @@ void HeartbeatInvoker::invoke(const InvokeRequest& req) { unsigned long intervalMs = 0; InvokeRequest::params_t::const_iterator paramIter = req.params.begin(); while(paramIter != req.params.end()) { - if (boost::iequals(paramIter->first, "interval")) { + if (iequals(paramIter->first, "interval")) { intervalStr = paramIter->second.atom; NumAttr intervalAttr(paramIter->second.atom); interval = strTo(intervalAttr.value); if (false) { - } else if (boost::iequals(intervalAttr.unit, "s")) { + } else if (iequals(intervalAttr.unit, "s")) { intervalMs = interval * 1000; - } else if (boost::iequals(intervalAttr.unit, "ms")) { + } else if (iequals(intervalAttr.unit, "ms")) { intervalMs = interval; } else { intervalMs = interval; } } - if (boost::iequals(paramIter->first, "eventname")) { + if (iequals(paramIter->first, "eventname")) { _event.name = paramIter->second.atom; } paramIter++; diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.cpp b/src/uscxml/plugins/invoker/im/IMInvoker.cpp index d1063bd..9c10bf2 100644 --- a/src/uscxml/plugins/invoker/im/IMInvoker.cpp +++ b/src/uscxml/plugins/invoker/im/IMInvoker.cpp @@ -603,7 +603,7 @@ void IMInvoker::send(void *userdata, const std::string event) { // we are in the thread that manages all of libpurple EventContext* ctx = (EventContext*)userdata; - if (boost::iequals(ctx->sendReq.name, "im.send")) { + if (iequals(ctx->sendReq.name, "im.send")) { if (ctx->instance->_account) { std::string receiver; Event::getParam(ctx->sendReq.params, "receiver", receiver); diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp index 1ec6dce..bd466b6 100644 --- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp +++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp @@ -59,7 +59,7 @@ Data MilesSessionInvoker::getDataModelVariables() { void MilesSessionInvoker::send(const SendRequest& req) { // std::cout << req; - if (boost::iequals(req.name, "disconnect")) { + if (iequals(req.name, "disconnect")) { std::string reflectorIP = "127.0.0.1"; Event::getParam(req.params, "reflectorip", reflectorIP); @@ -72,7 +72,7 @@ void MilesSessionInvoker::send(const SendRequest& req) { LOG(ERROR) << "Could not disconnect from reflector session"; return; } - } else if (boost::iequals(req.name, "image")) { + } else if (iequals(req.name, "image")) { // client wants an image URL imageURL1("test1.jpeg"); URL imageURL2("test2.jpeg"); @@ -102,7 +102,7 @@ void MilesSessionInvoker::send(const SendRequest& req) { returnEvent(retEv); - } else if (boost::iequals(req.name, "connect")) { + } else if (iequals(req.name, "connect")) { std::string email = "someSaneDefault"; Event::getParam(req.params, "email", email); diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp index 8d694d2..13c3e40 100644 --- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp @@ -64,8 +64,8 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) { tthread::lock_guard lock(_mutex); // these are the XHR requests - if (boost::iequals(req.data["header"]["X-Requested-With"].atom, "XMLHttpRequest")) { - if (boost::iequals(req.data["type"].atom, "get")) { + if (iequals(req.data["header"]["X-Requested-With"].atom, "XMLHttpRequest")) { + if (iequals(req.data["type"].atom, "get")) { // the long-polling GET if (_longPoll) { evhttp_send_error(_longPoll.curlReq, 204, NULL); @@ -101,7 +101,7 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) { // initial request for a document if (!req.data["query"] && // no query parameters - boost::iequals(req.data["type"].atom, "get") && // request type is GET + iequals(req.data["type"].atom, "get") && // request type is GET req.content.length() == 0) { // no content HTTPServer::Reply reply(req); @@ -184,7 +184,7 @@ void XHTMLInvoker::reply(const SendRequest& req, const HTTPServer::Request& long std::stringstream ss; // Arabica::DOM::Node content = req.dom.getDocumentElement(); Arabica::DOM::Node content = req.dom; - if (content && boost::iequals(content.getLocalName(), "content")) { + if (content && iequals(content.getLocalName(), "content")) { reply.headers["X-SCXML-Type"] = (HAS_ATTR(content, "type") ? ATTR(content, "type") : "replacechildren"); reply.headers["X-SCXML-XPath"] = (HAS_ATTR(content, "xpath") ? ATTR(content, "xpath") : "/html/body"); if (HAS_ATTR(content, "attr")) diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp index cfdfa18..5ae76a9 100644 --- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp @@ -107,7 +107,7 @@ void SCXMLIOProcessor::send(const SendRequest& req) { // reqCopy.sendid = ""; // test 198 _interpreter->receive(reqCopy); - } else if (boost::iequals(reqCopy.target, "#_internal")) { + } else if (iequals(reqCopy.target, "#_internal")) { /** * #_internal: If the target is the special term '#_internal', the Processor * must add the event to the internal event queue of the sending session. @@ -133,7 +133,7 @@ void SCXMLIOProcessor::send(const SendRequest& req) { error.sendid = reqCopy.sendid; _interpreter->receiveInternal(error); } - } else if (boost::iequals(reqCopy.target, "#_parent")) { + } else if (iequals(reqCopy.target, "#_parent")) { /** * #_parent: If the target is the special term '#_parent', the Processor must * add the event to the external event queue of the SCXML session that invoked diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index ef7fb83..4598615 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -364,7 +364,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD request.data.compound["header"].compound.find("Content-Type") != request.data.compound["header"].compound.end()) { std::string contentType = request.data.compound["header"].compound["Content-Type"].atom; if (false) { - } else if (boost::iequals(contentType, "application/x-www-form-urlencoded")) { + } else if (iequals(contentType, "application/x-www-form-urlencoded")) { // this is a form submit std::stringstream ss(request.data.compound["content"].atom); std::string item; @@ -387,7 +387,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD key.clear(); } request.data.compound["content"].atom.clear(); - } else if (boost::iequals(contentType, "application/json")) { + } else if (iequals(contentType, "application/json")) { request.data.compound["content"] = Data::fromJSON(request.data.compound["content"].atom); } } @@ -415,8 +415,8 @@ void HTTPServer::processByMatchingServlet(const Request& request) { while(servletIter != _servlets.end()) { // is the servlet path a prefix of the actual path? std::string servletPath = "/" + servletIter->first; - if (boost::iequals(actualPath.substr(0, servletPath.length()), servletPath) && // actual path is a prefix - boost::iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/' + if (iequals(actualPath.substr(0, servletPath.length()), servletPath) && // actual path is a prefix + iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/' matches.insert(std::make_pair(servletPath, servletIter->second)); } servletIter++; @@ -462,7 +462,7 @@ void HTTPServer::replyCallback(evutil_socket_t fd, short what, void *arg) { struct evbuffer *evb = NULL; - if (!boost::iequals(reply->type, "HEAD") && reply->content.size() > 0) { + if (!iequals(reply->type, "HEAD") && reply->content.size() > 0) { evb = evbuffer_new(); evbuffer_add(evb, reply->content.data(), reply->content.size()); } diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index f99e969..0486ca3 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -100,7 +100,7 @@ void printUsageAndExit() { class W3CStatusMonitor : public uscxml::InterpreterMonitor { void beforeCompletion(uscxml::Interpreter interpreter) { Arabica::XPath::NodeSet config = interpreter.getConfiguration(); - if (config.size() == 1 && boost::iequals(ATTR(config[0], "id"), "pass")) { + if (config.size() == 1 && iequals(ATTR(config[0], "id"), "pass")) { std::cout << "TEST SUCCEEDED" << std::endl; exit(EXIT_SUCCESS); } -- cgit v0.12