Skip to content
Snippets Groups Projects
Commit 3020b58e authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

ENH: duplicated code between SetStrings and SetListFromFileName

parent 929a2491
No related branches found
No related tags found
No related merge requests found
......@@ -107,15 +107,7 @@ void
ParameterList< T >
::SetListFromFileName( const StringVector & strings )
{
// First clear previous file chosen
ClearValue();
for( const StringVector::value_type & s : strings )
AddFromFileName( s );
Modified();
SetActive( true );
this->SetStrings(strings);
}
/*****************************************************************************/
......@@ -153,6 +145,8 @@ ParameterList< T >
assert( !m_Parameters.back().IsNull() );
SetActive( true );
Modified();
}
/*****************************************************************************/
......@@ -187,9 +181,9 @@ ParameterList< T >
// Should throw exception when failed.
FromString( m_Parameters[ i ], filename );
Modified();
SetActive( true );
Modified();
}
/*****************************************************************************/
......@@ -198,18 +192,24 @@ std::size_t
ParameterList< T >
::SetStrings( const StringVector & strings )
{
// First clear previous file chosen
ClearValue();
std::transform(
strings.begin(),
strings.end(),
std::back_inserter( m_Parameters ),
[ this ]( auto s ) -> auto
if ( !strings.empty() )
{
return this->FromString( s );
}
);
std::transform(
strings.begin(),
strings.end(),
std::back_inserter( m_Parameters ),
[ this ]( auto s ) -> auto
{
return this->FromString( s );
}
);
SetActive( true );
Modified();
}
return strings.size();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment