Salome HOME
[Code coverage GeomValidators]: Remove unused validator
authorazv <azv@opencascade.com>
Mon, 10 Dec 2018 09:24:25 +0000 (12:24 +0300)
committerazv <azv@opencascade.com>
Mon, 10 Dec 2018 09:24:25 +0000 (12:24 +0300)
src/GeomValidators/CMakeLists.txt
src/GeomValidators/GeomValidators_PartitionArguments.cpp [deleted file]
src/GeomValidators/GeomValidators_PartitionArguments.h [deleted file]
src/GeomValidators/GeomValidators_Plugin.cpp

index 85527474ee0c0ee69d3903a1a19228be3331a348..fcca1b51c9f189b99085e5ed2c52f0008b82c5c0 100644 (file)
@@ -28,7 +28,6 @@ SET(PROJECT_HEADERS
     GeomValidators_Face.h
     GeomValidators_FeatureKind.h
     GeomValidators_Finite.h
-    GeomValidators_PartitionArguments.h
     GeomValidators_Plugin.h
     GeomValidators_Positive.h
     GeomValidators_ShapeType.h
@@ -48,7 +47,6 @@ SET(PROJECT_SOURCES
     GeomValidators_Face.cpp
     GeomValidators_FeatureKind.cpp
     GeomValidators_Finite.cpp
-    GeomValidators_PartitionArguments.cpp
     GeomValidators_Plugin.cpp
     GeomValidators_Positive.cpp
     GeomValidators_ShapeType.cpp
diff --git a/src/GeomValidators/GeomValidators_PartitionArguments.cpp b/src/GeomValidators/GeomValidators_PartitionArguments.cpp
deleted file mode 100644 (file)
index 0231eda..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_PartitionArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeBoolean.h>
-#include <ModelAPI_AttributeSelectionList.h>
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                              const std::list<std::string>& theArguments,
-                                              Events_InfoMessage& theError) const
-{
-  if(theArguments.size() != 3) {
-    theError = "Wrong number of arguments (expected 3).";
-    return false;
-  }
-
-  int anObjectsNb = 0, aToolsNb = 0;
-  bool isCombine = true;
-
-  std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
-  std::shared_ptr<ModelAPI_AttributeSelectionList> anAttrSelList = theFeature->selectionList(*anIt);
-  if(anAttrSelList) {
-    anObjectsNb = anAttrSelList->size();
-  }
-  anIt++;
-
-  anAttrSelList = theFeature->selectionList(*anIt);
-  if(anAttrSelList) {
-    aToolsNb = anAttrSelList->size();
-  }
-  anIt++;
-
-  std::shared_ptr<ModelAPI_AttributeBoolean> anAttrBool = theFeature->boolean(*anIt);
-  if(anAttrBool) {
-    isCombine = anAttrBool->value();
-  }
-
-  if((anObjectsNb > 0 && aToolsNb > 0) ||
-     (isCombine && anObjectsNb != 0 && (anObjectsNb + aToolsNb > 1))) {
-    return true;
-  }
-
-  theError = "Not enough arguments";
-  return false;
-}
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isNotObligatory(std::string theFeature,
-                                                        std::string theAttribute)
-{
-  if(theAttribute == "tool_objects") {
-    return true;
-  }
-
-  return false;
-}
diff --git a/src/GeomValidators/GeomValidators_PartitionArguments.h b/src/GeomValidators/GeomValidators_PartitionArguments.h
deleted file mode 100644 (file)
index 8a8f072..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_PartitionArguments_H
-#define GeomValidators_PartitionArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_PartitionArguments
- *  \ingroup Validators
- *  \brief Validates that partition operation have enough arguments.
- */
-class GeomValidators_PartitionArguments : public ModelAPI_FeatureValidator
-{
-public:
-  /** \brief Returns true if feature and/or attributes are valid.
-   *  \param[in] theFeature the validated feature.
-   *  \param[in] theArguments the arguments in the configuration file for this validator.
-   *  \param[out] theError error message.
-   *  \returns true if feature is valid.
-   */
-  GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                             const std::list<std::string>& theArguments,
-                                             Events_InfoMessage& theError) const;
-
-  /// \return true if the attribute in feature is not obligatory for the feature execution.
-  GEOMVALIDATORS_EXPORT virtual
-    bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
index 733fc17bf384b193aec4fecd1c625be21f950a84..6f8129df5ac32b9e92fa489e9b2584f699f0f22c 100644 (file)
@@ -26,7 +26,6 @@
 #include <GeomValidators_DifferentShapes.h>
 #include <GeomValidators_Face.h>
 #include <GeomValidators_Finite.h>
-#include <GeomValidators_PartitionArguments.h>
 #include <GeomValidators_ShapeType.h>
 #include <GeomValidators_ZeroOffset.h>
 #include <GeomValidators_FeatureKind.h>
@@ -54,8 +53,6 @@ GeomValidators_Plugin::GeomValidators_Plugin()
                               new GeomValidators_DifferentShapes);
   aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
   aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
-  aFactory->registerValidator("GeomValidators_PartitionArguments",
-                              new GeomValidators_PartitionArguments);
   aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
   aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset);
   aFactory->registerValidator("GeomValidators_FeatureKind", new GeomValidators_FeatureKind);