Files
ResInsight/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp
T

68 lines
2.6 KiB
C++
Raw Normal View History

2012-06-26 16:10:41 +02:00
/////////////////////////////////////////////////////////////////////////////////
//
2014-09-23 15:04:57 +02:00
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
2012-06-26 16:10:41 +02: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 16:10:41 +02: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 16:10:41 +02:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEclipseInputPropertyCollection.h"
2012-06-26 16:10:41 +02:00
#include "RimEclipseInputProperty.h"
2014-07-24 10:11:43 +02:00
#include <QFileInfo>
2012-06-26 16:10:41 +02:00
CAF_PDM_SOURCE_INIT( RimEclipseInputPropertyCollection, "RimInputPropertyCollection" );
2012-06-26 16:10:41 +02:00
//--------------------------------------------------------------------------------------------------
///
2012-06-26 16:10:41 +02:00
//--------------------------------------------------------------------------------------------------
RimEclipseInputPropertyCollection::RimEclipseInputPropertyCollection()
2012-06-26 16:10:41 +02:00
{
CAF_PDM_InitObject( "Input Properties", ":/EclipseInput48x48.png" );
2012-06-26 16:10:41 +02:00
CAF_PDM_InitFieldNoDefault( &m_items, "InputProperties", "" );
2012-06-26 16:10:41 +02:00
}
//--------------------------------------------------------------------------------------------------
/// Returns the InputProperties pointing to the same file as \a fileName
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipseInputProperty*> RimEclipseInputPropertyCollection::findInputProperties( QString fileName )
2012-06-26 16:10:41 +02:00
{
QFileInfo fileInfo( fileName );
std::vector<RimEclipseInputProperty*> result;
for ( auto* prop : items() )
2012-06-26 16:10:41 +02:00
{
if ( !prop ) continue;
2012-06-26 16:10:41 +02:00
QFileInfo propFile( prop->fileName().path() );
if ( fileInfo == propFile ) result.push_back( prop );
2012-06-26 16:10:41 +02:00
}
return result;
}
//--------------------------------------------------------------------------------------------------
/// Returns the InputProperty with resultName \a resultName
//--------------------------------------------------------------------------------------------------
RimEclipseInputProperty* RimEclipseInputPropertyCollection::findInputProperty( QString resultName )
2012-06-26 16:10:41 +02:00
{
for ( auto* prop : items() )
2012-06-26 16:10:41 +02:00
{
if ( prop && prop->resultName() == resultName ) return prop;
2012-06-26 16:10:41 +02:00
}
2018-02-18 18:56:43 +01:00
return nullptr;
2012-06-26 16:10:41 +02:00
}