20 #ifndef Model_Validator_H_
21 #define Model_Validator_H_
24 #include <ModelAPI_Validator.h>
43 std::map<std::string, ModelAPI_Validator*> myIDs;
45 typedef std::map<std::string, std::list<std::string> > AttrValidators;
47 std::map<std::string, AttrValidators> myFeatures;
49 std::map<std::string, std::map<std::string, AttrValidators> > myAttrs;
52 std::map<std::string, std::set<std::string> > myConcealed;
56 std::map<std::string, std::map<std::string,
57 std::map<std::string, std::set<std::string> > > > myCases;
59 std::map<std::string, std::string> myMainArgument;
60 std::map<std::string, std::set<std::string> > myGeometricalSelection;
69 const std::string& theFeatureID);
73 const std::string& theFeatureID,
74 const std::list<std::string>& theArguments);
78 const std::string& theFeatureID,
79 const std::string& theAttrID,
80 const std::list<std::string>& theArguments);
83 MODEL_EXPORT
virtual void validators(
const std::string& theFeatureID,
86 MODEL_EXPORT
virtual void validators(
const std::string& theFeatureID,
87 const std::string& theAttrID,
Validators& theResult)
const;
93 MODEL_EXPORT
virtual bool validate(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
const;
96 MODEL_EXPORT
virtual bool validate(
const std::shared_ptr<ModelAPI_Attribute>& theAttribute,
104 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
111 virtual bool isConcealed(std::string theFeature, std::string theAttribute);
114 virtual void registerCase(std::string theFeature, std::string theAttribute,
115 const std::list<std::pair<std::string, std::string> >& theCases);
118 virtual bool isCase(FeaturePtr theFeature, std::string theAttribute);
124 virtual bool isMainArgument(std::string theFeature, std::string theAttribute);
An event message for sending a string message which has to be translated.
Definition: Events_InfoMessage.h:35
Allows to validate the attribute value of a feature or the whole feature.
Definition: ModelAPI_Validator.h:43
Manages the registered validators.
Definition: ModelAPI_Validator.h:66
std::list< std::pair< std::string, std::list< std::string > > > Validators
Validators is a list of pairs <Validator, list of arguments>
Definition: ModelAPI_Validator.h:87
Object that knows (from the initial XML file) which plugin contains which feature,...
Definition: Model_Session.h:43
Manages the registered validators.
Definition: Model_Validator.h:41
virtual bool isMainArgument(std::string theFeature, std::string theAttribute)
Returns true is the attribute is a main argument of the feature.
Definition: Model_Validator.cpp:374
virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute)
Returns true if the attribute is a geometrical selection.
Definition: Model_Validator.cpp:395
virtual MODEL_EXPORT const ModelAPI_Validator * validator(const std::string &theID) const
Returns registered validator by its Id.
Definition: Model_Validator.cpp:146
virtual void registerNotObligatory(std::string theFeature, std::string theAttribute)
register that this attribute in feature is not obligatory for the feature execution so,...
Definition: Model_Validator.cpp:268
virtual MODEL_EXPORT void validators(const std::string &theFeatureID, Validators &theResult) const
Provides a validator for the feature, returns NULL if no validator.
Definition: Model_Validator.cpp:96
virtual void registerMainArgument(std::string theFeature, std::string theAttribute)
Register the attribute as a main argument of the feature.
Definition: Model_Validator.cpp:366
virtual MODEL_EXPORT void assignValidator(const std::string &theID, const std::string &theFeatureID)
Assigns validator to the feature.
Definition: Model_Validator.cpp:46
virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute)
Register the selection attribute as geometrical selection.
Definition: Model_Validator.cpp:380
virtual bool isNotObligatory(std::string theFeature, std::string theAttribute)
Returns true if the attribute in feature is not obligatory for the feature execution.
Definition: Model_Validator.cpp:281
virtual void registerCase(std::string theFeature, std::string theAttribute, const std::list< std::pair< std::string, std::string > > &theCases)
register the case-attribute (myCases set definition)
Definition: Model_Validator.cpp:312
virtual MODEL_EXPORT void registerValidator(const std::string &theID, ModelAPI_Validator *theValidator)
Registers the instance of the validator by the ID.
Definition: Model_Validator.cpp:36
virtual bool isConcealed(std::string theFeature, std::string theAttribute)
Returns true that it was registered that attribute conceals the referenced result.
Definition: Model_Validator.cpp:306
Model_ValidatorsFactory()
Get instance from Session.
Definition: Model_Validator.cpp:139
void addDefaultAttributeValidators(Validators &theValidators) const
Adds the default validators that are useful for all attributes.
Definition: Model_Validator.cpp:163
virtual MODEL_EXPORT bool validate(const std::shared_ptr< ModelAPI_Feature > &theFeature) const
Returns true if feature and all its attributes are valid.
Definition: Model_Validator.cpp:171
void addDefaultValidators(Validators &theValidators) const
Adds the default validators that are useful for all features.
Definition: Model_Validator.cpp:155
virtual void registerConcealment(std::string theFeature, std::string theAttribute)
register that this attribute conceals in the object browser all referenced features after execution
Definition: Model_Validator.cpp:294
virtual bool isCase(FeaturePtr theFeature, std::string theAttribute)
Returns true if the attribute must be checked (the case is selected)
Definition: Model_Validator.cpp:342