]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Revert deletion of BuildPlugin_ValidatorExpressionInterpolation::isValid()
authorazv <azv@opencascade.com>
Thu, 15 Apr 2021 13:57:45 +0000 (16:57 +0300)
committerazv <azv@opencascade.com>
Thu, 15 Apr 2021 13:57:45 +0000 (16:57 +0300)
src/BuildPlugin/BuildPlugin_Validators.cpp

index b7a878a3f78669ff024c0eecf140094022faa029..46163ae18c1d661513fca90c6bbf5900d0c5ed0f 100644 (file)
@@ -699,3 +699,27 @@ bool BuildPlugin_ValidatorBaseForVertex::isValid(const AttributePtr& theAttribut
 
   return true;
 }
+
+//=================================================================================================
+bool BuildPlugin_ValidatorExpressionInterpolation::isValid(const AttributePtr& theAttribute,
+                                                   const std::list<std::string>& /*theArguments*/,
+                                                   Events_InfoMessage& theError) const
+{
+  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
+
+  AttributeStringPtr aStrAttr =
+      std::dynamic_pointer_cast<ModelAPI_AttributeString>(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();
+}