summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-19 13:43:23 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-20 08:14:13 +0000
commitfe3fd05966a668c1cdf53e8221b8614e9a07de65 (patch)
tree4c6c105b78d0cb9c45431c2fecd2583d6a2aa85c /forms
parent1d5c39192e81f950289dbdd7991a0e8a67c0aabc (diff)
add mapKeysToSequence/mapValuesToSequence methods to comphelper
and use them Change-Id: If4dc9df63db37185228aeaaab2979498d61304ec Reviewed-on: https://gerrit.libreoffice.org/20055 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/misc/InterfaceContainer.cxx9
-rw-r--r--forms/source/xforms/NameContainer.hxx14
-rw-r--r--forms/source/xforms/convert.cxx6
-rw-r--r--forms/source/xforms/datatyperepository.cxx9
4 files changed, 6 insertions, 32 deletions
diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index bc75f4eea26d..63aee56f9d5d 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -726,14 +726,7 @@ Any SAL_CALL OInterfaceContainer::getByName( const OUString& _rName ) throw(NoSu
css::uno::Sequence<OUString> SAL_CALL OInterfaceContainer::getElementNames() throw(RuntimeException, std::exception)
{
- css::uno::Sequence<OUString> aNameList(m_aItems.size());
- OUString* pStringArray = aNameList.getArray();
-
- for (OInterfaceMap::const_iterator i = m_aMap.begin(); i != m_aMap.end(); ++i, ++pStringArray)
- {
- *pStringArray = (*i).first;
- }
- return aNameList;
+ return comphelper::mapKeysToSequence(m_aMap);
}
diff --git a/forms/source/xforms/NameContainer.hxx b/forms/source/xforms/NameContainer.hxx
index c4a129febe78..f8879b02c3c0 100644
--- a/forms/source/xforms/NameContainer.hxx
+++ b/forms/source/xforms/NameContainer.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_FORMS_SOURCE_XFORMS_NAMECONTAINER_HXX
#define INCLUDED_FORMS_SOURCE_XFORMS_NAMECONTAINER_HXX
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <map>
@@ -123,18 +124,7 @@ public:
virtual css::uno::Sequence<OUString> SAL_CALL getElementNames()
throw( css::uno::RuntimeException, std::exception ) override
{
- css::uno::Sequence<OUString> aSequence( maItems.size() );
- typename map_t::const_iterator aIter = maItems.begin();
- OUString* pStrings = aSequence.getArray();
- while( aIter != maItems.end() )
- {
- *pStrings = aIter->first;
- ++aIter;
- ++pStrings;
- }
- OSL_ENSURE( pStrings == aSequence.getArray() + aSequence.getLength(),
- "sequence not of right size; possible buffer overflow" );
- return aSequence;
+ return comphelper::mapKeysToSequence(maItems);
}
virtual sal_Bool SAL_CALL hasByName(
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 0e05f2ef2221..da5eb7fa1e78 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/Time.hpp>
+#include <comphelper/sequence.hxx>
#include <unotools/datetime.hxx>
using xforms::Convert;
@@ -301,10 +302,7 @@ bool Convert::hasType( const css::uno::Type& rType )
css::uno::Sequence<css::uno::Type> Convert::getTypes()
{
- css::uno::Sequence<css::uno::Type> aTypes( maMap.size() );
- transform( maMap.begin(), maMap.end(), aTypes.getArray(),
- o3tl::select1st<Map_t::value_type>() );
- return aTypes;
+ return comphelper::mapKeysToSequence( maMap );
}
OUString Convert::toXSD( const css::uno::Any& rAny )
diff --git a/forms/source/xforms/datatyperepository.cxx b/forms/source/xforms/datatyperepository.cxx
index 0ea1e9c95a3d..ea35900c636e 100644
--- a/forms/source/xforms/datatyperepository.cxx
+++ b/forms/source/xforms/datatyperepository.cxx
@@ -178,14 +178,7 @@ namespace xforms
{
::osl::MutexGuard aGuard( m_aMutex );
- Sequence< OUString > aNames( m_aRepository.size() );
- ::std::transform(
- m_aRepository.begin(),
- m_aRepository.end(),
- aNames.getArray(),
- ::o3tl::select1st< Repository::value_type >()
- );
- return aNames;
+ return comphelper::mapKeysToSequence( m_aRepository );
}