diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-17 23:00:24 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-18 07:36:32 +0100 |
commit | 4e144751f12a06e358e4f7efa7c8f13954e6cfd7 (patch) | |
tree | c6df66d58d02ecaf5caa437a944665fe83959402 /dbaccess | |
parent | 39c618caf5aa19da95285bec6cab7108bee3984c (diff) |
loplugin:unusedindex
Change-Id: I256a807dd2a4c81126b5a76f3d472e31b8224146
Reviewed-on: https://gerrit.libreoffice.org/46652
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/query.cxx | 17 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasecontext.cxx | 16 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/exsrcbrw.cxx | 32 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/formadapter.cxx | 24 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 15 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 40 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.cxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dbfindex.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/tablespage.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/stringlistitem.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryTableView.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RelationController.cxx | 15 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableController.cxx | 36 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 10 |
16 files changed, 102 insertions, 165 deletions
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index efd3eb0748c0..d1ade9cc26d5 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -170,26 +170,23 @@ void OQuery::rebuildColumns() throw RuntimeException(); } - Sequence< OUString> aNames = xColumns->getElementNames(); - const OUString* pIter = aNames.getConstArray(); - const OUString* pEnd = pIter + aNames.getLength(); - for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i) + for ( const OUString& rName : xColumns->getElementNames() ) { - Reference<XPropertySet> xSource(xColumns->getByName( *pIter ),UNO_QUERY); - OUString sLabel = *pIter; - if ( xColumnDefinitions.is() && xColumnDefinitions->hasByName(*pIter) ) + Reference<XPropertySet> xSource(xColumns->getByName( rName ),UNO_QUERY); + OUString sLabel = rName; + if ( xColumnDefinitions.is() && xColumnDefinitions->hasByName(rName) ) { - Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( *pIter ),UNO_QUERY); + Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( rName ),UNO_QUERY); xCommandColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; } OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, sLabel); Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW ); xChild->setParent( *this ); - implAppendColumn( *pIter, pColumn ); + implAppendColumn( rName, pColumn ); Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW ); if ( m_pColumnMediator.is() ) - m_pColumnMediator->notifyElementCreated( *pIter, xDest ); + m_pColumnMediator->notifyElementCreated( rName, xDest ); } } catch( const SQLContext& e ) diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index b2cc08996dbf..0432b9a2e665 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -466,18 +466,14 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl if (xSetInfo.is()) aProperties = xSetInfo->getProperties(); - if (aProperties.getLength()) + for ( const Property& rProperty : aProperties ) { - const Property* pProperties = aProperties.getConstArray(); - for ( sal_Int32 i=0; i<aProperties.getLength(); ++i, ++pProperties ) + if ( ( ( rProperty.Attributes & PropertyAttribute::TRANSIENT) != 0 ) + && ( ( rProperty.Attributes & PropertyAttribute::READONLY) == 0 ) + ) { - if ( ( ( pProperties->Attributes & PropertyAttribute::TRANSIENT) != 0 ) - && ( ( pProperties->Attributes & PropertyAttribute::READONLY) == 0 ) - ) - { - // found such a property - aRememberProps.put( pProperties->Name, xSource->getPropertyValue( pProperties->Name ) ); - } + // found such a property + aRememberProps.put( rProperty.Name, xSource->getPropertyValue( rProperty.Name ) ); } } } diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index e5c34a8f53e7..e074f78c818f 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -383,12 +383,10 @@ void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibrar { // Export the images to the storage Reference< XGraphicObjectResolver > xGraphicResolver = GraphicObjectResolver::createWithStorage(rxContext, xTmpPic); - std::vector< OUString >::const_iterator it = vEmbedImgUrls.begin(); - std::vector< OUString >::const_iterator it_end = vEmbedImgUrls.end(); if ( xGraphicResolver.is() ) { - for ( sal_Int32 count = 0; it != it_end; ++it, ++count ) - xGraphicResolver->resolveGraphicObjectURL( *it ); + for ( const OUString& rURL : vEmbedImgUrls ) + xGraphicResolver->resolveGraphicObjectURL( rURL ); } // delete old 'Pictures' storage and copy the contents of tempPictures into xStorage diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx index 6c5b5d5dcc59..a3aca9051c72 100644 --- a/dbaccess/source/ui/browser/exsrcbrw.cxx +++ b/dbaccess/source/ui/browser/exsrcbrw.cxx @@ -132,39 +132,38 @@ void SbaExternalSourceBrowser::modified(const css::lang::EventObject& aEvent) void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, const Sequence< css::beans::PropertyValue>& aArgs) { - const css::beans::PropertyValue* pArguments = aArgs.getConstArray(); if ( aURL.Complete == ".uno:FormSlots/AddGridColumn" ) { // search the argument describing the column to create OUString sControlType; sal_Int32 nControlPos = -1; Sequence< css::beans::PropertyValue> aControlProps; - for ( sal_Int32 i = 0; i < aArgs.getLength(); ++i, ++pArguments ) + for ( const css::beans::PropertyValue& rArgument : aArgs ) { - if ( pArguments->Name == "ColumnType" ) + if ( rArgument.Name == "ColumnType" ) { - auto s = o3tl::tryAccess<OUString>(pArguments->Value); + auto s = o3tl::tryAccess<OUString>(rArgument.Value); OSL_ENSURE(s, "invalid type for argument \"ColumnType\" !"); if (s) sControlType = *s; } - else if ( pArguments->Name == "ColumnPosition" ) + else if ( rArgument.Name == "ColumnPosition" ) { - auto n = o3tl::tryAccess<sal_Int16>(pArguments->Value); + auto n = o3tl::tryAccess<sal_Int16>(rArgument.Value); OSL_ENSURE(n, "invalid type for argument \"ColumnPosition\" !"); if (n) nControlPos = *n; } - else if ( pArguments->Name == "ColumnProperties" ) + else if ( rArgument.Name == "ColumnProperties" ) { auto s = o3tl::tryAccess<Sequence<css::beans::PropertyValue>>( - pArguments->Value); + rArgument.Value); OSL_ENSURE(s, "invalid type for argument \"ColumnProperties\" !"); if (s) aControlProps = *s; } else - SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch(AddGridColumn) : unknown argument (" << pArguments->Name << ") !"); + SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch(AddGridColumn) : unknown argument (" << rArgument.Name << ") !"); } if (sControlType.isEmpty()) { @@ -182,17 +181,16 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con // set its properties if (xNewColProperties.is()) { - const css::beans::PropertyValue* pControlProps = aControlProps.getConstArray(); - for (sal_Int32 i=0; i<aControlProps.getLength(); ++i, ++pControlProps) + for (const css::beans::PropertyValue& rControlProp : aControlProps) { try { - if (xNewColProperties->hasPropertyByName(pControlProps->Name)) - xNewCol->setPropertyValue(pControlProps->Name, pControlProps->Value); + if (xNewColProperties->hasPropertyByName(rControlProp.Name)) + xNewCol->setPropertyValue(rControlProp.Name, rControlProp.Value); } catch (const Exception&) { - SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch : could not set a column property (" << pControlProps->Name << ")!"); + SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch : could not set a column property (" << rControlProp.Name << ")!"); } } } @@ -219,11 +217,11 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con Reference< XRowSet > xMasterForm; // search the arguments for the master form - for (sal_Int32 i=0; i<aArgs.getLength(); ++i, ++pArguments) + for (const css::beans::PropertyValue& rArgument : aArgs) { - if ( (pArguments->Name == "MasterForm") && (pArguments->Value.getValueTypeClass() == TypeClass_INTERFACE) ) + if ( (rArgument.Name == "MasterForm") && (rArgument.Value.getValueTypeClass() == TypeClass_INTERFACE) ) { - xMasterForm.set(pArguments->Value, UNO_QUERY); + xMasterForm.set(rArgument.Value, UNO_QUERY); break; } } diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 7fd72dbd7464..1fd7948ceafc 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1206,14 +1206,11 @@ Reference< css::beans::XPropertySetInfo > SAL_CALL SbaXFormAdapter::getPropertyS if (-1 == m_nNamePropHandle) { // we need to determine the handle for the NAME property - Sequence< css::beans::Property> aProps = xReturn->getProperties(); - const css::beans::Property* pProps = aProps.getConstArray(); - - for (sal_Int32 i=0; i<aProps.getLength(); ++i, ++pProps) + for (const css::beans::Property& rProp : xReturn->getProperties()) { - if (pProps->Name == PROPERTY_NAME) + if (rProp.Name == PROPERTY_NAME) { - m_nNamePropHandle = pProps->Handle; + m_nNamePropHandle = rProp.Handle; break; } } @@ -1234,16 +1231,14 @@ Sequence< Any > SAL_CALL SbaXFormAdapter::getPropertyValues(const Sequence< OUSt if (!xSet.is()) return Sequence< Any>(aPropertyNames.getLength()); - Sequence< Any> aReturn = xSet->getPropertyValues(aPropertyNames); + Sequence< Any> aReturn = xSet->getPropertyValues(aPropertyNames); // search for (and fake) the NAME property - const OUString* pNames = aPropertyNames.getConstArray(); - Any* pValues = aReturn.getArray(); OSL_ENSURE(aReturn.getLength() == aPropertyNames.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !"); - for (sal_Int32 i=0; i<aPropertyNames.getLength(); ++i, ++pNames, ++pValues) - if (*pNames == PROPERTY_NAME) + for (sal_Int32 i=0; i<aPropertyNames.getLength(); ++i) + if (aPropertyNames[i] == PROPERTY_NAME) { - (*pValues) <<= m_sName; + aReturn[i] <<= m_sName; break; } @@ -1336,9 +1331,8 @@ Sequence< css::beans::PropertyState> SAL_CALL SbaXFormAdapter::getPropertyStates // set them all to DEFAULT Sequence< css::beans::PropertyState> aReturn(aPropertyName.getLength()); - css::beans::PropertyState* pStates = aReturn.getArray(); - for (sal_Int32 i=0; i<aPropertyName.getLength(); ++i, ++pStates) - *pStates = css::beans::PropertyState_DEFAULT_VALUE; + for (css::beans::PropertyState& rState : aReturn) + rState = css::beans::PropertyState_DEFAULT_VALUE; return aReturn; } diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 2d5d39cab684..3d0e8a75aa46 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -427,22 +427,21 @@ void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyVa SolarMutexGuard aGuard; sal_Int16 nColId = -1; - const PropertyValue* pArgs = aArgs.getConstArray(); - for (sal_Int32 i=0; i<aArgs.getLength(); ++i, ++pArgs) + for (const PropertyValue& rArg : aArgs) { - if (pArgs->Name == "ColumnViewPos") + if (rArg.Name == "ColumnViewPos") { - nColId = pGrid->GetColumnIdFromViewPos(::comphelper::getINT16(pArgs->Value)); + nColId = pGrid->GetColumnIdFromViewPos(::comphelper::getINT16(rArg.Value)); break; } - if (pArgs->Name == "ColumnModelPos") + if (rArg.Name == "ColumnModelPos") { - nColId = pGrid->GetColumnIdFromModelPos(::comphelper::getINT16(pArgs->Value)); + nColId = pGrid->GetColumnIdFromModelPos(::comphelper::getINT16(rArg.Value)); break; } - if (pArgs->Name == "ColumnId") + if (rArg.Name == "ColumnId") { - nColId = ::comphelper::getINT16(pArgs->Value); + nColId = ::comphelper::getINT16(rArg.Value); break; } } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 3f70fdb4e1b0..689c4d2fc480 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -657,16 +657,13 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm OUString aCurrentModelType; Reference<XColumnsSupplier> xSupCols(getRowSet(),UNO_QUERY); Reference<XNameAccess> xColumns = xSupCols->getColumns(); - Sequence< OUString> aNames = xColumns->getElementNames(); - const OUString* pIter = aNames.getConstArray(); - const OUString* pEnd = pIter + aNames.getLength(); OUString sDefaultProperty; Reference< XPropertySet > xColumn; Reference< XPropertySetInfo > xColPSI; - for (sal_uInt16 i=0; pIter != pEnd; ++i,++pIter) + for (const OUString& rName : xColumns->getElementNames()) { - xColumn.set( xColumns->getByName( *pIter ), UNO_QUERY_THROW ); + xColumn.set( xColumns->getByName( rName ), UNO_QUERY_THROW ); xColPSI.set( xColumn->getPropertySetInfo(), UNO_SET_THROW ); // ignore the column when it is a rowversion one @@ -730,13 +727,13 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm break; } - aInitialValues.emplace_back( PROPERTY_CONTROLSOURCE, makeAny( *pIter ) ); + aInitialValues.emplace_back( PROPERTY_CONTROLSOURCE, makeAny( rName ) ); OUString sLabel; xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; if ( !sLabel.isEmpty() ) aInitialValues.emplace_back( PROPERTY_LABEL, makeAny( sLabel ) ); else - aInitialValues.emplace_back( PROPERTY_LABEL, makeAny( *pIter ) ); + aInitialValues.emplace_back( PROPERTY_LABEL, makeAny( rName ) ); Reference< XPropertySet > xGridCol( xColFactory->createColumn( aCurrentModelType ), UNO_SET_THROW ); Reference< XPropertySetInfo > xGridColPSI( xGridCol->getPropertySetInfo(), UNO_SET_THROW ); @@ -799,7 +796,7 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm ) xGridCol->setPropertyValue( *copyPropertyName, xColumn->getPropertyValue( *copyPropertyName ) ); - xColContainer->insertByName(*pIter, makeAny(xGridCol)); + xColContainer->insertByName(rName, makeAny(xGridCol)); } } } @@ -2083,11 +2080,8 @@ void SbaTableQueryBrowser::initializeTreeModel() OUString sQueriesName, sTablesName; // fill the model with the names of the registered datasources - Sequence< OUString > aDatasources = m_xDatabaseContext->getElementNames(); - const OUString* pIter = aDatasources.getConstArray(); - const OUString* pEnd = pIter + aDatasources.getLength(); - for (; pIter != pEnd; ++pIter) - implAddDatasource( *pIter, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage, SharedConnection() ); + for (const OUString& rDatasource : m_xDatabaseContext->getElementNames()) + implAddDatasource( rDatasource, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage, SharedConnection() ); } } @@ -2101,22 +2095,19 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce try { - Sequence< OUString > aNames = _xNameAccess->getElementNames(); - const OUString* pIter = aNames.getConstArray(); - const OUString* pEnd = pIter + aNames.getLength(); - for (; pIter != pEnd; ++pIter) + for (const OUString& rName : _xNameAccess->getElementNames()) { - if( !m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent)) + if( !m_pTreeView->getListBox().GetEntryPosByName(rName,_pParent)) { DBTreeListUserData* pEntryData = new DBTreeListUserData; pEntryData->eType = _eEntryType; if ( _eEntryType == etQuery ) { - Reference<XNameAccess> xChild(_xNameAccess->getByName(*pIter),UNO_QUERY); + Reference<XNameAccess> xChild(_xNameAccess->getByName(rName),UNO_QUERY); if ( xChild.is() ) pEntryData->eType = etQueryContainer; } - implAppendEntry( _pParent, *pIter, pEntryData, pEntryData->eType ); + implAppendEntry( _pParent, rName, pEntryData, pEntryData->eType ); } } } @@ -3591,14 +3582,11 @@ void SbaTableQueryBrowser::frameAction(const css::frame::FrameActionEvent& aEven void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _xColContainer) { // first we have to clear the grid - Sequence< OUString > aNames = _xColContainer->getElementNames(); - const OUString* pIter = aNames.getConstArray(); - const OUString* pEnd = pIter + aNames.getLength(); Reference< XInterface > xColumn; - for (; pIter != pEnd;++pIter) + for (const OUString& rName : _xColContainer->getElementNames()) { - _xColContainer->getByName(*pIter) >>= xColumn; - _xColContainer->removeByName(*pIter); + _xColContainer->getByName(rName) >>= xColumn; + _xColContainer->removeByName(rName); ::comphelper::disposeComponent(xColumn); } } diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index bb47bb39b41f..78249cacf006 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -589,18 +589,17 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr catch(Exception&) { } // collect the names of the additional settings - const PropertyValue* pAdditionalInfo = aAdditionalInfo.getConstArray(); PropertyValueSet aInfos; - for (sal_Int32 i=0; i<aAdditionalInfo.getLength(); ++i, ++pAdditionalInfo) + for (const PropertyValue& rAdditionalInfo : aAdditionalInfo) { - if( pAdditionalInfo->Name == "JDBCDRV" ) + if( rAdditionalInfo.Name == "JDBCDRV" ) { // compatibility - PropertyValue aCompatibility(*pAdditionalInfo); + PropertyValue aCompatibility(rAdditionalInfo); aCompatibility.Name = "JavaDriverClass"; aInfos.insert(aCompatibility); } else - aInfos.insert(*pAdditionalInfo); + aInfos.insert(rAdditionalInfo); } // go through all known translations and check if we have such a setting diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx index 17036195cf44..0a496280ba2f 100644 --- a/dbaccess/source/ui/dlg/dbfindex.cxx +++ b/dbaccess/source/ui/dlg/dbfindex.cxx @@ -281,20 +281,16 @@ void ODbaseIndexDialog::Init() // first assume for all indexes they're free - Sequence< OUString> aFolderContent( ::utl::LocalFileHelper::GetFolderContents(m_aDSN,bFolder)); - OUString const aIndexExt("ndx"); OUString const aTableExt("dbf"); std::vector< OUString > aUsedIndexes; - const OUString *pBegin = aFolderContent.getConstArray(); - const OUString *pEnd = pBegin + aFolderContent.getLength(); aURL.SetSmartProtocol(INetProtocol::File); - for(;pBegin != pEnd;++pBegin) + for(const OUString& rURL : ::utl::LocalFileHelper::GetFolderContents(m_aDSN, bFolder)) { OUString aName; - osl::FileBase::getSystemPathFromFileURL(pBegin->getStr(),aName); + osl::FileBase::getSystemPathFromFileURL(rURL,aName); aURL.SetSmartURL(aName); OUString aExt = aURL.getExtension(); if (aExt == aIndexExt) diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 3832c9183287..1f974a83de6c 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -159,13 +159,12 @@ namespace dbaui SvTreeListEntry* pRootEntry = m_pTablesList->getAllObjectsEntry(); - const OUString* pIncludeTable = _rTables.getConstArray(); - for (sal_Int32 i=0; i<_rTables.getLength(); ++i, ++pIncludeTable) + for (const OUString& rIncludeTable : _rTables) { if (xMeta.is()) - qualifiedNameComponents(xMeta, pIncludeTable->getStr(), sCatalog, sSchema, sName,::dbtools::EComposeRule::InDataManipulation); + qualifiedNameComponents(xMeta, rIncludeTable.getStr(), sCatalog, sSchema, sName,::dbtools::EComposeRule::InDataManipulation); else - sName = *pIncludeTable; + sName = rIncludeTable; bool bAllTables = (1 == sName.getLength()) && ('%' == sName[0]); bool bAllSchemas = (1 == sSchema.getLength()) && ('%' == sSchema[0]); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 00c2eaf5dddf..bae06ba9c1ca 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -879,8 +879,8 @@ bool callColumnFormatDialog(vcl::Window* _pParent, { const sal_uInt32* pDeletedKeys = pInfoItem->GetDelArray(); - for (sal_uInt32 i=0; i< pInfoItem->GetDelCount(); ++i, ++pDeletedKeys) - _pFormatter->DeleteEntry(*pDeletedKeys); + for (sal_uInt32 i=0; i< pInfoItem->GetDelCount(); ++i) + _pFormatter->DeleteEntry(pDeletedKeys[i]); } } } @@ -916,16 +916,14 @@ bool appendToFilter(const Reference<XConnection>& _xConnection, xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= aFilter; // first check if we have something like SCHEMA.% bool bHasToInsert = true; - const OUString* pBegin = aFilter.getConstArray(); - const OUString* pEnd = pBegin + aFilter.getLength(); - for (;pBegin != pEnd; ++pBegin) + for (const OUString& rItem : aFilter) { - if(pBegin->indexOf('%') != -1) + if(rItem.indexOf('%') != -1) { sal_Int32 nLen; - if((nLen = pBegin->lastIndexOf('.')) != -1 && !pBegin->compareTo(_sName,nLen)) + if((nLen = rItem.lastIndexOf('.')) != -1 && !rItem.compareTo(_sName,nLen)) bHasToInsert = false; - else if(pBegin->getLength() == 1) + else if(rItem.getLength() == 1) bHasToInsert = false; } } diff --git a/dbaccess/source/ui/misc/stringlistitem.cxx b/dbaccess/source/ui/misc/stringlistitem.cxx index 32649443b14e..fb865df54bb4 100644 --- a/dbaccess/source/ui/misc/stringlistitem.cxx +++ b/dbaccess/source/ui/misc/stringlistitem.cxx @@ -44,11 +44,8 @@ bool OStringListItem::operator==(const SfxPoolItem& _rItem) const return false; // compare all strings individually - const OUString* pMyStrings = m_aList.getConstArray(); - const OUString* pCompareStrings = pCompare->m_aList.getConstArray(); - - for (sal_Int32 i=0; i<m_aList.getLength(); ++i, ++pMyStrings, ++pCompareStrings) - if (*pMyStrings != *pCompareStrings) + for (sal_Int32 i=0; i<m_aList.getLength(); ++i) + if (m_aList[i] != pCompare->m_aList[i]) return false; return true; diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index 5144525f2c97..d721ed7da46d 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -139,13 +139,10 @@ namespace OUString sRelatedColumn; // iterate through all foreignkey columns to create the connections - Sequence< OUString> aElements(_rxSourceForeignKeyColumns->getElementNames()); - const OUString* pIter = aElements.getConstArray(); - const OUString* pEnd = pIter + aElements.getLength(); - for(sal_Int32 i=0;pIter != pEnd;++pIter,++i) + for(const OUString& rElement : _rxSourceForeignKeyColumns->getElementNames()) { Reference<XPropertySet> xColumn; - if ( !( _rxSourceForeignKeyColumns->getByName(*pIter) >>= xColumn ) ) + if ( !( _rxSourceForeignKeyColumns->getByName(rElement) >>= xColumn ) ) { OSL_FAIL( "addConnections: invalid foreign key column!" ); continue; @@ -154,7 +151,7 @@ namespace xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn; { - Sequence< sal_Int16> aFind(::comphelper::findValue(_rSource.GetOriginalColumns()->getElementNames(),*pIter,true)); + Sequence< sal_Int16> aFind(::comphelper::findValue(_rSource.GetOriginalColumns()->getElementNames(),rElement,true)); if(aFind.getLength()) pNewConnData->SetFieldIndex(JTCS_FROM,aFind[0]+1); else @@ -170,7 +167,7 @@ namespace else OSL_FAIL("Column not found!"); } - pNewConnData->AppendConnLine(*pIter,sRelatedColumn); + pNewConnData->AppendConnLine(rElement,sRelatedColumn); // now add the Conn itself ScopedVclPtrInstance< OQueryTableConnection > aNewConn(_pView, aNewConnData); diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index 3bb0804ae42b..233141474c4c 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -315,12 +315,11 @@ namespace { osl_setThreadName("RelationLoader"); - const OUString* pIter = m_aTableList.getConstArray() + m_nStartIndex; - for(sal_Int32 i = m_nStartIndex; i < m_nEndIndex;++i,++pIter) + for(sal_Int32 i = m_nStartIndex; i < m_nEndIndex; ++i) { OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData, - *pIter, + m_aTableList[i], sCatalog, sSchema, sTable, @@ -335,7 +334,7 @@ namespace if ( xResult.is() && xResult->next() ) { ::comphelper::disposeComponent(xResult); - loadTableData(m_xTables->getByName(*pIter)); + loadTableData(m_xTables->getByName(m_aTableList[i])); } } catch( const Exception& ) @@ -406,14 +405,12 @@ namespace // insert columns const Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY); OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!"); - const Reference<XNameAccess> xColumns = xColsSup->getColumns(); + const Reference<XNameAccess> xColumns = xColsSup->getColumns(); const Sequence< OUString> aNames = xColumns->getElementNames(); - const OUString* pIter = aNames.getConstArray(); - const OUString* pEnd = pIter + aNames.getLength(); OUString sColumnName,sRelatedName; - for(sal_uInt16 j=0;pIter != pEnd;++pIter,++j) + for(sal_Int32 j=0;j<aNames.getLength();++j) { - const Reference<XPropertySet> xPropSet(xColumns->getByName(*pIter),UNO_QUERY); + const Reference<XPropertySet> xPropSet(xColumns->getByName(aNames[j]),UNO_QUERY); OSL_ENSURE(xPropSet.is(),"Invalid column found in KeyColumns!"); if ( xPropSet.is() ) { diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 438497169b3f..86bcbbdd2692 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -781,14 +781,11 @@ void OTableController::loadData() // For Add and Drop all rows can be edited // sal_Bool bReadOldRow = xMetaData->supportsAlterTableWithAddColumn() && xMetaData->supportsAlterTableWithDropColumn(); bool bIsAlterAllowed = isAlterAllowed(); - Sequence< OUString> aColumns = xColumns->getElementNames(); - const OUString* pIter = aColumns.getConstArray(); - const OUString* pEnd = pIter + aColumns.getLength(); - for(;pIter != pEnd;++pIter) + for(const OUString& rColumn : xColumns->getElementNames()) { Reference<XPropertySet> xColumn; - xColumns->getByName(*pIter) >>= xColumn; + xColumns->getByName(rColumn) >>= xColumn; sal_Int32 nType = 0; sal_Int32 nScale = 0; sal_Int32 nPrecision = 0; @@ -855,19 +852,13 @@ void OTableController::loadData() Reference<XNameAccess> xKeyColumns = getKeyColumns(); if(xKeyColumns.is()) { - Sequence< OUString> aKeyColumns = xKeyColumns->getElementNames(); - const OUString* pKeyBegin = aKeyColumns.getConstArray(); - const OUString* pKeyEnd = pKeyBegin + aKeyColumns.getLength(); - - for(;pKeyBegin != pKeyEnd;++pKeyBegin) + for(const OUString& rKeyColumn : xKeyColumns->getElementNames()) { - std::vector< std::shared_ptr<OTableRow> >::const_iterator rowIter = m_vRowList.begin(); - std::vector< std::shared_ptr<OTableRow> >::const_iterator rowEnd = m_vRowList.end(); - for(;rowIter != rowEnd;++rowIter) + for(std::shared_ptr<OTableRow> const& pRow : m_vRowList) { - if((*rowIter)->GetActFieldDescr()->GetName() == *pKeyBegin) + if(pRow->GetActFieldDescr()->GetName() == rKeyColumn) { - (*rowIter)->SetPrimaryKey(true); + pRow->SetPrimaryKey(true); break; } } @@ -1176,17 +1167,14 @@ void OTableController::alterColumns() // now we have to look for the columns who could be deleted if ( xDrop.is() ) { - Sequence< OUString> aColumnNames = xColumns->getElementNames(); - const OUString* pIter = aColumnNames.getConstArray(); - const OUString* pEnd = pIter + aColumnNames.getLength(); - for(;pIter != pEnd;++pIter) + for(const OUString& rColumnName : xColumns->getElementNames()) { - if(aColumns.find(*pIter) == aColumns.end()) // found a column to delete + if(aColumns.find(rColumnName) == aColumns.end()) // found a column to delete { - if(xKeyColumns.is() && xKeyColumns->hasByName(*pIter)) // check if this column is a member of the primary key + if(xKeyColumns.is() && xKeyColumns->hasByName(rColumnName)) // check if this column is a member of the primary key { OUString aMsgT(DBA_RES(STR_TBL_COLUMN_IS_KEYCOLUMN)); - aMsgT = aMsgT.replaceFirst("$column$",*pIter); + aMsgT = aMsgT.replaceFirst("$column$",rColumnName); OUString aTitle(DBA_RES(STR_TBL_COLUMN_IS_KEYCOLUMN_TITLE)); ScopedVclPtrInstance< OSQLMessageBox > aMsg(getView(),aTitle,aMsgT,MessBoxStyle::YesNo| MessBoxStyle::DefaultYes); if(aMsg->Execute() == RET_YES) @@ -1202,12 +1190,12 @@ void OTableController::alterColumns() } try { - xDrop->dropByName(*pIter); + xDrop->dropByName(rColumnName); } catch (const SQLException&) { OUString sError( DBA_RES( STR_TABLEDESIGN_COULD_NOT_DROP_COL ) ); - sError = sError.replaceFirst( "$column$", *pIter ); + sError = sError.replaceFirst( "$column$", rColumnName ); SQLException aNewException; aNewException.Message = sError; diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 636cd7124947..c13c75f8cfc4 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1166,8 +1166,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou } ++nRowCount; - ODatabaseExport::TPositions::const_iterator aPosIter = aColumnPositions.begin(); - ODatabaseExport::TPositions::const_iterator aPosEnd = aColumnPositions.end(); aCopyEvent.Error.clear(); try @@ -1180,9 +1178,9 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou sal_Int32 nSourceColumn( 1 ); ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams ); - for ( ; aPosIter != aPosEnd; ++aPosIter ) + for ( auto const& rColumnPos : aColumnPositions ) { - nDestColumn = aPosIter->first; + nDestColumn = rColumnPos.first; if ( nDestColumn == COLUMN_POSITION_NOT_FOUND ) { ++nSourceColumn; @@ -1432,9 +1430,7 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< const OUString sQuote = xDestMetaData->getIdentifierQuoteString(); OUStringBuffer sColumns; // 1st check if the columns matching - const OCopyTableWizard& rWizard = impl_getDialog_throw(); - ODatabaseExport::TPositions const & rColumnPositions = rWizard.GetColumnPositions(); - for ( auto const & rColumnPositionPair : rColumnPositions ) + for ( auto const & rColumnPositionPair : impl_getDialog_throw().GetColumnPositions() ) { if ( COLUMN_POSITION_NOT_FOUND != rColumnPositionPair.second ) { |