-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.cpp
67 lines (60 loc) · 1.05 KB
/
utils.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
#include "utils.h"
double popAndTop(std::stack<double> &stackInput)
{
if(!stackInput.empty())
{
double data = stackInput.top();
stackInput.pop();
return data;
}
else
{
// todo error no items in stack
return 0;
}
}
double charToInt(char symbol)
{
return symbol - '0';
}
std::string charToStr(char symbol)
{
std::string string(1, symbol);
return string;
}
void removeSpaces(QString& str)
{
str.remove(" ");
}
Qt::GlobalColor getColor(int numColor)
{
if (numColor > 9)
{
numColor %= 10;
}
switch(numColor)
{
case 0:
return Qt::red;
case 1:
return Qt::blue;
case 2:
return Qt::darkGreen;
case 3:
return Qt::black;
case 4:
return Qt::darkYellow;
case 5:
return Qt::darkRed;
case 6:
return Qt::darkBlue;
case 7:
return Qt::darkCyan;
case 8:
return Qt::magenta;
case 9:
return Qt::darkMagenta;
default:
return Qt::black;
}
}