]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/MapType.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / MapType.cpp
1 #include "MapType.h"
2
3 namespace Databoard {
4         namespace Type {
5
6                 MapType::MapType()
7                 {
8                         keyType = NULL;
9                         valueType = NULL;
10                 }
11
12                 MapType::MapType(DataType* keyType, DataType* valueType)
13                 {
14                         this->keyType = keyType;
15                         this->valueType = valueType;
16                 }
17
18                 MapType::~MapType()
19                 {
20                         if(keyType != NULL)
21                         {
22                                 delete keyType;
23                         }
24
25                         if(valueType != NULL)
26                         {
27                                 delete valueType;
28                         }
29                 }
30
31                 DataType* MapType::getKeyType()
32                 {
33                         return keyType;
34                 }
35
36                 DataType* MapType::getValueType()
37                 {
38                         return valueType;
39                 }
40
41                 void MapType::setKeyType(DataType* keyType)
42                 {
43                         this->keyType = keyType;
44                 }
45
46                 void MapType::setValueType(DataType* valueType)
47                 {
48                         this->valueType = valueType;
49                 }
50
51                 std::string MapType::writeOut(int /*indent*/)
52                 {
53                         std::string s;
54
55                         s.append("Map");
56
57                         s += "(";
58                         s += keyType->writeOut();
59                         s += ", ";
60                         s += valueType->writeOut();
61                         s += ")";
62
63                         return s;
64                 }
65         }
66 }