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 email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef BuildPlugin_Validators_H_
21 #define BuildPlugin_Validators_H_
22
23 #include <ModelAPI_AttributeValidator.h>
24 #include <ModelAPI_FeatureValidator.h>
25
26 /// \class BuildPlugin_ValidatorBaseForBuild
27 /// \ingroup Validators
28 /// \brief A validator for selection base shapes for build features.
29 /// Allows to select shapes on sketch and
30 /// whole objects with allowed type.
31 class BuildPlugin_ValidatorBaseForBuild: public ModelAPI_AttributeValidator
32 {
33 public:
34   //! Returns true if attribute is ok.
35   //! \param[in] theAttribute the checked attribute.
36   //! \param[in] theArguments arguments of the attribute.
37   //! \param[out] theError error message.
38    virtual bool isValid(const AttributePtr& theAttribute,
39                         const std::list<std::string>& theArguments,
40                         Events_InfoMessage& theError) const;
41 };
42
43 /// \class BuildPlugin_ValidatorBaseForWire
44 /// \ingroup Validators
45 /// \brief A validator for selection base shapes for wire. Allows to select edges on sketch and
46 /// wires objects that are connected to already selected shapes.
47 class BuildPlugin_ValidatorBaseForWire: public ModelAPI_FeatureValidator
48 {
49 public:
50   //! Returns true if attributes is ok.
51   //! \param theFeature the checked feature.
52   //! \param theArguments arguments of the feature.
53   //! \param theError error message.
54   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55                        const std::list<std::string>& theArguments,
56                        Events_InfoMessage& theError) const;
57
58   /// \return true if the attribute in feature is not obligatory for the feature execution
59   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
60 };
61
62 /// \class BuildPlugin_ValidatorBaseForFace
63 /// \ingroup Validators
64 /// \brief A validator for selection base shapes for face. Allows to select sketch edges, edges and
65 /// wires objects that lie in the same plane and don't have intersections.
66 class BuildPlugin_ValidatorBaseForFace: public ModelAPI_FeatureValidator
67 {
68 public:
69   //! Returns true if attributes is ok.
70   //! \param theFeature the checked feature.
71   //! \param theArguments arguments of the feature.
72   //! \param theError error message.
73   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
74                        const std::list<std::string>& theArguments,
75                        Events_InfoMessage& theError) const;
76
77   /// \return true if the attribute in feature is not obligatory for the feature execution
78   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
79 };
80
81 /// \class BuildPlugin_ValidatorSubShapesSelection
82 /// \ingroup Validators
83 /// \brief A validator for selection sub-shapes for SubShape feature.
84 class BuildPlugin_ValidatorSubShapesSelection: public ModelAPI_AttributeValidator
85 {
86 public:
87   //! Returns true if attribute is ok.
88   //! \param[in] theAttribute the checked attribute.
89   //! \param[in] theArguments arguments of the attribute.
90   //! \param[out] theError error message.
91    virtual bool isValid(const AttributePtr& theAttribute,
92                         const std::list<std::string>& theArguments,
93                         Events_InfoMessage& theError) const;
94 };
95
96 #endif