Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue #719: taking into account that edges may lay on the same circle, but splitted...
[modules/shaper.git]
/
src
/
ParametersPlugin
/
ParametersPlugin_Validators.cpp
diff --git
a/src/ParametersPlugin/ParametersPlugin_Validators.cpp
b/src/ParametersPlugin/ParametersPlugin_Validators.cpp
index 90ded60313edf285607d299f0d0908c846d4bbd9..d0b00ca8e8bff0494247b5cd4af0956a2c650333 100644
(file)
--- a/
src/ParametersPlugin/ParametersPlugin_Validators.cpp
+++ b/
src/ParametersPlugin/ParametersPlugin_Validators.cpp
@@
-21,11
+21,19
@@
ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator()
}
bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribute,
}
bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments) const
+ const std::list<std::string>& theArguments,
+ std::string& theError) const
{
AttributeStringPtr aStrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
{
AttributeStringPtr aStrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
- bool result = isVariable(aStrAttr->value()) && isUnique(theAttribute, aStrAttr->value());
- return result;
+ if (!isVariable(aStrAttr->value())) {
+ theError = "Incorrect variable name.";
+ return false;
+ }
+ if (!isUnique(theAttribute, aStrAttr->value())) {
+ theError = "Variable name is not unique.";
+ return false;
+ }
+ return true;
}
bool ParametersPlugin_VariableValidator::isVariable(const std::string& theString) const
}
bool ParametersPlugin_VariableValidator::isVariable(const std::string& theString) const
@@
-75,20
+83,26
@@
ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator()
}
bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttribute,
}
bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments) const
+ const std::list<std::string>& theArguments,
+ std::string& theError) const
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
ResultParameterPtr aParam =
std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aFeature->firstResult());
AttributeStringPtr aStrAttr =
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
ResultParameterPtr aParam =
std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aFeature->firstResult());
AttributeStringPtr aStrAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
+
std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
bool isEmptyExpr = aStrAttr->value().empty();
bool isEmptyExpr = aStrAttr->value().empty();
- if(isEmptyExpr)
+ if(isEmptyExpr) {
+ theError = "Expression is empty.";
return false;
return false;
+ }
- if(!aParam.get())
+ if(!aParam.get()) {
+ theError = "Result is empty.";
return false;
return false;
+ }
+ theError = aFeature->error();
return aFeature->error().empty();
}
return aFeature->error().empty();
}