From: spo Date: Wed, 29 Jul 2015 10:55:13 +0000 (+0300) Subject: Error management -- Feature validator returns an error. X-Git-Tag: V_1.4.0_beta4~433 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=28636faf4eeaf4cf783c490f07b2efcf628cab1d;p=modules%2Fshaper.git Error management -- Feature validator returns an error. --- diff --git a/src/GeomValidators/GeomValidators_BooleanArguments.cpp b/src/GeomValidators/GeomValidators_BooleanArguments.cpp index cfd5620ea..a5caa03fa 100644 --- a/src/GeomValidators/GeomValidators_BooleanArguments.cpp +++ b/src/GeomValidators/GeomValidators_BooleanArguments.cpp @@ -11,7 +11,8 @@ //================================================================================================= bool GeomValidators_BooleanArguments::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const + const std::list& theArguments, + std::string& theError) const { if(theArguments.size() != 3) { return false; diff --git a/src/GeomValidators/GeomValidators_BooleanArguments.h b/src/GeomValidators/GeomValidators_BooleanArguments.h index c7134745f..d5c903111 100644 --- a/src/GeomValidators/GeomValidators_BooleanArguments.h +++ b/src/GeomValidators/GeomValidators_BooleanArguments.h @@ -24,7 +24,8 @@ public: * \returns true if feature is valid. */ GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; /// \return true if the attribute in feature is not obligatory for the feature execution. GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); diff --git a/src/GeomValidators/GeomValidators_Different.cpp b/src/GeomValidators/GeomValidators_Different.cpp index 65b834d3a..dcad93164 100644 --- a/src/GeomValidators/GeomValidators_Different.cpp +++ b/src/GeomValidators/GeomValidators_Different.cpp @@ -45,7 +45,8 @@ public: }; bool GeomValidators_Different::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const + const std::list& theArguments, + std::string& theError) const { std::map > anAttributesMap; // For all attributes referred by theArguments diff --git a/src/GeomValidators/GeomValidators_Different.h b/src/GeomValidators/GeomValidators_Different.h index 14380dd3e..28cc2c58f 100644 --- a/src/GeomValidators/GeomValidators_Different.h +++ b/src/GeomValidators/GeomValidators_Different.h @@ -24,7 +24,8 @@ public: * \returns true if feature is valid. */ GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); }; diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.cpp b/src/GeomValidators/GeomValidators_ZeroOffset.cpp index 4bfe414a1..63e6d5f89 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.cpp +++ b/src/GeomValidators/GeomValidators_ZeroOffset.cpp @@ -13,7 +13,8 @@ //================================================================================================= bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const + const std::list& theArguments, + std::string& theError) const { if(theArguments.size() != 8) { return false; diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.h b/src/GeomValidators/GeomValidators_ZeroOffset.h index d9f7f07af..e6897060a 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.h +++ b/src/GeomValidators/GeomValidators_ZeroOffset.h @@ -24,7 +24,8 @@ public: * \returns true if feature is valid. */ GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; /// \return true if the attribute in feature is not obligatory for the feature execution. GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); diff --git a/src/Model/Model_FeatureValidator.cpp b/src/Model/Model_FeatureValidator.cpp index 8cec7f4b7..99fc08fe7 100644 --- a/src/Model/Model_FeatureValidator.cpp +++ b/src/Model/Model_FeatureValidator.cpp @@ -16,7 +16,8 @@ #include bool Model_FeatureValidator::isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const + const std::list& theArguments, + std::string& theError) const { static Model_ValidatorsFactory* aValidators = static_cast(ModelAPI_Session::get()->validators()); diff --git a/src/Model/Model_FeatureValidator.h b/src/Model/Model_FeatureValidator.h index e412301fe..c35acc8e1 100644 --- a/src/Model/Model_FeatureValidator.h +++ b/src/Model/Model_FeatureValidator.h @@ -33,7 +33,8 @@ public: /// \param theArguments the arguments in the configuration file for this validator /// \returns true if feature is valid MODEL_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; /// sets not obligatory attributes, not checked for initialization virtual void registerNotObligatory(std::string theFeature, std::string theAttribute); diff --git a/src/ModelAPI/ModelAPI_FeatureValidator.h b/src/ModelAPI/ModelAPI_FeatureValidator.h index 5d6eb3b1c..9b529e9db 100644 --- a/src/ModelAPI/ModelAPI_FeatureValidator.h +++ b/src/ModelAPI/ModelAPI_FeatureValidator.h @@ -30,7 +30,8 @@ class MODELAPI_EXPORT ModelAPI_FeatureValidator : public ModelAPI_Validator /// \param theFeature the validated feature /// \param theArguments list of string, feature attribute names: dependent attributes virtual bool isValid(const std::shared_ptr& theFeature, - const std::list& theArguments) const = 0; + const std::list& theArguments, + std::string& theError = std::string()) const = 0; /// Returns true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute) = 0;