diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-13 17:57:36 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-13 17:57:36 (GMT) |
commit | 0da799e220877b538a492f89f1dd26049d904c12 (patch) | |
tree | dc28201079d2d2c6a2dae60f4fa0b1c6e70b0852 /src/bindings/swig | |
parent | 9a9afb6aaf314a68901cce3463e91512c261bd7a (diff) | |
download | uscxml-0da799e220877b538a492f89f1dd26049d904c12.zip uscxml-0da799e220877b538a492f89f1dd26049d904c12.tar.gz uscxml-0da799e220877b538a492f89f1dd26049d904c12.tar.bz2 |
More work on Rhino datamodel
Diffstat (limited to 'src/bindings/swig')
-rw-r--r-- | src/bindings/swig/java/JavaDataModel.h | 16 | ||||
-rw-r--r-- | src/bindings/swig/java/org/uscxml/Data.java | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/bindings/swig/java/JavaDataModel.h b/src/bindings/swig/java/JavaDataModel.h index ef8daa6..fcfb665 100644 --- a/src/bindings/swig/java/JavaDataModel.h +++ b/src/bindings/swig/java/JavaDataModel.h @@ -54,11 +54,13 @@ public: return ""; } virtual bool evalAsBool(const std::string& expr) { - return false; + return evalAsBool("", expr); } virtual bool evalAsBool(const Arabica::DOM::Node<std::string>& node, const std::string& expr) { - return false; + std::ostringstream ssNode; + ssNode << node; + return evalAsBool(ssNode.str(), expr); } virtual bool isDeclared(const std::string& expr) { @@ -73,6 +75,7 @@ public: if (assignElem.hasAttribute("location")) { location = assignElem.getAttribute("location"); } + std::ostringstream ssAssign; ssAssign << assignElem; std::string tmp; @@ -80,10 +83,12 @@ public: std::ostringstream ssContent; ssContent << node; tmp = ssContent.str(); + } else if (assignElem.hasAttribute("expr")) { + tmp = assignElem.getAttribute("expr"); } else { tmp = content; } - assign(location, ssAssign.str(), tmp); + assign(ssAssign.str(), location, tmp); } virtual void assign(const std::string& location, const Data& data) { @@ -108,10 +113,12 @@ public: std::ostringstream ssContent; ssContent << node; tmp = ssContent.str(); + } else if (dataElem.hasAttribute("expr")) { + tmp = dataElem.getAttribute("expr"); } else { tmp = content; } - init(location, ssData.str(), tmp); + init(ssData.str(), location, tmp); } virtual void init(const std::string& location, const Data& data) { @@ -119,6 +126,7 @@ public: } // these functions are exposed to java + virtual bool evalAsBool(const std::string& elem, const std::string& content) { return false; } virtual void init(const std::string& dataElem, const std::string& location, const std::string& content) {} virtual void assign(const std::string& assignElem, const std::string& location, const std::string& content) {} virtual void eval(const std::string& scriptElem, const std::string& expr) {} diff --git a/src/bindings/swig/java/org/uscxml/Data.java b/src/bindings/swig/java/org/uscxml/Data.java index ce295af..f3f21f3 100644 --- a/src/bindings/swig/java/org/uscxml/Data.java +++ b/src/bindings/swig/java/org/uscxml/Data.java @@ -74,7 +74,7 @@ public class Data { nativeDataList.add(toNative(item)); } nativeData.setArray(nativeDataList); - } else { + } else if (data.atom != null) { nativeData.setAtom(data.atom); if (data.type == Type.INTERPRETED) { nativeData.setType(DataNative.Type.INTERPRETED); |