X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fnodemetadata.h;h=6baf3b3d37bf3808bedab05e768c6472ccaaed13;hb=55c646c5c2b40931d24be8541b3056ab3322a70f;hp=ce2c9e6d9f0e9aaf81309f8c567a03d62a26dd26;hpb=4e1f50035e860a00636ca5d804c267119df99601;p=oweals%2Fminetest.git diff --git a/src/nodemetadata.h b/src/nodemetadata.h index ce2c9e6d9..6baf3b3d3 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -49,28 +49,10 @@ public: void clear(); // Generic key/value store - std::string getString(const std::string &name) const - { - std::map::const_iterator i; - i = m_stringvars.find(name); - if(i == m_stringvars.end()) - return ""; - return resolveString(i->second); - } - void setString(const std::string &name, const std::string &var) - { - if(var.empty()) - m_stringvars.erase(name); - else - m_stringvars[name] = var; - } - // support variable names in values - std::string resolveString(const std::string &str) const - { - if(str.substr(0,2) == "${" && str[str.length()-1] == '}') - return resolveString(getString(str.substr(2,str.length()-3))); - return str; - } + std::string getString(const std::string &name, unsigned short recursion = 0) const; + void setString(const std::string &name, const std::string &var); + // Support variable names in values + std::string resolveString(const std::string &str, unsigned short recursion = 0) const; std::map getStrings() const { return m_stringvars;