add blob tag
[ecparse.git] / BlobTag.cpp
diff --git a/BlobTag.cpp b/BlobTag.cpp
new file mode 100644 (file)
index 0000000..0bf4bda
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#include "BlobTag.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+BlobTag::BlobTag(int id, void* value, int length): Tag(Blob, id) {
+       this->length = length;
+       this->value = malloc(length);
+       memcpy(this->value, value, length);
+}
+
+BlobTag::~BlobTag() {
+       if (value) {
+               free(value);
+       }
+}
+
+int BlobTag::getSize() {
+       return length;
+}
+
+void* BlobTag::getValue() {
+       return value;
+}
+