Kaydet (Commit) 85538dd3 authored tarafından Julien Nabet's avatar Julien Nabet

Modernize a bit vcl (part1)

by using for-range loops
+ remove useless vars
+ avoid some iterators calculus by using plain loop

Change-Id: I94572bfd56ad9ac76c9899cf68d5ba831009fa7b
Reviewed-on: https://gerrit.libreoffice.org/48777Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 1730d47a
...@@ -501,9 +501,9 @@ void SvpSalGraphics::clipRegion(cairo_t* cr) ...@@ -501,9 +501,9 @@ void SvpSalGraphics::clipRegion(cairo_t* cr)
} }
if (!aRectangles.empty()) if (!aRectangles.empty())
{ {
for (RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter) for (auto const& rectangle : aRectangles)
{ {
cairo_rectangle(cr, aRectIter->Left(), aRectIter->Top(), aRectIter->GetWidth(), aRectIter->GetHeight()); cairo_rectangle(cr, rectangle.Left(), rectangle.Top(), rectangle.GetWidth(), rectangle.GetHeight());
} }
cairo_clip(cr); cairo_clip(cr);
} }
......
...@@ -214,12 +214,12 @@ void SvpSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) ...@@ -214,12 +214,12 @@ void SvpSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
::std::vector< OUString > aPrinters; ::std::vector< OUString > aPrinters;
rManager.listPrinters( aPrinters ); rManager.listPrinters( aPrinters );
for( ::std::vector< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it ) for (auto const& printer : aPrinters)
{ {
const PrinterInfo& rInfo( rManager.getPrinterInfo( *it ) ); const PrinterInfo& rInfo( rManager.getPrinterInfo(printer) );
// create new entry // create new entry
SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
pInfo->maPrinterName = *it; pInfo->maPrinterName = printer;
pInfo->maDriver = rInfo.m_aDriverName; pInfo->maDriver = rInfo.m_aDriverName;
pInfo->maLocation = rInfo.m_aLocation; pInfo->maLocation = rInfo.m_aLocation;
pInfo->maComment = rInfo.m_aComment; pInfo->maComment = rInfo.m_aComment;
......
...@@ -92,9 +92,9 @@ void IconThemeScanner::ScanDirectoryForIconThemes(const OUString& paths) ...@@ -92,9 +92,9 @@ void IconThemeScanner::ScanDirectoryForIconThemes(const OUString& paths)
SAL_WARN("vcl.app", "Could not find any icon themes in the provided directory ('" <<path<<"'."); SAL_WARN("vcl.app", "Could not find any icon themes in the provided directory ('" <<path<<"'.");
continue; continue;
} }
for (std::vector<OUString>::iterator aI = iconThemePaths.begin(); aI != iconThemePaths.end(); ++aI) for (auto const& iconThemePath : iconThemePaths)
{ {
AddIconThemeByPath(*aI); AddIconThemeByPath(iconThemePath);
} }
} }
} }
......
...@@ -94,9 +94,8 @@ public: ...@@ -94,9 +94,8 @@ public:
void push( ScaleRangeContext const &aRC ) { maStrips.push_back( aRC ); } void push( ScaleRangeContext const &aRC ) { maStrips.push_back( aRC ); }
virtual void doWork() override virtual void doWork() override
{ {
std::vector< ScaleRangeContext >::iterator it; for (auto const& strip : maStrips)
for (it = maStrips.begin(); it != maStrips.end(); ++it) mpFn( *(strip.mrCtx), strip.mnStartY, strip.mnEndY );
mpFn( *(it->mrCtx), it->mnStartY, it->mnEndY );
} }
}; };
......
...@@ -2169,11 +2169,11 @@ void RadioButton::group(RadioButton &rOther) ...@@ -2169,11 +2169,11 @@ void RadioButton::group(RadioButton &rOther)
{ {
std::vector< VclPtr<RadioButton> > aOthers(rOther.GetRadioButtonGroup(false)); std::vector< VclPtr<RadioButton> > aOthers(rOther.GetRadioButtonGroup(false));
//make all members of the group share the same button group //make all members of the group share the same button group
for (auto aI = aOthers.begin(), aEnd = aOthers.end(); aI != aEnd; ++aI) for (auto const& elem : aOthers)
{ {
aFind = std::find(m_xGroup->begin(), m_xGroup->end(), *aI); aFind = std::find(m_xGroup->begin(), m_xGroup->end(), elem);
if (aFind == m_xGroup->end()) if (aFind == m_xGroup->end())
m_xGroup->push_back(*aI); m_xGroup->push_back(elem);
} }
} }
...@@ -2238,9 +2238,9 @@ void RadioButton::ImplUncheckAllOther() ...@@ -2238,9 +2238,9 @@ void RadioButton::ImplUncheckAllOther()
std::vector<VclPtr<RadioButton> > aGroup(GetRadioButtonGroup(false)); std::vector<VclPtr<RadioButton> > aGroup(GetRadioButtonGroup(false));
// iterate over radio button group and checked buttons // iterate over radio button group and checked buttons
for (auto aI = aGroup.begin(), aEnd = aGroup.end(); aI != aEnd; ++aI) for (auto const& elem : aGroup)
{ {
VclPtr<RadioButton> pWindow = *aI; VclPtr<RadioButton> pWindow = elem;
if ( pWindow->IsChecked() ) if ( pWindow->IsChecked() )
{ {
pWindow->SetState( false ); pWindow->SetState( false );
......
...@@ -998,10 +998,10 @@ static const OUString ImplMetricToString( FieldUnit rUnit ) ...@@ -998,10 +998,10 @@ static const OUString ImplMetricToString( FieldUnit rUnit )
if( pList ) if( pList )
{ {
// return unit's default string (ie, the first one ) // return unit's default string (ie, the first one )
for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) for (auto const& elem : *pList)
{ {
if ( it->second == rUnit ) if ( elem.second == rUnit )
return it->first; return elem.first;
} }
} }
...@@ -1015,10 +1015,10 @@ FieldUnit MetricFormatter::StringToMetric(const OUString &rMetricString) ...@@ -1015,10 +1015,10 @@ FieldUnit MetricFormatter::StringToMetric(const OUString &rMetricString)
{ {
// return FieldUnit // return FieldUnit
OUString aStr = rMetricString.toAsciiLowerCase().replaceAll(" ", ""); OUString aStr = rMetricString.toAsciiLowerCase().replaceAll(" ", "");
for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) for (auto const& elem : *pList)
{ {
if ( it->first == aStr ) if ( elem.first == aStr )
return it->second; return elem.second;
} }
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment