diff options
Diffstat (limited to 'src/uscxml/plugins/datamodel/prolog')
-rw-r--r-- | src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp | 37 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h | 29 |
2 files changed, 22 insertions, 44 deletions
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index f3af4b6..fcd606d 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -134,38 +134,25 @@ std::string SWIDataModel::evalAsString(const std::string& expr) { return std::string(compound); } -void SWIDataModel::assign(const std::string& location, +void SWIDataModel::assign(const Arabica::DOM::Element<std::string>& assignElem, const Arabica::DOM::Document<std::string>& doc, - const Arabica::DOM::Element<std::string>& assignElem) { - + const std::string& content) { + std::string expr = content; + if (HAS_ATTR(assignElem, "expr")) { + expr = ATTR(assignElem, "expr"); + } + if (expr.length() > 0) + eval(expr); } -void SWIDataModel::assign(const std::string& location, - const std::string& expr, - const Arabica::DOM::Element<std::string>& assignElem) { - eval(expr); -} -void SWIDataModel::assign(const std::string& location, - const Data& data, - const Arabica::DOM::Element<std::string>& assignElem) { +void SWIDataModel::assign(const std::string& location, const Data& data) { eval(data.atom); } -void SWIDataModel::init(const std::string& location, +void SWIDataModel::init(const Arabica::DOM::Element<std::string>& dataElem, const Arabica::DOM::Document<std::string>& doc, - const Arabica::DOM::Element<std::string>& dataElem) { - -} -void SWIDataModel::init(const std::string& location, - const std::string& expr, - const Arabica::DOM::Element<std::string>& dataElem) { - -} -void SWIDataModel::init(const std::string& location, - const Data& data, - const Arabica::DOM::Element<std::string>& dataElem) { - -} + const std::string& content) {} +void SWIDataModel::init(const std::string& location, const Data& data) {} bool SWIDataModel::isDeclared(const std::string& expr) { return true; diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h index 5d95476..a278db8 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h @@ -36,6 +36,16 @@ public: virtual void pushContext(); virtual void popContext(); + virtual void assign(const Arabica::DOM::Element<std::string>& assignElem, + const Arabica::DOM::Document<std::string>& doc, + const std::string& content); + virtual void assign(const std::string& location, const Data& data); + + virtual void init(const Arabica::DOM::Element<std::string>& dataElem, + const Arabica::DOM::Document<std::string>& doc, + const std::string& content); + virtual void init(const std::string& location, const Data& data); + virtual void eval(const std::string& expr); virtual bool isDeclared(const std::string& expr); @@ -44,25 +54,6 @@ public: virtual std::string evalAsString(const std::string& expr); virtual bool evalAsBool(const std::string& expr); - virtual void assign(const std::string& location, - const Arabica::DOM::Document<std::string>& doc, - const Arabica::DOM::Element<std::string>& assignElem); - virtual void assign(const std::string& location, - const std::string& expr, - const Arabica::DOM::Element<std::string>& assignElem); - virtual void assign(const std::string& location, - const Data& data, - const Arabica::DOM::Element<std::string>& assignElem); - - virtual void init(const std::string& location, - const Arabica::DOM::Document<std::string>& doc, - const Arabica::DOM::Element<std::string>& dataElem); - virtual void init(const std::string& location, - const std::string& expr, - const Arabica::DOM::Element<std::string>& dataElem); - virtual void init(const std::string& location, - const Data& data, - const Arabica::DOM::Element<std::string>& dataElem); protected: Event _event; |