Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2 /*
3  * Parameters_VariableValidator.h
4  *
5  *  Created on: Apr 9, 2015
6  *      Author: sbh
7  */
8
9 #ifndef PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
10 #define PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
11
12 #include <ParametersPlugin.h>
13 #include <ParametersPlugin_Validators.h>
14
15 #include <ModelAPI_AttributeValidator.h>
16
17 #include <memory>
18
19 /**
20  * \class ParametersPlugin_VariableValidator
21  * \ingroup Validators
22  * \brief Validator for the variable name of parameter.
23  */
24 class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator
25 {
26  public:
27   PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator();
28   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator();
29
30   /**
31    * \brief Returns true if attribute has a valid parameter name.
32    * \param theAttribute the checked attribute
33    * \param theArguments arguments of the attribute
34    * \param theError the error string message if validation fails
35    */
36   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
37                                                const std::list<std::string>& theArguments,
38                                                Events_InfoMessage& theError) const;
39
40  protected:
41   /// Returns true if theString is unique parameter name in the document of theAttribute.
42   PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute,
43                                         const std::string& theString) const;
44 };
45
46 /**
47  * \class ParametersPlugin_ExpressionValidator
48  * \ingroup Validators
49  * \brief Validator for the expression of parameter.
50  */
51 class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator
52 {
53  public:
54   PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator();
55   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator();
56
57   /**
58    * \brief Returns true if attribute has a valid parameter expression.
59    * \param theAttribute the checked attribute
60    * \param theArguments arguments of the attribute
61    * \param theError the error string message if validation fails
62    */
63   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
64                                                const std::list<std::string>& theArguments,
65                                                Events_InfoMessage& theError) const;
66 };
67
68
69 #endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */