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/Tag.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/NBT/Tag.hpp') diff --git a/src/NBT/Tag.hpp b/src/NBT/Tag.hpp index a3c0c76..bb71b23 100644 --- a/src/NBT/Tag.hpp +++ b/src/NBT/Tag.hpp @@ -60,11 +60,18 @@ public: static std::pair> readNamedTag(Buffer *buffer); virtual Type getType() const = 0; + virtual void print(std::ostream& os, const std::string &indent) const = 0; virtual ~Tag() {} }; std::ostream& operator<<(std::ostream& os, Tag::Type type); +static inline std::ostream& operator<<(std::ostream& os, const Tag &tag) { + os << tag.getType() << " "; + tag.print(os, ""); + return os; +} + } } -- cgit v1.2.3