#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; } } }