diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-02 21:38:10 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-02 21:38:10 (GMT) |
commit | 7938e286967597c7168b855b7e3fdfbd9b949e0e (patch) | |
tree | bc5d9bfb80a07ec80b36dc025b3fac9f3ca03ec4 /src/uscxml/Message.cpp | |
parent | a874a181add7b292e52140f8c753f663a4cb5a87 (diff) | |
download | uscxml-7938e286967597c7168b855b7e3fdfbd9b949e0e.zip uscxml-7938e286967597c7168b855b7e3fdfbd9b949e0e.tar.gz uscxml-7938e286967597c7168b855b7e3fdfbd9b949e0e.tar.bz2 |
New file element for executable content
Diffstat (limited to 'src/uscxml/Message.cpp')
-rw-r--r-- | src/uscxml/Message.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/uscxml/Message.cpp b/src/uscxml/Message.cpp index f3f8c27..6388f9f 100644 --- a/src/uscxml/Message.cpp +++ b/src/uscxml/Message.cpp @@ -21,6 +21,30 @@ namespace uscxml { static int _dataIndentation = 1; +Blob::~Blob() { + free(_data); +} + +Blob::Blob(size_t size) { + _data = (char*)malloc(size); + memset(_data, 0, size); + _size = size; +} + +Blob::Blob(void* data, size_t size, bool adopt) { + if (adopt) { + _data = (char*)data; + } else { + _data = (char*)malloc(size); + memcpy(_data, data, size); + } + _size = size; +} + +Data::Data(const char* data, size_t size, bool adopt) { + binary = boost::shared_ptr<Blob>(new Blob((void*)data, size, adopt)); +} + Data::Data(const Arabica::DOM::Node<std::string>& dom) { // we may need to convert some keys to arrays if we have the same name as an element std::map<std::string, std::list<Data> > arrays; |