SHAPER  9.12.0
Model_ValidatorsFactory Class Reference

Manages the registered validators. More...

Inheritance diagram for Model_ValidatorsFactory:
Inheritance graph

Public Types

typedef std::list< std::pair< std::string, std::list< std::string > > > Validators
 Validators is a list of pairs <Validator, list of arguments> More...
 

Public Member Functions

virtual MODEL_EXPORT void registerValidator (const std::string &theID, ModelAPI_Validator *theValidator)
 Registers the instance of the validator by the ID. More...
 
virtual MODEL_EXPORT void assignValidator (const std::string &theID, const std::string &theFeatureID)
 Assigns validator to the feature. More...
 
virtual MODEL_EXPORT void assignValidator (const std::string &theID, const std::string &theFeatureID, const std::list< std::string > &theArguments)
 Assigns validator to the feature with arguments of the validator. More...
 
virtual MODEL_EXPORT void assignValidator (const std::string &theID, const std::string &theFeatureID, const std::string &theAttrID, const std::list< std::string > &theArguments)
 Assigns validator to the attribute of the feature. More...
 
virtual MODEL_EXPORT void validators (const std::string &theFeatureID, Validators &theResult) const
 Provides a validator for the feature, returns NULL if no validator. More...
 
virtual MODEL_EXPORT void validators (const std::string &theFeatureID, const std::string &theAttrID, Validators &theResult) const
 Provides a validator for the attribute, returns NULL if no validator. More...
 
virtual MODEL_EXPORT const ModelAPI_Validatorvalidator (const std::string &theID) const
 Returns registered validator by its Id. More...
 
virtual MODEL_EXPORT bool validate (const std::shared_ptr< ModelAPI_Feature > &theFeature) const
 Returns true if feature and all its attributes are valid. More...
 
virtual MODEL_EXPORT bool validate (const std::shared_ptr< ModelAPI_Attribute > &theAttribute, std::string &theValidator, Events_InfoMessage &theError) const
 Returns true if the attribute is valid. More...
 
virtual void registerNotObligatory (std::string theFeature, std::string theAttribute)
 register that this attribute in feature is not obligatory for the feature execution so, it is not needed for the standard validation mechanism More...
 
virtual bool isNotObligatory (std::string theFeature, std::string theAttribute)
 Returns true if the attribute in feature is not obligatory for the feature execution. More...
 
virtual void registerConcealment (std::string theFeature, std::string theAttribute)
 register that this attribute conceals in the object browser all referenced features after execution More...
 
virtual bool isConcealed (std::string theFeature, std::string theAttribute)
 Returns true that it was registered that attribute conceals the referenced result. More...
 
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) More...
 
virtual bool isCase (FeaturePtr theFeature, std::string theAttribute)
 Returns true if the attribute must be checked (the case is selected) More...
 
virtual void registerMainArgument (std::string theFeature, std::string theAttribute)
 Register the attribute as a main argument of the feature. More...
 
virtual bool isMainArgument (std::string theFeature, std::string theAttribute)
 Returns true is the attribute is a main argument of the feature. More...
 
virtual void registerGeometricalSelection (std::string theFeature, std::string theAttribute)
 Register the selection attribute as geometrical selection. More...
 
virtual bool isGeometricalSelection (std::string theFeature, std::string theAttribute)
 Returns true if the attribute is a geometrical selection. More...
 

Protected Member Functions

void addDefaultValidators (Validators &theValidators) const
 Adds the defualt validators that are usefull for all features. More...
 
void addDefaultAttributeValidators (Validators &theValidators) const
 Adds the defualt validators that are usefull for all attributes. More...
 
 Model_ValidatorsFactory ()
 Get instance from Session. More...
 

Friends

class Model_Session
 

Detailed Description

Manages the registered validators.

Allows to get a validator by the feature identifier and the attribute identifier (if attribute is validated). All accessible validators mustbe registered by the ID string first. The instance of this factory can be get in the Session. Keeps the validator objects alive and just returns one of it by request. All the needed information is provided to the validator as an argument, this allows to work with them independently from the feature specific object.

Member Typedef Documentation

◆ Validators

typedef std::list<std::pair<std::string, std::list<std::string> > > ModelAPI_ValidatorsFactory::Validators
inherited

Validators is a list of pairs <Validator, list of arguments>

Constructor & Destructor Documentation

◆ Model_ValidatorsFactory()

Model_ValidatorsFactory::Model_ValidatorsFactory ( )
protected

Get instance from Session.

Member Function Documentation

◆ registerValidator()

void Model_ValidatorsFactory::registerValidator ( const std::string &  theID,
ModelAPI_Validator theValidator 
)
virtual

Registers the instance of the validator by the ID.

Implements ModelAPI_ValidatorsFactory.

◆ assignValidator() [1/3]

void Model_ValidatorsFactory::assignValidator ( const std::string &  theID,
const std::string &  theFeatureID 
)
virtual

Assigns validator to the feature.

Implements ModelAPI_ValidatorsFactory.

◆ assignValidator() [2/3]

void Model_ValidatorsFactory::assignValidator ( const std::string &  theID,
const std::string &  theFeatureID,
const std::list< std::string > &  theArguments 
)
virtual

Assigns validator to the feature with arguments of the validator.

Implements ModelAPI_ValidatorsFactory.

◆ assignValidator() [3/3]

void Model_ValidatorsFactory::assignValidator ( const std::string &  theID,
const std::string &  theFeatureID,
const std::string &  theAttrID,
const std::list< std::string > &  theArguments 
)
virtual

Assigns validator to the attribute of the feature.

Implements ModelAPI_ValidatorsFactory.

◆ validators() [1/2]

void Model_ValidatorsFactory::validators ( const std::string &  theFeatureID,
Validators theResult 
) const
virtual

Provides a validator for the feature, returns NULL if no validator.

Implements ModelAPI_ValidatorsFactory.

◆ validators() [2/2]

void Model_ValidatorsFactory::validators ( const std::string &  theFeatureID,
const std::string &  theAttrID,
Validators theResult 
) const
virtual

Provides a validator for the attribute, returns NULL if no validator.

Implements ModelAPI_ValidatorsFactory.

◆ validator()

const ModelAPI_Validator * Model_ValidatorsFactory::validator ( const std::string &  theID) const
virtual

Returns registered validator by its Id.

Implements ModelAPI_ValidatorsFactory.

◆ validate() [1/2]

bool Model_ValidatorsFactory::validate ( const std::shared_ptr< ModelAPI_Feature > &  theFeature) const
virtual

Returns true if feature and all its attributes are valid.

Implements ModelAPI_ValidatorsFactory.

◆ validate() [2/2]

bool Model_ValidatorsFactory::validate ( const std::shared_ptr< ModelAPI_Attribute > &  theAttribute,
std::string &  theValidator,
Events_InfoMessage theError 
) const
virtual

Returns true if the attribute is valid.

Implements ModelAPI_ValidatorsFactory.

◆ registerNotObligatory()

void Model_ValidatorsFactory::registerNotObligatory ( std::string  theFeature,
std::string  theAttribute 
)
virtual

register that this attribute in feature is not obligatory for the feature execution so, it is not needed for the standard validation mechanism

Implements ModelAPI_ValidatorsFactory.

◆ isNotObligatory()

bool Model_ValidatorsFactory::isNotObligatory ( std::string  theFeature,
std::string  theAttribute 
)
virtual

Returns true if the attribute in feature is not obligatory for the feature execution.

Implements ModelAPI_ValidatorsFactory.

◆ registerConcealment()

void Model_ValidatorsFactory::registerConcealment ( std::string  theFeature,
std::string  theAttribute 
)
virtual

register that this attribute conceals in the object browser all referenced features after execution

Implements ModelAPI_ValidatorsFactory.

◆ isConcealed()

bool Model_ValidatorsFactory::isConcealed ( std::string  theFeature,
std::string  theAttribute 
)
virtual

Returns true that it was registered that attribute conceals the referenced result.

Implements ModelAPI_ValidatorsFactory.

◆ registerCase()

void Model_ValidatorsFactory::registerCase ( std::string  theFeature,
std::string  theAttribute,
const std::list< std::pair< std::string, std::string > > &  theCases 
)
virtual

register the case-attribute (myCases set definition)

Implements ModelAPI_ValidatorsFactory.

◆ isCase()

bool Model_ValidatorsFactory::isCase ( FeaturePtr  theFeature,
std::string  theAttribute 
)
virtual

Returns true if the attribute must be checked (the case is selected)

Implements ModelAPI_ValidatorsFactory.

◆ registerMainArgument()

void Model_ValidatorsFactory::registerMainArgument ( std::string  theFeature,
std::string  theAttribute 
)
virtual

Register the attribute as a main argument of the feature.

Implements ModelAPI_ValidatorsFactory.

◆ isMainArgument()

bool Model_ValidatorsFactory::isMainArgument ( std::string  theFeature,
std::string  theAttribute 
)
virtual

Returns true is the attribute is a main argument of the feature.

Implements ModelAPI_ValidatorsFactory.

◆ registerGeometricalSelection()

void Model_ValidatorsFactory::registerGeometricalSelection ( std::string  theFeature,
std::string  theAttribute 
)
virtual

Register the selection attribute as geometrical selection.

Implements ModelAPI_ValidatorsFactory.

◆ isGeometricalSelection()

bool Model_ValidatorsFactory::isGeometricalSelection ( std::string  theFeature,
std::string  theAttribute 
)
virtual

Returns true if the attribute is a geometrical selection.

Implements ModelAPI_ValidatorsFactory.

◆ addDefaultValidators()

void Model_ValidatorsFactory::addDefaultValidators ( Validators theValidators) const
protected

Adds the defualt validators that are usefull for all features.

◆ addDefaultAttributeValidators()

void Model_ValidatorsFactory::addDefaultAttributeValidators ( Validators theValidators) const
protected

Adds the defualt validators that are usefull for all attributes.