aboutsummaryrefslogtreecommitdiff
path: root/doc/minetest.6
Commit message (Expand)AuthorAge
* Add server side ncurses terminalest312015-11-06
* Clean up and tweak build systemShadowNinja2015-03-27
* Fix hyphen used as minus signMarkus Koschany2015-01-20
* Search for subgames using $MINETEST_SUBGAME_PATH.David Thompson2014-10-22
* Add --version optionKahrl2013-09-28
* Add --migrate to manpages and update manpage datesKahrl2013-09-10
* Replace c55.me linksKahrl2013-06-03
* Add --videomodes option to show available video modesKahrl2013-05-09
* Fix hypen used as minus sign (manpages), fix spelling error (server.cpp)Ilya Zhuravlev2012-12-17
* Add output levels --info and --trace (--verbose is now more verbose)Perttu Ahola2012-03-22
* Update --gameid to manpagesPerttu Ahola2012-03-11
* Improve command-line parametersPerttu Ahola2012-03-11
* Add UNIX man pages to aid package creators.Juhani Numminen2012-02-28
ite to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include <string> #include <iostream> #include <set> #include <unordered_map> #include "irrlichttypes_bloated.h" typedef std::unordered_map<u16, std::string> IdToNameMap; typedef std::unordered_map<std::string, u16> NameToIdMap; class NameIdMapping { public: void serialize(std::ostream &os) const; void deSerialize(std::istream &is); void clear() { m_id_to_name.clear(); m_name_to_id.clear(); } void set(u16 id, const std::string &name) { m_id_to_name[id] = name; m_name_to_id[name] = id; } void removeId(u16 id) { std::string name; bool found = getName(id, name); if (!found) return; m_id_to_name.erase(id); m_name_to_id.erase(name); } void eraseName(const std::string &name) { u16 id; bool found = getId(name, id); if (!found) return; m_id_to_name.erase(id); m_name_to_id.erase(name); } bool getName(u16 id, std::string &result) const { IdToNameMap::const_iterator i; i = m_id_to_name.find(id); if (i == m_id_to_name.end()) return false; result = i->second; return true; } bool getId(const std::string &name, u16 &result) const { NameToIdMap::const_iterator i; i = m_name_to_id.find(name); if (i == m_name_to_id.end()) return false; result = i->second; return true; } u16 size() const { return m_id_to_name.size(); } private: IdToNameMap m_id_to_name; NameToIdMap m_name_to_id; };