From 91615f9588420fd716978552fdacf1323b8df11c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 6 Apr 2018 09:52:29 +0100 Subject: Add player:get_meta(), deprecate player attributes (#7202) * Add player:get_meta(), deprecate player attributes --- src/metadata.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/metadata.h') diff --git a/src/metadata.h b/src/metadata.h index d95a0ed5d..5333f8a9d 100644 --- a/src/metadata.h +++ b/src/metadata.h @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., class Metadata { + bool m_modified = false; public: virtual ~Metadata() = default; @@ -45,14 +46,18 @@ public: size_t size() const; bool contains(const std::string &name) const; const std::string &getString(const std::string &name, u16 recursion = 0) const; + bool getStringToRef(const std::string &name, std::string &str, u16 recursion = 0) const; virtual bool setString(const std::string &name, const std::string &var); + inline bool removeString(const std::string &name) { return setString(name, ""); } const StringMap &getStrings() const { return m_stringvars; } // Add support for variable names in values const std::string &resolveString(const std::string &str, u16 recursion = 0) const; + + inline bool isModified() const { return m_modified; } + inline void setModified(bool v) { m_modified = v; } protected: StringMap m_stringvars; - }; -- cgit v1.2.3