summaryrefslogtreecommitdiffstats
path: root/src/NBT/ByteArrayTag.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-07-20 23:09:33 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-07-20 23:49:50 +0200
commit4b9bb2ab4894c52f60baba3273c27948ad022292 (patch)
tree1bbe847b339fb3f332fd79e4f0b045d64717f2e1 /src/NBT/ByteArrayTag.hpp
parent64f81ff50c3e221351c0b50a65c2d0b5289b4edf (diff)
downloadMinedMap-4b9bb2ab4894c52f60baba3273c27948ad022292.tar
MinedMap-4b9bb2ab4894c52f60baba3273c27948ad022292.zip
Add Tag print functions and nbtdump tool
Diffstat (limited to 'src/NBT/ByteArrayTag.hpp')
-rw-r--r--src/NBT/ByteArrayTag.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/NBT/ByteArrayTag.hpp b/src/NBT/ByteArrayTag.hpp
index 0e56a9a..36d9fe7 100644
--- a/src/NBT/ByteArrayTag.hpp
+++ b/src/NBT/ByteArrayTag.hpp
@@ -51,6 +51,24 @@ public:
return Type::ByteArray;
}
+ virtual void print(std::ostream& os, const std::string &indent) const {
+ os << "(" << len << ") [" << std::endl;
+
+ std::string inner = indent + " ";
+
+ for (size_t i = 0; i < len; i++) {
+ uint8_t v = value[i];
+
+ os << inner
+ << (unsigned)v << " / "
+ << (int)(int8_t)v << " / "
+ << std::hex << "0x" << (unsigned)v << std::dec
+ << std::endl;
+ }
+
+ os << indent << "]";
+ }
+
uint32_t getLength() const {
return len;
}