Add readability-simplify-boolean-expr

* Add readability-simplify-boolean-expr
* Fixes based on review
This commit is contained in:
Magne Sjaastad
2023-06-26 13:12:41 +02:00
committed by GitHub
parent 34d83efaed
commit 59ca0b943c
116 changed files with 179 additions and 635 deletions

View File

@@ -35,12 +35,7 @@ bool RicDeletePolylineTargetFeature::isCommandEnabled()
std::vector<RimPolylineTarget*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( !objects.empty() )
{
return true;
}
return false;
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -22,7 +22,9 @@ CAF_CMD_SOURCE_INIT( RicDeleteWellPathTargetFeature, "RicDeleteWellPathTargetFea
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathTarget.h"
#include "cafSelectionManager.h"
#include <QAction>
//--------------------------------------------------------------------------------------------------
@@ -33,12 +35,7 @@ bool RicDeleteWellPathTargetFeature::isCommandEnabled()
std::vector<RimWellPathTarget*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( objects.size() > 0 )
{
return true;
}
return false;
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -48,12 +48,7 @@ CAF_CMD_SOURCE_INIT( RicNewWellPathLateralAtDepthFeature, "RicNewWellPathLateral
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathLateralAtDepthFeature::isCommandEnabled()
{
if ( RiuWellPathSelectionItem::wellPathSelectionItem() )
{
return true;
}
return false;
return RiuWellPathSelectionItem::wellPathSelectionItem() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -32,20 +32,11 @@ CAF_CMD_SOURCE_INIT( RicShowWellPlanFeature, "RicShowWellPlanFeature" );
//--------------------------------------------------------------------------------------------------
///
///
/// RicShowPlotDataFeature
///
///
//--------------------------------------------------------------------------------------------------
bool RicShowWellPlanFeature::isCommandEnabled()
{
auto selectedWellPaths = caf::selectedObjectsByType<RimModeledWellPath*>();
if ( selectedWellPaths.size() > 0 )
{
return true;
}
return false;
return !selectedWellPaths.empty();
}
//--------------------------------------------------------------------------------------------------
@@ -56,8 +47,7 @@ void RicShowWellPlanFeature::onActionTriggered( bool isChecked )
this->disableModelChangeContribution();
std::vector<RimModeledWellPath*> selectedWellPaths = caf::selectedObjectsByType<RimModeledWellPath*>();
if ( selectedWellPaths.size() == 0 )
if ( selectedWellPaths.empty() )
{
return;
}