Simplify the method and fix its description

The description had the copy-paste error since commit
648106f879 (Fri Apr 04 16:12:43 2003 +0000)
when impl_searchMatchingInterceptor was replaced with findByPattern.

Change-Id: I84d8c867b6606ef8adb74df823046b58cf6d9b51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142541
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2022-11-10 11:24:03 +03:00
parent bc9487f745
commit 35be7c8198

View File

@@ -97,23 +97,19 @@ class InterceptionHelper final : public ::cppu::WeakImplHelper<
/** @short search for an interceptor inside this list using it's reference. /** @short search for an interceptor inside this list using it's reference.
@param xInterceptor @param sURL
points to the interceptor object, which should be located inside this list. URL which should match with a registered pattern.
@return An iterator object, which points directly to the located item inside this list. @return An iterator object, which points directly to the located item inside this list.
In case no interceptor could be found, it points to the end of this list! In case no interceptor could be found, it points to the end of this list!
*/ */
iterator findByPattern(std::u16string_view sURL) iterator findByPattern(std::u16string_view sURL)
{ {
iterator pIt; for (iterator pIt=begin(); pIt!=end(); ++pIt)
for (pIt=begin(); pIt!=end(); ++pIt)
{ {
sal_Int32 c = pIt->lURLPattern.getLength(); for (const OUString& pattern : pIt->lURLPattern)
const OUString* pPattern = pIt->lURLPattern.getConstArray();
for (sal_Int32 i=0; i<c; ++i)
{ {
WildCard aPattern(pPattern[i]); WildCard aPattern(pattern);
if (aPattern.Matches(sURL)) if (aPattern.Matches(sURL))
return pIt; return pIt;
} }