Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Validators.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef BuildPlugin_Validators_H_
22 #define BuildPlugin_Validators_H_
23
24 #include <ModelAPI_AttributeValidator.h>
25 #include <ModelAPI_FeatureValidator.h>
26
27 /// \class BuildPlugin_ValidatorBaseForBuild
28 /// \ingroup Validators
29 /// \brief A validator for selection base shapes for build features.
30 /// Allows to select shapes on sketch and
31 /// whole objects with allowed type.
32 class BuildPlugin_ValidatorBaseForBuild: public ModelAPI_AttributeValidator
33 {
34 public:
35   //! Returns true if attribute is ok.
36   //! \param[in] theAttribute the checked attribute.
37   //! \param[in] theArguments arguments of the attribute.
38   //! \param[out] theError error message.
39    virtual bool isValid(const AttributePtr& theAttribute,
40                         const std::list<std::string>& theArguments,
41                         Events_InfoMessage& theError) const;
42 };
43
44 /// \class BuildPlugin_ValidatorBaseForWire
45 /// \ingroup Validators
46 /// \brief A validator for selection base shapes for wire. Allows to select edges on sketch and
47 /// wires objects that are connected to already selected shapes.
48 class BuildPlugin_ValidatorBaseForWire: public ModelAPI_FeatureValidator
49 {
50 public:
51   //! Returns true if attributes is ok.
52   //! \param theFeature the checked feature.
53   //! \param theArguments arguments of the feature.
54   //! \param theError error message.
55   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
56                        const std::list<std::string>& theArguments,
57                        Events_InfoMessage& theError) const;
58
59   /// \return true if the attribute in feature is not obligatory for the feature execution
60   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
61 };
62
63 /// \class BuildPlugin_ValidatorBaseForFace
64 /// \ingroup Validators
65 /// \brief A validator for selection base shapes for face. Allows to select sketch edges, edges and
66 /// wires objects that lie in the same plane and don't have intersections.
67 class BuildPlugin_ValidatorBaseForFace: public ModelAPI_FeatureValidator
68 {
69 public:
70   //! Returns true if attributes is ok.
71   //! \param theFeature the checked feature.
72   //! \param theArguments arguments of the feature.
73   //! \param theError error message.
74   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
75                        const std::list<std::string>& theArguments,
76                        Events_InfoMessage& theError) const;
77
78   /// \return true if the attribute in feature is not obligatory for the feature execution
79   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
80 };
81
82 /// \class BuildPlugin_ValidatorSubShapesSelection
83 /// \ingroup Validators
84 /// \brief A validator for selection sub-shapes for SubShape feature.
85 class BuildPlugin_ValidatorSubShapesSelection: public ModelAPI_AttributeValidator
86 {
87 public:
88   //! Returns true if attribute is ok.
89   //! \param[in] theAttribute the checked attribute.
90   //! \param[in] theArguments arguments of the attribute.
91   //! \param[out] theError error message.
92    virtual bool isValid(const AttributePtr& theAttribute,
93                         const std::list<std::string>& theArguments,
94                         Events_InfoMessage& theError) const;
95 };
96
97 #endif