Salome HOME
Error management -- Attribute validator returns an error.
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_Validators.h
1 /*
2  * Parameters_VariableValidator.h
3  *
4  *  Created on: Apr 9, 2015
5  *      Author: sbh
6  */
7
8 #ifndef PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
9 #define PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
10
11 #include <ParametersPlugin.h>
12 #include <ParametersPlugin_Validators.h>
13
14 #include <ModelAPI_AttributeValidator.h>
15
16 #include <memory>
17
18 class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator
19 {
20  public:
21   PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator();
22   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator();
23
24   //! returns true if attribute is valid
25   //! \param theAttribute the checked attribute
26   //! \param theArguments arguments of the attribute
27   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
28                                                const std::list<std::string>& theArguments,
29                                                std::string& theError) const;
30
31  protected:
32   PARAMETERSPLUGIN_EXPORT bool isVariable(const std::string& theString) const;
33   PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute, 
34                                         const std::string& theString) const;
35 };
36
37 class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator
38 {
39  public:
40   PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator();
41   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator();
42
43   //! returns true if attribute is valid
44   //! \param theAttribute the checked attribute
45   //! \param theArguments arguments of the attribute
46   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
47                                                const std::list<std::string>& theArguments,
48                                                std::string& theError) const;
49 };
50
51
52 #endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */