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 ...@@ -107,15 +107,7 @@ void
ParameterList< T > ParameterList< T >
::SetListFromFileName( const StringVector & strings ) ::SetListFromFileName( const StringVector & strings )
{ {
// First clear previous file chosen this->SetStrings(strings);
ClearValue();
for( const StringVector::value_type & s : strings )
AddFromFileName( s );
Modified();
SetActive( true );
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -153,6 +145,8 @@ ParameterList< T > ...@@ -153,6 +145,8 @@ ParameterList< T >
assert( !m_Parameters.back().IsNull() ); assert( !m_Parameters.back().IsNull() );
SetActive( true ); SetActive( true );
Modified();
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -187,9 +181,9 @@ ParameterList< T > ...@@ -187,9 +181,9 @@ ParameterList< T >
// Should throw exception when failed. // Should throw exception when failed.
FromString( m_Parameters[ i ], filename ); FromString( m_Parameters[ i ], filename );
Modified();
SetActive( true ); SetActive( true );
Modified();
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -198,18 +192,24 @@ std::size_t ...@@ -198,18 +192,24 @@ std::size_t
ParameterList< T > ParameterList< T >
::SetStrings( const StringVector & strings ) ::SetStrings( const StringVector & strings )
{ {
// First clear previous file chosen
ClearValue(); ClearValue();
std::transform( if ( !strings.empty() )
strings.begin(),
strings.end(),
std::back_inserter( m_Parameters ),
[ this ]( auto s ) -> auto
{ {
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(); 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