summaryrefslogtreecommitdiffstats
path: root/src/uscxml/messages/Event.h
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-01-13 16:47:44 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-01-13 16:47:44 (GMT)
commit4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235 (patch)
tree8c023473bb342780ddf51a893d18369f1319bb5c /src/uscxml/messages/Event.h
parent0aa0fe08dc308c94379c47d0bf9745e341cb4c81 (diff)
downloaduscxml-4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235.zip
uscxml-4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235.tar.gz
uscxml-4f6cbe9e7aec2b4a6c8f286f9097abfb011a6235.tar.bz2
First support for serialization and some bug fixes for DOM per data.src
Diffstat (limited to 'src/uscxml/messages/Event.h')
-rw-r--r--src/uscxml/messages/Event.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/uscxml/messages/Event.h b/src/uscxml/messages/Event.h
index 59b2690..b774f8a 100644
--- a/src/uscxml/messages/Event.h
+++ b/src/uscxml/messages/Event.h
@@ -24,20 +24,26 @@
#include "uscxml/util/UUID.h"
#define ERROR_PLATFORM_THROW(msg) \
- ErrorEvent e; \
+ uscxml::ErrorEvent e; \
e.name = "error.platform"; \
- e.data.compound["cause"] = Data(msg, Data::VERBATIM); \
+ e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
+ e.data.compound["file"] = uscxml::Data(uscxml::toStr(__FILE__), uscxml::Data::VERBATIM); \
+ e.data.compound["line"] = uscxml::Data(uscxml::toStr(__LINE__), uscxml::Data::INTERPRETED); \
throw e; \
#define ERROR_EXECUTION(identifier, cause) \
uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.data.compound["file"] = uscxml::Data(uscxml::toStr(__FILE__), uscxml::Data::VERBATIM); \
+ identifier.data.compound["line"] = uscxml::Data(uscxml::toStr(__LINE__), uscxml::Data::INTERPRETED); \
identifier.name = "error.execution"; \
identifier.eventType = uscxml::Event::PLATFORM;
#define ERROR_EXECUTION2(identifier, cause, node) \
uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.data.compound["file"] = uscxml::Data(uscxml::toStr(__FILE__), uscxml::Data::VERBATIM); \
+ identifier.data.compound["line"] = uscxml::Data(uscxml::toStr(__LINE__), uscxml::Data::INTERPRETED); \
identifier.name = "error.execution"; \
identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
identifier.eventType = uscxml::Event::PLATFORM;
@@ -45,12 +51,16 @@
#define ERROR_COMMUNICATION(identifier, cause) \
uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.data.compound["file"] = uscxml::Data(uscxml::toStr(__FILE__), uscxml::Data::VERBATIM); \
+ identifier.data.compound["line"] = uscxml::Data(uscxml::toStr(__LINE__), uscxml::Data::INTERPRETED); \
identifier.name = "error.communication"; \
identifier.eventType = uscxml::Event::PLATFORM;
#define ERROR_COMMUNICATION2(identifier, cause, node) \
uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
+ identifier.data.compound["file"] = uscxml::Data(uscxml::toStr(__FILE__), uscxml::Data::VERBATIM); \
+ identifier.data.compound["line"] = uscxml::Data(uscxml::toStr(__LINE__), uscxml::Data::INTERPRETED); \
identifier.name = "error.communication"; \
identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
identifier.eventType = uscxml::Event::PLATFORM;
@@ -91,6 +101,8 @@ public:
Event() : eventType(INTERNAL), hideSendId(false), uuid(UUID::getUUID()) {}
explicit Event(const std::string& name, Type type = INTERNAL) : name(name), eventType(type), hideSendId(false) {}
+ static Event fromData(const Data& data);
+
bool operator< (const Event& other) const {
return this < &other;
}
@@ -109,6 +121,8 @@ public:
return name.size() > 0;
}
+ operator Data();
+
operator std::string() {
std::stringstream ss;
ss << *this;