Salome HOME
Issue #2343: Take into account new dimensions for show/hide dimensional constraints
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_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 PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
22 #define PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
23
24 #include <ParametersPlugin.h>
25 #include <ParametersPlugin_Validators.h>
26
27 #include <ModelAPI_AttributeValidator.h>
28
29 #include <memory>
30
31 /**
32  * \class ParametersPlugin_VariableValidator
33  * \ingroup Validators
34  * \brief Validator for the variable name of parameter.
35  */
36 class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator
37 {
38  public:
39   PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator();
40   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator();
41
42   /**
43    * \brief Returns true if attribute has a valid parameter name.
44    * \param theAttribute the checked attribute
45    * \param theArguments arguments of the attribute
46    * \param theError the error string message if validation fails
47    */
48   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
49                                                const std::list<std::string>& theArguments,
50                                                Events_InfoMessage& theError) const;
51
52  protected:
53   /// Returns true if theString is unique parameter name in the document of theAttribute.
54   PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute,
55                                         const std::string& theString) const;
56 };
57
58 /**
59  * \class ParametersPlugin_ExpressionValidator
60  * \ingroup Validators
61  * \brief Validator for the expression of parameter.
62  */
63 class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator
64 {
65  public:
66   PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator();
67   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator();
68
69   /**
70    * \brief Returns true if attribute has a valid parameter expression.
71    * \param theAttribute the checked attribute
72    * \param theArguments arguments of the attribute
73    * \param theError the error string message if validation fails
74    */
75   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
76                                                const std::list<std::string>& theArguments,
77                                                Events_InfoMessage& theError) const;
78 };
79
80
81 #endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */