add hash tag
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 6 Jul 2008 10:08:46 +0000 (12:08 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 6 Jul 2008 10:08:46 +0000 (12:08 +0200)
HashTag.cpp [new file with mode: 0644]
HashTag.h [new file with mode: 0644]
Makefile

diff --git a/HashTag.cpp b/HashTag.cpp
new file mode 100644 (file)
index 0000000..f6fd7fa
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * © 2008 by David ‘Bombe’ Roden <bombe@pterodactylus.net>
+ */
+
+#include "HashTag.h"
+
+#include <string.h>
+
+HashTag::HashTag(const char* hash): Tag(Hash, 0) {
+       memcpy(this->hash, hash, 16);
+}
+
+int HashTag::getSize() {
+       return 16;
+}
+
+void* HashTag::getValue() {
+       return hash;
+}
+
diff --git a/HashTag.h b/HashTag.h
new file mode 100644 (file)
index 0000000..abcf98b
--- /dev/null
+++ b/HashTag.h
@@ -0,0 +1,21 @@
+/**
+ * © 2008 by David ‘Bombe’ Roden <bombe@pterodactylus.net>
+ */
+
+#pragma once
+
+#include "Tag.h"
+
+class HashTag: public Tag {
+
+public:
+       HashTag(const char* hash);
+
+       int getSize();
+       void* getValue();
+
+private:
+       char hash[16];
+
+};
+
index b7fda71..60d0734 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ endif
 
 all: ecparse
 
-ecparse: Tag.o BlobTag.o StringTag.o GlobalSettings.o GrowingBuffer.o ED2KLink.o ReaderInput.o FileReaderInput.o CollectionReader.o Main.o
+ecparse: Tag.o HashTag.o BlobTag.o StringTag.o GlobalSettings.o GrowingBuffer.o ED2KLink.o ReaderInput.o FileReaderInput.o CollectionReader.o Main.o
        $(CC) -o $@ $^ 
 
 GlobalSettings.o: GlobalSettings.cpp GlobalSettings.h
@@ -29,7 +29,9 @@ StringTag.o: StringTag.cpp StringTag.h Tag.h TagType.h
 
 BlobTag.o: BlobTag.cpp BlobTag.h Tag.h TagType.h
 
-CollectionReader.o: CollectionReader.cpp ReaderInput.h ED2KLink.h GrowingBuffer.h GlobalSettings.h Tag.h TagType.h StringTag.h BlobTag.h
+HashTag.o: HashTag.cpp HashTag.h Tag.h
+
+CollectionReader.o: CollectionReader.cpp ReaderInput.h ED2KLink.h GrowingBuffer.h GlobalSettings.h Tag.h TagType.h StringTag.h BlobTag.h HashTag.h
 
 ED2KLink.o: ED2KLink.cpp ED2KLink.h GlobalSettings.h