comphelper/source/container/NamedPropertyValuesContainer.cxx |    2 +-
 comphelper/source/misc/DirectoryHelper.cxx                   |    2 +-
 comphelper/source/misc/graphicmimetype.cxx                   |    2 +-
 comphelper/source/property/opropertybag.cxx                  |    4 ++--
 comphelper/source/property/propagg.cxx                       |    4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 967c43bf55a22f71b98ed097612a03779c7021cf
Author:     Raul Feier <[email protected]>
AuthorDate: Wed Dec 3 21:37:33 2025 +0200
Commit:     Gabriel Masei <[email protected]>
CommitDate: Wed Dec 10 16:26:03 2025 +0100

    tdf#158237 use c++20 contains() instead of find() and end()
    
    Change-Id: Idffad61325c531fb65398cf838d90fd3497b4d72
    Signed-off-by: Raul Feier <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194965
    Tested-by: Jenkins
    Reviewed-by: Gabriel Masei <[email protected]>

diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx 
b/comphelper/source/container/NamedPropertyValuesContainer.cxx
index 9759c2bce706..32a8c25784a3 100644
--- a/comphelper/source/container/NamedPropertyValuesContainer.cxx
+++ b/comphelper/source/container/NamedPropertyValuesContainer.cxx
@@ -73,7 +73,7 @@ NamedPropertyValuesContainer::NamedPropertyValuesContainer() 
noexcept
 // XNameContainer
 void SAL_CALL NamedPropertyValuesContainer::insertByName( const OUString& 
aName, const uno::Any& aElement )
 {
-    if( maProperties.find( aName ) != maProperties.end() )
+    if( maProperties.contains( aName ) )
         throw container::ElementExistException();
 
     uno::Sequence<beans::PropertyValue> aProps;
diff --git a/comphelper/source/misc/DirectoryHelper.cxx 
b/comphelper/source/misc/DirectoryHelper.cxx
index badfe9b62d80..76f1e44dec58 100644
--- a/comphelper/source/misc/DirectoryHelper.cxx
+++ b/comphelper/source/misc/DirectoryHelper.cxx
@@ -160,7 +160,7 @@ bool DirectoryHelper::moveDirContent(const OUString& 
rSourceDirURL,
 
     for (const auto& dir : aDirs)
     {
-        const bool bExcluded(!rExcludeList.empty() && rExcludeList.find(dir) 
!= rExcludeList.end());
+        const bool bExcluded(!rExcludeList.empty() && 
rExcludeList.contains(dir));
 
         if (!bExcluded)
         {
diff --git a/comphelper/source/misc/graphicmimetype.cxx 
b/comphelper/source/misc/graphicmimetype.cxx
index 9981b33ed386..f9e1f11157fd 100644
--- a/comphelper/source/misc/graphicmimetype.cxx
+++ b/comphelper/source/misc/graphicmimetype.cxx
@@ -222,7 +222,7 @@ auto IsMediaMimeType(OUString const& rMimeType) -> bool
             mimes.insert(OStringToOUString(it.second, RTL_TEXTENCODING_UTF8));
         }
     }
-    return rMimeType == AVMEDIA_MIMETYPE_COMMON || mimes.find(rMimeType) != 
mimes.end();
+    return rMimeType == AVMEDIA_MIMETYPE_COMMON || mimes.contains(rMimeType);
 }
 
 auto GuessMediaMimeType(::std::u16string_view rFileName) -> OUString
diff --git a/comphelper/source/property/opropertybag.cxx 
b/comphelper/source/property/opropertybag.cxx
index eec379ffd761..16e3e5167fb3 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -205,7 +205,7 @@ namespace comphelper
             // check whether the type is allowed, everything else will be 
checked
             // by m_aDynamicProperties
             if (!m_aAllowedTypes.empty()
-                && m_aAllowedTypes.find(aProperty.Type) == 
m_aAllowedTypes.end())
+                && !m_aAllowedTypes.contains(aProperty.Type))
                 throw IllegalArgumentException(u"not in list of allowed 
types"_ustr, *this, 1);
 
             m_aDynamicProperties.addVoidProperty(aProperty.Name, 
aProperty.Type, findFreeHandle(),
@@ -310,7 +310,7 @@ namespace comphelper
             // by m_aDynamicProperties
             const Type& aPropertyType = _rInitialValue.getValueType();
             if (_rInitialValue.hasValue() && !m_aAllowedTypes.empty()
-                && m_aAllowedTypes.find(aPropertyType) == 
m_aAllowedTypes.end())
+                && !m_aAllowedTypes.contains(aPropertyType))
                 throw IllegalTypeException(OUString(), *this);
 
             m_aDynamicProperties.addProperty(_rName, findFreeHandle(), 
_nAttributes,
diff --git a/comphelper/source/property/propagg.cxx 
b/comphelper/source/property/propagg.cxx
index f84649b3bf19..08a1471160c3 100644
--- a/comphelper/source/property/propagg.cxx
+++ b/comphelper/source/property/propagg.cxx
@@ -87,7 +87,7 @@ 
OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper(
     for ( std::size_t nMPLoop = 0; nMPLoop < m_aProperties.size(); ++nMPLoop )
     {
         auto &prop = m_aProperties[ nMPLoop ];
-        if ( aDelegatorProps.find( prop.Name ) != aDelegatorProps.end() )
+        if ( aDelegatorProps.contains( prop.Name ) )
         {
             m_aPropertyAccessors.insert_or_assign(
                 prop.Handle, OPropertyAccessor( -1, nMPLoop, false ));
@@ -101,7 +101,7 @@ 
OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper(
             if ( _pInfoService )
                 nHandle = _pInfoService->getPreferredPropertyId( prop.Name );
 
-            if ( ( -1 == nHandle ) || ( existingHandles.find( nHandle ) != 
existingHandles.end() ) )
+            if ( ( -1 == nHandle ) || ( existingHandles.contains( nHandle ) ) )
             {
                 // 1. no handle from the info service -> default
                 // 2. conflicts -> use another one (which we don't check 
anymore, assuming _nFirstAggregateId was large enough)

Reply via email to