Skip to content

Commit

Permalink
Added virtual destructors to ABCs
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlegiantJGC committed Jul 15, 2024
1 parent 1343cd9 commit ae7d90f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,30 @@ namespace Amulet {

class AbstractBaseTag {
public:
virtual ~AbstractBaseTag() = default;
virtual std::string to_nbt(std::string, std::endian, Amulet::StringEncode) const = 0;
virtual std::string to_snbt() const = 0;
virtual std::string to_snbt(const std::string& indent) const = 0;
};

class AbstractBaseImmutableTag: public AbstractBaseTag {};
class AbstractBaseMutableTag: public AbstractBaseTag {};
class AbstractBaseNumericTag: public AbstractBaseImmutableTag {};
class AbstractBaseIntTag: public AbstractBaseNumericTag {};
class AbstractBaseFloatTag: public AbstractBaseNumericTag {};
class AbstractBaseArrayTag: public AbstractBaseMutableTag {};
class AbstractBaseImmutableTag: public AbstractBaseTag {
virtual ~AbstractBaseImmutableTag() = default;
};
class AbstractBaseMutableTag: public AbstractBaseTag {
virtual ~AbstractBaseMutableTag() = default;
};
class AbstractBaseNumericTag: public AbstractBaseImmutableTag {
virtual ~AbstractBaseNumericTag() = default;
};
class AbstractBaseIntTag: public AbstractBaseNumericTag {
virtual ~AbstractBaseIntTag() = default;
};
class AbstractBaseFloatTag: public AbstractBaseNumericTag {
virtual ~AbstractBaseFloatTag() = default;
};
class AbstractBaseArrayTag: public AbstractBaseMutableTag {
virtual ~AbstractBaseArrayTag() = default;
};

// pybind cannot directly store fundamental types
// This wrapper exists to allow pybind to store fundamental types
Expand Down

0 comments on commit ae7d90f

Please sign in to comment.