mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Move function to RiaProjectFileTools
Rename to RiaProjectFileTools
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaProjectBackupTools.h"
|
||||
#include "RiaProjectFileVersionTools.h"
|
||||
#include "RiaProjectFileTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
#include "RiaVersionInfo.h"
|
||||
|
||||
@@ -479,7 +479,7 @@ bool RimProject::isProjectFileVersionEqualOrOlderThan( const QString& otherProje
|
||||
{
|
||||
QString candidateProjectFileVersion = projectFileVersionString();
|
||||
|
||||
return !RiaProjectFileVersionTools::isCandidateVersionNewerThanOther( candidateProjectFileVersion, otherProjectFileVersion );
|
||||
return !RiaProjectFileTools::isCandidateVersionNewerThanOther( candidateProjectFileVersion, otherProjectFileVersion );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1336,7 +1336,7 @@ RimPlotTemplateFolderItem* RimProject::rootPlotTemplateItem() const
|
||||
std::vector<caf::FilePath*> RimProject::allFilePaths() const
|
||||
{
|
||||
std::vector<caf::FilePath*> filePaths;
|
||||
fieldContentsByType( this, filePaths );
|
||||
RiaProjectFileTools::fieldContentsByType( this, filePaths );
|
||||
|
||||
return filePaths;
|
||||
}
|
||||
|
||||
@@ -204,9 +204,6 @@ protected:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
static void fieldContentsByType( const caf::PdmObjectHandle* object, std::vector<T*>& fieldContents );
|
||||
|
||||
void transferPathsToGlobalPathList();
|
||||
void distributePathsFromGlobalPathList();
|
||||
|
||||
@@ -239,42 +236,3 @@ private:
|
||||
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
|
||||
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void RimProject::fieldContentsByType( const caf::PdmObjectHandle* object, std::vector<T*>& fieldContents )
|
||||
{
|
||||
if ( !object ) return;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> allFieldsInObject = object->fields();
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
|
||||
for ( const auto& field : allFieldsInObject )
|
||||
{
|
||||
auto xmlFieldCapability = field->xmlCapability();
|
||||
if ( xmlFieldCapability && !xmlFieldCapability->isIOWritable() ) continue;
|
||||
|
||||
caf::PdmField<T>* typedField = dynamic_cast<caf::PdmField<T>*>( field );
|
||||
if ( typedField ) fieldContents.push_back( &typedField->v() );
|
||||
|
||||
caf::PdmField<std::vector<T>>* typedFieldInVector = dynamic_cast<caf::PdmField<std::vector<T>>*>( field );
|
||||
if ( typedFieldInVector )
|
||||
{
|
||||
for ( T& typedFieldFromVector : typedFieldInVector->v() )
|
||||
{
|
||||
fieldContents.push_back( &typedFieldFromVector );
|
||||
}
|
||||
}
|
||||
|
||||
auto other = field->children();
|
||||
children.insert( children.end(), other.begin(), other.end() );
|
||||
}
|
||||
|
||||
for ( const auto& child : children )
|
||||
{
|
||||
fieldContentsByType( child, fieldContents );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user