summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/null
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-12 11:57:08 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-12 11:57:08 (GMT)
commitba050afaaad699e60ca657b311d5c34d038bb89c (patch)
treed4c79e30631c63e8557c6ec893a70dda46aa6cd5 /src/uscxml/plugins/datamodel/null
parent45ab2909e17f7e0348ccfe4179f23a897a2fd305 (diff)
downloaduscxml-ba050afaaad699e60ca657b311d5c34d038bb89c.zip
uscxml-ba050afaaad699e60ca657b311d5c34d038bb89c.tar.gz
uscxml-ba050afaaad699e60ca657b311d5c34d038bb89c.tar.bz2
Refactoring for other datamodels
Diffstat (limited to 'src/uscxml/plugins/datamodel/null')
-rw-r--r--src/uscxml/plugins/datamodel/null/NULLDataModel.cpp16
-rw-r--r--src/uscxml/plugins/datamodel/null/NULLDataModel.h30
2 files changed, 18 insertions, 28 deletions
diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp
index 69970dd..6911480 100644
--- a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp
@@ -52,7 +52,7 @@ bool NULLDataModel::validate(const std::string& location, const std::string& sch
}
uint32_t NULLDataModel::getLength(const std::string& expr) {
- return 0;
+ return 0;
}
void NULLDataModel::eval(const std::string& expr) {
@@ -63,9 +63,9 @@ bool NULLDataModel::isDeclared(const std::string& expr) {
}
/**
- * The boolean expression language consists of the In predicate only. It has the
- * form 'In(id)', where id is the id of a state in the enclosing state machine.
- * The predicate must return 'true' if and only if that state is in the current
+ * The boolean expression language consists of the In predicate only. It has the
+ * form 'In(id)', where id is the id of a state in the enclosing state machine.
+ * The predicate must return 'true' if and only if that state is in the current
* state configuration.
*/
bool NULLDataModel::evalAsBool(const std::string& expr) {
@@ -73,14 +73,14 @@ bool NULLDataModel::evalAsBool(const std::string& expr) {
boost::trim(trimmedExpr);
if (!boost::istarts_with(trimmedExpr, "in"))
return false;
-
+
// find string in between brackets
size_t start = trimmedExpr.find_first_of("(");
size_t end = trimmedExpr.find_last_of(")");
if (start == std::string::npos || end == std::string::npos || start >= end)
return false;
start++;
-
+
// split at comma
std::stringstream ss(trimmedExpr.substr(start, end - start));
std::vector<std::string> stateExprs;
@@ -88,7 +88,7 @@ bool NULLDataModel::evalAsBool(const std::string& expr) {
while(std::getline(ss, item, ',')) {
stateExprs.push_back(item);
}
-
+
for (unsigned int i = 0; i < stateExprs.size(); i++) {
// remove ticks
size_t start = stateExprs[i].find_first_of("'");
@@ -101,7 +101,7 @@ bool NULLDataModel::evalAsBool(const std::string& expr) {
} else {
stateName = stateExprs[i];
}
-
+
if (Interpreter::isMember(_interpreter->getState(stateName), _interpreter->getConfiguration())) {
continue;
}
diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.h b/src/uscxml/plugins/datamodel/null/NULLDataModel.h
index eaa9dbd..423c5ff 100644
--- a/src/uscxml/plugins/datamodel/null/NULLDataModel.h
+++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.h
@@ -36,30 +36,20 @@ public:
virtual void pushContext();
virtual void popContext();
- virtual void eval(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) {};
+ 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 Data getStringAsData(const std::string& content);
virtual bool isDeclared(const std::string& expr);
+ virtual void eval(const std::string& expr);
virtual std::string evalAsString(const std::string& expr);
virtual bool evalAsBool(const std::string& expr);
virtual double evalAsNumber(const std::string& expr);