Kaydet (Commit) ee0e713b authored tarafından Noel Grandin's avatar Noel Grandin

make comphelper::sequenceToContainer a little smarter

so we don't have to specify the source type

Change-Id: I4106705a39874a8043f0f294a11374404d6cfc3a
Reviewed-on: https://gerrit.libreoffice.org/30713Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 5c2c2d8d
......@@ -359,7 +359,7 @@ namespace dxcanvas
aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
const ::std::vector< Gdiplus::REAL >& rDashArray(
::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >(
::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL >, double >(
strokeAttributes.DashArray ) );
if( !rDashArray.empty() )
{
......
......@@ -340,6 +340,15 @@ namespace comphelper
return result;
}
// this one does better type deduction, but does not allow us to copy into a different element type
template < typename DstType >
inline DstType sequenceToContainer( const css::uno::Sequence< typename DstType::value_type >& i_Sequence )
{
DstType result( i_Sequence.getLength() );
::std::copy( i_Sequence.begin(), i_Sequence.end(), result.begin() );
return result;
}
/** Copy from a Sequence into an existing container
This potentially saves a needless extra copy operation over
......
......@@ -638,7 +638,7 @@ void SAL_CALL PasswordContainer::addPersistent( const OUString& Url, const OUStr
void PasswordContainer::PrivateAdd( const OUString& Url, const OUString& UserName, const Sequence< OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException, std::exception)
{
NamePassRecord aRecord( UserName );
::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString>, OUString>( Passwords );
::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString> >( Passwords );
if( Mode == PERSISTENT_RECORD )
aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) );
......
......@@ -131,8 +131,7 @@ void SvgData::ensureSequenceAndRange()
{
const uno::Reference< graphic::XSvgParser > xSvgParser = graphic::SvgTools::create(xContext);
maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>,
css::uno::Reference< css::graphic::XPrimitive2D >>(xSvgParser->getDecomposition(myInputStream, maPath));
maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, maPath));
}
catch(const uno::Exception&)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment