Salome HOME
Issue #1343: Architecture changes. Composite features now derived from extrusion...
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesPlugin_Validators.h
4 // Created:     22 March 2016
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_Validators_H_
8 #define FeaturesPlugin_Validators_H_
9
10 #include <ModelAPI_AttributeValidator.h>
11 #include <ModelAPI_FeatureValidator.h>
12
13 /// \class FeaturesPlugin_PipeLocationsValidator
14 /// \ingroup Validators
15 /// \brief Validator for the pipe locations.
16 class FeaturesPlugin_PipeLocationsValidator : public ModelAPI_FeatureValidator
17 {
18  public:
19   //! \return true if number of selected locations the same as number of selected bases, or empty.
20   //! \param theFeature the checked feature
21   //! \param theArguments arguments of the feature (not used)
22   //! \param theError error message
23   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
24                        const std::list<std::string>& theArguments,
25                        std::string& theError) const;
26
27   /// Returns true if the attribute in feature is not obligatory for the feature execution
28   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
29 };
30
31 /// \class FeaturesPlugin_ValidatorBaseForGeneration
32 /// \ingroup Validators
33 /// \brief A validator for selection base for generation. Allows to select faces on sketch,
34 /// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.
35 class FeaturesPlugin_ValidatorBaseForGeneration : public ModelAPI_AttributeValidator
36 {
37 public:
38   //! Returns true if attribute has selection type listed in the parameter arguments.
39   //! \param[in] theAttribute the checked attribute.
40   //! \param[in] theArguments arguments of the attribute.
41   //! \param[out] theError error message.
42    virtual bool isValid(const AttributePtr& theAttribute,
43                         const std::list<std::string>& theArguments,
44                         std::string& theError) const;
45
46 private:
47   bool isValidAttribute(const AttributePtr& theAttribute,
48                         std::string& theError) const;
49 };
50
51 #endif