From 4b9bb2ab4894c52f60baba3273c27948ad022292 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 20 Jul 2018 23:09:33 +0200 Subject: Add Tag print functions and nbtdump tool --- src/NBT/IntArrayTag.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/NBT/IntArrayTag.hpp') diff --git a/src/NBT/IntArrayTag.hpp b/src/NBT/IntArrayTag.hpp index 22f84b2..5fdd3fc 100644 --- a/src/NBT/IntArrayTag.hpp +++ b/src/NBT/IntArrayTag.hpp @@ -50,6 +50,24 @@ public: virtual Type getType() const { return Type::IntArray; } + + 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++) { + uint32_t v = Buffer::parse32(&ptr[4*i]); + + os << inner + << v << " / " + << (int32_t)v << " / " + << std::hex << "0x" << v << std::dec + << std::endl; + } + + os << indent << "]"; + } }; } -- cgit v1.2.3