]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/VariantValue.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / VariantValue.cpp
1 #include "VariantValue.h"
2
3 #include "Constants.h"
4
5 #include "DataType.h"
6
7 namespace Databoard {
8         namespace Value {
9                 VariantValue::VariantValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)
10                 {
11                         value = NULL;
12                 }
13
14                 VariantValue::~VariantValue()
15                 {
16                         if(value != NULL)
17                         {
18                                 value->freeType();
19
20                                 delete value;
21                                 value = 0;
22                         }
23                 }
24
25                 void VariantValue::setValue(Value* value)
26                 {
27                         this->value = value;
28                 }
29
30                 Value* VariantValue::getValue()
31                 {
32                         return value;
33                 }
34
35                 std::string VariantValue::writeOut(int /*indent*/)
36                 {
37                         std::string s;
38
39                         if(value != NULL)
40                         {
41                                 s += value->writeOut();
42
43                                 s += " : ";
44
45                                 s += value->type()->writeOut();
46
47                         }
48
49                         return s;
50                 }
51
52                 std::string VariantValue::isValid()
53                 {
54                         std::string retValue = STR_EMPTY;
55
56                         return retValue;
57                 }
58
59                 bool VariantValue::equals(const Value* other)
60                 {
61                         VariantValue* o = (VariantValue*)other;
62
63
64
65                         return (this->value < o->value);
66
67                 }
68         }
69 }