summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-10 14:49:40 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-10 16:52:53 +0100
commitba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5 (patch)
tree31e69726116d87a088d561cadae96bf2e08d07a4 /dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
parent351043e5120470ff4d382f01e4c2f215ba84ef59 (diff)
Modernize a bit more dbaccess (part2)
mainly by using for-range loops but also by simplifying some simple algo Change-Id: If5ce6d901761db2b872a99e6de0eb6d2f098df99 Reviewed-on: https://gerrit.libreoffice.org/51044 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx')
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index 366c827a9744..ddebfc064ddd 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -77,13 +77,20 @@ namespace dbaui
if( m_pLine )
{
// search the position of our table window in the table window map
+ // TODO JNA Shouldn't nIndex begin at 0?
nIndex = m_pLine->GetParent()->GetTabWinMap().size();
const auto& rVec = m_pLine->GetParent()->getTableConnections();
- auto aIter = rVec.begin();
- auto aEnd = rVec.end();
- for (; aIter != aEnd && (*aIter).get() != m_pLine; ++nIndex,++aIter)
- ;
- nIndex = ( aIter != aEnd ) ? nIndex : -1;
+ bool bFound = false;
+ for (auto const& elem : rVec)
+ {
+ if (elem.get() == m_pLine)
+ {
+ bFound = true;
+ break;
+ }
+ ++nIndex;
+ }
+ nIndex = bFound ? nIndex : -1;
}
return nIndex;
}