summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSakura286 <sakura286@outlook.com>2024-10-18 13:52:44 +0800
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-10-18 10:02:51 +0200
commit7bd9aaccb99287e4e50fb18759edc7688502a1fb (patch)
tree14240534f2155d5c4fe1938fe826324086297ea4
parentf6033dca9dc5e2640e796c2ba8853a8e157e338c (diff)
tdf#158237 comphelper: Use C++20 contains() instead of find() and end()
Change-Id: I3fc233ffc4c57b02e605306cb9bf3903a88401a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175116 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--comphelper/source/property/ChainablePropertySetInfo.cxx2
-rw-r--r--comphelper/source/property/MasterPropertySetInfo.cxx2
-rw-r--r--comphelper/source/property/propertysetinfo.cxx4
-rw-r--r--include/comphelper/sequenceashashmap.hxx2
4 files changed, 5 insertions, 5 deletions
diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx
index 4515e5c4314b..a68c0c32c5d5 100644
--- a/comphelper/source/property/ChainablePropertySetInfo.cxx
+++ b/comphelper/source/property/ChainablePropertySetInfo.cxx
@@ -89,7 +89,7 @@ Property SAL_CALL ChainablePropertySetInfo::getPropertyByName( const OUString& r
sal_Bool SAL_CALL ChainablePropertySetInfo::hasPropertyByName( const OUString& rName )
{
- return maMap.find ( rName ) != maMap.end();
+ return maMap.contains( rName );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx
index 4040b479a05c..c7ec69b56ecf 100644
--- a/comphelper/source/property/MasterPropertySetInfo.cxx
+++ b/comphelper/source/property/MasterPropertySetInfo.cxx
@@ -99,7 +99,7 @@ Property SAL_CALL MasterPropertySetInfo::getPropertyByName( const OUString& rNam
sal_Bool SAL_CALL MasterPropertySetInfo::hasPropertyByName( const OUString& rName )
{
- return maMap.find ( rName ) != maMap.end();
+ return maMap.contains( rName );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx
index 1d4ad2be8d25..2f959d25dfe4 100644
--- a/comphelper/source/property/propertysetinfo.cxx
+++ b/comphelper/source/property/propertysetinfo.cxx
@@ -37,7 +37,7 @@ PropertySetInfo::PropertySetInfo( std::span<const PropertyMapEntry> pMap ) noexc
for (const auto & rEntry : pMap)
{
// check for duplicates
- assert(maPropertyMap.find(rEntry.maName) == maPropertyMap.end());
+ assert(!maPropertyMap.contains(rEntry.maName));
// Make sure there are no accidental empty entries left at the end of the array from
// when this method used to take a empty-terminated array.
assert(!rEntry.maName.isEmpty());
@@ -56,7 +56,7 @@ void PropertySetInfo::add( std::span<PropertyMapEntry const> pMap ) noexcept
for (const auto & rEntry : pMap)
{
// check for duplicates
- assert(maPropertyMap.find(rEntry.maName) == maPropertyMap.end());
+ assert(!maPropertyMap.contains(rEntry.maName));
// Make sure there are no accidental empty entries left at the end of the array from
// when this method used to take a empty-terminated array.
assert(!rEntry.maName.isEmpty());
diff --git a/include/comphelper/sequenceashashmap.hxx b/include/comphelper/sequenceashashmap.hxx
index e0de5ead44f8..f7d669468156 100644
--- a/include/comphelper/sequenceashashmap.hxx
+++ b/include/comphelper/sequenceashashmap.hxx
@@ -297,7 +297,7 @@ class SAL_WARN_UNUSED COMPHELPER_DLLPUBLIC SequenceAsHashMap
bool createItemIfMissing(const OUString& sKey ,
const TValueType& aValue)
{
- if (m_aMap.find(sKey) == m_aMap.end())
+ if (!m_aMap.contains(sKey))
{
(*this)[sKey] = css::uno::toAny(aValue);
return true;