X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FArrayType.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FArrayType.cpp;h=0209ce4e3c1e031a041bdd15d635e10b907c5828;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/ArrayType.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/ArrayType.cpp new file mode 100644 index 000000000..0209ce4e3 --- /dev/null +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/ArrayType.cpp @@ -0,0 +1,92 @@ +#include "ArrayType.h" + +#include "Range.h" + +namespace Databoard { + namespace Type { + + ArrayType::ArrayType() + { + this->componentType = NULL; + this->length = NULL; + } + + ArrayType::ArrayType(DataType* componentType) + { + this->componentType = componentType; + this->length = NULL; + } + + ArrayType::ArrayType(DataType* componentType, Range* length) + { + this->componentType = componentType; + this->length = length; + } + + ArrayType::~ArrayType() + { + if(componentType != NULL) + { + delete componentType; + } + + if(length != NULL) + { + delete length; + } + } + + DataType* ArrayType::getComponentType() + { + return componentType; + } + + void ArrayType::setComponentType(DataType* componentType) + { + this->componentType = componentType; + + if(componentType->getNotBuiltIn() == true) + { + notBuiltIn = true; + } + } + + int ArrayType::minLength() + { + if(length == NULL) return 0; + + return 0;//length->getLower(); + } + + int ArrayType::maxLength() + { + if(length == NULL) return INT_MAX; + + return 0;//length->Upper(); + } + + Range* ArrayType::getLength() + { + return length; + } + + void ArrayType::setLength(Range* length) + { + this->length = length; + } + + std::string ArrayType::writeOut(int /*indent*/) + { + std::string s; + + s += componentType->writeOut(); + + if(length != NULL) + { + s += length->writeOut(); + } + + return s; + } + } +}