From 8fb05d53cbf7b30cc7ead2d27d4b4b15adbc0261 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 15 Apr 2021 16:57:45 +0300 Subject: [PATCH] Revert deletion of BuildPlugin_ValidatorExpressionInterpolation::isValid() --- src/BuildPlugin/BuildPlugin_Validators.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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(); +} -- 2.39.2