]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/IntegerType.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / IntegerType.cpp
1 #include "IntegerType.h"
2
3 #include "Range.h"
4 #include "Limit.h"
5
6 namespace Databoard {
7         namespace Type {
8
9                 IntegerType::IntegerType() : NumberType()
10                 {
11                         this->unit = unit;
12                         this->range = NULL;
13                 }
14
15                 IntegerType::IntegerType(std::string unit) : NumberType(unit)
16                 {
17                         this->unit = unit;
18                         this->range = NULL;
19                 }
20
21                 IntegerType::IntegerType(std::string unit, Range* range) : NumberType(unit, range)
22                 {
23                         this->unit = unit;
24                         this->range = range;
25                 }
26
27                 IntegerType::~IntegerType()
28                 {
29                 }
30
31                 int IntegerType::minValue()
32                 {
33                         if(range == NULL) return INT_MIN;
34
35                         Limit* l = range->getLower();
36
37                         int value = l->getInteger(INT_MIN);
38
39                         return value;
40                 }
41
42                 int IntegerType::maxValue()
43                 {
44                         if(range == NULL) return INT_MAX;
45
46                         Limit* l = range->getUpper();
47
48                         int value = l->getInteger(INT_MAX);
49
50                         return value;
51                 }
52
53                 std::string IntegerType::writeOut(int indent)
54                 {
55                         std::string s;
56
57                         s.append("Integer");
58
59                         s += NumberType::writeOut(indent + 1);
60
61                         return s;
62                 }
63         }
64 }