SHAPER  9.12.0
ParametersPlugin_Validators.h
1 // Copyright (C) 2014-2023 CEA, EDF
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
18 //
19 
20 #ifndef PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
21 #define PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_
22 
23 #include <ParametersPlugin.h>
24 #include <ParametersPlugin_Validators.h>
25 
26 #include <ModelAPI_AttributeValidator.h>
27 
28 #include <memory>
29 
36 {
37  public:
38  PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator();
39  PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator();
40 
47  PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
48  const std::list<std::string>& theArguments,
49  Events_InfoMessage& theError) const;
50 
51  protected:
53  PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute,
54  const std::string& theString) const;
55 };
56 
63 {
64  public:
65  PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator();
66  PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator();
67 
74  PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
75  const std::list<std::string>& theArguments,
76  Events_InfoMessage& theError) const;
77 };
78 
79 
80 #endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */
An event message for sending a string message which has to be translated.
Definition: Events_InfoMessage.h:35
Generic validator for any attribute of a feature.
Definition: ModelAPI_AttributeValidator.h:31
Validator for the expression of parameter.
Definition: ParametersPlugin_Validators.h:63
virtual PARAMETERSPLUGIN_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list< std::string > &theArguments, Events_InfoMessage &theError) const
Returns true if attribute has a valid parameter expression.
Definition: ParametersPlugin_Validators.cpp:99
Validator for the variable name of parameter.
Definition: ParametersPlugin_Validators.h:36
PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr &theAttribute, const std::string &theString) const
Returns true if theString is unique parameter name in the document of theAttribute.
Definition: ParametersPlugin_Validators.cpp:69
virtual PARAMETERSPLUGIN_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list< std::string > &theArguments, Events_InfoMessage &theError) const
Returns true if attribute has a valid parameter name.
Definition: ParametersPlugin_Validators.cpp:42