#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 ) 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(); RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return {}; if ( oilField == nullptr ) return {};
@ -963,7 +963,7 @@ std::vector<RimWellPath*> RiaApplication::addWellPathsToModel( QList<QString> we
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathFormationsToModel( QList<QString> wellPathFormationsFilePaths ) 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(); RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return; if ( oilField == nullptr ) return;
@ -989,7 +989,7 @@ void RiaApplication::addWellPathFormationsToModel( QList<QString> wellPathFormat
std::vector<RimWellLogFile*> RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths, std::vector<RimWellLogFile*> RiaApplication::addWellLogsToModel( const QList<QString>& wellLogFilePaths,
gsl::not_null<QStringList*> errorMessages ) 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(); RimOilField* oilField = m_project->activeOilField();
if ( oilField == nullptr ) return {}; if ( oilField == nullptr ) return {};

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ QList<caf::PdmOptionItemInfo> RiaSimWellBranchTools::valueOptionsForBranchIndexF
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
size_t branchCount = simulationWellPaths.size(); size_t branchCount = simulationWellPaths.size();
if ( simulationWellPaths.size() == 0 ) if ( simulationWellPaths.empty() )
{ {
options.push_front( caf::PdmOptionItemInfo( "None", -1 ) ); 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 ); auto branches = RiaSimWellBranchTools::simulationWellBranches( simWellName, branchDetection );
if ( branches.size() == 0 ) if ( branches.empty() )
{ {
return -1; return -1;
} }

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ bool RicEclipseCaseNewGroupFeature::isCommandEnabled() const
std::vector<RimEclipseCaseCollection*> caseCollSelection; std::vector<RimEclipseCaseCollection*> caseCollSelection;
caf::SelectionManager::instance()->objectsByType( &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; std::vector<RimEclipseStatisticsCaseCollection*> statisticsCaseCollections;
caf::SelectionManager::instance()->objectsByType( &statisticsCaseCollections ); caf::SelectionManager::instance()->objectsByType( &statisticsCaseCollections );
if ( statisticsCaseCollections.size() > 0 ) if ( !statisticsCaseCollections.empty() )
{ {
return statisticsCaseCollections[0]; return statisticsCaseCollections[0];
} }
@ -81,7 +81,7 @@ caf::PdmUiItem* RicNewStatisticsCaseFeature::selectedValidUIItem()
std::vector<RimCaseCollection*> caseCollections; std::vector<RimCaseCollection*> caseCollections;
caf::SelectionManager::instance()->objectsByType( &caseCollections ); caf::SelectionManager::instance()->objectsByType( &caseCollections );
if ( caseCollections.size() > 0 ) if ( !caseCollections.empty() )
{ {
if ( RimIdenticalGridCaseGroup::isStatisticsCaseCollection( caseCollections[0] ) ) if ( RimIdenticalGridCaseGroup::isStatisticsCaseCollection( caseCollections[0] ) )
{ {

View File

@ -50,7 +50,7 @@ bool RicExportFaultsFeature::isCommandEnabled() const
caf::SelectionManager::instance()->objectsByType( &selectedFaults ); 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 ); caf::SelectionManager::instance()->objectsByType( &selectedFaults );
if ( selectedFaults.size() == 0 ) return; if ( selectedFaults.empty() ) return;
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "FAULTS" ); QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "FAULTS" );

View File

@ -123,7 +123,7 @@ bool RicExportToLasFileFeature::isCommandEnabled() const
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false; if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) 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; if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves(); std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
if ( curves.size() == 0 ) return; if ( curves.empty() ) return;
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "WELL_LOGS_DIR" ); QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "WELL_LOGS_DIR" );

View File

@ -155,5 +155,5 @@ RimEclipseInputProperty* RicSaveEclipseInputPropertyFeature::selectedInputProper
std::vector<RimEclipseInputProperty*> selection; std::vector<RimEclipseInputProperty*> selection;
caf::SelectionManager::instance()->objectsByType( &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; std::vector<RimEclipseView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 ) if ( !selection.empty() )
{ {
return selection[0]; return selection[0];
} }
@ -63,7 +63,7 @@ RimEclipseCellColors* RicSaveEclipseResultAsInputPropertyFeature::selectedEclips
std::vector<RimEclipseCellColors*> selection; std::vector<RimEclipseCellColors*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 ) if ( !selection.empty() )
{ {
return selection[0]; return selection[0];
} }

View File

@ -119,7 +119,7 @@ QList<caf::PdmOptionItemInfo> RicSelectViewUI::calculateValueOptions( const caf:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSelectViewUI::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) 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; m_createNewView = true;
} }

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ void RicImportGeoMechCaseFeature::onActionTriggered( bool isChecked )
"Import Geo-Mechanical Model", "Import Geo-Mechanical Model",
defaultDir, defaultDir,
"Abaqus results (*.odb);;Abaqus input file (*.inp)" ); "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 ); app->setLastUsedDialogDirectory( "GEOMECH_MODEL", defaultDir );
for ( const auto& fileName : fileNames ) for ( const auto& fileName : fileNames )

View File

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

View File

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

View File

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

View File

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

View File

@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicAddScriptPathFeature, "RicAddScriptPathFeature" );
bool RicAddScriptPathFeature::isCommandEnabled() const bool RicAddScriptPathFeature::isCommandEnabled() const
{ {
std::vector<RimScriptCollection*> selection = RicScriptFeatureImpl::selectedScriptCollections(); 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; 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 ) void RicDeleteScriptPathFeature::onActionTriggered( bool isChecked )
{ {
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
RimScriptCollection* scriptCollection = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr; RimScriptCollection* scriptCollection = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr;
if ( scriptCollection ) if ( scriptCollection )
{ {
QString toBeRemoved = scriptCollection->directory; QString toBeRemoved = scriptCollection->directory;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -66,7 +66,7 @@ void RicSelectCaseOrEnsembleUi::setEnsembleSelectionMode( bool ensembleMode )
else else
{ {
std::vector<RimSummaryCase*> cases = proj->allSummaryCases(); 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; std::vector<RimObservedFmuRftData*> fmuRftSelection;
caf::SelectionManager::instance()->objectsByType( &fmuRftSelection ); caf::SelectionManager::instance()->objectsByType( &fmuRftSelection );
if ( summarySelection.size() == 0 && fmuRftSelection.size() == 0 ) if ( summarySelection.empty() && fmuRftSelection.empty() )
{ {
return false; return false;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -107,7 +107,7 @@ bool RicImportObservedDataFeature::isCommandEnabled() const
std::vector<RimObservedSummaryData*> selectionObservedData; std::vector<RimObservedSummaryData*> selectionObservedData;
caf::SelectionManager::instance()->objectsByType( &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; std::vector<RimObservedSummaryData*> selectionObservedData;
caf::SelectionManager::instance()->objectsByType( &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; std::vector<RimEclipseCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 ) if ( !selection.empty() )
{ {
return selection[0]; return selection[0];
} }
@ -140,7 +140,7 @@ RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
std::vector<RimGeoMechCase*> selection; std::vector<RimGeoMechCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 ) if ( !selection.empty() )
{ {
return selection[0]; return selection[0];
} }
@ -175,7 +175,7 @@ RimGeoMechView* RicNewViewFeature::selectedGeoMechView()
std::vector<RimGeoMechView*> selection; std::vector<RimGeoMechView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 ) if ( !selection.empty() )
{ {
return selection[0]; return selection[0];
} }

View File

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

View File

@ -39,7 +39,7 @@ bool RicReloadFormationNamesFeature::isCommandEnabled() const
std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs; std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs;
caf::SelectionManager::instance()->objectsByType( &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; std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs;
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs ); caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
if ( selectedFormationNamesCollObjs.size() ) if ( !selectedFormationNamesCollObjs.empty() )
{ {
selectedFormationNamesCollObjs[0]->readAllFormationNames(); selectedFormationNamesCollObjs[0]->readAllFormationNames();
for ( RimFormationNames* fnames : selectedFormationNamesCollObjs[0]->formationNamesList() ) for ( RimFormationNames* fnames : selectedFormationNamesCollObjs[0]->formationNamesList() )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ bool RicPasteAsciiDataCurveFeature::isCommandEnabled() const
return false; 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 ); std::vector<RimAsciiDataCurve*> curves = parseCurves( text, pasteOptions );
if ( curves.size() > 0 ) if ( !curves.empty() )
{ {
if ( !summaryPlot ) if ( !summaryPlot )
{ {

View File

@ -496,7 +496,7 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::initialize( RifCsvUserDataParser*
} }
parser->parseColumnInfo( parseOptions() ); parser->parseColumnInfo( parseOptions() );
if ( parser->tableData().columnInfos().size() > 0 ) if ( !parser->tableData().columnInfos().empty() )
{ {
m_timeSeriesColumnName = QString::fromStdString( parser->tableData().columnInfos()[0].columnName() ); 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(); std::vector<caf::PdmPointer<RimSummaryCase>> summaryCases = RicPasteSummaryCaseFeature::summaryCases();
if ( summaryCases.size() == 0 ) if ( summaryCases.empty() )
{ {
return false; return false;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -41,7 +41,7 @@ bool RicToggleItemsOnOthersOffFeature::isCommandEnabled() const
caf::PdmFieldHandle* commonParent = commonParentForAllSelections( selectedObjects ); caf::PdmFieldHandle* commonParent = commonParentForAllSelections( selectedObjects );
std::vector<caf::PdmObjectHandle*> children = childObjects( commonParent ); 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 bool RicAddWellLogToPlotFeature::isCommandEnabled() const
{ {
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs(); 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 ) void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
{ {
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs(); std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
if ( selection.size() < 1 ) return; if ( selection.empty() ) return;
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(); RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();

View File

@ -47,7 +47,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled() const
std::vector<RimPlot*> selection; std::vector<RimPlot*> selection;
getSelection( 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 RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
{ {
auto selection = caf::selectedObjectsByType<RimWellPath*>(); 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; std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
( *branchIndex ) = 0; ( *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; std::vector<RimWellLogPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &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 false;
} }
return RicPasteWellLogPlotFeature::plots().size() > 0; return !RicPasteWellLogPlotFeature::plots().empty();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ bool RicPasteWellLogTrackFeature::isCommandEnabled() const
return false; 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 bool RicWellLogFileCloseFeature::isCommandEnabled() const
{ {
std::vector<RimWellLogFile*> objects = caf::selectedObjectsByType<RimWellLogFile*>(); 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*>(); std::vector<RimWellLogFile*> objects = caf::selectedObjectsByType<RimWellLogFile*>();
if ( objects.size() == 0 ) return; if ( objects.empty() ) return;
for ( const auto& wellLogFile : objects ) for ( const auto& wellLogFile : objects )
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
QString line = stream.readLine(); QString line = stream.readLine();
QStringList lineSegs = line.split( "'" ); 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() == 1 ) continue; // No name present. Comment line ?
if ( lineSegs.size() == 2 ) 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) // Look for set of restart files (one file per time step)
QStringList restartFiles = RifEclipseOutputFileTools::filterFileNamesOfType( filesWithSameBaseName, ECL_RESTART_FILE ); QStringList restartFiles = RifEclipseOutputFileTools::filterFileNamesOfType( filesWithSameBaseName, ECL_RESTART_FILE );
if ( restartFiles.size() > 0 ) if ( !restartFiles.empty() )
{ {
resultsAccess = new RifEclipseRestartFilesetAccess(); resultsAccess = new RifEclipseRestartFilesetAccess();
resultsAccess->setRestartFiles( restartFiles ); resultsAccess->setRestartFiles( restartFiles );

View File

@ -57,7 +57,7 @@ RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseRestartFilesetAccess::open() bool RifEclipseRestartFilesetAccess::open()
{ {
if ( m_fileNames.size() > 0 ) if ( !m_fileNames.empty() )
{ {
caf::ProgressInfo progInfo( m_fileNames.size(), "" ); 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 ) 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 numSteps = m_fileNames.size();
size_t i; size_t i;
@ -314,7 +314,7 @@ int RifEclipseRestartFilesetAccess::readUnitsType()
{ {
ecl_file_type* ecl_file = nullptr; ecl_file_type* ecl_file = nullptr;
if ( m_ecl_files.size() > 0 ) if ( !m_ecl_files.empty() )
{ {
openTimeStep( 0 ); openTimeStep( 0 );
ecl_file = m_ecl_files[0]; ecl_file = m_ecl_files[0];

View File

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

View File

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

View File

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

View File

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

View File

@ -613,7 +613,7 @@ const size_t* RifReaderEclipseOutput::eclipseCellIndexMapping()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RifReaderEclipseOutput::importFaults( const QStringList& fileSet, cvf::Collection<RigFault>* faults ) 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++ ) for ( size_t i = 0; i < filenamesWithFaults().size(); i++ )
{ {
@ -833,7 +833,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
void RifReaderEclipseOutput::buildMetaData( ecl_grid_type* grid ) void RifReaderEclipseOutput::buildMetaData( ecl_grid_type* grid )
{ {
CVF_ASSERT( m_eclipseCase ); CVF_ASSERT( m_eclipseCase );
CVF_ASSERT( m_filesWithSameBaseName.size() > 0 ); CVF_ASSERT( !m_filesWithSameBaseName.empty() );
caf::ProgressInfo progInfo( m_filesWithSameBaseName.size() + 3, "" ); 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 ( x != HUGE_VAL && y != HUGE_VAL && tvd != HUGE_VAL && md != HUGE_VAL )
{ {
if ( !fileWellDataArray.size() ) if ( fileWellDataArray.empty() )
{ {
fileWellDataArray.push_back( RifWellPathImporter::WellData() ); fileWellDataArray.push_back( RifWellPathImporter::WellData() );
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath(); 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. // Create a new Well data if we have read some data into the previous one.
// if not, just overwrite the name // if not, just overwrite the name
if ( hasReadWellPointInCurrentWell || fileWellDataArray.size() == 0 ) if ( hasReadWellPointInCurrentWell || fileWellDataArray.empty() )
{ {
fileWellDataArray.push_back( RifWellPathImporter::WellData() ); fileWellDataArray.push_back( RifWellPathImporter::WellData() );
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath(); fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();

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