diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2016-03-28 21:42:43 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2016-03-28 20:28:28 +0000 |
commit | a8ef64199b4bb03fb652b7dfbed7be126bd99059 (patch) | |
tree | af40d94aebb9fac561debaa13fce708332750c53 /connectivity/source/drivers | |
parent | 2b60e64c18e16391ab7e04d1ded1119b8b5428ac (diff) |
Use const_iterator when possible (connectivity)
Change-Id: I749e4c3ffa0c89f919459c376edad4804b2b66ca
Reviewed-on: https://gerrit.libreoffice.org/23573
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'connectivity/source/drivers')
25 files changed, 72 insertions, 72 deletions
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index 0fbc2da541c6..a968b28a7d5a 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -205,7 +205,7 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( co { OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) ); - for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + for (OWeakRefArray::const_iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) { if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == pSearchConnection) { diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 928e47175711..c27dd7b8969c 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2523,7 +2523,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos) sal_Int32 nCurPos; - OValueRefVector::Vector::iterator aIter; + OValueRefVector::Vector::const_iterator aIter; for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.db_anz;++nRowPos) { bool bOk = seekRow( IResultSetHelper::BOOKMARK, nRowPos+1, nCurPos ); diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index 59c6a8bb1e49..72e02c57ddab 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -195,7 +195,7 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection { OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) ); OConnection* pConnection = nullptr; - for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + for (OWeakRefArray::const_iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) { if (static_cast<OConnection*>( Reference< XConnection >::query(i->get().get()).get() ) == pSearchConnection) { diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index ed6fbc911af0..236e846c39c3 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.cxx @@ -93,7 +93,7 @@ OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow) OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_uInt32)nBookmarkValue); - ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin(); + ::std::vector<sal_Int32>::const_iterator aIter = m_aOrderbyColumnNumber.begin(); for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) { OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!"); diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 49ee0d31147b..523651bc0686 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1122,7 +1122,7 @@ void OResultSet::sortRows() } OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size()); - ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); + ::std::vector<sal_Int32>::const_iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i) { OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index"); @@ -1337,8 +1337,8 @@ bool OResultSet::OpenImpl() nKey = (m_pFileSet->get())[j-1]; ExecuteRow(IResultSetHelper::BOOKMARK,nKey,false); m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); - OValueRefVector::Vector::iterator loopInRow = m_aSelectRow->get().begin(); - OValueVector::Vector::iterator existentInSearchRow = aSearchRow->get().begin(); + OValueRefVector::Vector::const_iterator loopInRow = m_aSelectRow->get().begin(); + OValueVector::Vector::const_iterator existentInSearchRow = aSearchRow->get().begin(); for ( ++loopInRow,++existentInSearchRow; // the first column is the bookmark column loopInRow != m_aSelectRow->get().end(); ++loopInRow,++existentInSearchRow) @@ -1452,7 +1452,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, typedef ::std::map<OSQLColumns::Vector::iterator,sal_Bool> IterMap; IterMap aSelectIters; - OValueRefVector::Vector::iterator aRowIter = _rRow->get().begin()+1; + OValueRefVector::Vector::const_iterator aRowIter = _rRow->get().begin()+1; for (sal_Int32 i=0; // the first column is the bookmark column aRowIter != _rRow->get().end(); ++i, ++aRowIter @@ -1578,7 +1578,7 @@ void OResultSet::clearInsertRow() { m_aRow->setDeleted(false); // set to false here because this is the new row OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin(); - const OValueRefVector::Vector::iterator aEnd = m_aInsertRow->get().end(); + const OValueRefVector::Vector::const_iterator aEnd = m_aInsertRow->get().end(); for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos) { ORowSetValueDecoratorRef& rValue = (*aIter); diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index 151f70b8dc8b..7f37053879c7 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.cxx @@ -132,7 +132,7 @@ void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow) void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) { // first the select part - for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter) + for ( ::std::vector< TPredicates >::const_iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter) { if ( aIter->first.is() ) bindRow(aIter->first->m_aCodeList,_pRow); diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 071ff80be9af..f71502c3ec59 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -363,7 +363,7 @@ void ONthOperator::Exec(OCodeStack& rCodeStack) rCodeStack.push(new OOperandResult(operate(aValues))); ::std::vector<OOperand*>::iterator aIter = aOperands.begin(); - ::std::vector<OOperand*>::iterator aEnd = aOperands.end(); + ::std::vector<OOperand*>::const_iterator aEnd = aOperands.end(); for (; aIter != aEnd; ++aIter) { if (typeid(OOperandResult) != typeid(*(*aIter))) diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index fc4a2efb0ba4..2d2d1ebbe58c 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -456,7 +456,7 @@ namespace connectivity Reference< XTablesSupplier > xTab; - TWeakPairVector::iterator aEnd = m_aConnections.end(); + TWeakPairVector::const_iterator aEnd = m_aConnections.end(); for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i) { if ( i->second.second.first.get() == connection.get() ) @@ -594,7 +594,7 @@ namespace connectivity void ODriverDelegator::shutdownConnections() { m_bInShutDownConnections = true; - TWeakPairVector::iterator aEnd = m_aConnections.end(); + TWeakPairVector::const_iterator aEnd = m_aConnections.end(); for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i) { try @@ -612,7 +612,7 @@ namespace connectivity void ODriverDelegator::flushConnections() { - TWeakPairVector::iterator aEnd = m_aConnections.end(); + TWeakPairVector::const_iterator aEnd = m_aConnections.end(); for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i) { try @@ -636,7 +636,7 @@ namespace connectivity OUString sKey = StorageContainer::getRegisteredKey(xStorage); if ( !sKey.isEmpty() ) { - TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(), m_aConnections.end(), + TWeakPairVector::const_iterator i = ::std::find_if(m_aConnections.begin(), m_aConnections.end(), [&sKey] (const TWeakPairVector::value_type& conn) { return conn.second.first == sKey; }); diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index 334ff2b23970..c52805ee5a60 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -191,7 +191,7 @@ namespace connectivity OSL_ENSURE(_xStorage.is(),"Storage is NULL!"); TStorages& rMap = lcl_getStorageMap(); // check if the storage is already in our map - TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), + TStorages::const_iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), [&_xStorage] (const TStorages::value_type& storage) { return storage.second.mapStorage() == _xStorage; }); @@ -208,7 +208,7 @@ namespace connectivity { TStorages::mapped_type aRet; TStorages& rMap = lcl_getStorageMap(); - TStorages::iterator aFind = rMap.find(_sKey); + TStorages::const_iterator aFind = rMap.find(_sKey); OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!"); if ( aFind != rMap.end() ) aRet = aFind->second; @@ -222,7 +222,7 @@ namespace connectivity OSL_ENSURE(_xStorage.is(),"Storage is NULL!"); TStorages& rMap = lcl_getStorageMap(); // check if the storage is already in our map - TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), + TStorages::const_iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), [&_xStorage] (const TStorages::value_type& storage) { return storage.second.mapStorage() == _xStorage; }); @@ -342,11 +342,11 @@ namespace connectivity { TStreamMap::mapped_type pRet; TStorages& rMap = lcl_getStorageMap(); - TStorages::iterator aFind = rMap.find(jstring2ustring(env,key)); + TStorages::const_iterator aFind = rMap.find(jstring2ustring(env,key)); OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!"); if ( aFind != rMap.end() ) { - TStreamMap::iterator aStreamFind = aFind->second.streams.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.url)); + TStreamMap::const_iterator aStreamFind = aFind->second.streams.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.url)); if ( aStreamFind != aFind->second.streams.end() ) pRet = aStreamFind->second; } diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 20f78b333d40..2968278fb538 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -467,8 +467,8 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( ODatabaseMetaDataResultSet::ORow aRow(8); while ( xRow.is() && xTemp->next() ) { - ::std::map<sal_Int32,sal_Int32>::iterator aIter = aColumnMatching.begin(); - ::std::map<sal_Int32,sal_Int32>::iterator aEnd = aColumnMatching.end(); + ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = aColumnMatching.begin(); + ::std::map<sal_Int32,sal_Int32>::const_iterator aEnd = aColumnMatching.end(); for (;aIter != aEnd ; ++aIter) { sValue = xRow->getString(aIter->first); diff --git a/connectivity/source/drivers/kab/KDatabaseMetaData.cxx b/connectivity/source/drivers/kab/KDatabaseMetaData.cxx index 219e0d980d58..c87e7043f8f8 100644 --- a/connectivity/source/drivers/kab/KDatabaseMetaData.cxx +++ b/connectivity/source/drivers/kab/KDatabaseMetaData.cxx @@ -891,7 +891,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns( } ::KABC::Field::List aFields = ::KABC::Field::allFields(); - ::KABC::Field::List::iterator aField; + ::KABC::Field::List::const_iterator aField; for ( aField = aFields.begin(); aField != aFields.end(); diff --git a/connectivity/source/drivers/kab/kfields.cxx b/connectivity/source/drivers/kab/kfields.cxx index 55f5d4d8e220..d19f1caebcb2 100644 --- a/connectivity/source/drivers/kab/kfields.cxx +++ b/connectivity/source/drivers/kab/kfields.cxx @@ -58,7 +58,7 @@ sal_uInt32 findKabField(const OUString& columnName) throw(SQLException) return KAB_FIELD_REVISION; ::KABC::Field::List aFields = ::KABC::Field::allFields(); - ::KABC::Field::List::iterator aField; + ::KABC::Field::List::const_iterator aField; sal_uInt32 nResult; for ( aField = aFields.begin(), nResult = KAB_DATA_FIELDS; diff --git a/connectivity/source/drivers/mork/MColumnAlias.cxx b/connectivity/source/drivers/mork/MColumnAlias.cxx index 28c76a9ab65c..b171e4f04a2e 100644 --- a/connectivity/source/drivers/mork/MColumnAlias.cxx +++ b/connectivity/source/drivers/mork/MColumnAlias.cxx @@ -95,7 +95,7 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su OUStringToOString( aProgrammaticNames[i], RTL_TEXTENCODING_ASCII_US)); bool bFound = false; - for (AliasMap::iterator j(m_aAliasMap.begin()); j != m_aAliasMap.end(); + for (AliasMap::const_iterator j(m_aAliasMap.begin()); j != m_aAliasMap.end(); ++j) { if (j->second.programmaticAsciiName == sAsciiProgrammaticName) { diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx index d8c681d207c2..c034f1613520 100644 --- a/connectivity/source/drivers/mork/MConnection.cxx +++ b/connectivity/source/drivers/mork/MConnection.cxx @@ -151,7 +151,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& // check that we can retrieve the tables: MorkTableMap *Tables = m_pBook->getTables( defaultScope ); - MorkTableMap::Map::iterator tableIter; + MorkTableMap::Map::const_iterator tableIter; if (Tables) { // Iterate all tables diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx index e5d34d73ed42..38f79c8c289c 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx @@ -53,7 +53,7 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, std::set<std::string> lists; MorkParser* pMork = _pCon->getMorkParser("AddressBook"); pMork->retrieveLists(lists); - for (::std::set<std::string>::iterator iter = lists.begin(); iter != lists.end(); ++iter) { + for (::std::set<std::string>::const_iterator iter = lists.begin(); iter != lists.end(); ++iter) { OUString groupTableName = OStringToOUString((*iter).c_str(), RTL_TEXTENCODING_UTF8); SAL_INFO("connectivity.mork", "add Table " << groupTableName); @@ -65,7 +65,7 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, std::set<std::string> lists_history; pMork = _pCon->getMorkParser("CollectedAddressBook"); pMork->retrieveLists(lists_history); - for (::std::set<std::string>::iterator iter = lists_history.begin(); iter != lists_history.end(); ++iter) { + for (::std::set<std::string>::const_iterator iter = lists_history.begin(); iter != lists_history.end(); ++iter) { OUString groupTableName = OStringToOUString((*iter).c_str(), RTL_TEXTENCODING_UTF8); SAL_INFO("connectivity.mork", "add Table " << groupTableName); diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx index 98f69da2e889..65c8fbba3a7f 100644 --- a/connectivity/source/drivers/mork/MQueryHelper.cxx +++ b/connectivity/source/drivers/mork/MQueryHelper.cxx @@ -214,7 +214,7 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression if (!Tables) return -1; MorkRowMap *Rows = nullptr; - MorkRowMap::Map::iterator rowIter; + MorkRowMap::Map::const_iterator rowIter; // Iterate all tables for ( tableIter = Tables->map.begin(); tableIter != Tables->map.end(); ++tableIter ) @@ -240,7 +240,7 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression } MQueryHelperResultEntry* entry = new MQueryHelperResultEntry(); - for (MorkCells::iterator CellsIter = rowIter->second.begin(); + for (MorkCells::const_iterator CellsIter = rowIter->second.begin(); CellsIter != rowIter->second.end(); ++CellsIter ) { std::string column = xMork->getColumn(CellsIter->first); @@ -252,7 +252,7 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression } ::std::vector<bool> vector = entryMatchedByExpression(this, &expr, entry); bool result = true; - for (::std::vector<bool>::iterator iter = vector.begin(); iter != vector.end(); ++iter) + for (::std::vector<bool>::const_iterator iter = vector.begin(); iter != vector.end(); ++iter) { result = result && *iter; } @@ -337,13 +337,13 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression MQueryExpression::bool_cond condition = queryExpression->getExpressionCondition(); if (condition == MQueryExpression::OR) { bool result = false; - for (::std::vector<bool>::iterator iter = subquery_result.begin(); iter != subquery_result.end(); ++iter) { + for (::std::vector<bool>::const_iterator iter = subquery_result.begin(); iter != subquery_result.end(); ++iter) { result = result || *iter; } resultVector.push_back(result); } else if (condition == MQueryExpression::AND) { bool result = true; - for (::std::vector<bool>::iterator iter = subquery_result.begin(); iter != subquery_result.end(); ++iter) { + for (::std::vector<bool>::const_iterator iter = subquery_result.begin(); iter != subquery_result.end(); ++iter) { result = result && *iter; } resultVector.push_back(result); diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx index a05037d65e0d..96ae5e0cfafc 100644 --- a/connectivity/source/drivers/mork/MResultSet.cxx +++ b/connectivity/source/drivers/mork/MResultSet.cxx @@ -741,7 +741,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT if(xColumns.is()) { OUString aColName, aParameterValue; - OSQLColumns::Vector::iterator aIter = xColumns->get().begin(); + OSQLColumns::Vector::const_iterator aIter = xColumns->get().begin(); sal_Int32 i = 1; for(;aIter != xColumns->get().end();++aIter) { @@ -1080,8 +1080,8 @@ void OResultSet::fillRowData() static bool matchRow( OValueRow& row1, OValueRow& row2 ) { - OValueVector::Vector::iterator row1Iter = row1->get().begin(); - OValueVector::Vector::iterator row2Iter = row2->get().begin(); + OValueVector::Vector::const_iterator row1Iter = row1->get().begin(); + OValueVector::Vector::const_iterator row2Iter = row2->get().begin(); for ( ++row1Iter,++row2Iter; // the first column is the bookmark column row1Iter != row1->get().end(); ++row1Iter,++row2Iter) { @@ -1168,7 +1168,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep } OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size()); - ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); + ::std::vector<sal_Int32>::const_iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); for ( ::std::vector<sal_Int16>::size_type i = 0; aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i) { OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index"); @@ -1227,7 +1227,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow)); - ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin(); + ::std::vector<sal_Int32>::const_iterator aIter = m_aOrderbyColumnNumber.begin(); for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) { const ORowSetValue& value = getValue(nRow, *aIter); @@ -1332,7 +1332,7 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, // look if we have such a select column // TODO: would like to have a O(log n) search here ... sal_Int32 nColumnPos = 0; - for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin(); + for ( OSQLColumns::Vector::const_iterator aIter = _rxColumns->get().begin(); aIter != _rxColumns->get().end(); ++aIter,++nColumnPos ) diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx index 5c6c33e32437..18ae66d34ed4 100644 --- a/connectivity/source/drivers/mork/MorkParser.cxx +++ b/connectivity/source/drivers/mork/MorkParser.cxx @@ -618,7 +618,7 @@ void MorkParser::retrieveLists(std::set<std::string>& lists) #endif MorkRowMap* rows = getRows( defaultListScope_, &TableIter->second ); if (!rows) return; - for ( MorkRowMap::Map::iterator RowIter = rows->map.begin(); + for ( MorkRowMap::Map::const_iterator RowIter = rows->map.begin(); RowIter != rows->map.end(); ++RowIter ) { #ifdef VERBOSE @@ -628,7 +628,7 @@ void MorkParser::retrieveLists(std::set<std::string>& lists) std::cout << "\t\t\t\t Cells:\r\n"; #endif // Get cells - for ( MorkCells::iterator cellsIter = RowIter->second.begin(); + for ( MorkCells::const_iterator cellsIter = RowIter->second.begin(); cellsIter != RowIter->second.end(); ++cellsIter ) { if (cellsIter->first == 0xC1) @@ -660,7 +660,7 @@ void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>& #endif MorkRowMap* rows = getRows( 0x81, &TableIter->second ); if (!rows) return; - for ( MorkRowMap::Map::iterator RowIter = rows->map.begin(); + for ( MorkRowMap::Map::const_iterator RowIter = rows->map.begin(); RowIter != rows->map.end(); ++RowIter ) { #ifdef VERBOSE @@ -671,7 +671,7 @@ void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>& #endif // Get cells bool isListFound = false; - for ( MorkCells::iterator cellsIter = RowIter->second.begin(); + for ( MorkCells::const_iterator cellsIter = RowIter->second.begin(); cellsIter != RowIter->second.end(); ++cellsIter ) { if (isListFound) @@ -703,7 +703,7 @@ void MorkParser::dump() std::cout << "=============================================\r\n\r\n"; //// columns dict - for ( MorkDict::iterator iter = columns_.begin(); + for ( MorkDict::const_iterator iter = columns_.begin(); iter != columns_.end(); ++iter ) { std::cout << iter->first @@ -716,7 +716,7 @@ void MorkParser::dump() std::cout << "\r\nValues Dict:\r\n"; std::cout << "=============================================\r\n\r\n"; - for ( MorkDict::iterator iter = values_.begin(); + for ( MorkDict::const_iterator iter = values_.begin(); iter != values_.end(); ++iter ) { if (iter->first >= nextAddValueId_) { @@ -734,25 +734,25 @@ void MorkParser::dump() << std::endl << std::endl; //// Mork data - for ( TableScopeMap::Map::iterator iter = mork_.map.begin(); + for ( TableScopeMap::Map::const_iterator iter = mork_.map.begin(); iter != mork_.map.end(); ++iter ) { std::cout << "\r\n Scope:" << iter->first << std::endl; - for ( MorkTableMap::Map::iterator TableIter = iter->second.map.begin(); + for ( MorkTableMap::Map::const_iterator TableIter = iter->second.map.begin(); TableIter != iter->second.map.end(); ++TableIter ) { std::cout << "\t Table:" << ( ( int ) TableIter->first < 0 ? "-" : " " ) << TableIter->first << std::endl; - for (RowScopeMap::Map::iterator RowScopeIter = TableIter->second.map.begin(); + for (RowScopeMap::Map::const_iterator RowScopeIter = TableIter->second.map.begin(); RowScopeIter != TableIter->second.map.end(); ++RowScopeIter ) { std::cout << "\t\t RowScope:" << RowScopeIter->first << std::endl; - for (MorkRowMap::Map::iterator RowIter = RowScopeIter->second.map.begin(); + for (MorkRowMap::Map::const_iterator RowIter = RowScopeIter->second.map.begin(); RowIter != RowScopeIter->second.map.end(); ++RowIter ) { std::cout << "\t\t\t Row Id:" @@ -760,7 +760,7 @@ void MorkParser::dump() << RowIter->first << std::endl; std::cout << "\t\t\t\t Cells:" << std::endl; - for (MorkCells::iterator CellsIter = RowIter->second.begin(); + for (MorkCells::const_iterator CellsIter = RowIter->second.begin(); CellsIter != RowIter->second.end(); ++CellsIter ) { // Write ids @@ -770,7 +770,7 @@ void MorkParser::dump() << CellsIter->second << " => "; - MorkDict::iterator FoundIter = values_.find( CellsIter->second ); + MorkDict::const_iterator FoundIter = values_.find( CellsIter->second ); if ( FoundIter != values_.end() ) { // Write string values diff --git a/connectivity/source/drivers/mork/mork_helper.cxx b/connectivity/source/drivers/mork/mork_helper.cxx index d2779cf4c5b5..7ef3a5f76007 100644 --- a/connectivity/source/drivers/mork/mork_helper.cxx +++ b/connectivity/source/drivers/mork/mork_helper.cxx @@ -12,7 +12,7 @@ bool openAddressBook(const std::string& path) return false; } const int defaultScope = 0x80; - MorkTableMap::Map::iterator tableIter; + MorkTableMap::Map::const_iterator tableIter; MorkTableMap *Tables = mork.getTables( defaultScope ); if ( Tables ) { diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index 3e68f1321170..92f45cb2237c 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -73,7 +73,7 @@ namespace connectivity IniSectionMap &mAllSection = parser.getAllSection(); IniSectionMap::iterator iBegin = mAllSection.begin(); - IniSectionMap::iterator iEnd = mAllSection.end(); + IniSectionMap::const_iterator iEnd = mAllSection.end(); for(;iBegin != iEnd;++iBegin) { ini_Section *aSection = &(*iBegin).second; @@ -166,7 +166,7 @@ namespace connectivity ProductStruct &m_Product = m_ProductProfileList[index]; list.realloc(static_cast<sal_Int32>(m_Product.mProfileList.size())); sal_Int32 i=0; - for(ProfileList::iterator itor=m_Product.mProfileList.begin(); + for(ProfileList::const_iterator itor=m_Product.mProfileList.begin(); itor != m_Product.mProfileList.end(); ++itor) { diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index 28d5a9d6e510..9125247b8db5 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -74,7 +74,7 @@ namespace connectivity ::comphelper::disposeComponent(m_xODBCDriver); ::comphelper::disposeComponent(m_xNativeDriver); TJDBCDrivers::iterator aIter = m_aJdbcDrivers.begin(); - TJDBCDrivers::iterator aEnd = m_aJdbcDrivers.end(); + TJDBCDrivers::const_iterator aEnd = m_aJdbcDrivers.end(); for ( ;aIter != aEnd;++aIter ) ::comphelper::disposeComponent(aIter->second); } @@ -405,7 +405,7 @@ namespace connectivity OMetaConnection* pConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() )); if ( pConnection ) { - TWeakPairVector::iterator aEnd = m_aConnections.end(); + TWeakPairVector::const_iterator aEnd = m_aConnections.end(); for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i) { if ( i->second.second == pConnection ) @@ -423,7 +423,7 @@ namespace connectivity } // if ( xTunnel.is() ) if ( !xTab.is() ) { - TWeakPairVector::iterator aEnd = m_aConnections.end(); + TWeakPairVector::const_iterator aEnd = m_aConnections.end(); for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i) { Reference< XConnection > xTemp(i->first.get(),UNO_QUERY); diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index 7c089cfa3257..2fa488782308 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -200,7 +200,7 @@ SQLRETURN OResultSet::unbind(bool _bUnbindHandle) if ( m_aBindVector.size() > 0 ) { TVoidVector::iterator pValue = m_aBindVector.begin(); - TVoidVector::iterator pEnd = m_aBindVector.end(); + TVoidVector::const_iterator pEnd = m_aBindVector.end(); for(; pValue != pEnd; ++pValue) { switch (pValue->second) @@ -960,7 +960,7 @@ void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException, st if ( m_bRowDeleted ) { TBookmarkPosMap::iterator aIter = m_aPosToBookmarks.begin(); - TBookmarkPosMap::iterator aEnd = m_aPosToBookmarks.end(); + TBookmarkPosMap::const_iterator aEnd = m_aPosToBookmarks.end(); for (; aIter != aEnd; ++aIter) { if ( aIter->second == nPos ) @@ -1160,7 +1160,7 @@ Sequence<sal_Int8> OResultSet::impl_getBookmark( ) throw( SQLException, Runtim { checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - TBookmarkPosMap::iterator aFind = ::std::find_if(m_aPosToBookmarks.begin(),m_aPosToBookmarks.end(), + TBookmarkPosMap::const_iterator aFind = ::std::find_if(m_aPosToBookmarks.begin(),m_aPosToBookmarks.end(), [this] (const TBookmarkPosMap::value_type& bookmarkPos) { return bookmarkPos.second == m_nRowPos; }); @@ -1202,7 +1202,7 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLE { m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0); OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - TBookmarkPosMap::iterator aFind = m_aPosToBookmarks.find(aBookmark); + TBookmarkPosMap::const_iterator aFind = m_aPosToBookmarks.find(aBookmark); if(aFind != m_aPosToBookmarks.end()) m_nRowPos = aFind->second; else @@ -1666,8 +1666,8 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO break; case IResultSetHelper::BOOKMARK: // special case here because we are only called with position numbers { - TBookmarkPosMap::iterator aIter = m_aPosToBookmarks.begin(); - TBookmarkPosMap::iterator aEnd = m_aPosToBookmarks.end(); + TBookmarkPosMap::const_iterator aIter = m_aPosToBookmarks.begin(); + TBookmarkPosMap::const_iterator aEnd = m_aPosToBookmarks.end(); for (; aIter != aEnd; ++aIter) { if ( aIter->second == _nOffset ) @@ -1823,7 +1823,7 @@ void OResultSet::fillNeededData(SQLRETURN _nRet) SWORD OResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex) { - ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex); + ::std::map<sal_Int32,SWORD>::const_iterator aFind = m_aODBCColumnTypes.find(columnIndex); if ( aFind == m_aODBCColumnTypes.end() ) aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; return aFind->second; diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 5928eaeeec48..c7ab42428c80 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -235,7 +235,7 @@ void Connection::close() throw ( SQLException, RuntimeException, std::exception m_settings.tables.clear(); m_settings.users.clear(); - for( WeakHashMap::iterator ii = m_myStatements.begin() ; + for( WeakHashMap::const_iterator ii = m_myStatements.begin() ; ii != m_myStatements.end() ; ++ii ) { @@ -427,9 +427,9 @@ public: { OSL_ENSURE(values.size() == acquired.size(), "pq_connection: cstr_vector values and acquired size mismatch"); std::vector<char*>::iterator pv = values.begin(); - std::vector<bool>::iterator pa = acquired.begin(); - const std::vector<char*>::iterator pve = values.end(); - for( ; pv < pve ; ++pv, ++pa ) + std::vector<bool>::const_iterator pa = acquired.begin(); + const std::vector<char*>::const_iterator pve = values.end(); + for( ; pv != pve ; ++pv, ++pa ) if (*pa) free(*pv); } diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index e60043eff625..4d4ce9e78011 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -1339,7 +1339,7 @@ sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype // } // base type Statics &statics = getStatics(); - BaseTypeMap::iterator ii = statics.baseTypeMap.find( typeName ); + BaseTypeMap::const_iterator ii = statics.baseTypeMap.find( typeName ); if( ii != statics.baseTypeMap.end() ) { ret = ii->second; @@ -1808,7 +1808,7 @@ static void columnMetaData2DatabaseTypeDescription( } - std::vector< std::vector<Any> >::iterator ii = vec.begin(); + std::vector< std::vector<Any> >::const_iterator ii = vec.begin(); OUString lastTableOid; sal_Int32 index = 0; std::vector< std::vector< Any > > ret( vec.size() ); diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index 8a0056a7ecdc..60be95b46039 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -757,7 +757,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert( { OUString value; OString columnName = OUStringToOString( keyColumnNames[i], pConnectionSettings->encoding ); - String2StringMap::iterator ii = namedValues.begin(); + String2StringMap::const_iterator ii = namedValues.begin(); for( ; ii != namedValues.end() ; ++ii ) { if( columnName.equalsIgnoreAsciiCase( ii->first ) ) @@ -776,7 +776,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert( getAutoValues( autoValues, connection, schemaName, tableName ); } // this could mean, that the column is a default or auto value, check this ... - String2StringMap::iterator j = autoValues.begin(); + String2StringMap::const_iterator j = autoValues.begin(); for( ; j != autoValues.end() ; ++j ) { if( columnName.equalsIgnoreAsciiCase( j->first ) ) |