From e9bd547c31bc06fac87b49cafa624c03c2d50c91 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 6 Jul 2008 11:30:36 +0200 Subject: [PATCH] add blob tag --- BlobTag.cpp | 29 +++++++++++++++++++++++++++++ BlobTag.h | 23 +++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 BlobTag.cpp create mode 100644 BlobTag.h diff --git a/BlobTag.cpp b/BlobTag.cpp new file mode 100644 index 0000000..0bf4bda --- /dev/null +++ b/BlobTag.cpp @@ -0,0 +1,29 @@ +/** + * © 2008 by David Roden + */ + +#include "BlobTag.h" + +#include +#include + +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; +} + diff --git a/BlobTag.h b/BlobTag.h new file mode 100644 index 0000000..5a9963b --- /dev/null +++ b/BlobTag.h @@ -0,0 +1,23 @@ +/** + * © 2008 by David Roden + */ + +#pragma once + +#include "Tag.h" + +class BlobTag: public Tag { + +public: + BlobTag(int id, void* value, int length); + ~BlobTag(); + + int getSize(); + void* getValue(); + +private: + int length; + void* value; + +}; + -- 2.7.4