summaryrefslogtreecommitdiff
path: root/sd/source/ui/framework/factories/BasicViewFactory.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-12-13 00:42:49 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-12-13 18:07:25 +0100
commit0f0f8bdc3e5c1534d608f8475d9d3e3df4faddaa (patch)
treeddeb138aafb32e64b7e065406359a79c2d12c4ff /sd/source/ui/framework/factories/BasicViewFactory.cxx
parent3e06873d124c9f8f4cd2e5f5d619de3c99ca09bf (diff)
Simplify containers iterations in sd/source/ui/[a-r]*
Use range-based loop or replace with STL functions Change-Id: I063dc78205a4cd982c252a9b62c456e9660b8790 Reviewed-on: https://gerrit.libreoffice.org/65063 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/framework/factories/BasicViewFactory.cxx')
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx33
1 files changed, 11 insertions, 22 deletions
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index d76eccbde220..7537882625ea 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -109,10 +109,9 @@ void SAL_CALL BasicViewFactory::disposing()
}
// Release the view cache.
- ViewShellContainer::const_iterator iView;
- for (iView=mpViewCache->begin(); iView!=mpViewCache->end(); ++iView)
+ for (const auto& rxView : *mpViewCache)
{
- ReleaseView(*iView, true);
+ ReleaseView(rxView, true);
}
// Release the view shell container. At this point no one other than us
@@ -120,9 +119,9 @@ void SAL_CALL BasicViewFactory::disposing()
// trivial requirement, because no one other than us holds a shared
// pointer).
// ViewShellContainer::const_iterator iView;
- for (iView=mpViewShellContainer->begin(); iView!=mpViewShellContainer->end(); ++iView)
+ for (const auto& rxView : *mpViewShellContainer)
{
- OSL_ASSERT((*iView)->mpViewShell.use_count() == 1);
+ OSL_ASSERT(rxView->mpViewShell.use_count() == 1);
}
mpViewShellContainer.reset();
}
@@ -452,15 +451,8 @@ bool BasicViewFactory::IsCacheable (const std::shared_ptr<ViewDescriptor>& rpDes
return tmp;
}();
- ::std::vector<Reference<XResourceId> >::const_iterator iId;
- for (iId=s_aCacheableResources.begin(); iId!=s_aCacheableResources.end(); ++iId)
- {
- if ((*iId)->compareTo(rpDescriptor->mxViewId) == 0)
- {
- bIsCacheable = true;
- break;
- }
- }
+ bIsCacheable = std::any_of(s_aCacheableResources.begin(), s_aCacheableResources.end(),
+ [&rpDescriptor](const Reference<XResourceId>& rxId) { return rxId->compareTo(rpDescriptor->mxViewId) == 0; });
}
return bIsCacheable;
@@ -473,15 +465,12 @@ std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::GetViewFromC
std::shared_ptr<ViewDescriptor> pDescriptor;
// Search for the requested view in the cache.
- ViewCache::iterator iEntry;
- for (iEntry=mpViewCache->begin(); iEntry!=mpViewCache->end(); ++iEntry)
+ ViewCache::iterator iEntry = std::find_if(mpViewCache->begin(), mpViewCache->end(),
+ [&rxViewId](const ViewCache::value_type& rxEntry) { return rxEntry->mxViewId->compareTo(rxViewId) == 0; });
+ if (iEntry != mpViewCache->end())
{
- if ((*iEntry)->mxViewId->compareTo(rxViewId) == 0)
- {
- pDescriptor = *iEntry;
- mpViewCache->erase(iEntry);
- break;
- }
+ pDescriptor = *iEntry;
+ mpViewCache->erase(iEntry);
}
// When the view has been found then relocate it to the given pane and