diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2020-12-29 12:43:40 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-31 08:48:10 +0100 |
commit | 77f6990b5b990d7e9b247a36f0ed8cb72d00cd69 (patch) | |
tree | 1039f2fdfb468a9c1adb3241c07098218bc0a0da /xmloff | |
parent | 8c9cc54bd7b6f3ba723d7a42ccc6a5372a80f970 (diff) |
remove unnecessary list member counter
std::list::size() has constant complexity since C++11
Change-Id: I97c4b0a2d4fe899bcdf5fd2492fed69ed26c20e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108342
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlexppr.cxx | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 893e0fb36ee4..a9cc2962155e 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -156,7 +156,6 @@ typedef std::list<FilterPropertyInfo_Impl> FilterPropertyInfoList_Impl; class FilterPropertiesInfo_Impl { - sal_uInt32 nCount; FilterPropertyInfoList_Impl aPropInfos; std::unique_ptr<Sequence<OUString>> pApiNames; @@ -171,11 +170,10 @@ public: const Reference< XPropertySet >& xPropSet, const rtl::Reference< XMLPropertySetMapper >& maPropMapper, const bool bDefault); - sal_uInt32 GetPropertyCount() const { return nCount; } + sal_uInt32 GetPropertyCount() const { return aPropInfos.size(); } }; FilterPropertiesInfo_Impl::FilterPropertiesInfo_Impl() : - nCount(0), aPropInfos() { } @@ -184,7 +182,6 @@ void FilterPropertiesInfo_Impl::AddProperty( const OUString& rApiName, const sal_uInt32 nIndex) { aPropInfos.emplace_back(rApiName, nIndex); - nCount++; OSL_ENSURE( !pApiNames, "performance warning: API names already retrieved" ); pApiNames.reset(); @@ -192,7 +189,6 @@ void FilterPropertiesInfo_Impl::AddProperty( const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() { - OSL_ENSURE(nCount == aPropInfos.size(), "wrong property count"); if( !pApiNames ) { // we have to do three things: @@ -204,7 +200,7 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() aPropInfos.sort(); // merge duplicates - if ( nCount > 1 ) + if ( aPropInfos.size() > 1 ) { FilterPropertyInfoList_Impl::iterator aOld = aPropInfos.begin(); FilterPropertyInfoList_Impl::iterator aEnd = aPropInfos.end(); @@ -225,7 +221,6 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() aCurrent->GetIndexes().clear(); // erase element, and continue with next aCurrent = aPropInfos.erase( aCurrent ); - nCount--; } else { @@ -237,7 +232,7 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() } // construct sequence - pApiNames.reset( new Sequence < OUString >( nCount ) ); + pApiNames.reset( new Sequence < OUString >( aPropInfos.size() ) ); OUString *pNames = pApiNames->getArray(); for (auto const& propInfo : aPropInfos) @@ -273,7 +268,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray( FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin()); XMLPropertyState aNewProperty( -1 ); sal_uInt32 i = 0; - while (nResultCount > 0 && i < nCount) + while (nResultCount > 0 && i < aPropInfos.size()) { if (pResults->Name == aPropIter->GetApiName()) { @@ -299,7 +294,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray( OSL_ENSURE( rApiNames.getLength() == aResults.getLength(), "wrong implemented XTolerantMultiPropertySet" ); FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin()); XMLPropertyState aNewProperty( -1 ); - OSL_ENSURE( nCount == static_cast<sal_uInt32>(aResults.getLength()), "wrong implemented XTolerantMultiPropertySet??" ); + OSL_ENSURE( aPropInfos.size() == static_cast<sal_uInt32>(aResults.getLength()), "wrong implemented XTolerantMultiPropertySet??" ); for( const auto& rResult : aResults ) { if ((rResult.Result == beans::TolerantPropertySetResultType::SUCCESS) && @@ -339,7 +334,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray( sal_uInt32 nValueCount = 0; sal_uInt32 i; - for( i = 0; i < nCount; ++i, ++pStates ) + for( i = 0; i < aPropInfos.size(); ++i, ++pStates ) { if( *pStates == PropertyState_DIRECT_VALUE ) nValueCount++; @@ -400,7 +395,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray( const Any *pValues = aValues.getConstArray(); FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin(); - for(sal_uInt32 i = 0; i < nCount; ++i) + for(sal_uInt32 i = 0; i < aPropInfos.size(); ++i) { // The value is stored in the PropertySet itself, add to list. XMLPropertyState aNewProperty( -1 ); @@ -418,7 +413,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray( else { FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin(); - for(sal_uInt32 i = 0; i < nCount; ++i) + for(sal_uInt32 i = 0; i < aPropInfos.size(); ++i) { bool bDirectValue = !pStates || *pStates == PropertyState_DIRECT_VALUE; |