-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChartsBase.cpp
56 lines (51 loc) · 1.04 KB
/
ChartsBase.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
#include "ChartsBase.hpp"
Type* Type::createFromCppName(std::string type)
{
if (type == "void" || type == "") {
return nullptr;
} else if (type == "int") {
return new PrimitiveType(PrimitiveType::Integer);
} else if (type == "float") {
return new PrimitiveType(PrimitiveType::Float);
} else if (type == "bool") {
return new PrimitiveType(PrimitiveType::Boolean);
} else if (type == "std::string" || type == "QString") {
return new PrimitiveType(PrimitiveType::Text);
} else if (type == "char") {
return new PrimitiveType(PrimitiveType::Character);
} else {
return new ClassType(type);
}
}
ClassType::ClassType(std::string name)
: name(name)
{
}
std::string ClassType::umlName()
{
return name;
}
PrimitiveType::PrimitiveType(TypeEnum typeEnum)
: typeEnum(typeEnum)
{
}
std::string PrimitiveType::umlName()
{
switch (typeEnum) {
case Integer: {
return "GZ";
}
case Float: {
return "FKZ";
}
case Boolean: {
return "Boolean";
}
case Text: {
return "Text";
}
case Character: {
return "Zeichen";
}
}
}