summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/baside2b.cxx
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-02-24 10:45:45 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-02-24 11:46:24 +0100
commit8f2d6e80608b7f8cc931e6d7e7280c043fc92ae8 (patch)
treec971155c14f681821432be2ca727920dc5ef1b1c /basctl/source/basicide/baside2b.cxx
parent556c2eaffcdb541317ed148d58c6c973fa6fd0e6 (diff)
Modernize a bit accessibility and basctl
by using for range loops + compare end iterator with "!=" instead of "<" Change-Id: I615a8ca417a58fde4976bb6d8d9112dc5d993a88 Reviewed-on: https://gerrit.libreoffice.org/50277 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'basctl/source/basicide/baside2b.cxx')
-rw-r--r--basctl/source/basicide/baside2b.cxx36
1 files changed, 15 insertions, 21 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 3f81bde3bb5a..f25e60c91a23 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -600,12 +600,11 @@ void EditorWindow::HandleAutoCorrect()
HighlightPortion& r = aPortions.back();
if( static_cast<size_t>(nIndex) != aPortions.size()-1 )
{//cursor is not standing at the end of the line
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- if( i->nEnd == nIndex )
+ if( portion.nEnd == nIndex )
{
- r = *i;
+ r = portion;
break;
}
}
@@ -673,12 +672,11 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
HighlightPortion& r = aPortions.back();
if( static_cast<size_t>(nIndex) != aPortions.size()-1 )
{//cursor is not standing at the end of the line
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- if( i->nEnd == nIndex )
+ if( portion.nEnd == nIndex )
{
- r = *i;
+ r = portion;
break;
}
}
@@ -794,18 +792,17 @@ bool EditorWindow::GetProcedureName(OUString const & rLine, OUString& rProcType,
bool bFoundType = false;
bool bFoundName = false;
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- OUString sTokStr = rLine.copy(i->nBegin, i->nEnd - i->nBegin);
+ OUString sTokStr = rLine.copy(portion.nBegin, portion.nEnd - portion.nBegin);
- if( i->tokenType == TokenType::Keywords && ( sTokStr.equalsIgnoreAsciiCase("sub")
+ if( portion.tokenType == TokenType::Keywords && ( sTokStr.equalsIgnoreAsciiCase("sub")
|| sTokStr.equalsIgnoreAsciiCase("function")) )
{
rProcType = sTokStr;
bFoundType = true;
}
- if( i->tokenType == TokenType::Identifier && bFoundType )
+ if( portion.tokenType == TokenType::Identifier && bFoundType )
{
rProcName = sTokStr;
bFoundName = true;
@@ -1166,11 +1163,10 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( aLine, aPortions );
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(i->tokenType);
- pEditEngine->SetAttrib(TextAttribFontColor(aColor), nLine, i->nBegin, i->nEnd);
+ Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(portion.tokenType);
+ pEditEngine->SetAttrib(TextAttribFontColor(aColor), nLine, portion.nBegin, portion.nEnd);
}
pEditEngine->SetModified(bWasModified);
@@ -1261,11 +1257,9 @@ IMPL_LINK_NOARG(EditorWindow, SyntaxTimerHdl, Timer *, void)
//pEditEngine->SetUpdateMode(false);
bHighlighting = true;
- for ( std::set<sal_uInt16>::const_iterator it = aSyntaxLineTable.begin();
- it != aSyntaxLineTable.end(); ++it )
+ for (auto const& syntaxLine : aSyntaxLineTable)
{
- sal_uInt16 nLine = *it;
- DoSyntaxHighlight( nLine );
+ DoSyntaxHighlight(syntaxLine);
}
// #i45572#