forked from ZXCroon/Wordable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic.cpp
executable file
·95 lines (78 loc) · 1.74 KB
/
basic.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "basic.h"
Basic::Basic(FileStrBridge* fsb) :
ComplexInfo(fsb, "all", true) {
construct();
}
Basic::~Basic() {
destruct();
}
void Basic::transStrToProp(const string& infoStr) {
int lp, rp;
lp = infoStr.find("@timestamp@");
if (lp == string::npos) {
timestamp = 0;
}
else {
lp += 11;
rp = infoStr.find(".", lp) - 1;
timestamp = str::strToInt(infoStr.substr(lp, rp - lp + 1));
}
lp = infoStr.find("@level@");
if (lp == string::npos) {
level = 0;
}
else {
lp += 7;
rp = infoStr.find(".", lp) - 1;
level = str::strToInt(infoStr.substr(lp, rp - lp + 1));
}
lp = infoStr.find("@selectstrategy@");
if (lp == string::npos) {
sstraNum = -1;
}
else {
lp += 16;
rp = infoStr.find(".", lp) - 1;
sstraNum = str::strToInt(infoStr.substr(lp, rp - lp + 1));
}
lp = infoStr.find("@formstrategy@");
if (lp == string::npos) {
sstraNum = 0;
}
else {
lp += 14;
rp = infoStr.find(".", lp) - 1;
fstraNum = str::strToInt(infoStr.substr(lp, rp - lp + 1));
}
}
string Basic::transPropToStr() {
string res = "@timestamp@" + str::intToStr(timestamp) + ".\n";
res += "@level@" + str::intToStr(level) + ".\n";
res += "@selectstrategy@" + str::intToStr(sstraNum) + ".\n";
res += "@formstrategy@" + str::intToStr(fstraNum) + ".\n";
return res;
}
int Basic::getTimestamp() {
return timestamp;
}
int Basic::getLevel() {
return level;
}
int Basic::getSelectStrategy() {
return sstraNum;
}
int Basic::getFormStrategy() {
return fstraNum;
}
void Basic::setTimestamp(int ts) {
timestamp = ts;
}
void Basic::setLevel(int le) {
level = le;
}
void Basic::setSelectStrategy(int ss) {
sstraNum = ss;
}
void Basic::setFormStrategy(int fs) {
fstraNum = fs;
}