summaryrefslogtreecommitdiffstats
path: root/src/uscxml/messages
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-01-18 17:15:46 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-01-18 17:15:46 (GMT)
commitfc78cfdc4d1f5bba8dbd6a412f23651e185cb191 (patch)
treedd32929c07e6c19250f2e8fde1e73712bab0c6fb /src/uscxml/messages
parent01ee860a88b5c8cf25fb7dcc145662d2c27f3ebe (diff)
downloaduscxml-fc78cfdc4d1f5bba8dbd6a412f23651e185cb191.zip
uscxml-fc78cfdc4d1f5bba8dbd6a412f23651e185cb191.tar.gz
uscxml-fc78cfdc4d1f5bba8dbd6a412f23651e185cb191.tar.bz2
Worked on passing even more IRP tests
Diffstat (limited to 'src/uscxml/messages')
-rw-r--r--src/uscxml/messages/Data.cpp4
-rw-r--r--src/uscxml/messages/Data.h35
2 files changed, 20 insertions, 19 deletions
diff --git a/src/uscxml/messages/Data.cpp b/src/uscxml/messages/Data.cpp
index 277b7d8..6c48c46 100644
--- a/src/uscxml/messages/Data.cpp
+++ b/src/uscxml/messages/Data.cpp
@@ -350,8 +350,8 @@ std::string Data::jsonEscape(const std::string& expr) {
os << "\\n";
} else if (expr[i] == '\r') {
os << "\\r";
- } else if (expr[i] == '\'') {
- os << "\\'";
+// } else if (expr[i] == '\'') {
+// os << "\\\'";
} else if (expr[i] == '\"') {
os << "\\\"";
} else if (expr[i] == '\\') {
diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h
index 19134dd..b279696 100644
--- a/src/uscxml/messages/Data.h
+++ b/src/uscxml/messages/Data.h
@@ -23,6 +23,7 @@
#include <list>
#include <map>
#include <memory>
+#include <type_traits>
#include "uscxml/Common.h"
#include "uscxml/util/Convenience.h"
@@ -49,27 +50,27 @@ public:
Data() : node(NULL), type(INTERPRETED) {}
- Data(const char* data, size_t size, const std::string& mimeType, bool adopt = false);
+ explicit Data(const char* data, size_t size, const std::string& mimeType, bool adopt = false);
// convenience constructors
- Data(bool atom) : node(NULL), type(VERBATIM) {
- if (atom) {
- this->atom = "true";
- } else {
- this->atom = "false";
- }
- }
+// explicit Data(bool atom) : node(NULL), type(VERBATIM) {
+// if (atom) {
+// this->atom = "true";
+// } else {
+// this->atom = "false";
+// }
+// }
explicit Data(XERCESC_NS::DOMNode* node_) : node(node_) {}
- // template <typename T> Data(T value, Type type = INTERPRETED) : atom(toStr(value)), type(type) {}
- // we will have to drop this constructor as it interferes with operator Data() and requires C++11
- template <typename T>
- explicit Data(T value, typename std::enable_if<! std::is_base_of<Data, T>::value>::type* = nullptr)
- : node(NULL), atom(toStr(value)), type(VERBATIM) {}
+ explicit Data(const std::string& value) : node(NULL), atom(toStr(value)), type(VERBATIM) {}
+
+ template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
+ explicit Data(T value)
+ : node(NULL), atom(toStr(value)), type(INTERPRETED) {}
+
template <typename T>
- explicit Data(T value, Type type, typename std::enable_if<! std::is_base_of<Data, T>::value>::type* = nullptr)
- : node(NULL), atom(toStr(value)), type(type) {}
+ explicit Data(T value, Type type) : node(NULL), atom(toStr(value)), type(type) {}
~Data() {
}
@@ -170,11 +171,11 @@ public:
}
bool operator==(const Data &other) const {
- return (*this < other || other < *this);
+ return !(*this != other);
}
bool operator!=(const Data &other) const {
- return !(*this == other);
+ return (*this < other || other < *this);
}
operator std::string() const {