diff --git a/src/nbt/NBT.cpp b/src/nbt/NBT.cpp index 218faef..8aa86a4 100644 --- a/src/nbt/NBT.cpp +++ b/src/nbt/NBT.cpp @@ -137,6 +137,11 @@ namespace NBT return nbt_dump_ascii(m_node); } + Tag::operator bool() const + { + return m_node != NULL && m_node->type != TAG_INVALID; + } + std::ostream& operator<<(std::ostream& stream, const Tag& tag) { return stream << tag.ToString(); diff --git a/src/nbt/NBT.h b/src/nbt/NBT.h index a925798..f937407 100644 --- a/src/nbt/NBT.h +++ b/src/nbt/NBT.h @@ -45,6 +45,8 @@ namespace NBT const DataBuffer GetData() const; const char* ToString() const; + + operator bool() const; }; // Operator overload for ostream