]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_FeatureValidator.cpp
Salome HOME
Make general validation mechanism also for attributes the validate method for feature...
[modules/shaper.git] / src / Model / Model_FeatureValidator.cpp
1 // File:        Model_FeatureValidator.cpp
2 // Created:     8 Jul 2014
3 // Author:      Vitaly SMETANNIKOV
4
5 #include <Model_FeatureValidator.h>
6 #include <ModelAPI_Attribute.h>
7 #include <ModelAPI_Data.h>
8 #include <ModelAPI_Feature.h>
9 #include <ModelAPI_Object.h>
10
11 #include <list>
12 #include <boost/shared_ptr.hpp>
13
14 bool Model_FeatureValidator::isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature,
15   const std::list<std::string>& theArguments) const
16 {
17   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
18   if (!aData->isValid())
19     return false;
20   const std::string kAllTypes = "";
21   std::list<AttributePtr> aLtAttributes = aData->attributes(kAllTypes);
22   std::list<AttributePtr>::iterator it = aLtAttributes.begin();
23   for (; it != aLtAttributes.end(); it++) {
24     if (!(*it)->isInitialized())
25       return false;
26   }
27   return true;
28 }