X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeValidator.cpp;h=0f7c48082c4625626bb2f0d45cb0c376ba50104a;hb=176403004ff97696f3c0b5f8bdf48692177fb34a;hp=9a6c954653200f1ddd1b670d3df2d8928773294c;hpb=8cac8d7c1b08cb25f02cd60e953ce1656dd2a3a6;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeValidator.cpp b/src/Model/Model_AttributeValidator.cpp index 9a6c95465..0f7c48082 100644 --- a/src/Model/Model_AttributeValidator.cpp +++ b/src/Model/Model_AttributeValidator.cpp @@ -5,19 +5,34 @@ // Author: Sergey POKHODENKO #include "Model_AttributeValidator.h" + +#include + #include +#include + #include #include bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const + Events_InfoMessage& theError) const { + if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) { + AttributeIntegerPtr anAttribue = + std::dynamic_pointer_cast(theAttribute); + if (!anAttribue->expressionError().empty()) { + theError = "Expression error: %1"; + theError.arg(anAttribue->expressionError()); + return false; + } + } else if (theAttribute->attributeType() == ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttribue = std::dynamic_pointer_cast(theAttribute); if (!anAttribue->expressionError().empty()) { - theError = anAttribue->expressionError(); + theError = "Expression error: %1"; + theError.arg(anAttribue->expressionError()); return false; } } else @@ -29,10 +44,12 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, std::string anErrorMessage; for (int i = 0; i < 3; ++i) { if (!anAttribue->expressionError(i).empty()) - anErrorMessage.append("\n").append(aComponent[i]).append(": ").append(anAttribue->expressionError(i)); + anErrorMessage.append("\n").append(aComponent[i]) + .append(": ").append(anAttribue->expressionError(i)); } if (!anErrorMessage.empty()) { - theError = anErrorMessage; + theError = "Expression error: %1"; + theError.arg(anErrorMessage); return false; } } else @@ -44,13 +61,14 @@ bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, std::string anErrorMessage; for (int i = 0; i < 2; ++i) { if (!anAttribue->expressionError(i).empty()) - anErrorMessage.append("\n").append(aComponent[i]).append(": ").append(anAttribue->expressionError(i)); + anErrorMessage.append("\n").append(aComponent[i]) + .append(": ").append(anAttribue->expressionError(i)); } if (!anErrorMessage.empty()) { - theError = anErrorMessage; + theError = "Expression error: %1"; + theError.arg(anErrorMessage); return false; } } return true; } -