X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Validator.cpp;h=6795e43e1b2b13cb7387d4ff8e3515534a25ac4b;hb=a83e22046c5fb877969fa8879e42491d4054f198;hp=9f186a1a0d13db1248c4d1cc02c8778740599a25;hpb=803af3deaa4abc9b937e8cfb4a42e7060b6acc22;p=modules%2Fshaper.git diff --git a/src/Model/Model_Validator.cpp b/src/Model/Model_Validator.cpp index 9f186a1a0..6795e43e1 100644 --- a/src/Model/Model_Validator.cpp +++ b/src/Model/Model_Validator.cpp @@ -179,7 +179,7 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& if (!aFValidator->isValid(theFeature, anArguments, anError)) { if (anError.empty()) anError = "Unknown error."; - anError = "Feature invalidated by \"" + aValidatorID + "\" with error: " + anError; + anError = aValidatorID + ": " + anError; theFeature->setError(anError, false); theFeature->data()->execState(ModelAPI_StateInvalidArgument); return false; @@ -206,7 +206,7 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& // } // } //} - + // check all attributes for validity // Validity of data is checked by "Model_FeatureValidator" (kDefaultId) // if (!aData || !aData->isValid()) @@ -223,7 +223,7 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr& if (!validate(anAttribute, aValidatorID, anError)) { if (anError.empty()) anError = "Unknown error."; - anError = "Attribute \"" + anAttributeID + "\" invalidated by \"" + aValidatorID + "\" with error: " + anError; + anError = anAttributeID + " - " + aValidatorID + ": " + anError; theFeature->setError(anError, false); theFeature->data()->execState(ModelAPI_StateInvalidArgument); return false; @@ -314,28 +314,36 @@ bool Model_ValidatorsFactory::isConcealed(std::string theFeature, std::string th void Model_ValidatorsFactory::registerCase(std::string theFeature, std::string theAttribute, std::string theSwitchId, std::string theCaseId) { - std::map > >::iterator - aFindFeature = myCases.find(theFeature); + std::map > > > + ::iterator aFindFeature = myCases.find(theFeature); if (aFindFeature == myCases.end()) { - myCases[theFeature] = std::map >(); + myCases[theFeature] = std::map > >(); aFindFeature = myCases.find(theFeature); } - (aFindFeature->second)[theAttribute] = std::pair(theSwitchId, theCaseId); + std::map > >::iterator aFindAttrID = + aFindFeature->second.find(theAttribute); + if (aFindAttrID == aFindFeature->second.end()) { + aFindFeature->second[theAttribute] = + std::pair >(theSwitchId, std::set()); + aFindAttrID = aFindFeature->second.find(theAttribute); + } + aFindAttrID->second.second.insert(theCaseId); } -bool Model_ValidatorsFactory::isCase( - FeaturePtr theFeature, std::string theAttribute) +bool Model_ValidatorsFactory::isCase(FeaturePtr theFeature, std::string theAttribute) { - std::map > >::iterator - aFindFeature = myCases.find(theFeature->getKind()); + std::map > > > + ::iterator aFindFeature = myCases.find(theFeature->getKind()); if (aFindFeature != myCases.end()) { - std::map >::iterator - aFindAttr = aFindFeature->second.find(theAttribute); - if (aFindAttr != aFindFeature->second.end()) { + std::map > >::iterator + aFindAttrID = aFindFeature->second.find(theAttribute); + if (aFindAttrID != aFindFeature->second.end()) { // the the switch-attribute that contains the case value - AttributeStringPtr aSwitch = theFeature->string(aFindAttr->second.first); + AttributeStringPtr aSwitch = theFeature->string(aFindAttrID->second.first); if (aSwitch.get()) { - return aSwitch->value() == aFindAttr->second.second; // the second is the case identifier + // the second has the case identifier + return aFindAttrID->second.second.find(aSwitch->value()) != + aFindAttrID->second.second.end(); } } }