X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FNumberType.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FNumberType.cpp;h=b0ce120bb174bfed867150f1536a05c09a51c0af;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=6cb9e164b6435f473e0c2f01590e2dba950f3f35;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/NumberType.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/NumberType.cpp index 6cb9e164b..b0ce120bb 100644 --- a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/NumberType.cpp +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/NumberType.cpp @@ -1,98 +1,98 @@ -#include "NumberType.h" - -#include "Range.h" - -#include "Constants.h" - -namespace Databoard { - namespace Type { - - NumberType::NumberType() - { - range = NULL; - } - - NumberType::NumberType(std::string unit) - { - this->unit = unit; - range = new Range(); - } - - NumberType::NumberType(std::string unit, Range* range) - { - this->unit = unit; - this->range = range; - } - - NumberType::~NumberType() - { - if(range != NULL) - { - delete range; - } - } - - std::string NumberType::getUnit() - { - return unit; - } - - void NumberType::setUnit(std::string unit) - { - this->unit = unit; - } - - Range* NumberType::getRange() - { - return range; - } - - void NumberType::setRange(Range* value) - { - this->range = value; - } - - std::string NumberType::writeOut(int /*indent*/) - { - std::string s; - - bool parenthesis = false; - - if(unit.size() != 0) - { - s += "("; - s.append(STR_UNIT); - s += "=\"" + unit + "\""; - - - parenthesis = true; - } - - if(range != NULL) - { - if(parenthesis == false) - { - s += "("; - } - else - { - s += ", "; - } - - s.append(STR_RANGE); - s += "=" + range->writeOut(); - - parenthesis = true; - } - - if(parenthesis == true) - { - s += ")"; - } - - - - return s; - } - } -} +#include "NumberType.h" + +#include "Range.h" + +#include "Constants.h" + +namespace Databoard { + namespace Type { + + NumberType::NumberType() + { + range = NULL; + } + + NumberType::NumberType(std::string unit) + { + this->unit = unit; + range = new Range(); + } + + NumberType::NumberType(std::string unit, Range* range) + { + this->unit = unit; + this->range = range; + } + + NumberType::~NumberType() + { + if(range != NULL) + { + delete range; + } + } + + std::string NumberType::getUnit() + { + return unit; + } + + void NumberType::setUnit(std::string unit) + { + this->unit = unit; + } + + Range* NumberType::getRange() + { + return range; + } + + void NumberType::setRange(Range* value) + { + this->range = value; + } + + std::string NumberType::writeOut(int /*indent*/) + { + std::string s; + + bool parenthesis = false; + + if(unit.size() != 0) + { + s += "("; + s.append(STR_UNIT); + s += "=\"" + unit + "\""; + + + parenthesis = true; + } + + if(range != NULL) + { + if(parenthesis == false) + { + s += "("; + } + else + { + s += ", "; + } + + s.append(STR_RANGE); + s += "=" + range->writeOut(); + + parenthesis = true; + } + + if(parenthesis == true) + { + s += ")"; + } + + + + return s; + } + } +}