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 /connectivity | |
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 'connectivity')
-rw-r--r-- | connectivity/source/commontools/DriversConfig.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/commontools/TSkipDeletedSet.cxx | 16 | ||||
-rw-r--r-- | connectivity/source/commontools/TTableHelper.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/parameters.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/cpool/ZConnectionPool.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/cpool/ZPoolCollection.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/ado/AConnection.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/manager/mdrivermanager.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/parse/PColumn.cxx | 2 |
12 files changed, 26 insertions, 26 deletions
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index 2da9b4dc4953..a6b78b0d0330 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -115,7 +115,7 @@ const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Refer if ( !aInstalledDriver.sDriverFactory.isEmpty() && ( aMiscOptions.IsExperimentalMode() || aInstalledDriver.sDriverFactory != "com.sun.star.comp.sdbc.firebird.Driver" )) - m_aDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver)); + m_aDrivers.emplace(*pPatternIter,aInstalledDriver); } } // if ( m_aInstalled.isValid() ) } diff --git a/connectivity/source/commontools/TSkipDeletedSet.cxx b/connectivity/source/commontools/TSkipDeletedSet.cxx index 5778e219d121..d2317c838bff 100644 --- a/connectivity/source/commontools/TSkipDeletedSet.cxx +++ b/connectivity/source/commontools/TSkipDeletedSet.cxx @@ -75,7 +75,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s { bDataFound = m_pHelper->move(IResultSetHelper::FIRST, 0, _bRetrieveData); if(bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted())) - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); } else @@ -95,7 +95,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s if( bDataFound && ( m_bDeletedVisible || !m_pHelper->isRowDeleted()) ) { // we weren't on the last row we remember it and move on m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); } else if(!bDataFound && !m_aBookmarksPositions.empty() ) { @@ -121,7 +121,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s bDone = (--nDelOffset) == 0; if ( !bDone ) m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); } else bDone = false; @@ -137,7 +137,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s bDone = (--nDelOffset) == 0; if ( !bDone ) m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); } else bDone = false; @@ -155,7 +155,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s m_aBookmarksPositions.push_back(nDriverPos); /*sal_Int32 nDriverPos = m_pHelper->getDriverPos(); if(m_aBookmarks.find(nDriverPos) == m_aBookmarks.end()) - m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(nDriverPos,m_aBookmarksPositions.size()+1)).first);*/ + m_aBookmarksPositions.push_back(m_aBookmarks.emplace( nDriverPos,m_aBookmarksPositions.size()+1)).first);*/ } return bDataFound; @@ -179,7 +179,7 @@ bool OSkipDeletedSet::moveAbsolute(sal_Int32 _nPos,bool _bRetrieveData) { ++nCurPos; m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); --nNewPos; } } // if ( m_aBookmarksPositions.empty() ) @@ -199,7 +199,7 @@ bool OSkipDeletedSet::moveAbsolute(sal_Int32 _nPos,bool _bRetrieveData) { ++nCurPos; m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first); --nNewPos; } } @@ -244,7 +244,7 @@ sal_Int32 OSkipDeletedSet::getMappedPosition(sal_Int32 _nPos) const void OSkipDeletedSet::insertNewPosition(sal_Int32 _nPos) { //OSL_ENSURE(m_aBookmarks.find(_nPos) == m_aBookmarks.end(),"OSkipDeletedSet::insertNewPosition: Invalid position"); - //m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(_nPos,m_aBookmarksPositions.size()+1)).first); + //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( _nPos,m_aBookmarksPositions.size()+1)).first); //OSL_ENSURE(std::find(m_aBookmarksPositions.begin(),m_aBookmarksPositions.end(),_nPos) == m_aBookmarksPositions.end(),"Invalid driver pos"); m_aBookmarksPositions.push_back(_nPos); } diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index 928164308839..8569f225b132 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -349,7 +349,7 @@ void OTableHelper::refreshPrimaryKeys(TStringVector& _rNames) { SAL_WARN_IF(aPkName.isEmpty(),"connectivity.commontools", "empty Primary Key name"); SAL_WARN_IF(pKeyProps->m_aKeyColumnNames.size() == 0,"connectivity.commontools", "Primary Key has no columns"); - m_pImpl->m_aKeys.insert(TKeyMap::value_type(aPkName,pKeyProps)); + m_pImpl->m_aKeys.emplace(aPkName,pKeyProps); _rNames.push_back(aPkName); } } // if ( xResult.is() && xResult->next() ) @@ -392,7 +392,7 @@ void OTableHelper::refreshForeignKeys(TStringVector& _rNames) if ( sOldFKName != sFkName ) { if ( pKeyProps.get() ) - m_pImpl->m_aKeys.insert(TKeyMap::value_type(sOldFKName,pKeyProps)); + m_pImpl->m_aKeys.emplace(sOldFKName,pKeyProps); const OUString sReferencedName = ::dbtools::composeTableName(getMetaData(),sCatalog,aSchema,aName,false,::dbtools::EComposeRule::InDataManipulation); pKeyProps.reset(new sdbcx::KeyProperties(sReferencedName,KeyType::FOREIGN,nUpdateRule,nDeleteRule)); @@ -414,7 +414,7 @@ void OTableHelper::refreshForeignKeys(TStringVector& _rNames) } } // while( xResult->next() ) if ( pKeyProps.get() ) - m_pImpl->m_aKeys.insert(TKeyMap::value_type(sOldFKName,pKeyProps)); + m_pImpl->m_aKeys.emplace(sOldFKName,pKeyProps); ::comphelper::disposeComponent(xResult); } } @@ -586,7 +586,7 @@ std::shared_ptr<sdbcx::KeyProperties> OTableHelper::getKeyProperties(const OUStr void OTableHelper::addKey(const OUString& _sName,const std::shared_ptr<sdbcx::KeyProperties>& _aKeyProperties) { - m_pImpl->m_aKeys.insert(TKeyMap::value_type(_sName,_aKeyProperties)); + m_pImpl->m_aKeys.emplace(_sName,_aKeyProperties); } OUString OTableHelper::getTypeCreatePattern() const diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 7ee10d3f3323..be98ee4ea918 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -819,8 +819,8 @@ void collectColumnInformation(const Reference< XConnection>& _xConnection, OSL_ENSURE( nCount != 0, "::dbtools::collectColumnInformation: result set has empty (column-less) meta data!" ); for (sal_Int32 i=1; i <= nCount ; ++i) { - _rInfo.insert(ColumnInformationMap::value_type(xMeta->getColumnName(i), - ColumnInformation(TBoolPair(xMeta->isAutoIncrement(i),xMeta->isCurrency(i)),xMeta->getColumnType(i)))); + _rInfo.emplace( xMeta->getColumnName(i), + ColumnInformation(TBoolPair(xMeta->isAutoIncrement(i),xMeta->isCurrency(i)),xMeta->getColumnType(i))); } } catch( const Exception& ) diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx index 30311ba22aa4..e5513f078055 100644 --- a/connectivity/source/commontools/parameters.cxx +++ b/connectivity/source/commontools/parameters.cxx @@ -193,8 +193,8 @@ namespace dbtools if ( aExistentPos == m_aParameterInformation.end() ) { - aExistentPos = m_aParameterInformation.insert( ParameterInformation::value_type( - sName, xParam ) ).first; + aExistentPos = m_aParameterInformation.emplace( + sName, xParam ).first; } else aExistentPos->second.xComposerColumn = xParam; diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx index 346f102e8401..cfa16ca44e2a 100644 --- a/connectivity/source/cpool/ZConnectionPool.cxx +++ b/connectivity/source/cpool/ZConnectionPool.cxx @@ -215,9 +215,9 @@ Reference< XConnection> OConnectionPool::createNewConnection(const OUString& _rU // insert the new connection and struct into the active connection map aPack.nALiveCount = m_nALiveCount; TActiveConnectionInfo aActiveInfo; - aActiveInfo.aPos = m_aPool.insert(TConnectionMap::value_type(nId,aPack)).first; + aActiveInfo.aPos = m_aPool.emplace(nId,aPack).first; aActiveInfo.xPooledConnection = xPooledConnection; - m_aActiveConnections.insert(TActiveConnectionMap::value_type(xConnection,aActiveInfo)); + m_aActiveConnections.emplace(xConnection,aActiveInfo); if(m_xInvalidator->isExpired()) m_xInvalidator->start(); diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index 22ac35d02d9f..811be298bb07 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -305,7 +305,7 @@ OConnectionPool* OPoolCollection::getConnectionPool(const OUString& _sImplName, if(xProp.is()) xProp->addPropertyChangeListener(getEnableNodeName(),this); OConnectionPool* pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode,m_xProxyFactory); - aFind = m_aPools.insert(OConnectionPools::value_type(_sImplName,pConnectionPool)).first; + aFind = m_aPools.emplace(_sImplName,pConnectionPool).first; pRet = aFind->second.get(); } diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index b7c39c7e5550..aafb81d39368 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -461,7 +461,7 @@ void OConnection::buildTypeInfo() // in the Hashtable if we don't already have an // entry for this SQL type. - m_aTypeInfo.insert(OTypeInfoMap::value_type(aInfo->eType,aInfo)); + m_aTypeInfo.emplace(aInfo->eType,aInfo); } while ( SUCCEEDED(pRecordset->MoveNext()) ); } diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 96ea61692aa8..32425cf69d51 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1465,7 +1465,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, if ( aCase(sTableColumnName, sSelectColumnRealName) && !(*aRowIter)->isBound() && aSelectIters.end() == aSelectIters.find(aIter) ) { - aSelectIters.insert(IterMap::value_type(aIter,true)); + aSelectIters.emplace(aIter,true); if(_bSetColumnMapping) { sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1; @@ -1511,7 +1511,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, if ( xNameAccess->hasByName( sSelectColumnRealName ) ) { - aSelectIters.insert(IterMap::value_type(aIter,true)); + aSelectIters.emplace(aIter,true); sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1; const OUString* pBegin = aSelectColumns.getConstArray(); const OUString* pEnd = pBegin + aSelectColumns.getLength(); diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index 68a29c2e7c9b..f5d5b2cd83ba 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -238,7 +238,7 @@ namespace connectivity OUString sDriverClass(getJavaDriverClass(info)); TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass); if ( aFind == m_aJdbcDrivers.end() ) - aFind = m_aJdbcDrivers.insert(TJDBCDrivers::value_type(sDriverClass,lcl_loadDriver(m_xContext,sCuttedUrl))).first; + aFind = m_aJdbcDrivers.emplace(sDriverClass,lcl_loadDriver(m_xContext,sCuttedUrl)).first; xDriver = aFind->second; } diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 53216e2bd0cd..e32934774d8a 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -570,7 +570,7 @@ void SAL_CALL OSDBCDriverManager::registerObject( const OUString& _rName, const { Reference< XDriver > xNewDriver(_rxObject, UNO_QUERY); if (xNewDriver.is()) - m_aDriversRT.insert(DriverCollection::value_type(_rName, xNewDriver)); + m_aDriversRT.emplace(_rName, xNewDriver); else throw IllegalArgumentException(); } diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index 2a0ee738e5de..1a58935f5401 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -140,7 +140,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe } sLabel = sAlias; } - _rColumns.insert(StringMap::value_type(sLabel,0)); + _rColumns.emplace(sLabel,0); OParseColumn* pColumn = new OParseColumn( sLabel, _rxResMetaData->getColumnTypeName( _nColumnPos ), |