X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FStringType.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FStringType.cpp;h=b4140b07a3ab905fcb0ca041cb3d44d13de86a17;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=5d6e2aa3441e6138d1ccd8c6641735e6f5875f84;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/StringType.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/StringType.cpp index 5d6e2aa34..b4140b07a 100644 --- a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/StringType.cpp +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/StringType.cpp @@ -1,120 +1,120 @@ -#include "StringType.h" - -#include "Range.h" -#include "Limit.h" - -#include - -namespace Databoard { - namespace Type { - - StringType::StringType() - { - this->length = NULL; - } - - StringType::StringType(std::string pattern) - { - this->pattern = pattern; - this->length = NULL; - } - - StringType::StringType(std::string pattern, std::string mimeType, Range* length) - { - this->pattern = pattern; - this->mimeType = mimeType; - this->length = length; - } - - StringType::~StringType() - { - if(length != NULL) - { - delete length; - } - } - - std::string StringType::getPattern() - { - return pattern; - } - - void StringType::setPattern(std::string pattern) - { - this->pattern = pattern; - } - - std::string StringType::getMimeType() - { - return mimeType; - } - - void StringType::setMimeType(std::string mimeType) - { - this->mimeType = mimeType; - } - - Range* StringType::getLength() - { - return length; - } - - void StringType::setLength(Range* length) - { - this->length = length; - } - - int StringType::minLength() - { - if(length == NULL) return 0; - - return length->getLower()->getInteger(INT_MAX); - } - - int StringType::maxLength() - { - if(length == NULL) return INT_MAX; - - return length->getUpper()->getInteger(INT_MIN); - } - - std::string StringType::writeOut(int /*indent*/) - { - std::string s; - - s.append("String"); - - bool parenthesis = false; - - if(mimeType.size() > 0) - { - s += "(mimeType=\"" + mimeType + "\""; - - parenthesis = true; - } - - if(pattern.size() > 0) - { - if(parenthesis == false) - { - s += "("; - } - else - { - s += ", "; - } - - s += "pattern=\"" + pattern + "\""; - - parenthesis = true; - } - - if(parenthesis == true) - { - s += ")"; - } - - return s; - } - } -} +#include "StringType.h" + +#include "Range.h" +#include "Limit.h" + +#include + +namespace Databoard { + namespace Type { + + StringType::StringType() + { + this->length = NULL; + } + + StringType::StringType(std::string pattern) + { + this->pattern = pattern; + this->length = NULL; + } + + StringType::StringType(std::string pattern, std::string mimeType, Range* length) + { + this->pattern = pattern; + this->mimeType = mimeType; + this->length = length; + } + + StringType::~StringType() + { + if(length != NULL) + { + delete length; + } + } + + std::string StringType::getPattern() + { + return pattern; + } + + void StringType::setPattern(std::string pattern) + { + this->pattern = pattern; + } + + std::string StringType::getMimeType() + { + return mimeType; + } + + void StringType::setMimeType(std::string mimeType) + { + this->mimeType = mimeType; + } + + Range* StringType::getLength() + { + return length; + } + + void StringType::setLength(Range* length) + { + this->length = length; + } + + int StringType::minLength() + { + if(length == NULL) return 0; + + return length->getLower()->getInteger(INT_MAX); + } + + int StringType::maxLength() + { + if(length == NULL) return INT_MAX; + + return length->getUpper()->getInteger(INT_MIN); + } + + std::string StringType::writeOut(int /*indent*/) + { + std::string s; + + s.append("String"); + + bool parenthesis = false; + + if(mimeType.size() > 0) + { + s += "(mimeType=\"" + mimeType + "\""; + + parenthesis = true; + } + + if(pattern.size() > 0) + { + if(parenthesis == false) + { + s += "("; + } + else + { + s += ", "; + } + + s += "pattern=\"" + pattern + "\""; + + parenthesis = true; + } + + if(parenthesis == true) + { + s += ")"; + } + + return s; + } + } +}