summaryrefslogtreecommitdiff
path: root/comphelper
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 /comphelper
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 'comphelper')
-rw-r--r--comphelper/source/container/NamedPropertyValuesContainer.cxx9
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx8
-rw-r--r--comphelper/source/container/namecontainer.cxx11
-rw-r--r--comphelper/source/eventattachermgr/eventattachermgr.cxx12
4 files changed, 7 insertions, 33 deletions
diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx b/comphelper/source/container/NamedPropertyValuesContainer.cxx
index 69f2b384e80e..90ce4cd723d1 100644
--- a/comphelper/source/container/NamedPropertyValuesContainer.cxx
+++ b/comphelper/source/container/NamedPropertyValuesContainer.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/supportsservice.hxx>
@@ -151,13 +152,7 @@ css::uno::Any SAL_CALL NamedPropertyValuesContainer::getByName( const OUString&
css::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getElementNames( )
throw(css::uno::RuntimeException, std::exception)
{
- uno::Sequence< OUString > aNames( maProperties.size() );
- OUString* pNames = aNames.getArray();
-
- for( const auto& rProperty : maProperties )
- *pNames++ = rProperty.first;
-
- return aNames;
+ return comphelper::mapKeysToSequence(maProperties);
}
sal_Bool SAL_CALL NamedPropertyValuesContainer::hasByName( const OUString& aName )
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 33814fbde73f..af4bc5ce3b77 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -230,13 +230,7 @@ OUString EmbeddedObjectContainer::CreateUniqueObjectName()
uno::Sequence < OUString > EmbeddedObjectContainer::GetObjectNames()
{
- uno::Sequence < OUString > aSeq( pImpl->maObjectContainer.size() );
- OUString* pNames = aSeq.getArray();
-
- for( const auto& rObj : pImpl->maObjectContainer )
- *pNames++ = rObj.first;
-
- return aSeq;
+ return comphelper::mapKeysToSequence(pImpl->maObjectContainer);
}
bool EmbeddedObjectContainer::HasEmbeddedObjects()
diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx
index a7b419b9a74d..b04ada10cf08 100644
--- a/comphelper/source/container/namecontainer.cxx
+++ b/comphelper/source/container/namecontainer.cxx
@@ -22,6 +22,7 @@
#include <map>
#include <comphelper/namecontainer.hxx>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
@@ -160,15 +161,7 @@ Sequence< OUString > SAL_CALL NameContainer::getElementNames( )
{
MutexGuard aGuard( maMutex );
- Sequence< OUString > aNames( maProperties.size() );
- OUString* pNames = aNames.getArray();
-
- for( const auto& rProperty : maProperties )
- {
- *pNames++ = rProperty.first;
- }
-
- return aNames;
+ return comphelper::mapKeysToSequence(maProperties);
}
sal_Bool SAL_CALL NameContainer::hasByName( const OUString& aName )
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 12101471bc97..d782b744fc42 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -21,6 +21,7 @@
#include <osl/diagnose.h>
#include <comphelper/eventattachermgr.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <com/sun/star/beans/theIntrospection.hpp>
#include <com/sun/star/io/XObjectInputStream.hpp>
#include <com/sun/star/io/XPersistObject.hpp>
@@ -573,16 +574,7 @@ Sequence< ScriptEventDescriptor > SAL_CALL ImplEventAttacherManager::getScriptEv
{
Guard< Mutex > aGuard( aLock );
::std::deque<AttacherIndex_Impl>::iterator aIt = implCheckIndex( nIndex );
-
- Sequence< ScriptEventDescriptor > aSeq( aIt->aEventList.size() );
- ScriptEventDescriptor * pArray = aSeq.getArray();
-
- sal_Int32 i = 0;
- for( const auto& rEvt : aIt->aEventList )
- {
- pArray[i++] = rEvt;
- }
- return aSeq;
+ return comphelper::containerToSequence<ScriptEventDescriptor>(aIt->aEventList);
}