-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdbtables.hpp
51 lines (37 loc) · 872 Bytes
/
dbtables.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef DBTABLES_HPP
#define DBTABLES_HPP
#include <string>
#include <unordered_map>
namespace SMSDB {
class DBTables;
}
class SMSDB::DBTables
{
public:
enum class TableName : unsigned char {
Categories,
SubCategories,
Messages
};
private:
template <typename _T>
struct Hasher
{
std::size_t operator()(const _T &t) const
{
return std::hash<unsigned char>()(static_cast<unsigned char>(t));
}
};
private:
std::unordered_map<TableName, std::string, Hasher<TableName>> m_tablesHash;
std::unordered_map<TableName, std::string, Hasher<TableName>> m_fieldsHash;
public:
static void InitTables();
public:
explicit DBTables();
std::string Table(TableName id);
std::string Fields(TableName id);
private:
void InitHashes();
};
#endif /* DBTABLES_HPP */