X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FLimit.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FLimit.cpp;h=eca8e12ef07c4d9c50049b8a2a771bc9362bacfa;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=3a861bf80d332e16b220cc7ed59b902c23b38243;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Limit.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Limit.cpp index 3a861bf80..eca8e12ef 100644 --- a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Limit.cpp +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/Limit.cpp @@ -1,214 +1,214 @@ -#include "Limit.h" - -#include "Constants.h" -#include - -#ifdef max -#undef max -#endif -#ifdef min -#undef min -#endif - -#include - -namespace Databoard { - - Limit::Limit(bool isLower) - { - this->isLower = isLower; - isInclusive = false; - } - - Limit::~Limit() - { - } - - void Limit::setValue(std::string value) - { - this->value = value; - } - - std::string Limit::getValue() - { - return value; - } - - double Limit::getDouble(double value) - { - if(this->value.size() > 0) - { - double c; - - std::istringstream iss(this->value); - - iss >> c; - - if(isLower == true) - { - c = std::max(value, c); - } - else - { - c = std::min(value, c); - } - - return c; - } - else - { - return value; - } - } - - float Limit::getFloat(float value) - { - if(this->value.size() > 0) - { - float c; - - std::istringstream iss(this->value); - - iss >> c; - - if(isLower == true) - { - c = std::max(value, c); - } - else - { - c = std::min(value, c); - } - - return c; - } - else - { - return value; - } - } - - int Limit::getInteger(int value) - { - if(this->value.size() > 0) - { - int c; - - std::istringstream iss(this->value); - - iss >> c; - - if(isLower == true) - { - c = std::max(value, c); - } - else - { - c = std::min(value, c); - } - - return c; - } - else - { - return value; - } - } - - long Limit::getLong(long value) - { - if(this->value.size() > 0) - { - long c; - - std::istringstream iss(this->value); - - iss >> c; - - if(isLower == true) - { - c = std::max(value, c); - } - else - { - c = std::min(value, c); - } - - return c; - } - else - { - return value; - } - } - - char Limit::getByte(char value) - { - if(this->value.size() > 0) - { - char c; - - std::istringstream iss(this->value); - - iss >> c; - - if(isLower == true) - { - c = std::max(value, c); - } - else - { - c = std::min(value, c); - } - - return c; - } - else - { - return value; - } - } - - void Limit::setInclusive() - { - isInclusive = true; - } - - bool Limit::getInclusive() - { - return isInclusive; - } - - std::string Limit::writeOut() - { - std::string s; - - if(isLower == true) - { - if(isInclusive == true) - { - s += "["; - } - else - { - s += "("; - } - } - - s += value; - - if(isLower == false) - { - if(isInclusive == true) - { - s += "]"; - } - else - { - s += ")"; - } - } - - return s; - } -} +#include "Limit.h" + +#include "Constants.h" +#include + +#ifdef max +#undef max +#endif +#ifdef min +#undef min +#endif + +#include + +namespace Databoard { + + Limit::Limit(bool isLower) + { + this->isLower = isLower; + isInclusive = false; + } + + Limit::~Limit() + { + } + + void Limit::setValue(std::string value) + { + this->value = value; + } + + std::string Limit::getValue() + { + return value; + } + + double Limit::getDouble(double value) + { + if(this->value.size() > 0) + { + double c; + + std::istringstream iss(this->value); + + iss >> c; + + if(isLower == true) + { + c = std::max(value, c); + } + else + { + c = std::min(value, c); + } + + return c; + } + else + { + return value; + } + } + + float Limit::getFloat(float value) + { + if(this->value.size() > 0) + { + float c; + + std::istringstream iss(this->value); + + iss >> c; + + if(isLower == true) + { + c = std::max(value, c); + } + else + { + c = std::min(value, c); + } + + return c; + } + else + { + return value; + } + } + + int Limit::getInteger(int value) + { + if(this->value.size() > 0) + { + int c; + + std::istringstream iss(this->value); + + iss >> c; + + if(isLower == true) + { + c = std::max(value, c); + } + else + { + c = std::min(value, c); + } + + return c; + } + else + { + return value; + } + } + + long Limit::getLong(long value) + { + if(this->value.size() > 0) + { + long c; + + std::istringstream iss(this->value); + + iss >> c; + + if(isLower == true) + { + c = std::max(value, c); + } + else + { + c = std::min(value, c); + } + + return c; + } + else + { + return value; + } + } + + char Limit::getByte(char value) + { + if(this->value.size() > 0) + { + char c; + + std::istringstream iss(this->value); + + iss >> c; + + if(isLower == true) + { + c = std::max(value, c); + } + else + { + c = std::min(value, c); + } + + return c; + } + else + { + return value; + } + } + + void Limit::setInclusive() + { + isInclusive = true; + } + + bool Limit::getInclusive() + { + return isInclusive; + } + + std::string Limit::writeOut() + { + std::string s; + + if(isLower == true) + { + if(isInclusive == true) + { + s += "["; + } + else + { + s += "("; + } + } + + s += value; + + if(isLower == false) + { + if(isInclusive == true) + { + s += "]"; + } + else + { + s += ")"; + } + } + + return s; + } +}