Salome HOME
Validators improvements (arguments for feature validator)
[modules/shaper.git] / src / ModelAPI / ModelAPI_Validator.h
index 7bc08324a78db0b7ab1616dc0bc696c6e3bd4ed5..78754d074e3dd581c6ebb6ba97b7751af8566cb6 100644 (file)
@@ -2,8 +2,8 @@
 // Created:     2 Jul 2014
 // Author:      Mikhail PONIKAROV
 
-#ifndef ModelAPI_Validator_HeaderFile
-#define ModelAPI_Validator_HeaderFile
+#ifndef ModelAPI_Validator_H_
+#define ModelAPI_Validator_H_
 
 #include <ModelAPI.h>
 #include <boost/shared_ptr.hpp>
@@ -24,9 +24,11 @@ class ModelAPI_Feature;
  */
 class MODELAPI_EXPORT ModelAPI_Validator
 {
-public:
+ public:
   // Make virtual destructor in order to make the class polymorphic
-  virtual ~ModelAPI_Validator() {};
+  virtual ~ModelAPI_Validator()
+  {
+  }
 
   /// Returns true if feature and/or attributes are valid
   /// \param theFeature the validated feature
@@ -52,33 +54,45 @@ typedef boost::shared_ptr<ModelAPI_Validator> ValidatorPtr;
  */
 class MODELAPI_EXPORT ModelAPI_ValidatorsFactory
 {
-public:
+ public:
   /// Registers the instance of the validator by the ID
   virtual void registerValidator(const std::string& theID, ModelAPI_Validator* theValidator) = 0;
 
   /// Assigns validator to the feature
   virtual void assignValidator(const std::string& theID, const std::string& theFeatureID) = 0;
 
+  /// Assigns validator to the feature with arguments of the validator
+  virtual void assignValidator(const std::string& theID,
+                                            const std::string& theFeatureID,
+                                            const std::list<std::string>& theArguments) = 0;
+
   /// Assigns validator to the attribute of the feature
-  virtual void assignValidator(const std::string& theID, 
-    const std::string& theFeatureID, const std::string& theAttrID,
-    const std::list<std::string>& theArguments) = 0;
+  virtual void assignValidator(const std::string& theID, const std::string& theFeatureID,
+                               const std::string& theAttrID,
+                               const std::list<std::string>& theArguments) = 0;
 
   /// Provides a validator for the feature, returns NULL if no validator
-  virtual const ModelAPI_Validator* validator(const std::string& theFeatureID) const = 0;
-
+  virtual void validators(const std::string& theFeatureID,
+                          std::list<ModelAPI_Validator*>& theResult,
+                          std::list<std::list<std::string> >& theArguments) const = 0;
   /// Provides a validator for the attribute, returns NULL if no validator
-  virtual const ModelAPI_Validator* validator(
-    const std::string& theFeatureID, const std::string& theAttrID) const = 0;
+  virtual void validators(const std::string& theFeatureID, const std::string& theAttrID,
+                          std::list<ModelAPI_Validator*>& theValidators,
+                          std::list<std::list<std::string> >& theArguments) const = 0;
+
+  /// Returns registered validator by its Id
+  virtual const ModelAPI_Validator* validator(const std::string& theID) const = 0;
 
   /// Returns the result of "validate" method for attribute of validator.
   /// If validator is not exists, returns true: everything is valid by default.
   //virtual bool validate(
   //  const boost::shared_ptr<ModelAPI_Feature>& theFeature, const std::string& theAttrID) const = 0;
 
-protected:
+ protected:
   /// Get instance from PluginManager
-  ModelAPI_ValidatorsFactory() {}
+  ModelAPI_ValidatorsFactory()
+  {
+  }
 };
 
 #endif