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 /framework/source/uiconfiguration | |
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 'framework/source/uiconfiguration')
7 files changed, 23 insertions, 24 deletions
diff --git a/framework/source/uiconfiguration/graphicnameaccess.cxx b/framework/source/uiconfiguration/graphicnameaccess.cxx index 029d34d05cd3..bdd4c1f2445c 100644 --- a/framework/source/uiconfiguration/graphicnameaccess.cxx +++ b/framework/source/uiconfiguration/graphicnameaccess.cxx @@ -36,7 +36,7 @@ GraphicNameAccess::~GraphicNameAccess() void GraphicNameAccess::addElement( const OUString& rName, const uno::Reference< graphic::XGraphic >& rElement ) { - m_aNameToElementMap.insert( NameGraphicHashMap::value_type( rName, rElement )); + m_aNameToElementMap.emplace( rName, rElement ); } // XNameAccess diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index fccf5977c8d0..030377316e31 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -670,12 +670,12 @@ Sequence< OUString > ImageManagerImpl::getAllImageNames( ::sal_Int16 nImageType const std::vector< OUString >& rGlobalImageNameVector = rGlobalImageList->getImageCommandNames(); const sal_uInt32 nGlobalCount = rGlobalImageNameVector.size(); for ( i = 0; i < nGlobalCount; i++ ) - aImageCmdNameMap.insert( ImageNameMap::value_type( rGlobalImageNameVector[i], true )); + aImageCmdNameMap.emplace( rGlobalImageNameVector[i], true ); const std::vector< OUString >& rModuleImageNameVector = implts_getDefaultImageList()->getImageCommandNames(); const sal_uInt32 nModuleCount = rModuleImageNameVector.size(); for ( i = 0; i < nModuleCount; i++ ) - aImageCmdNameMap.insert( ImageNameMap::value_type( rModuleImageNameVector[i], true )); + aImageCmdNameMap.emplace( rModuleImageNameVector[i], true ); } ImageList* pImageList = implts_getUserImageList(nIndex); @@ -683,7 +683,7 @@ Sequence< OUString > ImageManagerImpl::getAllImageNames( ::sal_Int16 nImageType pImageList->GetImageNames( rUserImageNames ); const sal_uInt32 nUserCount = rUserImageNames.size(); for ( i = 0; i < nUserCount; i++ ) - aImageCmdNameMap.insert( ImageNameMap::value_type( rUserImageNames[i], true )); + aImageCmdNameMap.emplace( rUserImageNames[i], true ); return comphelper::mapKeysToSequence( aImageCmdNameMap ); } @@ -986,7 +986,7 @@ void ImageManagerImpl::reload() sal_uInt32 j( 0 ); const sal_uInt32 nOldCount = aOldUserCmdImageVector.size(); for ( j = 0; j < nOldCount; j++ ) - aOldUserCmdImageSet.insert( CommandMap::value_type( aOldUserCmdImageVector[j], false )); + aOldUserCmdImageSet.emplace( aOldUserCmdImageVector[j], false ); // Attention: This can make the old image list pointer invalid! implts_loadUserImages( i, m_xUserImageStorage, m_xUserBitmapsStorage ); diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index b4d1a0e6fffd..14c3d0905d1e 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -107,7 +107,7 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons const Sequence< OUString > aNameSeq = xNameAccess->getElementNames(); const OUString* pNameSeq = aNameSeq.getConstArray(); for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ ) - m_aModuleToModuleUICfgMgrMap.insert( ModuleToModuleCfgMgr::value_type( pNameSeq[n], Reference< XModuleUIConfigurationManager2 >() )); + m_aModuleToModuleUICfgMgrMap.emplace( pNameSeq[n], Reference< XModuleUIConfigurationManager2 >() ); } catch(...) { diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 8b1e0bdc9a94..19f6ce0af138 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -302,14 +302,14 @@ void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIEleme } UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName ); - aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo )); + aUIElementInfoCollection.emplace( pUserIter->second.aResourceURL, aInfo ); } } else { // The user interface name for standard user interface elements is stored in the WindowState.xcu file UIElementInfo aInfo( pUserIter->second.aResourceURL, OUString() ); - aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo )); + aUIElementInfoCollection.emplace( pUserIter->second.aResourceURL, aInfo ); } ++pUserIter; } @@ -340,14 +340,14 @@ void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIEleme } UIElementInfo aInfo( pDefIter->second.aResourceURL, aUIName ); - aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo )); + aUIElementInfoCollection.emplace( pDefIter->second.aResourceURL, aInfo ); } } else { // The user interface name for standard user interface elements is stored in the WindowState.xcu file UIElementInfo aInfo( pDefIter->second.aResourceURL, OUString() ); - aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo )); + aUIElementInfoCollection.emplace( pDefIter->second.aResourceURL, aInfo ); } } @@ -398,7 +398,7 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, // Create std::unordered_map entries for all user interface elements inside the storage. We don't load the // settings to speed up the process. - rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData )); + rHashMap.emplace( aUIElementData.aResourceURL, aUIElementData ); } } rElementTypeData.bLoaded = true; @@ -1265,7 +1265,7 @@ void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const OUString& Res if ( pIter != rElements.end() ) pIter->second = aUIElementData; else - rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData )); + rElements.emplace( ResourceURL, aUIElementData ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); Reference< XInterface > xIfac( xThis, UNO_QUERY ); @@ -1406,7 +1406,7 @@ void SAL_CALL ModuleUIConfigurationManager::insertSettings( const OUString& NewR rElementType.bModified = true; UIElementDataHashMap& rElements = rElementType.aElementsHashMap; - rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, aUIElementData )); + rElements.emplace( NewResourceURL, aUIElementData ); Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx index 119d5282a373..50ea375c93bd 100644 --- a/framework/source/uiconfiguration/uicategorydescription.cxx +++ b/framework/source/uiconfiguration/uicategorydescription.cxx @@ -188,7 +188,7 @@ void ConfigurationAccess_UICategory::fillCache() { xNameAccess->getByName( m_aPropUIName ) >>= aUIName; - m_aIdCache.insert( IdToInfoCache::value_type( aNameSeq[i], aUIName )); + m_aIdCache.emplace( aNameSeq[i], aUIName ); } } catch ( const css::lang::WrappedTargetException& ) @@ -379,8 +379,7 @@ UICategoryDescription::UICategoryDescription( const Reference< XComponentContext m_xGenericUICommands = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, rxContext ); // insert generic categories mappings - m_aModuleToCommandFileMap.insert( ModuleToCommandFileMap::value_type( - OUString("generic"), aGenericCategories )); + m_aModuleToCommandFileMap.emplace( OUString("generic"), aGenericCategories ); UICommandsHashMap::iterator pCatIter = m_aUICommandsHashMap.find( aGenericCategories ); if ( pCatIter != m_aUICommandsHashMap.end() ) diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 945d0cee0f26..c8b5f574055c 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -271,7 +271,7 @@ void UIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfo } UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName ); - aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo )); + aUIElementInfoCollection.emplace( pUserIter->second.aResourceURL, aInfo ); } ++pUserIter; } @@ -315,7 +315,7 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy // Create unordered_map entries for all user interface elements inside the storage. We don't load the // settings to speed up the process. - rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData )); + rHashMap.emplace( aUIElementData.aResourceURL, aUIElementData ); } } } @@ -1107,7 +1107,7 @@ void SAL_CALL UIConfigurationManager::insertSettings( const OUString& NewResourc pDataSettings->aResourceURL = NewResourceURL; UIElementDataHashMap& rElements = rElementType.aElementsHashMap; - rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, *pDataSettings )); + rElements.emplace( NewResourceURL, *pDataSettings ); } Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index 3870b0c0cb28..036a12f40ce2 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -381,7 +381,7 @@ void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rRe { WindowStateInfo aWinStateInfo; impl_fillStructFromSequence( aWinStateInfo, aPropSet ); - m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWinStateInfo )); + m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo ); // insert must be write-through => insert element into configuration Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY ); @@ -765,7 +765,7 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU } aWindowStateInfo.nMask = nMask; - m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWindowStateInfo )); + m_aResourceURLToInfoCache.emplace( rResourceURL, aWindowStateInfo ); return makeAny( comphelper::containerToSequence(aPropVec) ); } @@ -940,7 +940,7 @@ ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowStat } aWindowStateInfo.nMask = nMask; - ResourceURLToInfoCache::iterator pIter = (m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWindowStateInfo ))).first; + ResourceURLToInfoCache::iterator pIter = (m_aResourceURLToInfoCache.emplace( rResourceURL, aWindowStateInfo )).first; return pIter->second; } @@ -1324,12 +1324,12 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentC if ( !aWindowStateFileStr.isEmpty() ) { // Create first mapping ModuleIdentifier ==> Window state configuration file - m_aModuleToFileHashMap.insert( ModuleToWindowStateFileMap::value_type( aModuleIdentifier, aWindowStateFileStr )); + m_aModuleToFileHashMap.emplace( aModuleIdentifier, aWindowStateFileStr ); // Create second mapping Command File ==> Window state configuration instance ModuleToWindowStateConfigHashMap::iterator pIter = m_aModuleToWindowStateHashMap.find( aWindowStateFileStr ); if ( pIter == m_aModuleToWindowStateHashMap.end() ) - m_aModuleToWindowStateHashMap.insert( ModuleToWindowStateConfigHashMap::value_type( aWindowStateFileStr, xEmptyNameAccess )); + m_aModuleToWindowStateHashMap.emplace( aWindowStateFileStr, xEmptyNameAccess ); } } } |