From: azv Date: Mon, 10 Dec 2018 09:24:25 +0000 (+0300) Subject: [Code coverage GeomValidators]: Remove unused validator X-Git-Tag: End2018~91 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8c4a214609d499b7e0dbd373422d5c9f4c3ebf6;p=modules%2Fshaper.git [Code coverage GeomValidators]: Remove unused validator --- diff --git a/src/GeomValidators/CMakeLists.txt b/src/GeomValidators/CMakeLists.txt index 85527474e..fcca1b51c 100644 --- a/src/GeomValidators/CMakeLists.txt +++ b/src/GeomValidators/CMakeLists.txt @@ -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 index 0231edafa..000000000 --- a/src/GeomValidators/GeomValidators_PartitionArguments.cpp +++ /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 -// - -#include - -#include - -#include -#include - -//================================================================================================= -bool GeomValidators_PartitionArguments::isValid(const std::shared_ptr& theFeature, - const std::list& 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::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); - - std::shared_ptr anAttrSelList = theFeature->selectionList(*anIt); - if(anAttrSelList) { - anObjectsNb = anAttrSelList->size(); - } - anIt++; - - anAttrSelList = theFeature->selectionList(*anIt); - if(anAttrSelList) { - aToolsNb = anAttrSelList->size(); - } - anIt++; - - std::shared_ptr 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 index 8a8f072dc..000000000 --- a/src/GeomValidators/GeomValidators_PartitionArguments.h +++ /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 -// - -#ifndef GeomValidators_PartitionArguments_H -#define GeomValidators_PartitionArguments_H - -#include -#include -#include - -/** \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& theFeature, - const std::list& 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 diff --git a/src/GeomValidators/GeomValidators_Plugin.cpp b/src/GeomValidators/GeomValidators_Plugin.cpp index 733fc17bf..6f8129df5 100644 --- a/src/GeomValidators/GeomValidators_Plugin.cpp +++ b/src/GeomValidators/GeomValidators_Plugin.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -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);