-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDB.h
78 lines (53 loc) · 1.24 KB
/
DB.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef DB_H
#define DB_H
#include"sqlite3/sqlite3.h"
#include"nlohmann/json.hpp"
#include<fstream>
#include"Character.h"
#include"stdafx.h"
#include<iomanip>
#include<list>
using json = nlohmann::json;
namespace db {
typedef struct User {
std::string name;
float pointX;
float pointY;
float money = 0.0f;
std::vector<screen::Stock> stock;
unsigned int hp;
unsigned int level;
float exp;
unsigned int damage;
unsigned int armor;
float step;
std::string jobName;
std::string kindOfField;
int rate;
int jobLevel;
float jobExp;
std::vector<items::Items> items;
std::vector<equipments::Equipments> equipments;
}User;
class DB {
private:
json data;
void load();
/*
* º¤Åͱ¸Á¶Ã¼ °¡Á®¿Ã¶§
auto parsed = json.get<std::vector<Test>>();
*/
void fromJsonStock(std::string structName, screen::Stock& stock);
void fromJsonItem(std::string structName, items::Items& item);
void fromJsonEquipments(std::string structName, equipments::Equipments& equipment);
public:
User user;
character::Character character;
void setCharacter(character::Character& character);
void read(std::string fileName);
void serialization();
void deserialization();
void write();
};
}
#endif //DB_H