-
Notifications
You must be signed in to change notification settings - Fork 0
/
BugClass.cpp
98 lines (87 loc) · 1.59 KB
/
BugClass.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
96
97
98
#include "BugClass.h"
#include <algorithm>
std::string Bug::getPriority() const
{
std::string res = "MEDIUM";
switch (_priority)
{
case BugPriority::HIGH:
res = "HIGH";
break;
case BugPriority::MEDIUM:
res = "MEDIUM";
break;
case BugPriority::LOW:
res = "LOW";
break;
default:
res = "MEDIUM";
break;
}
return res;
}
std::string Bug::getStatus() const
{
std::string res = "Unassigned";
switch (_status)
{
case BugStatus::UNASSIGNED:
res = "Unassigned";
break;
case BugStatus::IN_PROGRESS:
res = "In progress";
break;
case BugStatus::FIXED:
res = "Fixed";
break;
case BugStatus::UPDATED:
res = "Updated";
break;
default:
res = "Unassigned";
break;
}
return res;
}
void Bug::setPriority(std::string priority)
{
std::transform(priority.begin(), priority.end(), priority.begin(),
[](unsigned char c) { return std::tolower(c); });
if (priority == "high")
{
this->_priority = BugPriority::HIGH;
}
else if (priority == "medium")
{
this->_priority = BugPriority::MEDIUM;
}
else if (priority == "low")
{
this->_priority = BugPriority::LOW;
}
else
{
this->_priority = BugPriority::MEDIUM;
}
}
void Bug::setStatus(std::string status)
{
std::transform(status.begin(), status.end(), status.begin(),
[](unsigned char c) { return std::tolower(c); });
if (status == "unassigned")
{
this->_status = BugStatus::UNASSIGNED;
}
else if (status == "in progress")
{
this->_status = BugStatus::IN_PROGRESS;
}
else if (status == "fixed")
{
this->_status = BugStatus::FIXED;
}
else if (status == "updated")
{
this->_status = BugStatus::UPDATED;
}
}