X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FOptionalType.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FOptionalType.cpp;h=dbc53167395dbf5f635e233d3c3f3a87de30d2ca;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/OptionalType.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/OptionalType.cpp new file mode 100644 index 000000000..dbc531673 --- /dev/null +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/OptionalType.cpp @@ -0,0 +1,52 @@ +#include "OptionalType.h" + +namespace Databoard { + namespace Type { + + OptionalType::OptionalType() + { + componentType = NULL; + } + + OptionalType::OptionalType(DataType* componentType) + { + this->componentType = componentType; + } + + OptionalType::~OptionalType() + { + if(componentType != NULL) + { + delete componentType; + } + } + + DataType* OptionalType::getComponentType() + { + return componentType; + } + + void OptionalType::setComponentType(DataType* componentType) + { + this->componentType = componentType; + } + + std::string OptionalType::writeOut(int /*indent*/) + { + std::string s; + + s.append("Optional"); + + s += "("; + + if(componentType != NULL) + { + s += componentType->writeOut(); + } + + s += ")"; + + return s; + } + } +}