X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_FeatureValidator.h;h=ad6fb06b50601dcb2bd4071cd41bbeec88a870f2;hb=21b49d1cb352330d2221dbe397a1621ef9b04a01;hp=95a4ce1c5672e973f535ba4c7ffa2a8f6c54cd8f;hpb=55026eca2455683fd776d5d168e1f224f6a4fb57;p=modules%2Fshaper.git diff --git a/src/Model/Model_FeatureValidator.h b/src/Model/Model_FeatureValidator.h index 95a4ce1c5..ad6fb06b5 100644 --- a/src/Model/Model_FeatureValidator.h +++ b/src/Model/Model_FeatureValidator.h @@ -1,6 +1,21 @@ -// File: ModelAPI_FeatureValidator.h -// Created: 8 Jul 2014 -// Author: Vitaly SMETANNIKOV +// Copyright (C) 2014-2021 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 Model_FeatureValidator_H #define Model_FeatureValidator_H @@ -9,22 +24,37 @@ #include #include -#include +#include #include #include +/**\class Model_FeatureValidator + * \ingroup DataModel + * \brief The geneneric validator for the whole feature. + * + * Can be redefined for some specific feature, but by default for each feature this validator is + * used: it checks each argument of the feature and if one of it is not valid (and obligatory), + * the hole feature is invalid. + */ class Model_FeatureValidator : public ModelAPI_FeatureValidator { // not obligatory attributes, not checked for initialization std::map > myNotObligatory; - public: +public: /// Returns true if feature and/or attributes are valid /// \param theFeature the validated feature - MODEL_EXPORT virtual bool isValid(const boost::shared_ptr& theFeature, - const std::list& theArguments) const; + /// \param theArguments the arguments in the configuration file for this validator + /// \param theError erros message produced by validator to the user if it fails + /// \returns true if feature is valid + MODEL_EXPORT virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + Events_InfoMessage& theError) const; - // sets not obligatory attributes, not checked for initialization - void registerNotObligatory(std::string theFeature, std::string theAttribute); + /// sets not obligatory attributes, not checked for initialization + virtual void registerNotObligatory(std::string theFeature, std::string theAttribute); + + /// Returns true if the attribute in feature is not obligatory for the feature execution + virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); }; #endif