]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/OptionalType.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / OptionalType.cpp
1 #include "OptionalType.h"
2
3 namespace Databoard {
4         namespace Type {
5
6                 OptionalType::OptionalType()
7                 {
8                         componentType = NULL;
9                 }
10
11                 OptionalType::OptionalType(DataType* componentType)
12                 {
13                         this->componentType = componentType;
14                 }
15
16                 OptionalType::~OptionalType()
17                 {
18                         if(componentType != NULL)
19                         {
20                                 delete componentType;
21                         }
22                 }
23
24                 DataType* OptionalType::getComponentType()
25                 {
26                         return componentType;
27                 }
28
29                 void OptionalType::setComponentType(DataType* componentType)
30                 {
31                         this->componentType = componentType;
32                 }
33
34                 std::string OptionalType::writeOut(int /*indent*/)
35                 {
36                         std::string s;
37
38                         s.append("Optional");
39
40                         s += "(";
41
42                         if(componentType != NULL)
43                         {
44                                 s += componentType->writeOut();
45                         }
46
47                         s += ")";
48
49                         return s;
50                 }
51         }
52 }