]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/ArrayType.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / ArrayType.cpp
1 #include "ArrayType.h"
2
3 #include "Range.h"
4
5 namespace Databoard {
6         namespace Type {
7
8                 ArrayType::ArrayType()
9                 {
10                         this->componentType = NULL;
11                         this->length = NULL;
12                 }
13
14                 ArrayType::ArrayType(DataType* componentType)
15                 {
16                         this->componentType = componentType;
17                         this->length = NULL;
18                 }
19
20                 ArrayType::ArrayType(DataType* componentType, Range* length)
21                 {
22                         this->componentType = componentType;
23                         this->length = length;
24                 }
25
26                 ArrayType::~ArrayType()
27                 {
28                         if(componentType != NULL)
29                         {
30                                 delete componentType;
31                         }
32
33                         if(length != NULL)
34                         {
35                                 delete length;
36                         }
37                 }
38
39                 DataType* ArrayType::getComponentType()
40                 {
41                         return componentType;
42                 }
43
44                 void ArrayType::setComponentType(DataType* componentType)
45                 {
46                         this->componentType = componentType;
47
48                         if(componentType->getNotBuiltIn() == true)
49                         {
50                                 notBuiltIn = true;
51                         }
52                 }
53
54                 int ArrayType::minLength()
55                 {
56                         if(length == NULL) return 0;
57
58                         return 0;//length->getLower();
59                 }
60
61                 int ArrayType::maxLength()
62                 {
63                         if(length == NULL) return INT_MAX;
64
65                         return 0;//length->Upper();
66                 }
67
68                 Range* ArrayType::getLength()
69                 {
70                         return length;
71                 }
72
73                 void ArrayType::setLength(Range* length)
74                 {
75                         this->length = length;
76                 }
77
78                 std::string ArrayType::writeOut(int /*indent*/)
79                 {
80                         std::string s;
81
82                         s += componentType->writeOut();
83
84                         if(length != NULL)
85                         {
86                                 s += length->writeOut();
87                         }
88
89                         return s;
90                 }
91         }
92 }