Change API for PdmObjectHandle and PdmFieldHandle

* Refactor interface to PdmObjectHandle and PdmFieldHandle
Return objects instead of passing in structures as parameters

* Add nodiscard to several functions
* Remove redundant this->
* Rename to ptrReferencedObjectsByType
This commit is contained in:
Magne Sjaastad authored and GitHub committed 2023-05-12 21:41:34 +02:00
1 parent 37e29a0f68
commit 0c90f67dcc
510 files changed
+1651 -3111

No files matched your search

@@ -177,8 +177,7 @@ void RicCellRangeUi::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
// If this object is contained in another object, make sure the other object is updated
RicExportCarfinUi* exportCarfin = nullptr;
this->firstAncestorOrThisOfType( exportCarfin );
RicExportCarfinUi* exportCarfin = firstAncestorOrThisOfType<RicExportCarfinUi>();
if ( exportCarfin )
{
exportCarfin->uiCapability()->updateConnectedEditors();
@@ -75,7 +75,7 @@ void RicCreateDepthAdjustedLasFilesFeature::onActionTriggered( bool isChecked )
RimCase* selectedCase = featureUi.selectedCase();
RimWellPath* sourceWell = featureUi.sourceWell();
RimWellLogFile* soureWellLogFile = featureUi.wellLogFile();
std::vector<RimWellPath*> destinationWells = featureUi.destinationWells().ptrReferencedObjects();
std::vector<RimWellPath*> destinationWells = featureUi.destinationWells().ptrReferencedObjectsByType();
std::vector<QString> selectedResultProperties = featureUi.selectedResultProperties();
QString exportFolder = featureUi.exportFolder();
@@ -78,9 +78,7 @@ void RicExportFaultsFeature::onActionTriggered( bool isChecked )
for ( RimFaultInView* rimFault : selectedFaults )
{
RimEclipseCase* eclCase = nullptr;
rimFault->firstAncestorOrThisOfType( eclCase );
RimEclipseCase* eclCase = rimFault->firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclCase )
{
QString caseName = eclCase->caseUserDescription();
@@ -834,8 +834,7 @@ std::vector<RimWellPath*> RicExportLgrFeature::selectedWellPaths()
for ( auto completion : selectedCompletions )
{
RimWellPath* parentWellPath;
completion->firstAncestorOrThisOfType( parentWellPath );
RimWellPath* parentWellPath = completion->firstAncestorOrThisOfType<RimWellPath>();
if ( parentWellPath ) wellPaths.push_back( parentWellPath );
}
@@ -86,9 +86,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS
const QString absSnapshotPath = snapshotPath.absolutePath();
std::vector<RimViewWindow*> viewWindows;
RimMainPlotCollection::current()->descendantsIncludingThisOfType( viewWindows );
std::vector<RimViewWindow*> viewWindows = RimMainPlotCollection::current()->descendantsIncludingThisOfType<RimViewWindow>();
for ( auto viewWindow : viewWindows )
{
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) )