summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-26 09:08:01 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-26 07:43:58 +0000
commit17c4f7f0bc986ed2623a60eea99be01036899af3 (patch)
treece231cac5d9b2d91fb175f22a45bf9dd664057f8 /extensions
parent501720afbf226443c1121379efb661d2902113df (diff)
clang-tidy modernize-loop-convert in e*
Change-Id: If56abefa81b41479e3ea9890dee1c43f006086de Reviewed-on: https://gerrit.libreoffice.org/24384 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/bibliography/bibconfig.cxx4
-rw-r--r--extensions/source/bibliography/bibload.cxx6
-rw-r--r--extensions/source/bibliography/datman.cxx18
-rw-r--r--extensions/source/bibliography/general.cxx20
-rw-r--r--extensions/source/bibliography/toolbar.cxx3
-rw-r--r--extensions/source/logging/loggerconfig.cxx6
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx8
-rw-r--r--extensions/source/propctrlr/formlinkdialog.cxx12
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx32
-rw-r--r--extensions/source/propctrlr/propertycomposer.cxx7
-rw-r--r--extensions/source/scanner/grid.cxx4
-rw-r--r--extensions/source/scanner/sanedlg.cxx6
-rw-r--r--extensions/source/update/check/updatecheckconfig.cxx10
13 files changed, 60 insertions, 76 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx
index e4639a0ee0f8..e5779e2249aa 100644
--- a/extensions/source/bibliography/bibconfig.cxx
+++ b/extensions/source/bibliography/bibconfig.cxx
@@ -294,9 +294,9 @@ void BibConfig::ImplCommit()
const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const
{
- for(size_t i = 0; i < pMappingsArr->size(); i++)
+ for(std::unique_ptr<Mapping> & i : *pMappingsArr)
{
- Mapping& rMapping = *(*pMappingsArr)[i].get();
+ Mapping& rMapping = *i.get();
bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL);
if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual)
return &rMapping;
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index e0d0ac5568b0..ce394a16d289 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -422,11 +422,11 @@ static OUString lcl_AddProperty(const Reference< XNameAccess >& xColumns,
OUString sColumnName(rColumnName);
if(pMapping)
{
- for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ for(const auto & aColumnPair : pMapping->aColumnPairs)
{
- if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == rColumnName)
+ if(aColumnPair.sLogicalColumnName == rColumnName)
{
- sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName;
+ sColumnName = aColumnPair.sRealColumnName;
break;
}
}
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 418f6b2ffe9c..a11d6310c1bd 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -365,12 +365,12 @@ MappingDialog_Impl::MappingDialog_Impl(vcl::Window* pParent, BibDataManager* pMa
const Mapping* pMapping = pConfig->GetMapping(aDesc);
if(pMapping)
{
- for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ for(const auto & aColumnPair : pMapping->aColumnPairs)
{
- sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, pMapping->aColumnPairs[nEntry].sLogicalColumnName);
+ sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, aColumnPair.sLogicalColumnName);
if(nListBoxIndex < COLUMN_COUNT)
{
- aListBoxes[nListBoxIndex]->SelectEntry(pMapping->aColumnPairs[nEntry].sRealColumnName);
+ aListBoxes[nListBoxIndex]->SelectEntry(aColumnPair.sRealColumnName);
}
}
}
@@ -425,10 +425,10 @@ IMPL_LINK_TYPED(MappingDialog_Impl, ListBoxSelectHdl, ListBox&, rListBox, void)
const sal_Int32 nEntryPos = rListBox.GetSelectEntryPos();
if(0 < nEntryPos)
{
- for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
+ for(VclPtr<ListBox> & aListBoxe : aListBoxes)
{
- if(&rListBox != aListBoxes[i] && aListBoxes[i]->GetSelectEntryPos() == nEntryPos)
- aListBoxes[i]->SelectEntryPos(0);
+ if(&rListBox != aListBoxe && aListBoxe->GetSelectEntryPos() == nEntryPos)
+ aListBoxe->SelectEntryPos(0);
}
}
SetModified();
@@ -1578,11 +1578,11 @@ const OUString& BibDataManager::GetIdentifierMapping()
sIdentifierMapping = pConfig->GetDefColumnName(IDENTIFIER_POS);
if(pMapping)
{
- for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ for(const auto & aColumnPair : pMapping->aColumnPairs)
{
- if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sIdentifierMapping)
+ if(aColumnPair.sLogicalColumnName == sIdentifierMapping)
{
- sIdentifierMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
+ sIdentifierMapping = aColumnPair.sRealColumnName;
break;
}
}
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 440d59e17eb2..2e422250ea6d 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -57,11 +57,11 @@ static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos
BibConfig* pBibConfig = BibModul::GetConfig();
OUString sRet = pBibConfig->GetDefColumnName(nIndexPos);
if(pMapping)
- for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
+ for(const auto & aColumnPair : pMapping->aColumnPairs)
{
- if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet)
+ if(aColumnPair.sLogicalColumnName == sRet)
{
- sRet = pMapping->aColumnPairs[i].sRealColumnName;
+ sRet = aColumnPair.sRealColumnName;
break;
}
}
@@ -108,11 +108,11 @@ void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno
OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS);
if(pMapping)
{
- for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ for(const auto & aColumnPair : pMapping->aColumnPairs)
{
- if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping)
+ if(aColumnPair.sLogicalColumnName == sTypeMapping)
{
- sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
+ sTypeMapping = aColumnPair.sRealColumnName;
break;
}
}
@@ -393,13 +393,13 @@ void BibGeneralPage::dispose()
void BibGeneralPage::RemoveListeners()
{
- for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
+ for(uno::Reference<awt::XWindow> & aControl : aControls)
{
- if(aControls[i].is())
+ if(aControl.is())
{
- uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
+ uno::Reference< awt::XWindow > xCtrWin(aControl, uno::UNO_QUERY );
xCtrWin->removeFocusListener( mxBibGeneralPageFocusListener.get() );
- aControls[i] = nullptr;
+ aControl = nullptr;
}
}
}
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 109c05b69816..521446ca7515 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -524,9 +524,8 @@ IMPL_LINK_NOARG_TYPED( BibToolBar, MenuHdl, ToolBox*, void)
void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent)
throw( uno::RuntimeException )
{
- for(size_t i = 0; i < aListenerArr.size(); i++)
+ for(uno::Reference<frame::XStatusListener> & rListener : aListenerArr)
{
- css::uno::Reference< css::frame::XStatusListener>& rListener = aListenerArr[i];
rListener->statusChanged(rEvent);
}
}
diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx
index 19ef3e4d4d17..607a0d220766 100644
--- a/extensions/source/logging/loggerconfig.cxx
+++ b/extensions/source/logging/loggerconfig.cxx
@@ -141,9 +141,9 @@ namespace logging
Variable( RTL_CONSTASCII_USTRINGPARAM( "$(pid)" ), aPID )
};
- for ( size_t i = 0; i < SAL_N_ELEMENTS( aVariables ); ++i )
+ for (Variable & aVariable : aVariables)
{
- OUString sPattern( aVariables[i].pVariablePattern, aVariables[i].nPatternLength, aVariables[i].eEncoding );
+ OUString sPattern( aVariable.pVariablePattern, aVariable.nPatternLength, aVariable.eEncoding );
sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern );
if ( ( nVariableIndex == 0 )
|| ( ( nVariableIndex > 0 )
@@ -152,7 +152,7 @@ namespace logging
)
{
// found an (unescaped) variable
- _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariables[i].sVariableValue );
+ _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariable.sVariableValue );
}
}
}
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 35835048d077..fdfb3a53b01f 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -1705,12 +1705,12 @@ namespace pcr
// propagate the changes to the min/max/default fields
OUString aAffectedProps[] = { OUString(PROPERTY_VALUE), OUString(PROPERTY_DEFAULT_VALUE), OUString(PROPERTY_VALUEMIN), OUString(PROPERTY_VALUEMAX) };
- for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(aAffectedProps); ++i)
+ for (OUString & aAffectedProp : aAffectedProps)
{
Reference< XPropertyControl > xControl;
try
{
- xControl = _rxInspectorUI->getPropertyControl( aAffectedProps[i] );
+ xControl = _rxInspectorUI->getPropertyControl( aAffectedProp );
}
catch( const UnknownPropertyException& ) {}
if ( xControl.is() )
@@ -1752,12 +1752,12 @@ namespace pcr
OUString aFormattedPropertyControls[] = {
OUString(PROPERTY_EFFECTIVE_MIN), OUString(PROPERTY_EFFECTIVE_MAX), OUString(PROPERTY_EFFECTIVE_DEFAULT), OUString(PROPERTY_EFFECTIVE_VALUE)
};
- for ( sal_uInt16 i=0; i<SAL_N_ELEMENTS(aFormattedPropertyControls); ++i )
+ for (OUString & aFormattedPropertyControl : aFormattedPropertyControls)
{
Reference< XPropertyControl > xControl;
try
{
- xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControls[i] );
+ xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControl );
}
catch( const UnknownPropertyException& ) {}
if ( xControl.is() )
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 73ea806defd8..326d9a6b75ce 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -229,11 +229,11 @@ namespace pcr
m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get()
};
- for ( sal_Int32 i = 0; i < 4; ++i )
+ for (const FieldLinkRow* aRow : aRows)
{
OUString sDetailField, sMasterField;
- aRows[ i ]->GetFieldName( FieldLinkRow::eDetailField, sDetailField );
- aRows[ i ]->GetFieldName( FieldLinkRow::eMasterField, sMasterField );
+ aRow->GetFieldName( FieldLinkRow::eDetailField, sDetailField );
+ aRow->GetFieldName( FieldLinkRow::eMasterField, sMasterField );
if ( sDetailField.isEmpty() && sMasterField.isEmpty() )
continue;
@@ -280,10 +280,10 @@ namespace pcr
FieldLinkRow* aRows[] = {
m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get()
};
- for ( sal_Int32 i = 0; i < 4 ; ++i )
+ for (FieldLinkRow* aRow : aRows)
{
- aRows[i]->fillList( FieldLinkRow::eDetailField, sDetailFields );
- aRows[i]->fillList( FieldLinkRow::eMasterField, sMasterFields );
+ aRow->fillList( FieldLinkRow::eDetailField, sDetailFields );
+ aRow->fillList( FieldLinkRow::eMasterField, sMasterFields );
}
}
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 4fc9df5b3858..a9aa624770ad 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -1001,19 +1001,16 @@ namespace pcr
// append these properties to our "all properties" array
aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() );
- for ( StlSyntaxSequence< Property >::const_iterator copyProperty = aThisHandlersProperties.begin();
- copyProperty != aThisHandlersProperties.end();
- ++copyProperty
- )
+ for (const auto & aThisHandlersPropertie : aThisHandlersProperties)
{
::std::vector< Property >::const_iterator previous = ::std::find_if(
aProperties.begin(),
aProperties.end(),
- FindPropertyByName( copyProperty->Name )
+ FindPropertyByName( aThisHandlersPropertie.Name )
);
if ( previous == aProperties.end() )
{
- aProperties.push_back( *copyProperty );
+ aProperties.push_back( aThisHandlersPropertie );
continue;
}
@@ -1026,21 +1023,18 @@ namespace pcr
// which means it can give it a completely different meaning than the previous
// handler for this property is prepared for.
::std::pair< PropertyHandlerMultiRepository::iterator, PropertyHandlerMultiRepository::iterator >
- aDepHandlers = m_aDependencyHandlers.equal_range( copyProperty->Name );
+ aDepHandlers = m_aDependencyHandlers.equal_range( aThisHandlersPropertie.Name );
m_aDependencyHandlers.erase( aDepHandlers.first, aDepHandlers.second );
}
// determine the superseded properties
StlSyntaxSequence< OUString > aSupersededByThisHandler( (*aHandler)->getSupersededProperties() );
- for ( StlSyntaxSequence< OUString >::const_iterator superseded = aSupersededByThisHandler.begin();
- superseded != aSupersededByThisHandler.end();
- ++superseded
- )
+ for (const auto & superseded : aSupersededByThisHandler)
{
::std::vector< Property >::iterator existent = ::std::find_if(
aProperties.begin(),
aProperties.end(),
- FindPropertyByName( *superseded )
+ FindPropertyByName( superseded )
);
if ( existent != aProperties.end() )
// one of the properties superseded by this handler was supported by a previous
@@ -1053,25 +1047,19 @@ namespace pcr
// remember this handler for every of the properties which it is responsible
// for
- for ( StlSyntaxSequence< Property >::const_iterator remember = aThisHandlersProperties.begin();
- remember != aThisHandlersProperties.end();
- ++remember
- )
+ for (const auto & aThisHandlersPropertie : aThisHandlersProperties)
{
- m_aPropertyHandlers[ remember->Name ] = *aHandler;
+ m_aPropertyHandlers[ aThisHandlersPropertie.Name ] = *aHandler;
// note that this implies that if two handlers support the same property,
// the latter wins
}
// see if the handler expresses interest in any actuating properties
StlSyntaxSequence< OUString > aInterestingActuations( (*aHandler)->getActuatingProperties() );
- for ( StlSyntaxSequence< OUString >::const_iterator aLoop = aInterestingActuations.begin();
- aLoop != aInterestingActuations.end();
- ++aLoop
- )
+ for (const auto & aInterestingActuation : aInterestingActuations)
{
m_aDependencyHandlers.insert( PropertyHandlerMultiRepository::value_type(
- *aLoop, *aHandler ) );
+ aInterestingActuation, *aHandler ) );
}
++aHandler;
diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx
index 7c1d6fe7e9b1..98f67468cb0c 100644
--- a/extensions/source/propctrlr/propertycomposer.cxx
+++ b/extensions/source/propctrlr/propertycomposer.cxx
@@ -397,12 +397,9 @@ namespace pcr
{
// TODO: make this cheaper (cache it?)
const StlSyntaxSequence< OUString > aThisHandlersActuatingProps( (*loop)->getActuatingProperties() );
- for ( StlSyntaxSequence< OUString >::const_iterator loopProps = aThisHandlersActuatingProps.begin();
- loopProps != aThisHandlersActuatingProps.end();
- ++loopProps
- )
+ for (const auto & aThisHandlersActuatingProp : aThisHandlersActuatingProps)
{
- if ( *loopProps == _rActuatingPropertyName )
+ if ( aThisHandlersActuatingProp == _rActuatingPropertyName )
{
(*loop)->actuatingPropertyChanged( _rActuatingPropertyName, _rNewValue, _rOldValue,
m_pUIRequestComposer->getUIForPropertyHandler( *loop ),
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 08dffad52f39..40234aec61dd 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -519,9 +519,9 @@ void GridWindow::drawNew(vcl::RenderContext& rRenderContext)
void GridWindow::drawHandles(vcl::RenderContext& rRenderContext)
{
- for(size_t i(0L); i < m_aHandles.size(); i++)
+ for(impHandle & m_aHandle : m_aHandles)
{
- m_aHandles[i].draw(rRenderContext, m_aMarkerBitmap);
+ m_aHandle.draw(rRenderContext, m_aMarkerBitmap);
}
}
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index bb21e1e595a4..eb3f6f5c6efc 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -1413,10 +1413,10 @@ void SaneDlg::SaveState()
"br-x",
"br-y"
};
- for( size_t i = 0; i < SAL_N_ELEMENTS(pSaveOptions); ++i )
+ for(const char * pSaveOption : pSaveOptions)
{
- OString aOption = pSaveOptions[i];
- int nOption = mrSane.GetOptionByName( pSaveOptions[i] );
+ OString aOption = pSaveOption;
+ int nOption = mrSane.GetOptionByName( pSaveOption );
if( nOption > -1 )
{
SANE_Value_Type nType = mrSane.GetOptionType( nOption );
diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx
index 4bec357302e0..35f5e60477e6 100644
--- a/extensions/source/update/check/updatecheckconfig.cxx
+++ b/extensions/source/update/check/updatecheckconfig.cxx
@@ -346,10 +346,10 @@ UpdateCheckConfig::clearLocalFileName()
const sal_uInt8 nItems = 2;
const OUString aNameList[nItems] = { OUString(LOCAL_FILE), OUString(DOWNLOAD_SIZE) };
- for( sal_uInt8 i=0; i < nItems; ++i )
+ for(const auto & i : aNameList)
{
- if( m_xContainer->hasByName(aNameList[i]) )
- m_xContainer->removeByName(aNameList[i]);
+ if( m_xContainer->hasByName(i) )
+ m_xContainer->removeByName(i);
}
commitChanges();
@@ -413,9 +413,9 @@ UpdateCheckConfig::clearUpdateFound()
{
OUString aName;
- for( sal_uInt32 n=0; n < nUpdateEntryProperties; ++n )
+ for(const char* aUpdateEntryPropertie : aUpdateEntryProperties)
{
- aName = OUString::createFromAscii(aUpdateEntryProperties[n]);
+ aName = OUString::createFromAscii(aUpdateEntryPropertie);
try {
if( m_xContainer->hasByName(aName) )