From: David ‘Bombe’ Roden Date: Sun, 6 Jul 2008 09:30:36 +0000 (+0200) Subject: add blob tag X-Git-Tag: 0.1~12 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e9bd547c31bc06fac87b49cafa624c03c2d50c91;p=ecparse.git add blob tag --- 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; + +}; +