diff options
Diffstat (limited to 'src/uscxml/plugins')
12 files changed, 19 insertions, 19 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index a064394..a6909b5 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -222,7 +222,7 @@ void JSCDataModel::setEvent(const Event& event) { } else if (event.content.length() > 0) { // _event.data is a string or JSON Data json = Data::fromJSON(event.content); - if (json) { + if (!json.empty()) { JSStringRef propName = JSStringCreateWithUTF8CString("data"); JSObjectSetProperty(_ctx, eventObj, propName, getDataAsValue(json), 0, &exception); JSStringRelease(propName); @@ -255,7 +255,7 @@ void JSCDataModel::setEvent(const Event& event) { nameListIter++; } } - if (eventCopy.data > 0) { + if (!eventCopy.data.empty()) { JSStringRef propName = JSStringCreateWithUTF8CString("data"); JSObjectSetProperty(_ctx, eventObj, propName, getDataAsValue(eventCopy.data), 0, &exception); JSStringRelease(propName); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index ec9557e..2bdd796 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -233,7 +233,7 @@ void V8DataModel::setEvent(const Event& event) { } else if (event.content.length() > 0) { // _event.data is a string or JSON Data json = Data::fromJSON(event.content); - if (json) { + if (!json.empty()) { eventObj->Set(v8::String::New("data"), getDataAsValue(json)); } else { eventObj->Set(v8::String::New("data"), v8::String::New(InterpreterImpl::spaceNormalize(event.content).c_str())); @@ -255,7 +255,7 @@ void V8DataModel::setEvent(const Event& event) { nameListIter++; } } - if (eventCopy.data) { + if (!eventCopy.data.empty()) { // std::cout << Data::toJSON(eventCopy.data); eventObj->Set(v8::String::New("data"), getDataAsValue(eventCopy.data)); // set data part of _event } else { diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index 4cbe8f5..76c4373 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -276,7 +276,7 @@ void SWIDataModel::setEvent(const Event& event) { PlCall(dataInitStr.str().c_str()); } else if (event.content.size() > 0) { PlCall("assert", PlCompound("event", PlCompound("data", PlString(InterpreterImpl::spaceNormalize(event.content).c_str())))); - } else if (event.data) { + } else if (!event.data.empty()) { assertFromData(event.data, "event(data(", 2); } @@ -817,7 +817,7 @@ void SWIDataModel::assign(const Element<std::string>& assignElem, 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) { + } else if (!json.empty()) { std::stringstream dataInitStr; if (iequals(type, "retract")) PlCall("retractall", PlCompound(predicate.c_str(), 1)); diff --git a/src/uscxml/plugins/element/file/FileElement.cpp b/src/uscxml/plugins/element/file/FileElement.cpp index aef63aa..899c2d6 100644 --- a/src/uscxml/plugins/element/file/FileElement.cpp +++ b/src/uscxml/plugins/element/file/FileElement.cpp @@ -223,7 +223,7 @@ void FileElement::enterElement(const Arabica::DOM::Node<std::string>& node) { case JSON: { Data json = Data::fromJSON(fileContents); free(fileContents); - if (!json) { + if (json.empty()) { LOG(ERROR) << "Cannot parse contents of " << _filepath << " as JSON"; return; } diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt index 8ae4516..ceb9c90 100644 --- a/src/uscxml/plugins/invoker/CMakeLists.txt +++ b/src/uscxml/plugins/invoker/CMakeLists.txt @@ -109,7 +109,7 @@ if (EXPECT_FOUND AND TCL_FOUND) invoker_expect SHARED ${EXPECT_INVOKER} "../Plugins.cpp") - target_link_libraries(invoker_expect uscxml) + target_link_libraries(invoker_expect uscxml ${EXPECT_LIBRARY} ${TCL_LIBRARY}) set_target_properties(invoker_expect PROPERTIES FOLDER "Plugin Invoker") else() list (APPEND USCXML_FILES ${EXPECT_INVOKER}) diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp index f43e406..b6203d4 100644 --- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp +++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp @@ -250,7 +250,7 @@ void FFMPEGInvoker::process(const SendRequest& req) { Data image; Event::getParam(req.params, "frame", image); - if (!image) { + if (image.empty()) { return; } diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp index bc747a1..0ebf9b8 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp @@ -394,7 +394,7 @@ void OSGConverter::reportSuccess(const SendRequest& req, const Data& content) { event.name = "convert"; event.name += ".success"; - if (content) + if (!content.empty()) event.data.compound["content"] = content; returnEvent(event); } diff --git a/src/uscxml/plugins/invoker/miles/.MilesSessionInvoker.cpp.swp b/src/uscxml/plugins/invoker/miles/.MilesSessionInvoker.cpp.swp Binary files differdeleted file mode 100644 index 368f327..0000000 --- a/src/uscxml/plugins/invoker/miles/.MilesSessionInvoker.cpp.swp +++ /dev/null diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp index c84fd8f..6ef1bd4 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp @@ -77,10 +77,10 @@ void UmundoInvoker::send(const SendRequest& req) { try { Data data = req.data; - if (!data && req.content.length()) + if (data.empty() && req.content.length()) data = _interpreter->getDataModel().getStringAsData(req.content); - if (!data) { + if (data.empty()) { LOG(ERROR) << "Cannot transform content to data object per datamodel or no data given"; return; } diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp index e607cf4..0418f8a 100644 --- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp @@ -81,7 +81,7 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) { } else { // a POST request Event ev(req); - if (ev.data["header"]["X-SCXML-Name"]) { + if (ev.data["header"].hasKey("X-SCXML-Name")) { ev.name = ev.data["header"]["X-SCXML-Name"].atom; } else { ev.name = req.data.at("type").atom; @@ -101,7 +101,7 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) { } // initial request for a document - if (!req.data["query"] && // no query parameters + if (!req.data.hasKey("query") && // no query parameters iequals(req.data.at("type").atom, "get") && // request type is GET req.content.length() == 0) { // no content @@ -113,7 +113,7 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) { // ss << _invokeReq.getFirstDOMElement(); ss << _invokeReq.dom; content = ss.str(); - } else if(_invokeReq.data) { + } else if(!_invokeReq.data.empty()) { ss << _invokeReq.data; content = ss.str(); } else if (_invokeReq.content.length() > 0) { @@ -163,7 +163,7 @@ void XHTMLInvoker::send(const SendRequest& req) { SendRequest reqCopy(req); _interpreter->getDataModel().replaceExpressions(reqCopy.content); Data json = Data::fromJSON(reqCopy.content); - if (json) { + if (!json.empty()) { reqCopy.data = json; } @@ -195,7 +195,7 @@ void XHTMLInvoker::reply(const SendRequest& req, const HTTPServer::Request& long ss << req.dom; reply.content = ss.str(); reply.headers["Content-Type"] = "application/xml"; - } else if (req.data) { + } else if (!req.data.empty()) { reply.content = Data::toJSON(req.data); reply.headers["Content-Type"] = "application/json"; } else if (req.content.length() > 0) { diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp index 9c1ba45..8489d60 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp @@ -222,7 +222,7 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) { kvps << kvpSeperator << keyCStr << "=" << valueCStr; free(valueCStr); kvpSeperator = "&"; - } else if (req.data) { + } else if (!req.data.empty()) { char* valueCStr = NULL; if (req.data.atom.length() || req.data.array.size() || req.data.compound.size()) { valueCStr = evhttp_encode_uri(Data::toJSON(req.data).c_str()); diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp index 32052c7..cf11ec8 100644 --- a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp @@ -82,7 +82,7 @@ void CometIOProcessor::reply(const SendRequest& req, const HTTPServer::Request& ss << req.dom; reply.content = ss.str(); reply.headers["Content-Type"] = "application/xml"; - } else if (req.data) { + } else if (!req.data.empty()) { reply.content = Data::toJSON(req.data); reply.headers["Content-Type"] = "application/json"; } else if (req.content.length() > 0) { |