From 389999abdb2d35f8641a6ff2e8984887166d39e2 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 8 Nov 2016 15:53:21 +0200 Subject: make comphelper::containerToSequence a little smarter So we don't have to specify the source and destination type as often. Change-Id: Id9e286417a1cb246d163cbc3c536b231a4a92624 Reviewed-on: https://gerrit.libreoffice.org/30700 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- include/comphelper/sequence.hxx | 9 +++++++++ include/sot/exchange.hxx | 7 +------ include/svtools/transfer.hxx | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index 7d8209d7a21f..bb1b1e81ba61 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -291,6 +291,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 SrcType > + inline css::uno::Sequence< typename SrcType::value_type > containerToSequence( const SrcType& i_Container ) + { + css::uno::Sequence< typename SrcType::value_type > result( i_Container.size() ); + ::std::copy( i_Container.begin(), i_Container.end(), result.getArray() ); + return result; + } + template inline css::uno::Sequence containerToSequence( ::std::vector const& v ) diff --git a/include/sot/exchange.hxx b/include/sot/exchange.hxx index f28d47e58c7e..307ffea16bb4 100644 --- a/include/sot/exchange.hxx +++ b/include/sot/exchange.hxx @@ -42,12 +42,7 @@ struct DataFlavorEx : public css::datatransfer::DataFlavor SotClipboardFormatId mnSotId; }; -// JP 23.03.2001 - this struct is only for "hide" the STD of the vetor, -// because our makefile filter all this symbols and so nobody can use -// these struct in any interfacses. -struct DataFlavorExVector : public ::std::vector< DataFlavorEx > -{ -}; +typedef ::std::vector DataFlavorExVector; SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx index 2eb31595afe1..9213e6754db1 100644 --- a/include/svtools/transfer.hxx +++ b/include/svtools/transfer.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,6 @@ class INetBookmark; class INetImage; class FileList; class SotStorageStream; -struct DataFlavorExVector; namespace vcl { class Window; } // Drag&Drop defines -- cgit