Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
database-dummy.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include <map>
8#include <set>
9#include <string>
10#include "database.h"
11#include "irrlichttypes.h"
12
14{
15public:
16 bool saveBlock(const v3s16 &pos, std::string_view data);
17 void loadBlock(const v3s16 &pos, std::string *block);
18 bool deleteBlock(const v3s16 &pos);
19 void listAllLoadableBlocks(std::vector<v3s16> &dst);
20
21 void savePlayer(RemotePlayer *player);
22 bool loadPlayer(RemotePlayer *player, PlayerSAO *sao);
23 bool removePlayer(const std::string &name);
24 void listPlayers(std::vector<std::string> &res);
25
26 void getModEntries(const std::string &modname, StringMap *storage);
27 void getModKeys(const std::string &modname, std::vector<std::string> *storage);
28 bool getModEntry(const std::string &modname,
29 const std::string &key, std::string *value);
30 bool hasModEntry(const std::string &modname, const std::string &key);
31 bool setModEntry(const std::string &modname,
32 const std::string &key,std::string_view value);
33 bool removeModEntry(const std::string &modname, const std::string &key);
34 bool removeModEntries(const std::string &modname);
35 void listMods(std::vector<std::string> *res);
36
37 void beginSave() {}
38 void endSave() {}
39
40private:
41 std::map<s64, std::string> m_database;
42 std::set<std::string> m_player_database;
43 std::unordered_map<std::string, StringMap> m_mod_storage_database;
44};
Definition database-dummy.h:14
std::map< s64, std::string > m_database
Definition database-dummy.h:41
bool saveBlock(const v3s16 &pos, std::string_view data)
Definition database-dummy.cpp:13
bool hasModEntry(const std::string &modname, const std::string &key)
Definition database-dummy.cpp:105
void savePlayer(RemotePlayer *player)
Definition database-dummy.cpp:46
void getModKeys(const std::string &modname, std::vector< std::string > *storage)
Definition database-dummy.cpp:79
void listPlayers(std::vector< std::string > &res)
Definition database-dummy.cpp:62
void listMods(std::vector< std::string > *res)
Definition database-dummy.cpp:146
std::set< std::string > m_player_database
Definition database-dummy.h:42
void listAllLoadableBlocks(std::vector< v3s16 > &dst)
Definition database-dummy.cpp:37
bool setModEntry(const std::string &modname, const std::string &key, std::string_view value)
Definition database-dummy.cpp:115
bool deleteBlock(const v3s16 &pos)
Definition database-dummy.cpp:31
void getModEntries(const std::string &modname, StringMap *storage)
Definition database-dummy.cpp:69
void endSave()
Definition database-dummy.h:38
void loadBlock(const v3s16 &pos, std::string *block)
Definition database-dummy.cpp:19
bool removeModEntries(const std::string &modname)
Definition database-dummy.cpp:136
bool loadPlayer(RemotePlayer *player, PlayerSAO *sao)
Definition database-dummy.cpp:51
void beginSave()
Definition database-dummy.h:37
bool getModEntry(const std::string &modname, const std::string &key, std::string *value)
Definition database-dummy.cpp:89
bool removePlayer(const std::string &name)
Definition database-dummy.cpp:56
std::unordered_map< std::string, StringMap > m_mod_storage_database
Definition database-dummy.h:43
bool removeModEntry(const std::string &modname, const std::string &key)
Definition database-dummy.cpp:128
Definition database.h:23
Definition database.h:74
Definition database.h:41
Definition player_sao.h:56
Definition remoteplayer.h:26
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
std::unordered_map< std::string, std::string > StringMap
Definition string.h:65