summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx6
-rw-r--r--cppu/source/threadpool/jobqueue.cxx8
-rw-r--r--cppu/source/typelib/typelib.cxx56
-rw-r--r--cppu/source/uno/lbenv.cxx23
-rw-r--r--cppu/source/uno/lbmap.cxx5
-rw-r--r--cppuhelper/source/component_context.cxx23
-rw-r--r--cppuhelper/source/interfacecontainer.cxx92
-rw-r--r--cppuhelper/source/propertysetmixin.cxx44
-rw-r--r--cppuhelper/source/servicemanager.cxx249
-rw-r--r--cppuhelper/source/typemanager.cxx40
-rw-r--r--cppuhelper/source/weak.cxx12
11 files changed, 197 insertions, 361 deletions
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 422a92279659..93c0d617a22b 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -2025,13 +2025,11 @@ namespace cppcanvas
aMapModeTransform.set(0,2, 0.0);
aMapModeTransform.set(1,2, 0.0);
- PolyPolyVector::const_iterator aIter( aVCLPolyPolyVector.begin() );
- const PolyPolyVector::const_iterator aEnd( aVCLPolyPolyVector.end() );
- for( ; aIter!= aEnd; ++aIter )
+ for( const auto& rVCLPolyPolygon : aVCLPolyPolyVector )
{
::basegfx::B2DPolyPolygon aPolyPolygon;
- aPolyPolygon = aIter->getB2DPolyPolygon();
+ aPolyPolygon = rVCLPolyPolygon.getB2DPolyPolygon();
aPolyPolygon.transform( aMapModeTransform );
// append result to collecting polypoly
diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx
index 2d375dcf8bbd..6c9324521f40 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -129,13 +129,11 @@ namespace cppu_threadpool {
void JobQueue::dispose( sal_Int64 nDisposeId )
{
MutexGuard guard( m_mutex );
- for( auto ii = m_lstCallstack.begin() ;
- ii != m_lstCallstack.end() ;
- ++ii )
+ for( auto& rId : m_lstCallstack )
{
- if( (*ii) == nDisposeId )
+ if( rId == nDisposeId )
{
- (*ii) = 0;
+ rId = 0;
}
}
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 309543b4078d..d9fe276a6c3b 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -18,6 +18,7 @@
*/
+#include <algorithm>
#include <unordered_map>
#include <cassert>
#include <list>
@@ -223,14 +224,11 @@ inline void TypeDescriptor_Init_Impl::callChain(
assert(*ppRet == nullptr);
if (pCallbacks)
{
- CallbackSet_Impl::const_iterator aIt = pCallbacks->begin();
- while( aIt != pCallbacks->end() )
+ for( const CallbackEntry & rEntry : *pCallbacks )
{
- const CallbackEntry & rEntry = *aIt;
(*rEntry.second)( rEntry.first, ppRet, pName );
if( *ppRet )
return;
- ++aIt;
}
}
}
@@ -240,11 +238,9 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
{
if( pCache )
{
- TypeDescriptionList_Impl::const_iterator aIt = pCache->begin();
- while( aIt != pCache->end() )
+ for( typelib_TypeDescription* pItem : *pCache )
{
- typelib_typedescription_release( *aIt );
- ++aIt;
+ typelib_typedescription_release( pItem );
}
}
@@ -254,19 +250,14 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
ppTDR.reserve( pWeakMap->size() );
// save all weak references
- WeakMap_Impl::const_iterator aIt = pWeakMap->begin();
- while( aIt != pWeakMap->end() )
+ for( const auto& rEntry : *pWeakMap )
{
- ppTDR.push_back( (*aIt).second );
+ ppTDR.push_back( rEntry.second );
typelib_typedescriptionreference_acquire( ppTDR.back() );
- ++aIt;
}
- for( std::vector< typelib_TypeDescriptionReference * >::iterator i(
- ppTDR.begin() );
- i != ppTDR.end(); ++i )
+ for( typelib_TypeDescriptionReference * pTDR : ppTDR )
{
- typelib_TypeDescriptionReference * pTDR = *i;
OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount );
pTDR->nRefCount -= pTDR->nStaticRefCount;
@@ -278,11 +269,10 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
typelib_typedescriptionreference_release( pTDR );
}
- aIt = pWeakMap->begin();
#if defined SAL_LOG_INFO
- while( aIt != pWeakMap->end() )
+ for( const auto& rEntry : *pWeakMap )
{
- typelib_TypeDescriptionReference * pTDR = (*aIt).second;
+ typelib_TypeDescriptionReference * pTDR = rEntry.second;
if (pTDR)
{
OString aTypeName( OUStringToOString( pTDR->pTypeName, RTL_TEXTENCODING_ASCII_US ) );
@@ -292,7 +282,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
{
SAL_INFO("cppu.typelib", "remaining null type entry!?");
}
- ++aIt;
}
#endif
}
@@ -336,18 +325,8 @@ extern "C" void SAL_CALL typelib_typedescription_revokeCallback(
// todo mt safe: guard is no solution, can not acquire while calling callback!
// OslGuard aGuard( rInit.getMutex() );
CallbackEntry aEntry( pContext, pCallback );
- CallbackSet_Impl::iterator iPos( rInit.pCallbacks->begin() );
- while (iPos != rInit.pCallbacks->end())
- {
- if (*iPos == aEntry)
- {
- iPos = rInit.pCallbacks->erase(iPos);
- }
- else
- {
- ++iPos;
- }
- }
+ rInit.pCallbacks->erase(std::remove(rInit.pCallbacks->begin(), rInit.pCallbacks->end(), aEntry),
+ rInit.pCallbacks->end());
}
}
@@ -1018,21 +997,20 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface(
sal_Int32 n = 0;
BaseList::List const & rList = aBaseList.getList();
- for (BaseList::List::const_iterator i(rList.begin()); i != rList.end();
- ++i)
+ for (const auto& rEntry : rList)
{
- typelib_InterfaceTypeDescription const * pBase = i->base;
+ typelib_InterfaceTypeDescription const * pBase = rEntry.base;
typelib_InterfaceTypeDescription const * pDirectBase
- = pITD->ppBaseTypes[i->directBaseIndex];
+ = pITD->ppBaseTypes[rEntry.directBaseIndex];
OSL_ASSERT(pBase->ppAllMembers != nullptr);
for (sal_Int32 j = 0; j < pBase->nMembers; ++j) {
typelib_TypeDescriptionReference const * pDirectBaseMember
- = pDirectBase->ppAllMembers[i->directBaseMemberOffset + j];
+ = pDirectBase->ppAllMembers[rEntry.directBaseMemberOffset + j];
OUStringBuffer aBuf(pDirectBaseMember->pTypeName);
aBuf.append(":@");
- aBuf.append(i->directBaseIndex);
+ aBuf.append(rEntry.directBaseIndex);
aBuf.append(',');
- aBuf.append(i->memberOffset + j);
+ aBuf.append(rEntry.memberOffset + j);
aBuf.append(':');
aBuf.append(pITD->aBase.pTypeName);
OUString aName(aBuf.makeStringAndClear());
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 9e9de7655041..394aa2ddf41a 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -495,12 +495,9 @@ static void defenv_getRegisteredInterfaces(
sal_Int32 nPos = 0;
void ** ppInterfaces = static_cast<void **>((*memAlloc)( nLen * sizeof (void *) ));
- Ptr2ObjectMap::const_iterator iPos( that->aPtr2ObjectMap.begin() );
- Ptr2ObjectMap::const_iterator const iEnd( that->aPtr2ObjectMap.end() );
- while (iPos != iEnd)
+ for (const auto& rEntry : that->aPtr2ObjectMap)
{
- (*pEnv->acquireInterface)( pEnv, ppInterfaces[nPos++] = (*iPos).first );
- ++iPos;
+ (*pEnv->acquireInterface)( pEnv, ppInterfaces[nPos++] = rEntry.first );
}
*pppInterfaces = ppInterfaces;
@@ -711,10 +708,9 @@ extern "C" void SAL_CALL uno_dumpEnvironment(
::osl::MutexGuard guard( that->mutex );
Ptr2ObjectMap ptr2obj( that->aPtr2ObjectMap );
- OId2ObjectMap::const_iterator iPos( that->aOId2ObjectMap.begin() );
- while (iPos != that->aOId2ObjectMap.end())
+ for (const auto& rEntry : that->aOId2ObjectMap)
{
- ObjectEntry * pOEntry = iPos->second;
+ ObjectEntry * pOEntry = rEntry.second;
buf.append( "+ " );
if (pOEntry->mixedObject)
@@ -757,7 +753,6 @@ extern "C" void SAL_CALL uno_dumpEnvironment(
}
writeLine( stream, buf.makeStringAndClear(), pFilter );
}
- ++iPos;
}
if (! ptr2obj.empty())
writeLine( stream, "ptr map inconsistency!!!", pFilter );
@@ -893,10 +888,9 @@ EnvironmentsData::~EnvironmentsData()
::osl::MutexGuard guard( mutex );
isDisposing = true;
- for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
- iPos != aName2EnvMap.end(); ++iPos )
+ for ( const auto& rEntry : aName2EnvMap )
{
- uno_Environment * pWeak = iPos->second;
+ uno_Environment * pWeak = rEntry.second;
uno_Environment * pHard = nullptr;
(*pWeak->harden)( &pHard, pWeak );
(*pWeak->releaseWeak)( pWeak );
@@ -982,10 +976,9 @@ void EnvironmentsData::getRegisteredEnvironments(
sal_Int32 nSize = 0;
// find matching environment
- for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
- iPos != aName2EnvMap.end(); ++iPos )
+ for ( const auto& rEntry : aName2EnvMap )
{
- uno_Environment * pWeak = iPos->second;
+ uno_Environment * pWeak = rEntry.second;
if (rEnvDcp.isEmpty() ||
rEnvDcp == pWeak->pTypeName )
{
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 54852a63082f..fc093907c591 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -608,10 +608,9 @@ void SAL_CALL uno_getMapping(
if (! aRet.is()) // try callback chain
{
MutexGuard aGuard( rData.aCallbacksMutex );
- for ( t_CallbackSet::const_iterator iPos( rData.aCallbacks.begin() );
- iPos != rData.aCallbacks.end(); ++iPos )
+ for ( const auto& rCallback : rData.aCallbacks )
{
- (**iPos)( ppMapping, pFrom, pTo, aAddPurpose.pData );
+ (*rCallback)( ppMapping, pFrom, pTo, aAddPurpose.pData );
if (*ppMapping)
return;
}
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx
index e278302fbfcc..ba0c0635dc89 100644
--- a/cppuhelper/source/component_context.cxx
+++ b/cppuhelper/source/component_context.cxx
@@ -40,6 +40,8 @@
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
+#include <comphelper/sequence.hxx>
+
#include <memory>
#define SMGR_SINGLETON "/singletons/com.sun.star.lang.theServiceManager"
@@ -232,14 +234,7 @@ Any ComponentContext::getByName( OUString const & name )
Sequence<OUString> ComponentContext::getElementNames()
{
MutexGuard guard( m_mutex );
- Sequence<OUString> ret( m_map.size() );
- OUString * pret = ret.getArray();
- sal_Int32 pos = 0;
- t_map::const_iterator iPos( m_map.begin() );
- t_map::const_iterator const iEnd( m_map.end() );
- for ( ; iPos != iEnd; ++iPos )
- pret[pos++] = iPos->first;
- return ret;
+ return comphelper::mapKeysToSequence(m_map);
}
@@ -393,16 +388,12 @@ void ComponentContext::disposing()
Reference< lang::XComponent > xTDMgr, xAC; // to be disposed separately
// dispose all context objects
- t_map::iterator iPos( m_map.begin() );
- t_map::iterator const iEnd( m_map.end() );
- for ( ; iPos != iEnd; ++iPos )
+ for ( auto& [rName, rEntry] : m_map )
{
// service manager disposed separately
if (!m_xSMgr.is() ||
- !iPos->first.startsWith( SMGR_SINGLETON ))
+ !rName.startsWith( SMGR_SINGLETON ))
{
- ContextEntry& rEntry = iPos->second;
-
if (rEntry.lateInit)
{
// late init
@@ -419,11 +410,11 @@ void ComponentContext::disposing()
rEntry.value >>= xComp;
if (xComp.is())
{
- if ( iPos->first == TDMGR_SINGLETON )
+ if ( rName == TDMGR_SINGLETON )
{
xTDMgr = xComp;
}
- else if ( iPos->first == AC_SINGLETON )
+ else if ( rName == AC_SINGLETON )
{
xAC = xComp;
}
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
index 175526945e21..7f49682e410b 100644
--- a/cppuhelper/source/interfacecontainer.cxx
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -332,14 +332,11 @@ OMultiTypeInterfaceContainerHelper::OMultiTypeInterfaceContainerHelper( Mutex &
OMultiTypeInterfaceContainerHelper::~OMultiTypeInterfaceContainerHelper()
{
t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap);
- t_type2ptr::iterator iter = pMap->begin();
- t_type2ptr::iterator end = pMap->end();
- while( iter != end )
+ for (auto& rItem : *pMap)
{
- delete static_cast<OInterfaceContainerHelper*>((*iter).second);
- (*iter).second = nullptr;
- ++iter;
+ delete static_cast<OInterfaceContainerHelper*>(rItem.second);
+ rItem.second = nullptr;
}
delete pMap;
}
@@ -356,17 +353,13 @@ Sequence< Type > OMultiTypeInterfaceContainerHelper::getContainedTypes() const
css::uno::Sequence< Type > aInterfaceTypes( nSize );
Type * pArray = aInterfaceTypes.getArray();
- t_type2ptr::iterator iter = pMap->begin();
- t_type2ptr::iterator end = pMap->end();
-
sal_Int32 i = 0;
- while( iter != end )
+ for (const auto& rItem : *pMap)
{
// are interfaces added to this container?
- if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() )
+ if( static_cast<OInterfaceContainerHelper*>(rItem.second)->getLength() )
// yes, put the type in the array
- pArray[i++] = (*iter).first;
- ++iter;
+ pArray[i++] = rItem.first;
}
if( static_cast<t_type2ptr::size_type>(i) != nSize ) {
// may be empty container, reduce the sequence to the right size
@@ -379,16 +372,8 @@ Sequence< Type > OMultiTypeInterfaceContainerHelper::getContainedTypes() const
static t_type2ptr::iterator findType(t_type2ptr *pMap, const Type & rKey )
{
- t_type2ptr::iterator iter = pMap->begin();
- t_type2ptr::iterator end = pMap->end();
-
- while( iter != end )
- {
- if (iter->first == rKey)
- break;
- ++iter;
- }
- return iter;
+ return std::find_if(pMap->begin(), pMap->end(),
+ [&rKey](const t_type2ptr::value_type& rItem) { return rItem.first == rKey; });
}
OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelper::getContainer( const Type & rKey ) const
@@ -447,14 +432,10 @@ void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rE
ppListenerContainers.reset(new ppp[nSize]);
//ppListenerContainers = new (ListenerContainer*)[nSize];
- t_type2ptr::iterator iter = pMap->begin();
- t_type2ptr::iterator end = pMap->end();
-
t_type2ptr::size_type i = 0;
- while( iter != end )
+ for (const auto& rItem : *pMap)
{
- ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>((*iter).second);
- ++iter;
+ ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>(rItem.second);
}
}
}
@@ -472,13 +453,10 @@ void OMultiTypeInterfaceContainerHelper::clear()
{
::osl::MutexGuard aGuard( rMutex );
t_type2ptr * pMap = static_cast<t_type2ptr *>(m_pMap);
- t_type2ptr::iterator iter = pMap->begin();
- t_type2ptr::iterator end = pMap->end();
- while( iter != end )
+ for (auto& rItem : *pMap)
{
- static_cast<OInterfaceContainerHelper*>((*iter).second)->clear();
- ++iter;
+ static_cast<OInterfaceContainerHelper*>(rItem.second)->clear();
}
}
@@ -488,16 +466,8 @@ typedef std::vector< std::pair < sal_Int32 , void* > > t_long2ptr;
static t_long2ptr::iterator findLong(t_long2ptr *pMap, sal_Int32 nKey )
{
- t_long2ptr::iterator iter = pMap->begin();
- t_long2ptr::iterator end = pMap->end();
-
- while( iter != end )
- {
- if (iter->first == nKey)
- break;
- ++iter;
- }
- return iter;
+ return std::find_if(pMap->begin(), pMap->end(),
+ [&nKey](const t_long2ptr::value_type& rItem) { return rItem.first == nKey; });
}
OMultiTypeInterfaceContainerHelperInt32::OMultiTypeInterfaceContainerHelperInt32( Mutex & rMutex_ )
@@ -513,14 +483,11 @@ OMultiTypeInterfaceContainerHelperInt32::~OMultiTypeInterfaceContainerHelperInt3
return;
t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap);
- t_long2ptr::iterator iter = pMap->begin();
- t_long2ptr::iterator end = pMap->end();
- while( iter != end )
+ for (auto& rItem : *pMap)
{
- delete static_cast<OInterfaceContainerHelper*>((*iter).second);
- (*iter).second = nullptr;
- ++iter;
+ delete static_cast<OInterfaceContainerHelper*>(rItem.second);
+ rItem.second = nullptr;
}
delete pMap;
}
@@ -537,17 +504,13 @@ Sequence< sal_Int32 > OMultiTypeInterfaceContainerHelperInt32::getContainedTypes
css::uno::Sequence< sal_Int32 > aInterfaceTypes( nSize );
sal_Int32 * pArray = aInterfaceTypes.getArray();
- t_long2ptr::iterator iter = pMap->begin();
- t_long2ptr::iterator end = pMap->end();
-
sal_Int32 i = 0;
- while( iter != end )
+ for (const auto& rItem : *pMap)
{
// are interfaces added to this container?
- if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() )
+ if( static_cast<OInterfaceContainerHelper*>(rItem.second)->getLength() )
// yes, put the type in the array
- pArray[i++] = (*iter).first;
- ++iter;
+ pArray[i++] = rItem.first;
}
if( static_cast<t_long2ptr::size_type>(i) != nSize ) {
// may be empty container, reduce the sequence to the right size
@@ -622,14 +585,10 @@ void OMultiTypeInterfaceContainerHelperInt32::disposeAndClear( const EventObject
typedef OInterfaceContainerHelper* ppp;
ppListenerContainers.reset(new ppp[nSize]);
- t_long2ptr::iterator iter = pMap->begin();
- t_long2ptr::iterator end = pMap->end();
-
t_long2ptr::size_type i = 0;
- while( iter != end )
+ for (const auto& rItem : *pMap)
{
- ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>((*iter).second);
- ++iter;
+ ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>(rItem.second);
}
}
}
@@ -649,13 +608,10 @@ void OMultiTypeInterfaceContainerHelperInt32::clear()
if (!m_pMap)
return;
t_long2ptr * pMap = static_cast<t_long2ptr *>(m_pMap);
- t_long2ptr::iterator iter = pMap->begin();
- t_long2ptr::iterator end = pMap->end();
- while( iter != end )
+ for (auto& rItem : *pMap)
{
- static_cast<OInterfaceContainerHelper*>((*iter).second)->clear();
- ++iter;
+ static_cast<OInterfaceContainerHelper*>(rItem.second)->clear();
}
}
diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx
index 4c31beaa286d..7201d49def1a 100644
--- a/cppuhelper/source/propertysetmixin.cxx
+++ b/cppuhelper/source/propertysetmixin.cxx
@@ -291,11 +291,10 @@ css::uno::Sequence< css::beans::Property > Info::getProperties()
css::uno::Sequence< css::beans::Property > s(
static_cast< sal_Int32 >(m_data->properties.size()));
sal_Int32 n = 0;
- for (Data::PropertyMap::iterator i(m_data->properties.begin());
- i != m_data->properties.end(); ++i)
+ for (const auto& rEntry : m_data->properties)
{
- if (i->second.present) {
- s[n++] = i->second.property;
+ if (rEntry.second.present) {
+ s[n++] = rEntry.second.property;
}
}
s.realloc(n);
@@ -334,19 +333,16 @@ PropertySetMixinImpl::BoundListeners::~BoundListeners() {
}
void PropertySetMixinImpl::BoundListeners::notify() const {
- for (BoundListenerBag::const_iterator i(m_impl->specificListeners.begin());
- i != m_impl->specificListeners.end(); ++i)
+ for (const auto& rxListener : m_impl->specificListeners)
{
try {
- (*i)->propertyChange(m_impl->event);
+ rxListener->propertyChange(m_impl->event);
} catch (css::lang::DisposedException &) {}
}
- for (BoundListenerBag::const_iterator i(
- m_impl->unspecificListeners.begin());
- i != m_impl->unspecificListeners.end(); ++i)
+ for (const auto& rxListener : m_impl->unspecificListeners)
{
try {
- (*i)->propertyChange(m_impl->event);
+ rxListener->propertyChange(m_impl->event);
} catch (css::lang::DisposedException &) {}
}
}
@@ -898,18 +894,16 @@ void PropertySetMixinImpl::prepareSet(
css::beans::PropertyChangeEvent event(
static_cast< css::beans::XPropertySet * >(this), propertyName,
false, it->second.property.Handle, oldValue, newValue);
- for (Impl::VetoListenerBag::iterator i(specificVeto.begin());
- i != specificVeto.end(); ++i)
+ for (auto& rxVetoListener : specificVeto)
{
try {
- (*i)->vetoableChange(event);
+ rxVetoListener->vetoableChange(event);
} catch (css::lang::DisposedException &) {}
}
- for (Impl::VetoListenerBag::iterator i(unspecificVeto.begin());
- i != unspecificVeto.end(); ++i)
+ for (auto& rxVetoListener : unspecificVeto)
{
try {
- (*i)->vetoableChange(event);
+ rxVetoListener->vetoableChange(event);
} catch (css::lang::DisposedException &) {}
}
}
@@ -934,22 +928,18 @@ void PropertySetMixinImpl::dispose() {
}
css::lang::EventObject event(
static_cast< css::beans::XPropertySet * >(this));
- for (Impl::BoundListenerMap::iterator i(boundListeners.begin());
- i != boundListeners.end(); ++i)
+ for (auto& rEntry : boundListeners)
{
- for (BoundListenerBag::iterator j(i->second.begin());
- j != i->second.end(); ++j)
+ for (auto& rxBoundListener : rEntry.second)
{
- (*j)->disposing(event);
+ rxBoundListener->disposing(event);
}
}
- for (Impl::VetoListenerMap::iterator i(vetoListeners.begin());
- i != vetoListeners.end(); ++i)
+ for (auto& rEntry : vetoListeners)
{
- for (Impl::VetoListenerBag::iterator j(i->second.begin());
- j != i->second.end(); ++j)
+ for (auto& rxVetoListener : rEntry.second)
{
- (*j)->disposing(event);
+ rxVetoListener->disposing(event);
}
}
}
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 68db3c102329..765204301e1f 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/component_context.hxx>
#include <cppuhelper/implbase.hxx>
@@ -58,15 +59,13 @@ void insertImplementationMap(
cppuhelper::ServiceManager::Data::ImplementationMap const & source)
{
assert(destination != nullptr);
- for (cppuhelper::ServiceManager::Data::ImplementationMap::const_iterator i(
- source.begin());
- i != source.end(); ++i)
+ for (const auto& [rName, rImpls] : source)
{
std::vector<
std::shared_ptr<
cppuhelper::ServiceManager::Data::Implementation > > & impls
- = (*destination)[i->first];
- impls.insert(impls.end(), i->second.begin(), i->second.end());
+ = (*destination)[rName];
+ impls.insert(impls.end(), rImpls.begin(), rImpls.end());
}
}
@@ -79,11 +78,10 @@ void removeFromImplementationMap(
// The underlying data structures make this function somewhat inefficient,
// but the assumption is that it is rarely called:
assert(map != nullptr);
- for (std::vector< OUString >::const_iterator i(elements.begin());
- i != elements.end(); ++i)
+ for (const auto& rElement : elements)
{
cppuhelper::ServiceManager::Data::ImplementationMap::iterator j(
- map->find(*i));
+ map->find(rElement));
assert(j != map->end());
std::vector<
std::shared_ptr<
@@ -637,16 +635,7 @@ ImplementationWrapper::getSupportedServiceNames()
+ " supports too many services"),
static_cast< cppu::OWeakObject * >(this));
}
- css::uno::Sequence< OUString > names(
- static_cast< sal_Int32 >(impl->info->services.size()));
- sal_Int32 i = 0;
- for (std::vector< OUString >::const_iterator j(
- impl->info->services.begin());
- j != impl->info->services.end(); ++j)
- {
- names[i++] = *j;
- }
- return names;
+ return comphelper::containerToSequence(impl->info->services);
}
}
@@ -730,21 +719,20 @@ void cppuhelper::ServiceManager::addSingletonContextEntries(
std::vector< cppu::ContextEntry_Init > * entries)
{
assert(entries != nullptr);
- for (Data::ImplementationMap::const_iterator i(data_.singletons.begin());
- i != data_.singletons.end(); ++i)
+ for (const auto& [rName, rImpls] : data_.singletons)
{
- assert(!i->second.empty());
- assert(i->second[0].get() != nullptr);
+ assert(!rImpls.empty());
+ assert(rImpls[0].get() != nullptr);
SAL_INFO_IF(
- i->second.size() > 1, "cppuhelper",
- "Arbitrarily choosing " << i->second[0]->info->name
- << " among multiple implementations for " << i->first);
+ rImpls.size() > 1, "cppuhelper",
+ "Arbitrarily choosing " << rImpls[0]->info->name
+ << " among multiple implementations for " << rName);
entries->push_back(
cppu::ContextEntry_Init(
- "/singletons/" + i->first,
+ "/singletons/" + rName,
css::uno::makeAny<
css::uno::Reference<css::lang::XSingleComponentFactory> >(
- new SingletonFactory(this, i->second[0])),
+ new SingletonFactory(this, rImpls[0])),
true));
}
}
@@ -848,31 +836,27 @@ void cppuhelper::ServiceManager::disposing() {
Data clear;
{
osl::MutexGuard g(rBHelper.rMutex);
- for (Data::NamedImplementations::const_iterator i(
- data_.namedImplementations.begin());
- i != data_.namedImplementations.end(); ++i)
+ for (const auto& rEntry : data_.namedImplementations)
{
- assert(i->second.get() != nullptr);
- if (!i->second->info->singletons.empty()) {
- osl::MutexGuard g2(i->second->mutex);
- if (i->second->disposeSingleton.is()) {
- sngls.push_back(i->second->disposeSingleton);
+ assert(rEntry.second.get() != nullptr);
+ if (!rEntry.second->info->singletons.empty()) {
+ osl::MutexGuard g2(rEntry.second->mutex);
+ if (rEntry.second->disposeSingleton.is()) {
+ sngls.push_back(rEntry.second->disposeSingleton);
}
}
}
- for (Data::DynamicImplementations::const_iterator i(
- data_.dynamicImplementations.begin());
- i != data_.dynamicImplementations.end(); ++i)
+ for (const auto& rEntry : data_.dynamicImplementations)
{
- assert(i->second.get() != nullptr);
- if (!i->second->info->singletons.empty()) {
- osl::MutexGuard g2(i->second->mutex);
- if (i->second->disposeSingleton.is()) {
- sngls.push_back(i->second->disposeSingleton);
+ assert(rEntry.second.get() != nullptr);
+ if (!rEntry.second->info->singletons.empty()) {
+ osl::MutexGuard g2(rEntry.second->mutex);
+ if (rEntry.second->disposeSingleton.is()) {
+ sngls.push_back(rEntry.second->disposeSingleton);
}
}
- if (i->second->component.is()) {
- comps.push_back(i->second->component);
+ if (rEntry.second->component.is()) {
+ comps.push_back(rEntry.second->component);
}
}
data_.namedImplementations.swap(clear.namedImplementations);
@@ -880,23 +864,17 @@ void cppuhelper::ServiceManager::disposing() {
data_.services.swap(clear.services);
data_.singletons.swap(clear.singletons);
}
- for (std::vector<
- css::uno::Reference<css::lang::XComponent> >::const_iterator i(
- sngls.begin());
- i != sngls.end(); ++i)
+ for (const auto& rxSngl : sngls)
{
try {
- (*i)->dispose();
+ rxSngl->dispose();
} catch (css::uno::RuntimeException & e) {
SAL_WARN("cppuhelper", "Ignoring " << e << " while disposing singleton");
}
}
- for (std::vector<
- css::uno::Reference< css::lang::XComponent > >::const_iterator i(
- comps.begin());
- i != comps.end(); ++i)
+ for (const auto& rxComp : comps)
{
- removeEventListenerFromComponent(*i);
+ removeEventListenerFromComponent(rxComp);
}
}
@@ -960,21 +938,12 @@ cppuhelper::ServiceManager::getAvailableServiceNames()
if (isDisposed()) {
return css::uno::Sequence< OUString >();
}
- Data::ImplementationMap::size_type n = data_.services.size();
- if (n > static_cast< sal_uInt32 >(SAL_MAX_INT32)) {
+ if (data_.services.size() > static_cast< sal_uInt32 >(SAL_MAX_INT32)) {
throw css::uno::RuntimeException(
"getAvailableServiceNames: too many services",
static_cast< cppu::OWeakObject * >(this));
}
- css::uno::Sequence< OUString > names(static_cast< sal_Int32 >(n));
- sal_Int32 i = 0;
- for (Data::ImplementationMap::const_iterator j(data_.services.begin());
- j != data_.services.end(); ++j)
- {
- names[i++] = j->first;
- }
- assert(i == names.getLength());
- return names;
+ return comphelper::mapKeysToSequence(data_.services);
}
css::uno::Reference< css::uno::XInterface >
@@ -1146,12 +1115,9 @@ cppuhelper::ServiceManager::createContentEnumeration(
}
}
std::vector< css::uno::Any > factories;
- for (std::vector<
- std::shared_ptr< Data::Implementation > >::const_iterator i(
- impls.begin());
- i != impls.end(); ++i)
+ for (const auto& rxImpl : impls)
{
- Data::Implementation * impl = i->get();
+ Data::Implementation * impl = rxImpl.get();
assert(impl != nullptr);
{
osl::MutexGuard g(rBHelper.rMutex);
@@ -1166,11 +1132,11 @@ cppuhelper::ServiceManager::createContentEnumeration(
// synchronous error dialog when no JVM is specified, and
// showing the dialog while hovering over a menu can cause
// trouble):
- impl->factory1 = new ImplementationWrapper(this, *i);
+ impl->factory1 = new ImplementationWrapper(this, rxImpl);
impl->status = Data::Implementation::STATUS_WRAPPER;
}
if (impl->constructor != nullptr && !impl->factory1.is()) {
- impl->factory1 = new ImplementationWrapper(this, *i);
+ impl->factory1 = new ImplementationWrapper(this, rxImpl);
}
}
if (impl->factory1.is()) {
@@ -1440,19 +1406,15 @@ bool cppuhelper::ServiceManager::readLegacyRdbFile(OUString const & uri) {
}
readLegacyRdbStrings(
uri, implKey, "UNO/SERVICES", &impl->info->services);
- for (std::vector< OUString >::const_iterator j(
- impl->info->services.begin());
- j != impl->info->services.end(); ++j)
+ for (const auto& rService : impl->info->services)
{
- data_.services[*j].push_back(impl);
+ data_.services[rService].push_back(impl);
}
readLegacyRdbStrings(
uri, implKey, "UNO/SINGLETONS", &impl->info->singletons);
- for (std::vector< OUString >::const_iterator j(
- impl->info->singletons.begin());
- j != impl->info->singletons.end(); ++j)
+ for (const auto& rSingleton : impl->info->singletons)
{
- data_.singletons[*j].push_back(impl);
+ data_.singletons[rSingleton].push_back(impl);
}
}
return true;
@@ -1525,14 +1487,13 @@ void cppuhelper::ServiceManager::insertRdbFiles(
css::uno::Reference< css::uno::XComponentContext > const & alienContext)
{
Data extra;
- for (std::vector< OUString >::const_iterator i(uris.begin());
- i != uris.end(); ++i)
+ for (const auto& rUri : uris)
{
try {
- Parser(*i, alienContext, &extra);
+ Parser(rUri, alienContext, &extra);
} catch (css::container::NoSuchElementException &) {
throw css::lang::IllegalArgumentException(
- *i + ": no such file", static_cast< cppu::OWeakObject * >(this),
+ rUri + ": no such file", static_cast< cppu::OWeakObject * >(this),
0);
} catch (css::registry::InvalidRegistryException & e) {
throw css::lang::IllegalArgumentException(
@@ -1586,29 +1547,23 @@ bool cppuhelper::ServiceManager::insertExtraData(Data const & extra) {
if (isDisposed()) {
return false;
}
- for (Data::NamedImplementations::const_iterator i(
- extra.namedImplementations.begin());
- i != extra.namedImplementations.end(); ++i)
+ auto i = std::find_if(extra.namedImplementations.begin(), extra.namedImplementations.end(),
+ [this](const Data::NamedImplementations::value_type& rEntry) {
+ return data_.namedImplementations.find(rEntry.first) != data_.namedImplementations.end(); });
+ if (i != extra.namedImplementations.end())
{
- if (data_.namedImplementations.find(i->first)
- != data_.namedImplementations.end())
- {
- throw css::lang::IllegalArgumentException(
- "Insert duplicate implementation name " + i->first,
- static_cast< cppu::OWeakObject * >(this), 0);
- }
+ throw css::lang::IllegalArgumentException(
+ "Insert duplicate implementation name " + i->first,
+ static_cast< cppu::OWeakObject * >(this), 0);
}
- for (Data::DynamicImplementations::const_iterator i(
- extra.dynamicImplementations.begin());
- i != extra.dynamicImplementations.end(); ++i)
+ bool bDuplicate = std::any_of(extra.dynamicImplementations.begin(), extra.dynamicImplementations.end(),
+ [this](const Data::DynamicImplementations::value_type& rEntry) {
+ return data_.dynamicImplementations.find(rEntry.first) != data_.dynamicImplementations.end(); });
+ if (bDuplicate)
{
- if (data_.dynamicImplementations.find(i->first)
- != data_.dynamicImplementations.end())
- {
- throw css::lang::IllegalArgumentException(
- "Insert duplicate factory object",
- static_cast< cppu::OWeakObject * >(this), 0);
- }
+ throw css::lang::IllegalArgumentException(
+ "Insert duplicate factory object",
+ static_cast< cppu::OWeakObject * >(this), 0);
}
//TODO: The below leaves data_ in an inconsistent state upon exceptions:
data_.namedImplementations.insert(
@@ -1626,33 +1581,31 @@ bool cppuhelper::ServiceManager::insertExtraData(Data const & extra) {
assert(context_.is());
css::uno::Reference< css::container::XNameContainer > cont(
context_, css::uno::UNO_QUERY_THROW);
- for (Data::ImplementationMap::const_iterator i(
- extra.singletons.begin());
- i != extra.singletons.end(); ++i)
+ for (const auto& [rName, rImpls] : extra.singletons)
{
- OUString name("/singletons/" + i->first);
+ OUString name("/singletons/" + rName);
//TODO: Update should be atomic:
try {
cont->removeByName(name + "/arguments");
} catch (const css::container::NoSuchElementException &) {}
- assert(!i->second.empty());
- assert(i->second[0].get() != nullptr);
+ assert(!rImpls.empty());
+ assert(rImpls[0].get() != nullptr);
SAL_INFO_IF(
- i->second.size() > 1, "cppuhelper",
- "Arbitrarily choosing " << i->second[0]->info->name
+ rImpls.size() > 1, "cppuhelper",
+ "Arbitrarily choosing " << rImpls[0]->info->name
<< " among multiple implementations for singleton "
- << i->first);
+ << rName);
try {
cont->insertByName(
- name + "/service", css::uno::Any(i->second[0]->info->name));
+ name + "/service", css::uno::Any(rImpls[0]->info->name));
} catch (css::container::ElementExistException &) {
cont->replaceByName(
- name + "/service", css::uno::Any(i->second[0]->info->name));
+ name + "/service", css::uno::Any(rImpls[0]->info->name));
}
try {
cont->insertByName(name, css::uno::Any());
} catch (css::container::ElementExistException &) {
- SAL_INFO("cppuhelper", "Overwriting singleton " << i->first);
+ SAL_INFO("cppuhelper", "Overwriting singleton " << rName);
cont->replaceByName(name, css::uno::Any());
}
}
@@ -1669,15 +1622,14 @@ void cppuhelper::ServiceManager::removeRdbFiles(
std::vector< std::shared_ptr< Data::Implementation > > clear;
{
osl::MutexGuard g(rBHelper.rMutex);
- for (std::vector< OUString >::const_iterator i(uris.begin());
- i != uris.end(); ++i)
+ for (const auto& rUri : uris)
{
for (Data::NamedImplementations::iterator j(
data_.namedImplementations.begin());
j != data_.namedImplementations.end();)
{
assert(j->second.get() != nullptr);
- if (j->second->info->rdbFile == *i) {
+ if (j->second->info->rdbFile == rUri) {
clear.push_back(j->second);
//TODO: The below leaves data_ in an inconsistent state upon
// exceptions:
@@ -1754,15 +1706,10 @@ void cppuhelper::ServiceManager::removeImplementation(const OUString & name) {
&data_.services, i->second->info->services, i->second);
removeFromImplementationMap(
&data_.singletons, i->second->info->singletons, i->second);
- for (Data::DynamicImplementations::iterator j(
- data_.dynamicImplementations.begin());
- j != data_.dynamicImplementations.end(); ++j)
- {
- if (j->second == i->second) {
- data_.dynamicImplementations.erase(j);
- break;
- }
- }
+ auto j = std::find_if(data_.dynamicImplementations.begin(), data_.dynamicImplementations.end(),
+ [&i](const Data::DynamicImplementations::value_type& rEntry) { return rEntry.second == i->second; });
+ if (j != data_.dynamicImplementations.end())
+ data_.dynamicImplementations.erase(j);
data_.namedImplementations.erase(i);
}
}
@@ -1844,13 +1791,11 @@ void cppuhelper::ServiceManager::preloadImplementations() {
std::vector<OUString> aReported;
// loop all implementations
- for (Data::NamedImplementations::const_iterator iterator(
- data_.namedImplementations.begin());
- iterator != data_.namedImplementations.end(); ++iterator)
+ for (const auto& rEntry : data_.namedImplementations)
{
try
{
- const OUString &aLibrary = iterator->second->info->uri;
+ const OUString &aLibrary = rEntry.second->info->uri;
if (aLibrary.isEmpty())
continue;
@@ -1868,12 +1813,12 @@ void cppuhelper::ServiceManager::preloadImplementations() {
catch (css::lang::IllegalArgumentException& aError)
{
throw css::uno::DeploymentException(
- "Cannot expand URI" + iterator->second->info->uri + ": " + aError.Message,
+ "Cannot expand URI" + rEntry.second->info->uri + ": " + aError.Message,
static_cast< cppu::OWeakObject * >(this));
}
- if (iterator->second->info->loader == "com.sun.star.loader.SharedLibrary" &&
- iterator->second->status != Data::Implementation::STATUS_LOADED)
+ if (rEntry.second->info->loader == "com.sun.star.loader.SharedLibrary" &&
+ rEntry.second->status != Data::Implementation::STATUS_LOADED)
{
// load component library
osl::Module aModule(aUri, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL);
@@ -1885,20 +1830,20 @@ void cppuhelper::ServiceManager::preloadImplementations() {
}
if (aModule.is() &&
- !iterator->second->info->environment.isEmpty())
+ !rEntry.second->info->environment.isEmpty())
{
OUString aSymFactory;
oslGenericFunction fpFactory;
css::uno::Environment aTargetEnv;
css::uno::Reference<css::uno::XInterface> xFactory;
- if(iterator->second->info->constructor.isEmpty())
+ if(rEntry.second->info->constructor.isEmpty())
{
// expand full name component factory symbol
- if (iterator->second->info->prefix == "direct")
- aSymFactory = iterator->second->info->name.replace('.', '_') + "_" COMPONENT_GETFACTORY;
- else if (!iterator->second->info->prefix.isEmpty())
- aSymFactory = iterator->second->info->prefix + "_" COMPONENT_GETFACTORY;
+ if (rEntry.second->info->prefix == "direct")
+ aSymFactory = rEntry.second->info->name.replace('.', '_') + "_" COMPONENT_GETFACTORY;
+ else if (!rEntry.second->info->prefix.isEmpty())
+ aSymFactory = rEntry.second->info->prefix + "_" COMPONENT_GETFACTORY;
else
aSymFactory = COMPONENT_GETFACTORY;
@@ -1911,13 +1856,13 @@ void cppuhelper::ServiceManager::preloadImplementations() {
css::uno::Reference<css::uno::XInterface>());
}
- aTargetEnv = cppuhelper::detail::getEnvironment(iterator->second->info->environment, iterator->second->info->name);
+ aTargetEnv = cppuhelper::detail::getEnvironment(rEntry.second->info->environment, rEntry.second->info->name);
component_getFactoryFunc fpComponentFactory = reinterpret_cast<component_getFactoryFunc>(fpFactory);
if (aSourceEnv.get() == aTargetEnv.get())
{
// invoke function component factory
- OString aImpl(OUStringToOString(iterator->second->info->name, RTL_TEXTENCODING_ASCII_US));
+ OString aImpl(OUStringToOString(rEntry.second->info->name, RTL_TEXTENCODING_ASCII_US));
xFactory.set(css::uno::Reference<css::uno::XInterface>(static_cast<css::uno::XInterface *>(
(*fpComponentFactory)(aImpl.getStr(), this, nullptr)), SAL_NO_ACQUIRE));
}
@@ -1925,10 +1870,10 @@ void cppuhelper::ServiceManager::preloadImplementations() {
else
{
// get function symbol component factory
- aTargetEnv = cppuhelper::detail::getEnvironment(iterator->second->info->environment, iterator->second->info->name);
+ aTargetEnv = cppuhelper::detail::getEnvironment(rEntry.second->info->environment, rEntry.second->info->name);
if (aSourceEnv.get() == aTargetEnv.get())
{
- fpFactory = aModule.getFunctionSymbol(iterator->second->info->constructor);
+ fpFactory = aModule.getFunctionSymbol(rEntry.second->info->constructor);
}
else
{
@@ -1949,19 +1894,19 @@ void cppuhelper::ServiceManager::preloadImplementations() {
if (!xSSFactory.is())
{
throw css::uno::DeploymentException(
- ("Implementation " + iterator->second->info->name
+ ("Implementation " + rEntry.second->info->name
+ " does not provide a constructor or factory"),
static_cast< cppu::OWeakObject * >(this));
}
}
}
- if (!iterator->second->info->constructor.isEmpty() && fpFactory)
- iterator->second->constructor = WrapperConstructorFn(reinterpret_cast<ImplementationConstructorFn *>(fpFactory));
+ if (!rEntry.second->info->constructor.isEmpty() && fpFactory)
+ rEntry.second->constructor = WrapperConstructorFn(reinterpret_cast<ImplementationConstructorFn *>(fpFactory));
- iterator->second->factory1 = xSCFactory;
- iterator->second->factory2 = xSSFactory;
- iterator->second->status = Data::Implementation::STATUS_LOADED;
+ rEntry.second->factory1 = xSCFactory;
+ rEntry.second->factory2 = xSSFactory;
+ rEntry.second->status = Data::Implementation::STATUS_LOADED;
}
diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx
index 9faf4d0b2de0..3d4f474f89f0 100644
--- a/cppuhelper/source/typemanager.cxx
+++ b/cppuhelper/source/typemanager.cxx
@@ -494,14 +494,10 @@ InstantiatedPolymorphicStructTypeDescription::getMemberTypes()
for (sal_Int32 i = 0; i != n; ++i) {
OUString type(entity_->getMembers()[i].type);
if (entity_->getMembers()[i].parameterized) {
- for (std::vector< OUString >::const_iterator j(
- entity_->getTypeParameters().begin());
- j != entity_->getTypeParameters().end(); ++j)
- {
- if (*j == type) {
- type = arguments_[j - entity_->getTypeParameters().begin()];
- goto found;
- }
+ auto j = std::find(entity_->getTypeParameters().begin(), entity_->getTypeParameters().end(), type);
+ if (j != entity_->getTypeParameters().end()) {
+ type = arguments_[j - entity_->getTypeParameters().begin()];
+ goto found;
}
assert(false); // this cannot happen //TODO!
found:;
@@ -2247,14 +2243,10 @@ css::uno::Any cppuhelper::TypeManager::getEnumMember(
rtl::Reference< unoidl::EnumTypeEntity > const & entity,
OUString const & member)
{
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
- {
- if (i->name == member) {
- return css::uno::makeAny(i->value);
- }
- }
+ auto i = std::find_if(entity->getMembers().begin(), entity->getMembers().end(),
+ [&member](const unoidl::EnumTypeEntity::Member& rMember) { return rMember.name == member; });
+ if (i != entity->getMembers().end())
+ return css::uno::makeAny(i->value);
return css::uno::Any();
}
@@ -2263,16 +2255,12 @@ css::uno::Any cppuhelper::TypeManager::getConstant(
rtl::Reference< unoidl::ConstantGroupEntity > const & entity,
OUString const & member)
{
- for (std::vector< unoidl::ConstantGroupEntity::Member >::const_iterator i(
- entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
- {
- if (i->name == member) {
- return css::uno::makeAny<
- css::uno::Reference< css::reflection::XTypeDescription > >(
- new ConstantDescription(constantGroupName, *i));
- }
- }
+ auto i = std::find_if(entity->getMembers().begin(), entity->getMembers().end(),
+ [&member](const unoidl::ConstantGroupEntity::Member& rMember) { return rMember.name == member; });
+ if (i != entity->getMembers().end())
+ return css::uno::makeAny<
+ css::uno::Reference< css::reflection::XTypeDescription > >(
+ new ConstantDescription(constantGroupName, *i));
return css::uno::Any();
}
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index 57f22880adfc..cfb455f54488 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -183,14 +183,14 @@ void SAL_CALL OWeakConnectionPoint::removeReference(const Reference< XReference
// Search from end because the thing that last added a ref is most likely to be the
// first to remove a ref.
// It's not really valid to compare the pointer directly, but it's faster.
- for (auto it = m_aReferences.rbegin(); it != m_aReferences.rend(); ++it) {
- if (it->get() == rRef.get()) {
- m_aReferences.erase( it.base()-1 );
- return;
- }
+ auto it = std::find_if(m_aReferences.rbegin(), m_aReferences.rend(),
+ [&rRef](const Reference<XReference>& rxRef) { return rxRef.get() == rRef.get(); });
+ if (it != m_aReferences.rend()) {
+ m_aReferences.erase( it.base()-1 );
+ return;
}
// interface not found, use the correct compare method
- auto it = std::find(m_aReferences.rbegin(), m_aReferences.rend(), rRef);
+ it = std::find(m_aReferences.rbegin(), m_aReferences.rend(), rRef);
if ( it != m_aReferences.rend() )
m_aReferences.erase( it.base()-1 );
}