#10649 ApplicationLibCode: Use collection.empty() instead of comparing with size

This commit is contained in:
Kristian Bendiksen 2023-09-27 08:07:49 +02:00
parent 98796b0dd9
commit 959c9d48fa
220 changed files with 432 additions and 431 deletions

View File

@ -934,7 +934,7 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths, gsl::not_null<QStringList*> errorMessages )
{
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {};
if ( m_project == nullptr || m_project->oilFields.empty() ) return {};
RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return {};
@ -963,7 +963,7 @@ std::vector<RimWellPath*> RiaApplication::addWellPathsToModel( QList<QString> we
//--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathFormationsToModel( QList<QString> wellPathFormationsFilePaths )
{
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return;
if ( m_project == nullptr || m_project->oilFields.empty() ) return;
RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return;
@ -989,7 +989,7 @@ void RiaApplication::addWellPathFormationsToModel( QList<QString> wellPathFormat
std::vector<RimWellLogFile*> RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths,
gsl::not_null<QStringList*> errorMessages )
{
if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {};
if ( m_project == nullptr || m_project->oilFields.empty() ) return {};
RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return {};

View File

@ -380,7 +380,7 @@ RimViewWindow* RiaGuiApplication::activePlotWindow() const
if ( m_mainPlotWindow )
{
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList( QMdiArea::StackingOrder );
if ( subwindows.size() > 0 )
if ( !subwindows.empty() )
{
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() );
}
@ -1059,7 +1059,7 @@ RimViewWindow* RiaGuiApplication::activeViewWindow()
RiuPlotMainWindow* mainPlotWindow = dynamic_cast<RiuPlotMainWindow*>( mainWindowWidget );
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder );
if ( subwindows.size() > 0 )
if ( !subwindows.empty() )
{
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() );
}

View File

@ -59,7 +59,7 @@ std::string removeCommonStart( const std::string& mask, const std::string& filen
//--------------------------------------------------------------------------------------------------
void RiaImageCompareReporter::generateHTMLReport( const std::string& fileName, const std::string& diff2htmlHeaderText )
{
if ( m_directorySets.size() == 0 ) return;
if ( m_directorySets.empty() ) return;
std::ofstream output( fileName.c_str() );
if ( !output )

View File

@ -66,7 +66,7 @@ void RiaProjectFileVersionTools::decodeVersionString( const QString& projectFile
QStringList subStrings = projectFileVersion.split( "." );
if ( subStrings.size() > 0 )
if ( !subStrings.empty() )
{
*majorVersion = subStrings[0].toInt();
}

View File

@ -123,17 +123,17 @@ void RiaProjectModifier::invalidateExternalFilePaths( RimProject* project )
//--------------------------------------------------------------------------------------------------
bool RiaProjectModifier::applyModificationsToProject( RimProject* project )
{
if ( m_caseIdToGridFileNameMap.size() > 0 )
if ( !m_caseIdToGridFileNameMap.empty() )
{
replaceCase( project );
}
if ( m_groupIdToGridFileNamesMap.size() > 0 )
if ( !m_groupIdToGridFileNamesMap.empty() )
{
replaceSourceCases( project );
}
if ( m_caseIdToPropertiesFolderMap.size() > 0 )
if ( !m_caseIdToPropertiesFolderMap.empty() )
{
replacePropertiesFolder( project );
}
@ -309,7 +309,7 @@ int RiaProjectModifier::firstGroupId( RimProject* project )
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if ( analysisModels )
{
if ( analysisModels->caseGroups.size() > 0 )
if ( !analysisModels->caseGroups.empty() )
{
return analysisModels->caseGroups[0]->groupId();
}

View File

@ -54,7 +54,7 @@ QList<caf::PdmOptionItemInfo> RiaSimWellBranchTools::valueOptionsForBranchIndexF
QList<caf::PdmOptionItemInfo> options;
size_t branchCount = simulationWellPaths.size();
if ( simulationWellPaths.size() == 0 )
if ( simulationWellPaths.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "None", -1 ) );
}
@ -111,7 +111,7 @@ int RiaSimWellBranchTools::clampBranchIndex( const QString& simWellName, int bra
{
auto branches = RiaSimWellBranchTools::simulationWellBranches( simWellName, branchDetection );
if ( branches.size() == 0 )
if ( branches.empty() )
{
return -1;
}

View File

@ -63,7 +63,7 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered( bool isChe
defaultDir,
"Well Path Perforation Intervals (*.ev);;All Files (*.*)" );
if ( wellPathFilePaths.size() < 1 ) return;
if ( wellPathFilePaths.empty() ) return;
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );

View File

@ -31,7 +31,7 @@
bool RicEclipseWellFeatureImpl::isAnyWellSelected()
{
std::vector<RimSimWellInView*> selection = selectedWells();
return selection.size() > 0;
return !selection.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -63,7 +63,7 @@ bool RicEclipseWellShowLabelFeature::isCommandEnabled() const
bool RicEclipseWellShowLabelFeature::isCommandChecked() const
{
std::vector<RimSimWellInView*> selection = RicEclipseWellFeatureImpl::selectedWells();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimSimWellInView* well = selection[0];
@ -111,7 +111,7 @@ bool RicEclipseWellShowHeadFeature::isCommandEnabled() const
bool RicEclipseWellShowHeadFeature::isCommandChecked() const
{
std::vector<RimSimWellInView*> selection = RicEclipseWellFeatureImpl::selectedWells();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimSimWellInView* well = selection[0];
@ -159,7 +159,7 @@ bool RicEclipseWellShowPipeFeature::isCommandEnabled() const
bool RicEclipseWellShowPipeFeature::isCommandChecked() const
{
std::vector<RimSimWellInView*> selection = RicEclipseWellFeatureImpl::selectedWells();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimSimWellInView* well = selection[0];
@ -207,7 +207,7 @@ bool RicEclipseWellShowSpheresFeature::isCommandEnabled() const
bool RicEclipseWellShowSpheresFeature::isCommandChecked() const
{
std::vector<RimSimWellInView*> selection = RicEclipseWellFeatureImpl::selectedWells();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimSimWellInView* well = selection[0];
@ -255,7 +255,7 @@ bool RicEclipseWellShowWellCellsFeature::isCommandEnabled() const
bool RicEclipseWellShowWellCellsFeature::isCommandChecked() const
{
std::vector<RimSimWellInView*> selection = RicEclipseWellFeatureImpl::selectedWells();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimSimWellInView* well = selection[0];
@ -303,7 +303,7 @@ bool RicEclipseWellShowWellCellFenceFeature::isCommandEnabled() const
bool RicEclipseWellShowWellCellFenceFeature::isCommandChecked() const
{
std::vector<RimSimWellInView*> selection = RicEclipseWellFeatureImpl::selectedWells();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimSimWellInView* well = selection[0];

View File

@ -38,7 +38,7 @@ CAF_CMD_SOURCE_INIT( RicComputeStatisticsFeature, "RicComputeStatisticsFeature"
bool RicComputeStatisticsFeature::isCommandEnabled() const
{
std::vector<RimEclipseStatisticsCase*> selection = selectedCases();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimEclipseStatisticsCase* statisticsCase = selection[0];
if ( statisticsCase )
@ -46,7 +46,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled() const
RimIdenticalGridCaseGroup* gridCaseGroup = statisticsCase->firstAncestorOrThisOfType<RimIdenticalGridCaseGroup>();
RimCaseCollection* caseCollection = gridCaseGroup ? gridCaseGroup->caseCollection() : nullptr;
return caseCollection ? caseCollection->reservoirs.size() > 0 : false;
return caseCollection ? !caseCollection->reservoirs.empty() : false;
}
}
@ -59,7 +59,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled() const
void RicComputeStatisticsFeature::onActionTriggered( bool isChecked )
{
std::vector<RimEclipseStatisticsCase*> selection = selectedCases();
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimEclipseStatisticsCase* statisticsCase = selection[0];

View File

@ -42,7 +42,7 @@ bool RicEclipseCaseNewGroupFeature::isCommandEnabled() const
std::vector<RimEclipseCaseCollection*> caseCollSelection;
caf::SelectionManager::instance()->objectsByType( &caseCollSelection );
return caseSelection.size() > 0 || caseCollSelection.size() > 0;
return !caseSelection.empty() || !caseCollSelection.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -73,7 +73,7 @@ caf::PdmUiItem* RicNewStatisticsCaseFeature::selectedValidUIItem()
std::vector<RimEclipseStatisticsCaseCollection*> statisticsCaseCollections;
caf::SelectionManager::instance()->objectsByType( &statisticsCaseCollections );
if ( statisticsCaseCollections.size() > 0 )
if ( !statisticsCaseCollections.empty() )
{
return statisticsCaseCollections[0];
}
@ -81,7 +81,7 @@ caf::PdmUiItem* RicNewStatisticsCaseFeature::selectedValidUIItem()
std::vector<RimCaseCollection*> caseCollections;
caf::SelectionManager::instance()->objectsByType( &caseCollections );
if ( caseCollections.size() > 0 )
if ( !caseCollections.empty() )
{
if ( RimIdenticalGridCaseGroup::isStatisticsCaseCollection( caseCollections[0] ) )
{

View File

@ -50,7 +50,7 @@ bool RicExportFaultsFeature::isCommandEnabled() const
caf::SelectionManager::instance()->objectsByType( &selectedFaults );
return ( selectedFaults.size() > 0 );
return ( !selectedFaults.empty() );
}
//--------------------------------------------------------------------------------------------------
@ -64,7 +64,7 @@ void RicExportFaultsFeature::onActionTriggered( bool isChecked )
caf::SelectionManager::instance()->objectsByType( &selectedFaults );
if ( selectedFaults.size() == 0 ) return;
if ( selectedFaults.empty() ) return;
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "FAULTS" );

View File

@ -123,7 +123,7 @@ bool RicExportToLasFileFeature::isCommandEnabled() const
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
return RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().size() > 0;
return !RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().empty();
}
//--------------------------------------------------------------------------------------------------
@ -136,7 +136,7 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked )
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
if ( curves.size() == 0 ) return;
if ( curves.empty() ) return;
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "WELL_LOGS_DIR" );

View File

@ -155,5 +155,5 @@ RimEclipseInputProperty* RicSaveEclipseInputPropertyFeature::selectedInputProper
std::vector<RimEclipseInputProperty*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
return selection.size() > 0 ? selection[0] : nullptr;
return !selection.empty() ? selection[0] : nullptr;
}

View File

@ -47,7 +47,7 @@ RimEclipseView* RicSaveEclipseResultAsInputPropertyFeature::selectedEclipseView(
std::vector<RimEclipseView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
if ( !selection.empty() )
{
return selection[0];
}
@ -63,7 +63,7 @@ RimEclipseCellColors* RicSaveEclipseResultAsInputPropertyFeature::selectedEclips
std::vector<RimEclipseCellColors*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
if ( !selection.empty() )
{
return selection[0];
}

View File

@ -119,7 +119,7 @@ QList<caf::PdmOptionItemInfo> RicSelectViewUI::calculateValueOptions( const caf:
//--------------------------------------------------------------------------------------------------
void RicSelectViewUI::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
if ( m_currentCase && m_currentCase->views().size() == 0 )
if ( m_currentCase && m_currentCase->views().empty() )
{
m_createNewView = true;
}

View File

@ -39,7 +39,7 @@ bool RicShowTotalAllocationDataFeature::isCommandEnabled() const
{
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
return wellAllocPlots.size() > 0;
return !wellAllocPlots.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -48,7 +48,7 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled() const
std::vector<RimSimWellInView*> simWellCollection;
caf::SelectionManager::instance()->objectsByType( &simWellCollection );
if ( simWellCollection.size() > 0 )
if ( !simWellCollection.empty() )
{
return true;
}
@ -81,11 +81,11 @@ void RicShowWellAllocationPlotFeature::onActionTriggered( bool isChecked )
RimSimWellInView* simWell = nullptr;
if ( collection.size() > 0 )
if ( !collection.empty() )
{
simWell = collection[0];
}
else if ( wellPathCollection.size() > 0 )
else if ( !wellPathCollection.empty() )
{
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( !view ) return;

View File

@ -45,7 +45,7 @@ bool RicPasteEllipseFractureFeature::isCommandEnabled() const
std::vector<caf::PdmPointer<RimEllipseFractureTemplate>> typedObjects;
objectGroup.objectsByType( &typedObjects );
if ( typedObjects.size() == 0 )
if ( typedObjects.empty() )
{
return false;
}

View File

@ -45,7 +45,7 @@ bool RicPasteStimPlanFractureFeature::isCommandEnabled() const
std::vector<caf::PdmPointer<RimStimPlanFractureTemplate>> typedObjects;
objectGroup.objectsByType( &typedObjects );
if ( typedObjects.size() == 0 )
if ( typedObjects.empty() )
{
return false;
}

View File

@ -39,7 +39,7 @@ void RicImportGeoMechCaseFeature::onActionTriggered( bool isChecked )
"Import Geo-Mechanical Model",
defaultDir,
"Abaqus results (*.odb);;Abaqus input file (*.inp)" );
if ( fileNames.size() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
app->setLastUsedDialogDirectory( "GEOMECH_MODEL", defaultDir );
for ( const auto& fileName : fileNames )

View File

@ -39,7 +39,7 @@ void RicImportGeoMechCaseTimeStepFilterFeature::onActionTriggered( bool isChecke
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
QStringList fileNames =
RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)" );
if ( fileNames.size() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
for ( QString fileName : fileNames )
{
if ( !fileName.isEmpty() )

View File

@ -123,7 +123,7 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
{
gCase->reloadDataAndUpdate();
auto& views = gCase->geoMechViews();
if ( views.size() > 0 )
if ( !views.empty() )
{
Riu3DMainWindowTools::selectAsCurrentItem( views[0] );
}

View File

@ -71,7 +71,7 @@ void RicShowFaultReactModelFeature::onActionTriggered( bool isChecked )
{
gCase->reloadDataAndUpdate();
auto& views = gCase->geoMechViews();
if ( views.size() > 0 )
if ( !views.empty() )
{
Riu3DMainWindowTools::selectAsCurrentItem( views[0] );
}

View File

@ -263,14 +263,14 @@ void RicHoloLensSession::handleSuccessfulSendMetaData( int metaDataSequenceNumbe
else
{
// An empty server response means we should send all array referenced by the last sent meta data
if ( m_lastExtractionAllReferencedPacketIdsArr.size() > 0 )
if ( !m_lastExtractionAllReferencedPacketIdsArr.empty() )
{
arrayIdsToSend = m_lastExtractionAllReferencedPacketIdsArr;
RiaLogging::info( "HoloLens: Empty server response, sending all arrays referenced by last meta data" );
}
}
if ( arrayIdsToSend.size() == 0 )
if ( arrayIdsToSend.empty() )
{
RiaLogging::info( "HoloLens: Nothing to do, no data requested by server" );
return;

View File

@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicAddScriptPathFeature, "RicAddScriptPathFeature" );
bool RicAddScriptPathFeature::isCommandEnabled() const
{
std::vector<RimScriptCollection*> selection = RicScriptFeatureImpl::selectedScriptCollections();
return selection.size() > 0;
return !selection.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -45,7 +45,7 @@ bool RicDeleteScriptPathFeature::isCommandEnabled() const
{
if ( selection.front()->directory().isEmpty() ) return false;
}
return selection.size() > 0;
return !selection.empty();
}
//--------------------------------------------------------------------------------------------------
@ -54,7 +54,7 @@ bool RicDeleteScriptPathFeature::isCommandEnabled() const
void RicDeleteScriptPathFeature::onActionTriggered( bool isChecked )
{
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
RimScriptCollection* scriptCollection = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr;
RimScriptCollection* scriptCollection = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr;
if ( scriptCollection )
{
QString toBeRemoved = scriptCollection->directory;

View File

@ -49,7 +49,7 @@ CAF_CMD_SOURCE_INIT( RicExecuteScriptFeature, "RicExecuteScriptFeature" );
bool RicExecuteScriptFeature::isCommandEnabled() const
{
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
return selection.size() > 0;
return !selection.empty();
}
//--------------------------------------------------------------------------------------------------
@ -58,7 +58,7 @@ bool RicExecuteScriptFeature::isCommandEnabled() const
void RicExecuteScriptFeature::onActionTriggered( bool isChecked )
{
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
CVF_ASSERT( selection.size() > 0 );
CVF_ASSERT( !selection.empty() );
executeScript( selection[0] );
}

View File

@ -59,8 +59,8 @@ void RicNewOctaveScriptFeature::onActionTriggered( bool isChecked )
std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts();
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : nullptr;
RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr;
RimCalcScript* calcScript = !calcScripts.empty() ? calcScripts[0] : nullptr;
RimScriptCollection* scriptColl = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr;
QString fullPathNewScript;

View File

@ -60,8 +60,8 @@ void RicNewPythonScriptFeature::onActionTriggered( bool isChecked )
std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts();
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : nullptr;
RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr;
RimCalcScript* calcScript = !calcScripts.empty() ? calcScripts[0] : nullptr;
RimScriptCollection* scriptColl = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr;
QString fullPathNewScript;

View File

@ -53,7 +53,7 @@ bool RicPasteEclipseCasesFeature::isCommandEnabled() const
std::vector<caf::PdmPointer<RimEclipseResultCase>> typedObjects;
objectGroup.objectsByType( &typedObjects );
if ( typedObjects.size() == 0 )
if ( typedObjects.empty() )
{
return false;
}
@ -77,7 +77,7 @@ void RicPasteEclipseCasesFeature::onActionTriggered( bool isChecked )
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
if ( objectGroup.objects.size() == 0 ) return;
if ( objectGroup.objects.empty() ) return;
addCasesToGridCaseGroup( objectGroup, gridCaseGroup );
@ -115,7 +115,7 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup( caf::PdmObjectGroup&
}
}
if ( resultCases.size() == 0 )
if ( resultCases.empty() )
{
return;
}

View File

@ -46,7 +46,7 @@ bool RicPasteGeoMechViewsFeature::isCommandEnabled() const
std::vector<caf::PdmPointer<RimGeoMechView>> typedObjects;
objectGroup.objectsByType( &typedObjects );
if ( typedObjects.size() == 0 )
if ( typedObjects.empty() )
{
return false;
}
@ -70,7 +70,7 @@ void RicPasteGeoMechViewsFeature::onActionTriggered( bool isChecked )
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
if ( objectGroup.objects.size() == 0 ) return;
if ( objectGroup.objects.empty() ) return;
std::vector<caf::PdmPointer<RimGeoMechView>> geomViews;
objectGroup.objectsByType( &geomViews );

View File

@ -71,7 +71,7 @@ void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked )
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
if ( objectGroup.objects.size() == 0 ) return;
if ( objectGroup.objects.empty() ) return;
std::vector<caf::PdmPointer<RimExtrudedCurveIntersection>> intersectionObjects;
objectGroup.objectsByType( &intersectionObjects );

View File

@ -55,7 +55,7 @@ bool RicNewSummaryMultiPlotFromDataVectorFeature::isCommandEnabled() const
if ( adr->isEnsemble() ) nEnsembles++;
}
bool bOk = ( selectedAddressItems.size() > 0 );
bool bOk = ( !selectedAddressItems.empty() );
if ( nEnsembles > 0 )
{
bOk = bOk && ( nEnsembles == selectedItems.size() );

View File

@ -52,7 +52,7 @@ bool RicNewSummaryPlotFromDataVectorFeature::isCommandEnabled() const
if ( adr->isEnsemble() ) nEnsembles++;
}
bool bOk = ( selectedAddressItems.size() > 0 );
bool bOk = ( !selectedAddressItems.empty() );
if ( nEnsembles > 0 )
{
bOk = bOk && ( nEnsembles == selectedItems.size() );

View File

@ -413,7 +413,7 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPl
if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES )
{
RimSummaryMultiPlot* plotToSelect = nullptr;
bool ensembleTemplates = ( ensembles.size() > 0 );
bool ensembleTemplates = ( !ensembles.empty() );
for ( auto& filename : prefs->defaultSummaryPlotTemplates( ensembleTemplates ) )
{
plotToSelect = RicSummaryPlotTemplateTools::create( filename, cases, ensembles );

View File

@ -95,7 +95,7 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked )
plot->storeStepDimensionFromToolbar();
QString ext = ".rpt";
if ( selectedSummaryPlot()->curveSets().size() > 0 ) ext = ".erpt";
if ( !selectedSummaryPlot()->curveSets().empty() ) ext = ".erpt";
QString fileName = settings.filePath() + "/" + settings.name() + ext;
if ( !fileName.isEmpty() )

View File

@ -66,7 +66,7 @@ void RicSelectCaseOrEnsembleUi::setEnsembleSelectionMode( bool ensembleMode )
else
{
std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
if ( cases.size() > 0 ) m_selectedSummaryCase = cases.front();
if ( !cases.empty() ) m_selectedSummaryCase = cases.front();
}
}

View File

@ -105,7 +105,7 @@ bool RicCloseObservedDataFeature::isCommandEnabled() const
std::vector<RimObservedFmuRftData*> fmuRftSelection;
caf::SelectionManager::instance()->objectsByType( &fmuRftSelection );
if ( summarySelection.size() == 0 && fmuRftSelection.size() == 0 )
if ( summarySelection.empty() && fmuRftSelection.empty() )
{
return false;
}

View File

@ -116,7 +116,7 @@ bool RicCloseSummaryCaseFeature::isCommandEnabled() const
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() == 0 )
if ( selection.empty() )
{
return false;
}
@ -138,7 +138,7 @@ void RicCloseSummaryCaseFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
CVF_ASSERT( selection.size() > 0 );
CVF_ASSERT( !selection.empty() );
RicCloseSummaryCaseFeature::deleteSummaryCases( selection );
}

View File

@ -67,7 +67,7 @@ bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled() const
{ return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr; } ),
summaryCaseCollections.end() );
return ( summaryCaseMainCollections.size() > 0 || summaryCaseCollections.size() > 0 );
return ( !summaryCaseMainCollections.empty() || !summaryCaseCollections.empty() );
}
//--------------------------------------------------------------------------------------------------
@ -78,7 +78,7 @@ void RicCloseSummaryCaseInCollectionFeature::onActionTriggered( bool isChecked )
std::vector<RimSummaryCaseMainCollection*> summaryCaseMainCollections;
caf::SelectionManager::instance()->objectsByType( &summaryCaseMainCollections );
if ( summaryCaseMainCollections.size() > 0 )
if ( !summaryCaseMainCollections.empty() )
{
std::vector<RimSummaryCase*> allSummaryCases = summaryCaseMainCollections[0]->allSummaryCases();
RicCloseSummaryCaseFeature::deleteSummaryCases( allSummaryCases );

View File

@ -59,7 +59,7 @@ bool RicCreateSummaryCaseCollectionFeature::isCommandEnabled() const
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() == 0 )
if ( selection.empty() )
{
return false;
}
@ -81,7 +81,7 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() == 0 ) return;
if ( selection.empty() ) return;
std::vector<RimSummaryCase*> duplicates;

View File

@ -126,7 +126,7 @@ void RicDeleteSubItemsFeature::deleteSubItems( bool onlyDeleteUnchecked )
std::vector<caf::PdmUiItem*> items;
caf::SelectionManager::instance()->selectedItems( items );
CVF_ASSERT( items.size() > 0 );
CVF_ASSERT( !items.empty() );
for ( auto item : items )
{

View File

@ -73,7 +73,7 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const
[]( RimSummaryCaseCollection* coll )
{ return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr; } ),
selection.end() );
return ( selection.size() > 0 );
return ( !selection.empty() );
}
//--------------------------------------------------------------------------------------------------
@ -83,7 +83,7 @@ void RicDeleteSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryCaseCollection*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() == 0 ) return;
if ( selection.empty() ) return;
QMessageBox msgBox;
msgBox.setIcon( QMessageBox::Question );
@ -143,7 +143,7 @@ void RicDeleteSummaryCaseCollectionFeature::setupActionLook( QAction* actionToSe
void RicDeleteSummaryCaseCollectionFeature::moveAllCasesToMainSummaryCollection( RimSummaryCaseCollection* summaryCaseCollection )
{
std::vector<RimSummaryCase*> summaryCases = summaryCaseCollection->allSummaryCases();
if ( summaryCases.size() == 0 ) return;
if ( summaryCases.empty() ) return;
RimSummaryCaseMainCollection* summaryCaseMainCollection = summaryCaseCollection->firstAncestorOrThisOfType<RimSummaryCaseMainCollection>();

View File

@ -107,7 +107,7 @@ bool RicImportObservedDataFeature::isCommandEnabled() const
std::vector<RimObservedSummaryData*> selectionObservedData;
caf::SelectionManager::instance()->objectsByType( &selectionObservedData );
return ( selectionObservedDataCollection.size() > 0 || selectionObservedData.size() > 0 );
return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -102,7 +102,7 @@ bool RicImportObservedFmuDataFeature::isCommandEnabled() const
std::vector<RimObservedSummaryData*> selectionObservedData;
caf::SelectionManager::instance()->objectsByType( &selectionObservedData );
return ( selectionObservedDataCollection.size() > 0 || selectionObservedData.size() > 0 );
return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -124,7 +124,7 @@ RimEclipseCase* RicNewViewFeature::selectedEclipseCase()
std::vector<RimEclipseCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
if ( !selection.empty() )
{
return selection[0];
}
@ -140,7 +140,7 @@ RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
std::vector<RimGeoMechCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
if ( !selection.empty() )
{
return selection[0];
}
@ -175,7 +175,7 @@ RimGeoMechView* RicNewViewFeature::selectedGeoMechView()
std::vector<RimGeoMechView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
if ( !selection.empty() )
{
return selection[0];
}

View File

@ -643,7 +643,7 @@ QStringList RicRecursiveFileSearchDialog::createFileNameFilterList()
QStringList nameFilter;
QString effectiveFileNameFilter = !fileNameFilter.isEmpty() ? fileNameFilter : "*";
if ( fileExtensions.size() == 0 || !extensionFromFileNameFilter().isEmpty() )
if ( fileExtensions.empty() || !extensionFromFileNameFilter().isEmpty() )
{
nameFilter.append( effectiveFileNameFilter );
}

View File

@ -39,7 +39,7 @@ bool RicReloadFormationNamesFeature::isCommandEnabled() const
std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs;
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
return ( selectedFormationNamesObjs.size() > 0 || selectedFormationNamesCollObjs.size() > 0 );
return ( !selectedFormationNamesObjs.empty() || !selectedFormationNamesCollObjs.empty() );
}
//--------------------------------------------------------------------------------------------------
@ -50,7 +50,7 @@ void RicReloadFormationNamesFeature::onActionTriggered( bool isChecked )
std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs;
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
if ( selectedFormationNamesCollObjs.size() )
if ( !selectedFormationNamesCollObjs.empty() )
{
selectedFormationNamesCollObjs[0]->readAllFormationNames();
for ( RimFormationNames* fnames : selectedFormationNamesCollObjs[0]->formationNamesList() )

View File

@ -94,7 +94,7 @@ std::vector<RimSummaryCase*> RicReloadSummaryCaseFeature::selectedSummaryCases()
std::vector<RimSummaryCaseMainCollection*> mainCollectionSelection;
caf::SelectionManager::instance()->objectsByType( &mainCollectionSelection );
if ( mainCollectionSelection.size() > 0 )
if ( !mainCollectionSelection.empty() )
{
return mainCollectionSelection[0]->allSummaryCases();
}

View File

@ -39,7 +39,7 @@ bool RicReloadWellPathFormationNamesFeature::isCommandEnabled() const
std::vector<RimWellPathCollection*> wellPathCollection;
caf::SelectionManager::instance()->objectsByType( &wellPathCollection );
return ( wellPaths.size() > 0 || wellPathCollection.size() > 0 );
return ( !wellPaths.empty() || !wellPathCollection.empty() );
}
//--------------------------------------------------------------------------------------------------
@ -53,12 +53,12 @@ void RicReloadWellPathFormationNamesFeature::onActionTriggered( bool isChecked )
std::vector<RimWellPathCollection*> wellPathCollections;
caf::SelectionManager::instance()->objectsByType( &wellPathCollections );
if ( wellPaths.size() > 0 )
if ( !wellPaths.empty() )
{
RimWellPathCollection* wellPathCollection = wellPaths[0]->firstAncestorOrThisOfTypeAsserted<RimWellPathCollection>();
wellPathCollection->reloadAllWellPathFormations();
}
else if ( wellPathCollections.size() > 0 )
else if ( !wellPathCollections.empty() )
{
wellPathCollections[0]->reloadAllWellPathFormations();
}

View File

@ -122,7 +122,7 @@ RimEclipseView* RicSelectOrCreateViewFeatureImpl::getDefaultSelectedView( RimEcl
}
else
{
if ( resultCase->views().size() > 0 )
if ( !resultCase->views().empty() )
{
defaultSelectedView = dynamic_cast<RimEclipseView*>( resultCase->views()[0] );
}

View File

@ -68,7 +68,7 @@ RimSimWellInView* RicWellLogTools::selectedSimulationWell( int* branchIndex )
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
( *branchIndex ) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
return !selection.empty() ? selection[0] : nullptr;
}
}
@ -164,10 +164,10 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
if ( !selection.empty() )
{
RimWellPath* wellPath = selection[0];
if ( wellPath->wellLogFiles().size() > 0 )
if ( !wellPath->wellLogFiles().empty() )
{
return wellPath;
}
@ -182,7 +182,7 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( wellPath && wellPath->wellLogFiles().size() > 0 )
if ( wellPath && !wellPath->wellLogFiles().empty() )
{
return wellPath;
}

View File

@ -61,7 +61,7 @@ void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
RimSeismicData* selectedData = nullptr;
if ( uiItems.size() > 0 )
if ( !uiItems.empty() )
{
selectedData = dynamic_cast<RimSeismicData*>( uiItems[0] );
}

View File

@ -76,7 +76,7 @@ void RicSeismicSectionFromIntersectionFeature::onActionTriggered( bool isChecked
newSection->setUserDescription( intersection->name() );
auto polyline = intersection->polyLines();
if ( polyline.size() > 0 )
if ( !polyline.empty() )
{
for ( auto& p : polyline[0] )
{

View File

@ -107,7 +107,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked )
if ( QDialog::Accepted == wellImportwizard.exec() )
{
QStringList wellPaths = wellImportwizard.absoluteFilePathsToWellPaths();
if ( wellPaths.size() > 0 )
if ( !wellPaths.empty() )
{
QStringList errorMessages;
app->addWellPathsToModel( wellPaths, &errorMessages );

View File

@ -515,7 +515,7 @@ void RiuWellImportWizard::downloadWellPaths()
//--------------------------------------------------------------------------------------------------
void RiuWellImportWizard::checkDownloadQueueAndIssueRequests()
{
if ( m_wellRequestQueue.size() > 0 )
if ( !m_wellRequestQueue.empty() )
{
DownloadEntity firstItem = m_wellRequestQueue[0];
m_wellRequestQueue.pop_front();

View File

@ -56,7 +56,7 @@ void RicEditSummaryCurveCalculationFeature::onActionTriggered( bool isChecked )
std::vector<RimSummaryCurve*> selectedCurves = caf::selectedObjectsByType<RimSummaryCurve*>();
RimUserDefinedCalculation* calculation = nullptr;
if ( selectedCurves.size() > 0 )
if ( !selectedCurves.empty() )
{
RifEclipseSummaryAddress selectedAddress = selectedCurves.front()->summaryAddressY();

View File

@ -84,7 +84,7 @@ void RicNewDerivedEnsembleFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryCaseCollection*> ensembles = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
if ( ensembles.size() >= 1 ) newEnsemble->setEnsemble1( ensembles[0] );
if ( !ensembles.empty() ) newEnsemble->setEnsemble1( ensembles[0] );
if ( ensembles.size() == 2 )
{
newEnsemble->setEnsemble2( ensembles[1] );

View File

@ -53,7 +53,7 @@ void RicNewDerivedSummaryFeature::onActionTriggered( bool isChecked )
{
auto allCases = mainColl->allSummaryCases();
if ( allCases.size() > 0 )
if ( !allCases.empty() )
{
selectedCases.push_back( allCases[0] );
}

View File

@ -218,7 +218,7 @@ bool RicNewGridTimeHistoryCurveFeature::isCommandEnabled() const
std::vector<RiuSelectionItem*> items;
Riu3dSelectionManager::instance()->selectedItems( items );
if ( items.size() > 0 )
if ( !items.empty() )
{
const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>( items[0] );
if ( eclSelectionItem && eclSelectionItem->m_resultDefinition )
@ -246,7 +246,7 @@ void RicNewGridTimeHistoryCurveFeature::onActionTriggered( bool isChecked )
std::vector<RiuSelectionItem*> items;
Riu3dSelectionManager::instance()->selectedItems( items );
CVF_ASSERT( items.size() > 0 );
CVF_ASSERT( !items.empty() );
for ( auto item : items )
{

View File

@ -57,13 +57,13 @@ bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() const
RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr;
std::vector<RimSummaryCase*> selectedCases = caf::selectedObjectsByType<RimSummaryCase*>();
if ( selectedCases.size() > 0 ) return true;
if ( !selectedCases.empty() ) return true;
std::vector<RimSummaryCaseCollection*> selectedGroups = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
if ( selectedGroups.size() > 0 ) return true;
if ( !selectedGroups.empty() ) return true;
std::vector<RimSummaryMultiPlotCollection*> selectedPlotCollections = caf::selectedObjectsByType<RimSummaryMultiPlotCollection*>();
if ( selectedPlotCollections.size() > 0 ) return true;
if ( !selectedPlotCollections.empty() ) return true;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( !selObj ) return false;
@ -151,7 +151,7 @@ void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked )
if ( multiPlot )
{
if ( multiPlot->summaryPlots().size() > 0 )
if ( !multiPlot->summaryPlots().empty() )
{
dialog->updateFromSummaryPlot( multiPlot->summaryPlots()[0] );
}

View File

@ -46,7 +46,7 @@ bool RicPasteAsciiDataCurveFeature::isCommandEnabled() const
return false;
}
return RicPasteAsciiDataCurveFeature::asciiDataCurves().size() > 0;
return !RicPasteAsciiDataCurveFeature::asciiDataCurves().empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -84,7 +84,7 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered( bool isChecked )
std::vector<RimAsciiDataCurve*> curves = parseCurves( text, pasteOptions );
if ( curves.size() > 0 )
if ( !curves.empty() )
{
if ( !summaryPlot )
{

View File

@ -496,7 +496,7 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::initialize( RifCsvUserDataParser*
}
parser->parseColumnInfo( parseOptions() );
if ( parser->tableData().columnInfos().size() > 0 )
if ( !parser->tableData().columnInfos().empty() )
{
m_timeSeriesColumnName = QString::fromStdString( parser->tableData().columnInfos()[0].columnName() );
}

View File

@ -54,7 +54,7 @@ bool RicPasteSummaryCaseFeature::isCommandEnabled() const
std::vector<caf::PdmPointer<RimSummaryCase>> summaryCases = RicPasteSummaryCaseFeature::summaryCases();
if ( summaryCases.size() == 0 )
if ( summaryCases.empty() )
{
return false;
}

View File

@ -48,7 +48,7 @@ bool RicPasteSummaryCrossPlotCurveFeature::isCommandEnabled() const
return false;
}
if ( summaryCurvesOnClipboard().size() == 0 )
if ( summaryCurvesOnClipboard().empty() )
{
return false;
}

View File

@ -76,7 +76,7 @@ bool RicPasteSummaryCrossPlotFeature::isCommandEnabled() const
return false;
}
return RicPasteSummaryCrossPlotFeature::summaryPlots().size() > 0;
return !RicPasteSummaryCrossPlotFeature::summaryPlots().empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -92,7 +92,7 @@ bool RicPasteSummaryCurveFeature::isCommandEnabled() const
return false;
}
if ( summaryCurvesOnClipboard().size() == 0 )
if ( summaryCurvesOnClipboard().empty() )
{
return false;
}

View File

@ -69,7 +69,7 @@ bool RicPasteSummaryPlotFeature::isCommandEnabled() const
auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimMultiPlot>();
if ( !multiPlot ) return false;
return RicPasteSummaryPlotFeature::summaryPlots().size() > 0;
return !RicPasteSummaryPlotFeature::summaryPlots().empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -51,7 +51,7 @@ bool RicPasteTimeHistoryCurveFeature::isCommandEnabled() const
return false;
}
return RicPasteTimeHistoryCurveFeature::timeHistoryCurves().size() > 0;
return !RicPasteTimeHistoryCurveFeature::timeHistoryCurves().empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -40,7 +40,7 @@ bool RicSummaryCurveSwitchAxisFeature::isCommandEnabled() const
RicSummaryCurveSwitchAxisFeature::extractSelectedCurves( &summaryCurves, &asciiDataCurves, &gridTimeHistoryCurves );
return summaryCurves.size() || asciiDataCurves.size() || gridTimeHistoryCurves.size();
return !summaryCurves.empty() || !asciiDataCurves.empty() || !gridTimeHistoryCurves.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -310,7 +310,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
&summaryAddressFilters,
&gridResultAddressFilters );
if ( summaryAddressFilters.size() )
if ( !summaryAddressFilters.empty() )
{
RimSummaryCaseCollection* ensemble = nullptr;
@ -368,7 +368,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
// Grid Cell Result vectors
if ( gridResultAddressFilters.size() )
if ( !gridResultAddressFilters.empty() )
{
// Todo: Use identical grid case import if -e -c or -cl
@ -415,7 +415,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
}
}
if ( createdCurves.size() )
if ( !createdCurves.empty() )
{
RimSummaryPlot* newPlot = new RimSummaryPlot();
newPlot->enableAutoPlotTitle( true );
@ -471,7 +471,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
if ( isEnsembleMode ) ++curveColorIndex;
if ( createdCurves.size() )
if ( !createdCurves.empty() )
{
RimSummaryPlot* newPlot = new RimSummaryPlot();
newPlot->enableAutoPlotTitle( true );
@ -633,7 +633,7 @@ std::vector<RimSummaryPlot*> RicSummaryPlotFeatureImpl::createMultipleSummaryPlo
if ( historyCurve ) createdCurves.push_back( historyCurve );
}
if ( createdCurves.size() || createdEnsembleCurveSets.size() )
if ( !createdCurves.empty() || !createdEnsembleCurveSets.empty() )
{
RimSummaryPlot* newPlot = new RimSummaryPlot();
newPlot->enableAutoPlotTitle( true );

View File

@ -41,7 +41,7 @@ bool RicToggleItemsOnOthersOffFeature::isCommandEnabled() const
caf::PdmFieldHandle* commonParent = commonParentForAllSelections( selectedObjects );
std::vector<caf::PdmObjectHandle*> children = childObjects( commonParent );
return commonParent != nullptr && children.size() > 0 && objectToggleField( children.front() ) && children.size() > selectedObjects.size();
return commonParent != nullptr && !children.empty() && objectToggleField( children.front() ) && children.size() > selectedObjects.size();
}
//--------------------------------------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ CAF_CMD_SOURCE_INIT( RicAddWellLogToPlotFeature, "RicAddWellLogToPlotFeature" );
bool RicAddWellLogToPlotFeature::isCommandEnabled() const
{
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
return selection.size() > 0;
return !selection.empty();
}
//--------------------------------------------------------------------------------------------------
@ -59,7 +59,7 @@ bool RicAddWellLogToPlotFeature::isCommandEnabled() const
void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
if ( selection.size() < 1 ) return;
if ( selection.empty() ) return;
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();

View File

@ -47,7 +47,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled() const
std::vector<RimPlot*> selection;
getSelection( selection );
return ( selection.size() > 0 );
return ( !selection.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -140,7 +140,7 @@ void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup )
RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
{
auto selection = caf::selectedObjectsByType<RimWellPath*>();
return selection.size() > 0 ? selection[0] : nullptr;
return !selection.empty() ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -160,7 +160,7 @@ RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
( *branchIndex ) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
return !selection.empty() ? selection[0] : nullptr;
}
}

View File

@ -84,5 +84,5 @@ RimWellLogPlot* RicNewWellLogPlotTrackFeature::selectedWellLogPlot()
{
std::vector<RimWellLogPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
return selection.size() > 0 ? selection[0] : nullptr;
return !selection.empty() ? selection[0] : nullptr;
}

View File

@ -48,7 +48,7 @@ bool RicPasteWellLogPlotFeature::isCommandEnabled() const
return false;
}
return RicPasteWellLogPlotFeature::plots().size() > 0;
return !RicPasteWellLogPlotFeature::plots().empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ bool RicPasteWellLogTrackFeature::isCommandEnabled() const
return false;
}
return RicPasteWellLogTrackFeature::tracks().size() > 0;
return !RicPasteWellLogTrackFeature::tracks().empty();
}
//--------------------------------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicWellLogFileCloseFeature, "RicWellLogFileCloseFeature" );
bool RicWellLogFileCloseFeature::isCommandEnabled() const
{
std::vector<RimWellLogFile*> objects = caf::selectedObjectsByType<RimWellLogFile*>();
return objects.size() > 0;
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------
@ -51,7 +51,7 @@ void RicWellLogFileCloseFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellLogFile*> objects = caf::selectedObjectsByType<RimWellLogFile*>();
if ( objects.size() == 0 ) return;
if ( objects.empty() ) return;
for ( const auto& wellLogFile : objects )
{

View File

@ -74,7 +74,7 @@ void RicWellLogsImportFileFeature::onActionTriggered( bool isChecked )
QStringList wellLogFilePaths =
RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(), "Import Well Logs", defaultDir, nameFilterString );
if ( wellLogFilePaths.size() >= 1 )
if ( !wellLogFilePaths.empty() )
{
QStringList errorMessages;
importWellLogFiles( wellLogFilePaths, &errorMessages );

View File

@ -37,7 +37,7 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled() const
std::vector<RimWellPathAttribute*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}
@ -60,7 +60,7 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered( bool isChecked )
std::vector<RimWellPathAttribute*> attributes;
caf::SelectionManager::instance()->objectsByType( &attributes, caf::SelectionManager::FIRST_LEVEL );
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
if ( attributes.size() > 0 )
if ( !attributes.empty() )
{
wellPathAttributeCollection = attributes[0]->firstAncestorOrThisOfTypeAsserted<RimWellPathAttributeCollection>();
for ( RimWellPathAttribute* attributeToDelete : attributes )
@ -102,7 +102,7 @@ void RicDeleteWellPathAttributeFeature::setupActionLook( QAction* actionToSetup
{
std::vector<RimWellPathAttribute*> attributes;
caf::SelectionManager::instance()->objectsByType( &attributes, caf::SelectionManager::FIRST_LEVEL );
if ( attributes.size() > 0 )
if ( !attributes.empty() )
{
actionToSetup->setText( "Delete Attribute" );
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );

View File

@ -46,7 +46,7 @@ void RicDeleteWellPathTargetFeature::onActionTriggered( bool isChecked )
std::vector<RimWellPathTarget*> targets;
caf::SelectionManager::instance()->objectsByType( &targets, caf::SelectionManager::FIRST_LEVEL );
if ( targets.size() > 0 )
if ( !targets.empty() )
{
RimWellPathGeometryDef* wellGeomDef = targets[0]->firstAncestorOrThisOfTypeAsserted<RimWellPathGeometryDef>();

View File

@ -58,7 +58,7 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked )
defaultDir,
"Well Measurements (*.csv);;All Files (*.*)" );
if ( wellPathFilePaths.size() < 1 ) return;
if ( wellPathFilePaths.empty() ) return;
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );

View File

@ -43,7 +43,7 @@ bool RicNewEditableWellPathFeature::isCommandEnabled() const
std::vector<RimWellPath*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}
@ -52,7 +52,7 @@ bool RicNewEditableWellPathFeature::isCommandEnabled() const
std::vector<RimWellPathCollection*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}

View File

@ -38,7 +38,7 @@ bool RicNewWellPathAttributeFeature::isCommandEnabled() const
std::vector<RimWellPathAttribute*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}

View File

@ -37,7 +37,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled() const
std::vector<RimWellPathGeometryDef*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}
@ -46,7 +46,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled() const
std::vector<RimWellPathTarget*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}
@ -62,7 +62,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellPathTarget*> selectedTargets;
caf::SelectionManager::instance()->objectsByType( &selectedTargets, caf::SelectionManager::FIRST_LEVEL );
if ( selectedTargets.size() > 0 )
if ( !selectedTargets.empty() )
{
RimWellPathTarget* firstTarget = selectedTargets.front();
RimWellPathGeometryDef* wellGeomDef = firstTarget->firstAncestorOrThisOfTypeAsserted<RimWellPathGeometryDef>();
@ -135,7 +135,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
std::vector<RimWellPathGeometryDef*> geomDefs;
caf::SelectionManager::instance()->objectsByType( &geomDefs );
if ( geomDefs.size() > 0 )
if ( !geomDefs.empty() )
{
RimWellPathGeometryDef* wellGeomDef = geomDefs[0];
std::vector<RimWellPathTarget*> activeTargets = wellGeomDef->activeWellTargets();
@ -179,7 +179,7 @@ void RicNewWellPathListTargetFeature::setupActionLook( QAction* actionToSetup )
std::vector<RimWellPathTarget*> selectedTargets;
caf::SelectionManager::instance()->objectsByType( &selectedTargets, caf::SelectionManager::FIRST_LEVEL );
if ( selectedTargets.size() > 0 )
if ( !selectedTargets.empty() )
{
auto firstTarget = selectedTargets.front();
RimWellPathGeometryDef* wellGeomDef = firstTarget->firstAncestorOrThisOfTypeAsserted<RimWellPathGeometryDef>();

View File

@ -47,7 +47,7 @@ bool RicPasteModeledWellPathFeature::isCommandEnabled() const
std::vector<RimWellPathCollection*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
if ( !objects.empty() )
{
return true;
}

View File

@ -47,7 +47,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked )
defaultDir,
"Well Picks (*.csv);;All Files (*.*)" );
if ( wellPathFormationsFilePaths.size() < 1 ) return;
if ( wellPathFormationsFilePaths.empty() ) return;
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELLPATHFORMATIONS_DIR", QFileInfo( wellPathFormationsFilePaths.last() ).absolutePath() );
@ -65,7 +65,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked )
if ( !oilField ) return;
if ( oilField->wellPathCollection->allWellPaths().size() > 0 )
if ( !oilField->wellPathCollection->allWellPaths().empty() )
{
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
if ( wellPath )

View File

@ -69,7 +69,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
QString line = stream.readLine();
QStringList lineSegs = line.split( "'" );
if ( lineSegs.size() == 0 ) continue; // Empty line
if ( lineSegs.empty() ) continue; // Empty line
if ( lineSegs.size() == 1 ) continue; // No name present. Comment line ?
if ( lineSegs.size() == 2 )
{

View File

@ -514,7 +514,7 @@ cvf::ref<RifEclipseRestartDataAccess> RifEclipseOutputFileTools::createDynamicRe
{
// Look for set of restart files (one file per time step)
QStringList restartFiles = RifEclipseOutputFileTools::filterFileNamesOfType( filesWithSameBaseName, ECL_RESTART_FILE );
if ( restartFiles.size() > 0 )
if ( !restartFiles.empty() )
{
resultsAccess = new RifEclipseRestartFilesetAccess();
resultsAccess->setRestartFiles( restartFiles );

View File

@ -57,7 +57,7 @@ RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
//--------------------------------------------------------------------------------------------------
bool RifEclipseRestartFilesetAccess::open()
{
if ( m_fileNames.size() > 0 )
if ( !m_fileNames.empty() )
{
caf::ProgressInfo progInfo( m_fileNames.size(), "" );
@ -124,7 +124,7 @@ size_t RifEclipseRestartFilesetAccess::timeStepCount()
//--------------------------------------------------------------------------------------------------
void RifEclipseRestartFilesetAccess::timeSteps( std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart )
{
if ( m_timeSteps.size() == 0 )
if ( m_timeSteps.empty() )
{
size_t numSteps = m_fileNames.size();
size_t i;
@ -314,7 +314,7 @@ int RifEclipseRestartFilesetAccess::readUnitsType()
{
ecl_file_type* ecl_file = nullptr;
if ( m_ecl_files.size() > 0 )
if ( !m_ecl_files.empty() )
{
openTimeStep( 0 );
ecl_file = m_ecl_files[0];

View File

@ -198,7 +198,7 @@ void RifEclipseUnifiedRestartFileAccess::close()
//--------------------------------------------------------------------------------------------------
size_t RifEclipseUnifiedRestartFileAccess::timeStepCount()
{
if ( m_timeSteps.size() == 0 )
if ( m_timeSteps.empty() )
{
extractTimestepsFromEclipse();
}
@ -211,7 +211,7 @@ size_t RifEclipseUnifiedRestartFileAccess::timeStepCount()
//--------------------------------------------------------------------------------------------------
void RifEclipseUnifiedRestartFileAccess::timeSteps( std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart )
{
if ( m_timeSteps.size() == 0 )
if ( m_timeSteps.empty() )
{
extractTimestepsFromEclipse();
}
@ -354,7 +354,7 @@ void RifEclipseUnifiedRestartFileAccess::updateFromGridCount( size_t gridCount )
//--------------------------------------------------------------------------------------------------
std::vector<int> RifEclipseUnifiedRestartFileAccess::reportNumbers()
{
if ( m_timeSteps.size() == 0 )
if ( m_timeSteps.empty() )
{
extractTimestepsFromEclipse();
}

View File

@ -194,7 +194,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
break;
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER:
{
if ( columnHeaderText.size() > 0 )
if ( !columnHeaderText.empty() )
{
aquiferNumber = RiaStdStringTools::toInt( columnHeaderText[0] );
}
@ -206,7 +206,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
break;
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION:
{
if ( columnHeaderText.size() > 0 )
if ( !columnHeaderText.empty() )
{
regionNumber = RiaStdStringTools::toInt( columnHeaderText[0] );
}
@ -216,7 +216,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
break;
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP:
{
if ( columnHeaderText.size() > 0 )
if ( !columnHeaderText.empty() )
{
groupName = columnHeaderText[0];
}
@ -224,7 +224,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
}
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL:
{
if ( columnHeaderText.size() > 0 )
if ( !columnHeaderText.empty() )
{
wellName = columnHeaderText[0];
}
@ -265,7 +265,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
}
break;
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_BLOCK:
if ( columnHeaderText.size() > 0 )
if ( !columnHeaderText.empty() )
{
RifEclipseUserDataKeywordTools::extractThreeInts( &cellI, &cellJ, &cellK, columnHeaderText[0] );
}

View File

@ -333,7 +333,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s
else
{
std::vector<std::string> words = splitLineAndRemoveComments( firstLine );
if ( words.size() > 0 )
if ( !words.empty() )
{
allHeaderRows.push_back( words );
}
@ -364,7 +364,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s
if ( rowWords.size() == columnCount )
{
if ( unitNames.size() == 0 )
if ( unitNames.empty() )
{
for ( const std::string& word : rowWords )
{
@ -376,7 +376,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s
}
}
if ( scaleFactors.size() == 0 )
if ( scaleFactors.empty() )
{
std::vector<double> values;
@ -408,7 +408,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s
std::vector<std::string> parserErrors;
std::vector<std::vector<std::string>> tableHeaderText =
RifEclipseUserDataKeywordTools::buildColumnHeaderText( quantityNames, headerRows, &parserErrors );
if ( parserErrors.size() > 0 )
if ( !parserErrors.empty() )
{
if ( errorText ) errorText->insert( errorText->end(), parserErrors.begin(), parserErrors.end() );
@ -419,7 +419,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s
for ( size_t i = 0; i < tableHeaderText.size(); i++ )
{
auto columnText = tableHeaderText[i];
if ( columnText.size() == 0 )
if ( columnText.empty() )
{
if ( errorText ) errorText->push_back( "Detected column with no content" );
continue;
@ -586,11 +586,11 @@ std::vector<std::vector<std::string>> RifEclipseUserDataParserTools::splitIntoCo
{
std::vector<std::vector<std::string>> headerLinesPerColumn;
if ( headerLines.size() > 0 )
if ( !headerLines.empty() )
{
std::vector<size_t> columnOffsets = RifEclipseUserDataParserTools::columnIndexForWords( headerLines[0] );
if ( columnOffsets.size() > 0 )
if ( !columnOffsets.empty() )
{
headerLinesPerColumn.resize( columnOffsets.size() );
@ -655,7 +655,7 @@ std::vector<Column> RifEclipseUserDataParserTools::columnInfoFromColumnHeaders(
for ( auto columnLines : columnData )
{
if ( columnLines.size() == 0 ) continue;
if ( columnLines.empty() ) continue;
std::string vectorName = columnLines[0];
std::string unit;
@ -721,7 +721,7 @@ std::vector<TableData> RifEclipseUserDataParserTools::mergeEqualTimeSteps( const
return tables;
}
if ( tables[0].columnInfos().size() == 0 ) return tables;
if ( tables[0].columnInfos().empty() ) return tables;
QDateTime firstTableStartTime;
for ( auto c : tables[0].columnInfos() )
@ -771,7 +771,7 @@ std::vector<TableData> RifEclipseUserDataParserTools::mergeEqualTimeSteps( const
}
}
if ( tables[i].columnInfos().size() > 0 && tables[i].columnInfos()[0].itemCount() == itemsInFirstTable && isDatesEqual )
if ( !tables[i].columnInfos().empty() && tables[i].columnInfos()[0].itemCount() == itemsInFirstTable && isDatesEqual )
{
for ( auto& c : tables[i].columnInfos() )
{
@ -796,7 +796,7 @@ std::vector<TableData> RifEclipseUserDataParserTools::mergeEqualTimeSteps( const
std::string RifEclipseUserDataParserTools::trimString( const std::string& s )
{
auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 );
if ( sCopy.size() > 0 )
if ( !sCopy.empty() )
{
sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) );
}

View File

@ -124,7 +124,7 @@ void RifElementPropertyTableReader::readData( const RifElementPropertyMetadata*
QString line = stream.readLine();
if ( !line.startsWith( "*" ) )
{
if ( collectedCols.size() > 0 && collectedCols.size() != 8 )
if ( !collectedCols.empty() && collectedCols.size() != 8 )
{
if ( dataBlockFound )
{

View File

@ -613,7 +613,7 @@ const size_t* RifReaderEclipseOutput::eclipseCellIndexMapping()
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseOutput::importFaults( const QStringList& fileSet, cvf::Collection<RigFault>* faults )
{
if ( filenamesWithFaults().size() > 0 )
if ( !filenamesWithFaults().empty() )
{
for ( size_t i = 0; i < filenamesWithFaults().size(); i++ )
{
@ -833,7 +833,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
void RifReaderEclipseOutput::buildMetaData( ecl_grid_type* grid )
{
CVF_ASSERT( m_eclipseCase );
CVF_ASSERT( m_filesWithSameBaseName.size() > 0 );
CVF_ASSERT( !m_filesWithSameBaseName.empty() );
caf::ProgressInfo progInfo( m_filesWithSameBaseName.size() + 3, "" );

View File

@ -206,7 +206,7 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath )
if ( x != HUGE_VAL && y != HUGE_VAL && tvd != HUGE_VAL && md != HUGE_VAL )
{
if ( !fileWellDataArray.size() )
if ( fileWellDataArray.empty() )
{
fileWellDataArray.push_back( RifWellPathImporter::WellData() );
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();
@ -305,7 +305,7 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath )
{
// Create a new Well data if we have read some data into the previous one.
// if not, just overwrite the name
if ( hasReadWellPointInCurrentWell || fileWellDataArray.size() == 0 )
if ( hasReadWellPointInCurrentWell || fileWellDataArray.empty() )
{
fileWellDataArray.push_back( RifWellPathImporter::WellData() );
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();

Some files were not shown because too many files have changed in this diff Show More