-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuser.cpp
57 lines (45 loc) · 1.28 KB
/
user.cpp
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
#include "user.h"
User::User(const string& userName) : userName(userName) {
}
void User::create() {
makeDir("user/" + userName);
string prefix = "./user/" + userName + "/";
ofstream ofs;
ofs.open((prefix + "basic.dat").c_str());
ofs << "*all* {\n@timestamp@0.\n@level@50.\n@selectstrategy@-1.\n@formstrategy@0.\n}";
ofs.close();
ofs.clear();
ofs.open((prefix + "progress.dat").c_str());
ofs.close();
ofs.clear();
ofs.open((prefix + "sentences.dat").c_str());
ofs.close();
ofs.clear();
ofs.open((prefix + "history.dat").c_str());
ofs.close();
ofs.clear();
ofs.open((prefix + "mastered.dat").c_str());
ofs.close();
ofs.clear();
ofs.open((prefix + "stats.dat").c_str());
for (int i = 0; i < DIFFI_NUM; ++i) {
ofs << "*" << i << "* {\n@total@0.\n@known@0.\n}\n";
}
ofs.close();
ofs.clear();
ifstream ifs;
for (int i = 0; i < DIFFI_NUM; ++i) {
ifs.open(("vocabulary/" + str::intToStr(i) + ".dat").c_str());
ofs.open((prefix + str::intToStr(i) + ".dat").c_str());
ofs << ifs.rdbuf();
ifs.close();
ofs.close();
ifs.clear();
ofs.clear();
FileStrBridge* fsb = new FileStrBridge(prefix + str::intToStr(i) + ".dat");
SimpleInfo* voc = new SimpleInfo(fsb);
voc->shuffle();
delete voc;
delete fsb;
}
}