From a85fd8bcf45ec7f4238e7e997d54e19756e564fc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 22 Jul 2018 16:55:31 +0200 Subject: NBT: String: add data accessor --- src/NBT/StringTag.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/NBT') diff --git a/src/NBT/StringTag.hpp b/src/NBT/StringTag.hpp index 8672b73..6fb2b41 100644 --- a/src/NBT/StringTag.hpp +++ b/src/NBT/StringTag.hpp @@ -50,8 +50,12 @@ public: return Type; } + std::string getValue() const { + return std::string(reinterpret_cast(ptr), len); + } + virtual void print(std::ostream& os, const std::string &) const { - os << "\"" << std::string(reinterpret_cast(ptr), len) << "\""; + os << "\"" << getValue() << "\""; } }; -- cgit v1.2.3