summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Message.h
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-10-10 08:21:29 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-10-10 08:21:29 (GMT)
commita2c45baa7a14e8caa2a8f1c3937a03f4ba9fd8d4 (patch)
tree37c2dafd11493a2221af8f616dadf465e304a5c3 /src/uscxml/Message.h
parent525daee195c5593f077d837a689f2c5d26f91fb0 (diff)
downloaduscxml-a2c45baa7a14e8caa2a8f1c3937a03f4ba9fd8d4.zip
uscxml-a2c45baa7a14e8caa2a8f1c3937a03f4ba9fd8d4.tar.gz
uscxml-a2c45baa7a14e8caa2a8f1c3937a03f4ba9fd8d4.tar.bz2
Base64 and MD5 for Blobs
Diffstat (limited to 'src/uscxml/Message.h')
-rw-r--r--src/uscxml/Message.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h
index bc92180..3008a99 100644
--- a/src/uscxml/Message.h
+++ b/src/uscxml/Message.h
@@ -16,6 +16,9 @@
#include "uscxml/Convenience.h"
+#include "uscxml/util/MD5.h"
+#include "uscxml/util/Base64.h"
+
#define TAGNAME(elem) ((Arabica::DOM::Element<std::string>)elem).getTagName()
#define LOCALNAME(elem) ((Arabica::DOM::Element<std::string>)elem).getLocalName()
#define ATTR(elem, attr) ((Arabica::DOM::Element<std::string>)elem).getAttribute(attr)
@@ -31,6 +34,19 @@ public:
char* data;
size_t size;
std::string mimetype;
+
+ std::string md5() {
+ return uscxml::md5(data, size);
+ }
+
+ std::string base64() {
+ return base64_encode((char* const)data, size);
+ }
+
+ Blob* fromBase64(const std::string base64) {
+ std::string decoded = base64_decode(base64);
+ return new Blob((void*)decoded.c_str(), decoded.length());
+ }
};
class Data {