summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/datamodel')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp4
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp6
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp2
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp10
4 files changed, 14 insertions, 8 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index 142f3ec..b2f66b4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -223,14 +223,14 @@ void JSCDataModel::setEvent(const Event& event) {
if (!eventCopy.params.empty()) {
Event::params_t::iterator paramIter = eventCopy.params.begin();
while(paramIter != eventCopy.params.end()) {
- eventCopy.data.compound[paramIter->first] = Data(paramIter->second, Data::VERBATIM);
+ eventCopy.data.compound[paramIter->first] = paramIter->second;
paramIter++;
}
}
if (!eventCopy.namelist.empty()) {
Event::namelist_t::iterator nameListIter = eventCopy.namelist.begin();
while(nameListIter != eventCopy.namelist.end()) {
- eventCopy.data.compound[nameListIter->first] = Data(nameListIter->second, Data::VERBATIM);
+ eventCopy.data.compound[nameListIter->first] = nameListIter->second;
nameListIter++;
}
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 77efe78..0e72c67 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -207,18 +207,19 @@ void V8DataModel::setEvent(const Event& event) {
if (!eventCopy.params.empty()) {
Event::params_t::iterator paramIter = eventCopy.params.begin();
while(paramIter != eventCopy.params.end()) {
- eventCopy.data.compound[paramIter->first] = Data(paramIter->second, Data::VERBATIM);
+ eventCopy.data.compound[paramIter->first] = paramIter->second;
paramIter++;
}
}
if (!eventCopy.namelist.empty()) {
Event::namelist_t::iterator nameListIter = eventCopy.namelist.begin();
while(nameListIter != eventCopy.namelist.end()) {
- eventCopy.data.compound[nameListIter->first] = Data(nameListIter->second, Data::VERBATIM);
+ eventCopy.data.compound[nameListIter->first] = nameListIter->second;
nameListIter++;
}
}
if (eventCopy.data) {
+// std::cout << Data::toJSON(eventCopy.data);
eventObj->Set(v8::String::New("data"), getDataAsValue(eventCopy.data)); // set data part of _event
} else {
// test 343 / test 488
@@ -340,6 +341,7 @@ v8::Handle<v8::Value> V8DataModel::getDataAsValue(const Data& data) {
v8::Handle<v8::Object> value = v8::Object::New();
std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin();
while(compoundIter != data.compound.end()) {
+// std::cout << compoundIter->first.c_str() << std::endl;
value->Set(v8::String::New(compoundIter->first.c_str()), getDataAsValue(compoundIter->second));
compoundIter++;
}
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
index 07cba96..aec044e 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
@@ -230,6 +230,8 @@ void SWIDataModel::setEvent(const Event& event) {
PlCall(dataInitStr.str().c_str());
} else if (event.content.size() > 0) {
PlCall("assert", PlCompound("event", PlCompound("data", PlString(Interpreter::spaceNormalize(event.content).c_str()))));
+ } else if (event.data) {
+ LOG(ERROR) << "No support for structured data from events in prolog datamodel yet";
}
// event.params
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
index cb40890..f863bb7 100644
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
@@ -139,10 +139,11 @@ void XPathDataModel::setEvent(const Event& event) {
}
if (event.params.size() > 0) {
- std::multimap<std::string, std::string>::const_iterator paramIter = event.params.begin();
+ std::multimap<std::string, Data>::const_iterator paramIter = event.params.begin();
while(paramIter != event.params.end()) {
Element<std::string> eventParamElem = _doc.createElement("data");
- Text<std::string> eventParamText = _doc.createTextNode(paramIter->second);
+ // this is simplified - Data might be more elaborate than a simple string atom
+ Text<std::string> eventParamText = _doc.createTextNode(paramIter->second.atom);
eventParamElem.setAttribute("id", paramIter->first);
eventParamElem.appendChild(eventParamText);
@@ -151,10 +152,11 @@ void XPathDataModel::setEvent(const Event& event) {
}
}
if (event.namelist.size() > 0) {
- std::map<std::string, std::string>::const_iterator namelistIter = event.namelist.begin();
+ std::map<std::string, Data>::const_iterator namelistIter = event.namelist.begin();
while(namelistIter != event.namelist.end()) {
Element<std::string> eventNamelistElem = _doc.createElement("data");
- Text<std::string> eventNamelistText = _doc.createTextNode(namelistIter->second);
+ // this is simplified - Data might be more elaborate than a simple string atom
+ Text<std::string> eventNamelistText = _doc.createTextNode(namelistIter->second.atom);
eventNamelistElem.setAttribute("id", namelistIter->first);
eventNamelistElem.appendChild(eventNamelistText);