summaryrefslogtreecommitdiffstats
path: root/src/NBT/CompoundTag.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-07-21 18:07:45 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-07-21 18:11:59 +0200
commitf1f783877f0f8338a225244faff4e40efe10a4ce (patch)
treee071d5df7024fbc3c72713517672f217096ea47f /src/NBT/CompoundTag.hpp
parent315bb38444b8e363b4d8f2702d45d42fa585f619 (diff)
downloadMinedMap-f1f783877f0f8338a225244faff4e40efe10a4ce.tar
MinedMap-f1f783877f0f8338a225244faff4e40efe10a4ce.zip
NBT: rework type system
Diffstat (limited to 'src/NBT/CompoundTag.hpp')
-rw-r--r--src/NBT/CompoundTag.hpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/NBT/CompoundTag.hpp b/src/NBT/CompoundTag.hpp
index 310b995..68e2390 100644
--- a/src/NBT/CompoundTag.hpp
+++ b/src/NBT/CompoundTag.hpp
@@ -26,6 +26,7 @@
#pragma once
+#include "EndTag.hpp"
#include "Tag.hpp"
#include <string>
@@ -37,18 +38,21 @@ namespace NBT {
class CompoundTag : public Tag, public std::unordered_map<std::string, std::shared_ptr<const Tag>> {
public:
+ static const MakeType<CompoundTag> Type;
+
+
CompoundTag(Buffer *buffer) {
while (true) {
std::pair<std::string, std::shared_ptr<const Tag>> v = Tag::readNamedTag(buffer);
- if (v.second->getType() == Type::End)
+ if (v.second->getType() == EndTag::Type)
break;
insert(std::move(v));
}
}
- virtual Type getType() const {
- return Type::Compound;
+ virtual const TagType & getType() const {
+ return Type;
}
virtual void print(std::ostream& os, const std::string &indent) const {