X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Validators.h;h=d8c0a091e1a1e6ae1c09c17d7ce2cad7ba754b25;hb=95bf0a0de36129d80569e2b4634650b9cc38733e;hp=c806e754b8957904b3a62167aee37b7cbe09d91c;hpb=00ed338aec6098cd20b75179f3924c048d968e70;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index c806e754b..d8c0a091e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: FeaturesPlugin_Validators.h -// Created: 22 March 2016 -// Author: Dmitry Bobylev +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef FeaturesPlugin_Validators_H_ #define FeaturesPlugin_Validators_H_ @@ -22,7 +36,7 @@ public: //! \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorPipeLocations @@ -37,7 +51,7 @@ class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator //! \param theError error message virtual bool isValid(const std::shared_ptr& theFeature, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; /// Returns true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); @@ -56,12 +70,32 @@ public: //! \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; private: bool isValidAttribute(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects +/// \ingroup Validators +/// \brief Validator for the base objects for generation. Checks that sketch and it objects +/// are not selected at the same time. +class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects: + public ModelAPI_FeatureValidator +{ + public: + //! \return true if sketch and it objects not selected at the same time. + //! \param theFeature the checked feature + //! \param theArguments arguments of the feature (not used) + //! \param theError error message + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + Events_InfoMessage& theError) const; + + /// Returns true if the attribute in feature is not obligatory for the feature execution + virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); }; /// \class FeaturesPlugin_ValidatorCompositeLauncher @@ -76,7 +110,7 @@ public: //! \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorExtrusionDir @@ -92,14 +126,14 @@ public: //! \param[out] theError error message. virtual bool isValid(const std::shared_ptr& theFeature, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; /// \return true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); private: bool isShapesCanBeEmpty(const AttributePtr& theAttribute, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorBooleanSelection @@ -115,7 +149,7 @@ public: /// \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorPartitionSelection @@ -131,7 +165,7 @@ public: /// \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection @@ -147,7 +181,7 @@ public: /// \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult @@ -162,7 +196,7 @@ class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureVali //! \param theError error message virtual bool isValid(const std::shared_ptr& theFeature, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; /// \return true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); @@ -181,7 +215,7 @@ public: /// \param[out] theError error message. virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorUnionArguments @@ -196,10 +230,25 @@ class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator //! \param theError error message virtual bool isValid(const std::shared_ptr& theFeature, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; /// \return true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); }; +/// \class FeaturesPlugin_ValidatorConcealedResult +/// \ingroup Validators +/// \brief Validator for the "Recover" feature. +class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator +{ + public: + //! \return True if the attribute is valid. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + #endif