diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-06 16:04:18 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-06 16:04:18 (GMT) |
commit | 9cc762d85afffea42de3e1d156a6b8838d88a00c (patch) | |
tree | bff170c0493759c7f1bffca2648960b6f43ca139 /src/uscxml/messages/Blob.cpp | |
parent | be98a8297b4e10e169290f497e649e803e43d791 (diff) | |
download | uscxml-9cc762d85afffea42de3e1d156a6b8838d88a00c.zip uscxml-9cc762d85afffea42de3e1d156a6b8838d88a00c.tar.gz uscxml-9cc762d85afffea42de3e1d156a6b8838d88a00c.tar.bz2 |
Made Blob into Pimpl to better support language bindings
Diffstat (limited to 'src/uscxml/messages/Blob.cpp')
-rw-r--r-- | src/uscxml/messages/Blob.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/uscxml/messages/Blob.cpp b/src/uscxml/messages/Blob.cpp index 2e68e98..b8a263e 100644 --- a/src/uscxml/messages/Blob.cpp +++ b/src/uscxml/messages/Blob.cpp @@ -24,27 +24,27 @@ namespace uscxml { -Blob::~Blob() { +BlobImpl::~BlobImpl() { free(data); } -std::string Blob::md5() { +std::string BlobImpl::md5() const { return uscxml::md5(data, size); } -Blob* Blob::fromBase64(const std::string base64) { +BlobImpl* BlobImpl::fromBase64(const std::string base64, const std::string& mimeType) { std::string decoded = base64Decode(base64); - return new Blob(decoded.c_str(), decoded.length(), mimeType); + return new BlobImpl(decoded.c_str(), decoded.length(), mimeType); } -Blob::Blob(size_t _size) { +BlobImpl::BlobImpl(size_t _size) { data = (char*)malloc(_size); memset(data, 0, _size); size = _size; mimeType = "application/octet-stream"; } -Blob::Blob(const char* _data, size_t _size, const std::string& _mimeType, bool adopt) { +BlobImpl::BlobImpl(const char* _data, size_t _size, const std::string& _mimeType, bool adopt) { if (adopt) { data = (char*)_data; } else { @@ -54,8 +54,8 @@ Blob::Blob(const char* _data, size_t _size, const std::string& _mimeType, bool a mimeType = _mimeType; size = _size; } - -std::string Blob::base64() { + +std::string BlobImpl::base64() const { return base64Encode((char* const)data, size); } |