]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LongValue.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / LongValue.cpp
index 47632d567dec8c7ec86080846593c742a1a3caec..674edb4b147fe4a0edf1ec823f305b8db5c7bdb8 100644 (file)
-#include "LongValue.h"\r
-\r
-#include "LongType.h"\r
-#include "Constants.h"\r
-#include "Range.h"\r
-#include "Limit.h"\r
-\r
-#include <sstream>\r
-\r
-namespace Databoard {\r
-       namespace Value {\r
-               LongValue::LongValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)\r
-               {\r
-               }\r
-\r
-               LongValue::~LongValue()\r
-               {\r
-               }\r
-\r
-               void LongValue::setValue(long value)\r
-               {\r
-                       Databoard::Type::LongType* longType = dynamic_cast<Databoard::Type::LongType*>(dataBoard);\r
-\r
-                       if(longType != NULL)\r
-                       {\r
-                               this->value = value;\r
-                       }\r
-               }\r
-\r
-               long LongValue::getValue()\r
-               {\r
-                       return value;\r
-               }\r
-\r
-               std::string LongValue::writeOut(int /*indent*/)\r
-               {\r
-                       std::string s;\r
-\r
-                       std::stringstream oss;\r
-\r
-                       oss << value;\r
-\r
-                       oss >> s;\r
-\r
-                       //if(unit.size() != 0)\r
-                       //{\r
-                       //      s += "(Unit=\"" + unit + "\")";\r
-                       //}\r
-\r
-                       return s;\r
-               }\r
-\r
-               bool LongValue::equals(const Value* other)\r
-               {\r
-                       LongValue* o = (LongValue*)other;\r
-\r
-                       return (this->value < o->value);\r
-\r
-               }\r
-\r
-               std::string LongValue::isValid()\r
-               {\r
-                       if(dataBoard == NULL)\r
-                       {\r
-                               return "LongValue: There is no datatype.";\r
-                       }\r
-\r
-                       Databoard::Type::LongType* longType = (Databoard::Type::LongType*)dataBoard;\r
-\r
-                       if(longType->getRange() == NULL)\r
-                       {\r
-                               return STR_EMPTY;\r
-                       }\r
-\r
-                       int minValue = longType->minValue();\r
-                       int maxValue = longType->maxValue();\r
-\r
-                       if(longType->getRange()->getLower()->getInclusive() == true)\r
-                       {\r
-                               if(value < minValue)\r
-                               {\r
-                                       return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL;\r
-                               }\r
-                       }\r
-                       else //if(longType->getRange()->getLower()->getInclusive() == false)\r
-                       {\r
-                               if(value <= minValue)\r
-                               {\r
-                                       return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL;\r
-                               }\r
-                       }\r
-\r
-                       if(longType->getRange()->getUpper()->getInclusive() == true)\r
-                       {\r
-                               if(value > maxValue)\r
-                               {\r
-                                       return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE;\r
-                               }\r
-                       }\r
-                       else //if(longType->getRange()->getUpper()->getInclusive() == false)\r
-                       {\r
-                               if(value >= maxValue)\r
-                               {\r
-                                       return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE;\r
-                               }\r
-                       }\r
-\r
-                       return STR_EMPTY;\r
-               }\r
-       }\r
-}\r
+#include "LongValue.h"
+
+#include "LongType.h"
+#include "Constants.h"
+#include "Range.h"
+#include "Limit.h"
+
+#include <sstream>
+
+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::Type::LongType*>(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;
+               }
+       }
+}