From: azv Date: Thu, 15 Apr 2021 13:57:45 +0000 (+0300) Subject: Revert deletion of BuildPlugin_ValidatorExpressionInterpolation::isValid() X-Git-Tag: V9_7_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8fb05d53cbf7b30cc7ead2d27d4b4b15adbc0261;p=modules%2Fshaper.git Revert deletion of BuildPlugin_ValidatorExpressionInterpolation::isValid() --- diff --git a/src/BuildPlugin/BuildPlugin_Validators.cpp b/src/BuildPlugin/BuildPlugin_Validators.cpp index b7a878a3f..46163ae18 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.cpp +++ b/src/BuildPlugin/BuildPlugin_Validators.cpp @@ -699,3 +699,27 @@ bool BuildPlugin_ValidatorBaseForVertex::isValid(const AttributePtr& theAttribut return true; } + +//================================================================================================= +bool BuildPlugin_ValidatorExpressionInterpolation::isValid(const AttributePtr& theAttribute, + const std::list& /*theArguments*/, + Events_InfoMessage& theError) const +{ + FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); + + AttributeStringPtr aStrAttr = + std::dynamic_pointer_cast(theAttribute); + if (!aStrAttr->isInitialized()) { + theError = "Attribute \"%1\" is not initialized."; + theError.arg(aStrAttr->id()); + return false; + } + bool isEmptyExpr = aStrAttr->value().empty(); + if (isEmptyExpr) { + theError = "Expression is empty."; + return false; + } + + theError = aFeature->string(BuildPlugin_Interpolation::EXPRESSION_ERROR_ID())->value(); + return theError.empty(); +}