summaryrefslogtreecommitdiff
path: root/idlc/source/astscope.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-02-16 18:39:23 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-18 07:41:05 +0100
commit44841a6778821be3e68ab15819b39064b20e968f (patch)
tree8e9119cf35764f18f5b008e7758c6f950306fb8c /idlc/source/astscope.cxx
parentbcfbd24be02d2de5d4d27c147dc58c4515a9a0f5 (diff)
Simplify containers iterations in [f-l]*
Use range-based loop or replace with STL functions Change-Id: Ib3fab47318d1bfbb4df8f886a8cd9596525a420f Reviewed-on: https://gerrit.libreoffice.org/67914 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idlc/source/astscope.cxx')
-rw-r--r--idlc/source/astscope.cxx14
1 files changed, 2 insertions, 12 deletions
diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx
index 1ddda3984458..9af691501a8a 100644
--- a/idlc/source/astscope.cxx
+++ b/idlc/source/astscope.cxx
@@ -85,18 +85,8 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl)
sal_uInt16 AstScope::getNodeCount(NodeType nodeType) const
{
- DeclList::const_iterator iter = getIteratorBegin();
- DeclList::const_iterator end = getIteratorEnd();
- sal_uInt16 count = 0;
-
- while ( iter != end )
- {
- AstDeclaration* pDecl = *iter;
- if ( pDecl->getNodeType() == nodeType )
- count++;
- ++iter;
- }
- return count;
+ return static_cast<sal_uInt16>(std::count_if(getIteratorBegin(), getIteratorEnd(),
+ [&nodeType](const AstDeclaration* pDecl) { return pDecl->getNodeType() == nodeType; }));
}
AstDeclaration* AstScope::lookupByName(const OString& scopedName)