X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FLongValue.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FLongValue.cpp;h=674edb4b147fe4a0edf1ec823f305b8db5c7bdb8;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=47632d567dec8c7ec86080846593c742a1a3caec;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LongValue.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LongValue.cpp index 47632d567..674edb4b1 100644 --- a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LongValue.cpp +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LongValue.cpp @@ -1,111 +1,111 @@ -#include "LongValue.h" - -#include "LongType.h" -#include "Constants.h" -#include "Range.h" -#include "Limit.h" - -#include - -namespace Databoard { - namespace Value { - LongValue::LongValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard) - { - } - - LongValue::~LongValue() - { - } - - void LongValue::setValue(long value) - { - Databoard::Type::LongType* longType = dynamic_cast(dataBoard); - - if(longType != NULL) - { - this->value = value; - } - } - - long LongValue::getValue() - { - return value; - } - - std::string LongValue::writeOut(int /*indent*/) - { - std::string s; - - std::stringstream oss; - - oss << value; - - oss >> s; - - //if(unit.size() != 0) - //{ - // s += "(Unit=\"" + unit + "\")"; - //} - - return s; - } - - bool LongValue::equals(const Value* other) - { - LongValue* o = (LongValue*)other; - - return (this->value < o->value); - - } - - std::string LongValue::isValid() - { - if(dataBoard == NULL) - { - return "LongValue: There is no datatype."; - } - - Databoard::Type::LongType* longType = (Databoard::Type::LongType*)dataBoard; - - if(longType->getRange() == NULL) - { - return STR_EMPTY; - } - - int minValue = longType->minValue(); - int maxValue = longType->maxValue(); - - if(longType->getRange()->getLower()->getInclusive() == true) - { - if(value < minValue) - { - return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL; - } - } - else //if(longType->getRange()->getLower()->getInclusive() == false) - { - if(value <= minValue) - { - return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL; - } - } - - if(longType->getRange()->getUpper()->getInclusive() == true) - { - if(value > maxValue) - { - return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE; - } - } - else //if(longType->getRange()->getUpper()->getInclusive() == false) - { - if(value >= maxValue) - { - return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE; - } - } - - return STR_EMPTY; - } - } -} +#include "LongValue.h" + +#include "LongType.h" +#include "Constants.h" +#include "Range.h" +#include "Limit.h" + +#include + +namespace Databoard { + namespace Value { + LongValue::LongValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard) + { + } + + LongValue::~LongValue() + { + } + + void LongValue::setValue(long value) + { + Databoard::Type::LongType* longType = dynamic_cast(dataBoard); + + if(longType != NULL) + { + this->value = value; + } + } + + long LongValue::getValue() + { + return value; + } + + std::string LongValue::writeOut(int /*indent*/) + { + std::string s; + + std::stringstream oss; + + oss << value; + + oss >> s; + + //if(unit.size() != 0) + //{ + // s += "(Unit=\"" + unit + "\")"; + //} + + return s; + } + + bool LongValue::equals(const Value* other) + { + LongValue* o = (LongValue*)other; + + return (this->value < o->value); + + } + + std::string LongValue::isValid() + { + if(dataBoard == NULL) + { + return "LongValue: There is no datatype."; + } + + Databoard::Type::LongType* longType = (Databoard::Type::LongType*)dataBoard; + + if(longType->getRange() == NULL) + { + return STR_EMPTY; + } + + int minValue = longType->minValue(); + int maxValue = longType->maxValue(); + + if(longType->getRange()->getLower()->getInclusive() == true) + { + if(value < minValue) + { + return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL; + } + } + else //if(longType->getRange()->getLower()->getInclusive() == false) + { + if(value <= minValue) + { + return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL; + } + } + + if(longType->getRange()->getUpper()->getInclusive() == true) + { + if(value > maxValue) + { + return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE; + } + } + else //if(longType->getRange()->getUpper()->getInclusive() == false) + { + if(value >= maxValue) + { + return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE; + } + } + + return STR_EMPTY; + } + } +}