]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_FeatureValidator.cpp
Salome HOME
Issue #118: Crash on remove part is fixed
[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)
19     return false;
20   if (!aData->isValid())
21     return false;
22   const std::string kAllTypes = "";
23   std::list<AttributePtr> aLtAttributes = aData->attributes(kAllTypes);
24   std::list<AttributePtr>::iterator it = aLtAttributes.begin();
25   for (; it != aLtAttributes.end(); it++) {
26     if (!(*it)->isInitialized())
27       return false;
28   }
29   return true;
30 }