ResInsight/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp

81 lines
3.2 KiB
C++
Raw Normal View History

2012-06-26 09:10:41 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
2014-09-23 08:04:57 -05:00
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
2012-06-26 09:10:41 -05:00
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
2012-06-26 09:10:41 -05:00
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
2012-06-26 09:10:41 -05:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEclipseInputPropertyCollection.h"
2012-06-26 09:10:41 -05:00
#include "RimEclipseInputProperty.h"
#include <QFileInfo>
2012-06-26 09:10:41 -05:00
CAF_PDM_SOURCE_INIT( RimEclipseInputPropertyCollection, "RimInputPropertyCollection" );
2012-06-26 09:10:41 -05:00
//--------------------------------------------------------------------------------------------------
///
2012-06-26 09:10:41 -05:00
//--------------------------------------------------------------------------------------------------
RimEclipseInputPropertyCollection::RimEclipseInputPropertyCollection()
2012-06-26 09:10:41 -05:00
{
CAF_PDM_InitObject( "Input Properties", ":/EclipseInput48x48.png", "", "" );
2012-06-26 09:10:41 -05:00
CAF_PDM_InitFieldNoDefault( &inputProperties, "InputProperties", "", "", "", "" );
inputProperties.uiCapability()->setUiHidden( true );
2012-06-26 09:10:41 -05:00
}
//--------------------------------------------------------------------------------------------------
///
2012-06-26 09:10:41 -05:00
//--------------------------------------------------------------------------------------------------
RimEclipseInputPropertyCollection::~RimEclipseInputPropertyCollection()
2012-06-26 09:10:41 -05:00
{
inputProperties.deleteAllChildObjects();
2012-06-26 09:10:41 -05:00
}
//--------------------------------------------------------------------------------------------------
/// Returns the InputProperties pointing to the same file as \a fileName
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipseInputProperty*> RimEclipseInputPropertyCollection::findInputProperties( QString fileName )
2012-06-26 09:10:41 -05:00
{
QFileInfo fileInfo( fileName );
std::vector<RimEclipseInputProperty*> result;
for ( size_t i = 0; i < this->inputProperties.size(); ++i )
2012-06-26 09:10:41 -05:00
{
if ( !inputProperties[i] ) continue;
2012-06-26 09:10:41 -05:00
QFileInfo propFile( inputProperties[i]->fileName().path() );
if ( fileInfo == propFile ) result.push_back( inputProperties[i] );
2012-06-26 09:10:41 -05:00
}
return result;
}
//--------------------------------------------------------------------------------------------------
/// Returns the InputProperty with resultName \a resultName
//--------------------------------------------------------------------------------------------------
RimEclipseInputProperty* RimEclipseInputPropertyCollection::findInputProperty( QString resultName )
2012-06-26 09:10:41 -05:00
{
for ( size_t i = 0; i < this->inputProperties.size(); i++ )
2012-06-26 09:10:41 -05:00
{
if ( inputProperties[i] && inputProperties[i]->resultName() == resultName )
2012-06-26 09:10:41 -05:00
{
return inputProperties[i];
}
}
2018-02-18 11:56:43 -06:00
return nullptr;
2012-06-26 09:10:41 -05:00
}