X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParametersPlugin%2FParametersPlugin_Validators.h;h=cc1812abc711f87bad0424fdef8590ea2b8d5ce0;hb=1490e92974d2c0bdcdbecd6fa9388e31dccfa363;hp=3a4db55c88a8944bd6ede1e74e2ba600260a70b8;hpb=b900918cef83bb82217e7221c7ff0ad9d8a6dbe9;p=modules%2Fshaper.git diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.h b/src/ParametersPlugin/ParametersPlugin_Validators.h index 3a4db55c8..cc1812abc 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.h +++ b/src/ParametersPlugin/ParametersPlugin_Validators.h @@ -13,36 +13,57 @@ #include -#include #include +/** + * \class ParametersPlugin_VariableValidator + * \ingroup Validators + * \brief Validator for the variable name of parameter. + */ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator { public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator(); PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator(); - //! returns true if attribute is valid - //! \param theAttribute the checked attribute - //! \param theArguments arguments of the attribute + /** + * \brief Returns true if attribute has a valid parameter name. + * \param theAttribute the checked attribute + * \param theArguments arguments of the attribute + * \param theError the error string message if validation fails + */ PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; - private: - std::regex myPyVariableRegex; + protected: + /// Returns true if theString is a valid variable name. + PARAMETERSPLUGIN_EXPORT bool isVariable(const std::string& theString) const; + /// Returns true if theString is unique parameter name in the document of theAttribute. + PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute, + const std::string& theString) const; }; +/** + * \class ParametersPlugin_ExpressionValidator + * \ingroup Validators + * \brief Validator for the expression of parameter. + */ class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator { public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator(); PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator(); - //! returns true if attribute is valid - //! \param theAttribute the checked attribute - //! \param theArguments arguments of the attribute + /** + * \brief Returns true if attribute has a valid parameter expression. + * \param theAttribute the checked attribute + * \param theArguments arguments of the attribute + * \param theError the error string message if validation fails + */ PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; };