diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-10 16:43:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-11 12:38:32 +0200 |
commit | d347c2403605c5aa3ddd98fb605366914acab79f (patch) | |
tree | e39624030741234c514bccd858e69d6318dfba68 /extensions/source | |
parent | f0e68d4feaaa43f7450432ad1ebd92c2b572400f (diff) |
convert std::map::insert to std::map::emplace
which is considerably less verbose
Change-Id: Ifa373e8eb09e39bd6c8d3578641610a6055a187b
Reviewed-on: https://gerrit.libreoffice.org/40978
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/bibliography/framectr.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 5 | ||||
-rw-r--r-- | extensions/source/ole/unoobjw.cxx | 8 | ||||
-rw-r--r-- | extensions/source/propctrlr/eformshelper.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/eventhandler.cxx | 10 | ||||
-rw-r--r-- | extensions/source/propctrlr/genericpropertyhandler.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/propcontroller.cxx | 5 | ||||
-rw-r--r-- | extensions/source/propctrlr/propertyeditor.cxx | 2 |
8 files changed, 17 insertions, 19 deletions
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 35e825f567ee..885630c168b2 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -120,7 +120,7 @@ const CmdToInfoCache& GetCommandToInfoCache() CacheDispatchInfo aDispatchInfo; aDispatchInfo.nGroupId = SupportedCommandsArray[i].nGroupId; aDispatchInfo.bActiveConnection = SupportedCommandsArray[i].bActiveConnection; - aCmdToInfoCache.insert( CmdToInfoCache::value_type( aCommand, aDispatchInfo )); + aCmdToInfoCache.emplace(aCommand, aDispatchInfo); ++i; } bCacheInitialized = true; diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 414e707c9b15..14d63e450784 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -2394,7 +2394,7 @@ void IUnknownWrapper_Impl::buildComTlbIndex() if( SUCCEEDED(pType->GetNames( funcDesc->memid, & memberName, 1, &pcNames))) { OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName))); - m_mapComFunc.insert( TLBFuncIndexMap::value_type( usName, i)); + m_mapComFunc.emplace(usName, i); } else { @@ -2421,8 +2421,7 @@ void IUnknownWrapper_Impl::buildComTlbIndex() if (varDesc->varkind == VAR_DISPATCH) { OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName))); - m_mapComFunc.insert(TLBFuncIndexMap::value_type( - usName, i)); + m_mapComFunc.emplace(usName, i); } } else diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 816360853cca..d89d86192d75 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -252,11 +252,11 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, if (d.flags != 0) { m_MemberInfos.push_back(d); - iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(exactName, (DISPID)m_MemberInfos.size())).first; + iter = m_nameToDispIdMap.emplace(exactName, (DISPID)m_MemberInfos.size()).first; if (exactName != name) { - iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(name, (DISPID)m_MemberInfos.size())).first; + iter = m_nameToDispIdMap.emplace(name, (DISPID)m_MemberInfos.size()).first; } } } @@ -1263,12 +1263,12 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::GetIDsOfNames ( REFIID /*riid*/, OLECHA { // name has not been bad before( member exists typedef NameToIdMap::iterator ITnames; - pair< ITnames, bool > pair_id= m_nameToDispIdMap.insert( NameToIdMap::value_type(name, m_currentId++)); + pair< ITnames, bool > pair_id= m_nameToDispIdMap.emplace(name, m_currentId++); // new ID inserted ? if( pair_id.second ) {// yes, now create MemberInfo and ad to IdToMemberInfoMap MemberInfo d(0, name); - m_idToMemberInfoMap.insert( IdToMemberInfoMap::value_type( m_currentId - 1, d)); + m_idToMemberInfoMap.emplace(m_currentId - 1, d); } *rgdispid = pair_id.first->second; diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx index 54720f479054..b907eec8b249 100644 --- a/extensions/source/propctrlr/eformshelper.cxx +++ b/extensions/source/propctrlr/eformshelper.cxx @@ -690,7 +690,7 @@ namespace pcr OUString sUIName = composeModelElementUIName( *pModelName, sElementName ); OSL_ENSURE( rMapUINameToElement.find( sUIName ) == rMapUINameToElement.end(), "EFormsHelper::getAllElementUINames: duplicate name!" ); - rMapUINameToElement.insert( MapStringToPropertySet::value_type( sUIName, xElement ) ); + rMapUINameToElement.emplace( sUIName, xElement ); } } } diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 9b690dbd135c..fe01b84ba6aa 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -156,9 +156,9 @@ namespace pcr namespace { #define DESCRIBE_EVENT( asciinamespace, asciilistener, asciimethod, id_postfix ) \ - s_aKnownEvents.insert( EventMap::value_type( \ + s_aKnownEvents.emplace( \ asciimethod, \ - EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) ) + EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) bool lcl_getEventDescriptionForMethod( const OUString& _rMethodName, EventDescription& _out_rDescription ) { @@ -358,7 +358,7 @@ namespace pcr void EventHolder::addEvent( EventId _nId, const OUString& _rEventName, const ScriptEventDescriptor& _rScriptEvent ) { std::pair< EventMap::iterator, bool > insertionResult = - m_aEventNameAccess.insert( EventMap::value_type( _rEventName, _rScriptEvent ) ); + m_aEventNameAccess.emplace( _rEventName, _rScriptEvent ); OSL_ENSURE( insertionResult.second, "EventHolder::addEvent: there already was a MacroURL for this event!" ); m_aEventIndexAccess[ _nId ] = insertionResult.first; } @@ -730,8 +730,8 @@ namespace pcr if ( !impl_filterMethod_nothrow( aEvent ) ) continue; - m_aEvents.insert( EventMap::value_type( - lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ) ); + m_aEvents.emplace( + lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ); } } diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 0eb9a657b63f..859b7ae76eff 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -508,7 +508,7 @@ namespace pcr continue; } - m_aProperties.insert( PropertyMap::value_type( property.Name, property ) ); + m_aProperties.emplace( property.Name, property ); } } catch( const Exception& ) diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 4e7519a8701d..531c749941e4 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -1046,8 +1046,7 @@ namespace pcr StlSyntaxSequence< OUString > aInterestingActuations( (*aHandler)->getActuatingProperties() ); for (const auto & aInterestingActuation : aInterestingActuations) { - m_aDependencyHandlers.insert( PropertyHandlerMultiRepository::value_type( - aInterestingActuation, *aHandler ) ); + m_aDependencyHandlers.emplace( aInterestingActuation, *aHandler ); } ++aHandler; @@ -1065,7 +1064,7 @@ namespace pcr sal_Int32 nRelativePropertyOrder = sourceProps - aProperties.begin(); if ( m_xModel.is() ) nRelativePropertyOrder = m_xModel->getPropertyOrderIndex( sourceProps->Name ); - m_aProperties.insert(OrderedPropertyMap::value_type(nRelativePropertyOrder, *sourceProps)); + m_aProperties.emplace(nRelativePropertyOrder, *sourceProps); } // be notified when one of our inspectees dies diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx index 714e640cc0ec..02e69a623bf4 100644 --- a/extensions/source/propctrlr/propertyeditor.cxx +++ b/extensions/source/propctrlr/propertyeditor.cxx @@ -401,7 +401,7 @@ namespace pcr OSL_ENSURE( m_aPropertyPageIds.find( rData.sName ) == m_aPropertyPageIds.end(), "OPropertyEditor::InsertEntry: property already present in the map!" ); - m_aPropertyPageIds.insert( MapStringToPageId::value_type( rData.sName, _nPageId ) ); + m_aPropertyPageIds.emplace( rData.sName, _nPageId ); } |