database-dummy.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Minetest
  3. Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. #include <map>
  18. #include <string>
  19. #include "database.h"
  20. #include "irrlichttypes.h"
  21. class Database_Dummy : public MapDatabase, public PlayerDatabase, public ModMetadataDatabase
  22. {
  23. public:
  24. bool saveBlock(const v3s16 &pos, const std::string &data);
  25. void loadBlock(const v3s16 &pos, std::string *block);
  26. bool deleteBlock(const v3s16 &pos);
  27. void listAllLoadableBlocks(std::vector<v3s16> &dst);
  28. void savePlayer(RemotePlayer *player);
  29. bool loadPlayer(RemotePlayer *player, PlayerSAO *sao);
  30. bool removePlayer(const std::string &name);
  31. void listPlayers(std::vector<std::string> &res);
  32. bool getModEntries(const std::string &modname, StringMap *storage);
  33. bool getModEntry(const std::string &modname,
  34. const std::string &key, std::string *value);
  35. bool hasModEntry(const std::string &modname, const std::string &key);
  36. bool setModEntry(const std::string &modname,
  37. const std::string &key, const std::string &value);
  38. bool removeModEntry(const std::string &modname, const std::string &key);
  39. bool removeModEntries(const std::string &modname);
  40. void listMods(std::vector<std::string> *res);
  41. void beginSave() {}
  42. void endSave() {}
  43. private:
  44. std::map<s64, std::string> m_database;
  45. std::set<std::string> m_player_database;
  46. std::unordered_map<std::string, StringMap> m_mod_meta_database;
  47. };