simplify strip types from Sequence, related tdf#108782

Change-Id: Ia8bd4ead67183e7f56c804e949ac04c6451c5201
Reviewed-on: https://gerrit.libreoffice.org/39809
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
This commit is contained in:
Jochen Nitschke
2017-07-10 21:49:59 +02:00
parent b533b2748e
commit 2f0c10db70
2 changed files with 9 additions and 17 deletions

View File

@@ -263,14 +263,10 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( )
OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::getTypes: did not initialize this, yet!" ); OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::getTypes: did not initialize this, yet!" );
if ( !m_aDocScriptSupport || !*m_aDocScriptSupport ) if ( !m_aDocScriptSupport || !*m_aDocScriptSupport )
{ {
Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 ); auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
std::remove_copy_if( [](const Type& type)
aTypes.begin(), { return type == cppu::UnoType<XScriptInvocationContext>::get(); } );
aTypes.end(), aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
aStrippedTypes.getArray(),
std::bind2nd( std::equal_to< Type >(), cppu::UnoType<XScriptInvocationContext>::get() )
);
aTypes = aStrippedTypes;
} }
return aTypes; return aTypes;
} }

View File

@@ -226,15 +226,11 @@ namespace dbaui
Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() ); Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() );
if ( !m_pImpl->documentHasScriptSupport() ) if ( !m_pImpl->documentHasScriptSupport() )
{ {
Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 ); auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
std::remove_copy_if( [](const Type& type)
aTypes.begin(), { return type == cppu::UnoType<XScriptInvocationContext>::get(); } );
aTypes.end(), aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
aStrippedTypes.getArray(), }
std::bind2nd( std::equal_to< Type >(), cppu::UnoType<XScriptInvocationContext>::get() )
);
aTypes = aStrippedTypes;
}
return aTypes; return aTypes;
} }