summaryrefslogtreecommitdiffstats
path: root/src/uscxml/messages
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-01-08 21:59:18 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-01-08 21:59:18 (GMT)
commit030f3b483f54dbef6e164194a1771ef5b346312b (patch)
tree3f5b949b5ffed83d0b41a95d9fd3cfafd17cab2d /src/uscxml/messages
parent1ab8b9a0dcaa131b8cccc735a1794ce39b351715 (diff)
downloaduscxml-030f3b483f54dbef6e164194a1771ef5b346312b.zip
uscxml-030f3b483f54dbef6e164194a1771ef5b346312b.tar.gz
uscxml-030f3b483f54dbef6e164194a1771ef5b346312b.tar.bz2
Support for caching values on filesystem
Use USCXML_NOCACHE_FILES=YES to prevent, I will make this a build flag
Diffstat (limited to 'src/uscxml/messages')
-rw-r--r--src/uscxml/messages/Data.cpp2
-rw-r--r--src/uscxml/messages/Data.h40
2 files changed, 27 insertions, 15 deletions
diff --git a/src/uscxml/messages/Data.cpp b/src/uscxml/messages/Data.cpp
index b2d08e4..de9644b 100644
--- a/src/uscxml/messages/Data.cpp
+++ b/src/uscxml/messages/Data.cpp
@@ -283,8 +283,6 @@ std::string Data::toJSON(const Data& data) {
} else {
if (data.type == Data::VERBATIM) {
os << "\"\""; // empty string
- } else {
- os << "null";
}
}
return os.str();
diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h
index 2cf1945..17d37cb 100644
--- a/src/uscxml/messages/Data.h
+++ b/src/uscxml/messages/Data.h
@@ -73,6 +73,16 @@ public:
~Data() {}
+ void clear() {
+ type = VERBATIM;
+ compound.clear();
+ array.clear();
+ atom.clear();
+ adoptedDoc.reset();
+ binary = Blob();
+ node = NULL;
+ }
+
bool empty() const {
bool hasContent = (atom.length() > 0 || !compound.empty() || !array.empty() || binary || node);
return !hasContent;
@@ -101,18 +111,20 @@ public:
return (!compound.empty() && compound.find(key) != compound.end());
}
- Data& operator[](const std::string& key) {
- return operator[](key.c_str());
- }
+#ifndef SWIGIMPORTED
- const Data& operator[](const std::string& key) const {
- return operator[](key.c_str());
+ Data& operator[](const std::string& key) {
+ return compound[key];
}
Data& operator[](const char* key) {
return compound[key];
}
+ const Data& operator[](const std::string& key) const {
+ return compound.at(key);
+ }
+
const Data& operator[](const char* key) const {
return compound.at(key);
}
@@ -125,6 +137,7 @@ public:
for (size_t i = 0; i < index; i++, arrayIter++) {}
return *arrayIter;
}
+#endif
const Data at(const std::string& key) const {
return at(key.c_str());
@@ -179,14 +192,6 @@ public:
static std::string toJSON(const Data& data);
std::string asJSON() const;
-
- std::map<std::string, Data> getCompound() {
- return compound;
- }
- void setCompound(const std::map<std::string, Data>& compound) {
- this->compound = compound;
- }
-
std::list<Data> getArray() {
return array;
}
@@ -215,6 +220,15 @@ public:
this->type = type;
}
+ // Bug in SWIG 3.0.8 Python: Data in a map has to be fully qualified!
+ std::map<std::string, uscxml::Data> getCompound() {
+ return compound;
+ }
+
+ void setCompound(const std::map<std::string, uscxml::Data>& compound) {
+ this->compound = compound;
+ }
+
#ifdef SWIGIMPORTED
protected:
#endif