[Libreoffice-commits] core.git: 2 commits - editeng/source include/editeng include/svx svx/source sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Apr 9 06:46:36 UTC 2018
editeng/source/uno/unoedsrc.cxx | 4 ++--
editeng/source/uno/unotext2.cxx | 4 ++--
include/editeng/unoedsrc.hxx | 6 +++---
include/svx/ucsubset.hxx | 6 +++---
include/svx/unoshtxt.hxx | 2 +-
svx/source/dialog/charmap.cxx | 8 ++++----
svx/source/unodraw/unoshtxt.cxx | 12 ++++++------
sw/inc/calbck.hxx | 4 ++--
sw/source/core/attr/calbck.cxx | 11 +++++++----
9 files changed, 30 insertions(+), 27 deletions(-)
New commits:
commit 115a8539038ecdd5e496fb6c84101c5b14d11068
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Sun Apr 8 21:36:56 2018 +0200
std::list->std::vector in SubsetMap
Change-Id: I3fa98b787707dcbc555abe6aaa3a11e0fe467308
Reviewed-on: https://gerrit.libreoffice.org/52606
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/editeng/source/uno/unoedsrc.cxx b/editeng/source/uno/unoedsrc.cxx
index 9e2aa24b34ad..1c827472d11b 100644
--- a/editeng/source/uno/unoedsrc.cxx
+++ b/editeng/source/uno/unoedsrc.cxx
@@ -34,9 +34,9 @@ void SvxEditSource::removeRange( SvxUnoTextRangeBase* )
}
-const SvxUnoTextRangeBaseList& SvxEditSource::getRanges() const
+const SvxUnoTextRangeBaseVec& SvxEditSource::getRanges() const
{
- static SvxUnoTextRangeBaseList gList;
+ static SvxUnoTextRangeBaseVec gList;
return gList;
}
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 908485f86683..9c2c26151cfd 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -51,7 +51,7 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
{
if( currentPara>=maSelection.nStartPara && currentPara<=maSelection.nEndPara )
{
- const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
+ const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
SvxUnoTextContent* pContent = nullptr;
sal_Int32 nStartPos = 0;
sal_Int32 nEndPos = mrText.GetEditSource()->GetTextForwarder()->GetTextLen( currentPara );
@@ -405,7 +405,7 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rTe
nEndPos = std::min<sal_uInt16>(nEndPos, mnSel.nEndPos);
ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
- const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
+ const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
SvxUnoTextRange* pRange = nullptr;
for (auto const& elemRange : rRanges)
{
diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx
index 327ad7aeae19..adfdae894aeb 100644
--- a/include/editeng/unoedsrc.hxx
+++ b/include/editeng/unoedsrc.hxx
@@ -30,7 +30,7 @@
#include <editeng/editengdllapi.h>
#include <editeng/editeng.hxx>
-#include <list>
+#include <vector>
struct ESelection;
struct EFieldInfo;
@@ -45,7 +45,7 @@ class SvxFieldItem;
class SfxBroadcaster;
class SvxUnoTextRangeBase;
-typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
+typedef std::vector< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseVec;
/** Wrapper class for unified EditEngine/Outliner access
@@ -122,7 +122,7 @@ public:
/** returns a const list of all text ranges that are registered
for the underlying text object. */
- virtual const SvxUnoTextRangeBaseList& getRanges() const;
+ virtual const SvxUnoTextRangeBaseVec& getRanges() const;
};
diff --git a/include/svx/ucsubset.hxx b/include/svx/ucsubset.hxx
index ae5286ec3863..121b790d47eb 100644
--- a/include/svx/ucsubset.hxx
+++ b/include/svx/ucsubset.hxx
@@ -52,7 +52,7 @@ inline bool operator<(const Subset &rLHS, const Subset &rRHS)
return rLHS.GetRangeMin() < rRHS.GetRangeMin();
}
-typedef ::std::list<Subset> SubsetList;
+typedef ::std::vector<Subset> SubsetVec;
class SVX_DLLPUBLIC SubsetMap
{
@@ -60,10 +60,10 @@ public:
SubsetMap( const FontCharMapRef& );
const Subset* GetSubsetByUnicode( sal_UCS4 ) const;
- const SubsetList& GetSubsetMap() const;
+ const SubsetVec& GetSubsetMap() const;
private:
- SubsetList maSubsets;
+ SubsetVec maSubsets;
SVX_DLLPRIVATE void InitList();
SVX_DLLPRIVATE void ApplyCharMap( const FontCharMapRef& );
diff --git a/include/svx/unoshtxt.hxx b/include/svx/unoshtxt.hxx
index f16358d2432d..7cb75bd1f118 100644
--- a/include/svx/unoshtxt.hxx
+++ b/include/svx/unoshtxt.hxx
@@ -64,7 +64,7 @@ public:
virtual void addRange( SvxUnoTextRangeBase* pNewRange ) override;
virtual void removeRange( SvxUnoTextRangeBase* pOldRange ) override;
- virtual const SvxUnoTextRangeBaseList& getRanges() const override;
+ virtual const SvxUnoTextRangeBaseVec& getRanges() const override;
virtual SfxBroadcaster& GetBroadcaster() const override;
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 31db13cf61f7..8565db970e6f 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -865,7 +865,7 @@ SubsetMap::SubsetMap( const FontCharMapRef& rxFontCharMap )
ApplyCharMap(rxFontCharMap);
}
-const SubsetList& SubsetMap::GetSubsetMap() const
+const SubsetVec& SubsetMap::GetSubsetMap() const
{
return maSubsets;
}
@@ -885,7 +885,7 @@ inline Subset::Subset(sal_UCS4 nMin, sal_UCS4 nMax, const OUString& rName)
void SubsetMap::InitList()
{
- static SubsetList aAllSubsets;
+ static SubsetVec aAllSubsets;
static bool bInit = true;
if( bInit )
{
@@ -1769,7 +1769,7 @@ void SubsetMap::InitList()
#endif
}
- aAllSubsets.sort();
+ std::stable_sort(aAllSubsets.begin(), aAllSubsets.end());
}
maSubsets = aAllSubsets;
@@ -1781,7 +1781,7 @@ void SubsetMap::ApplyCharMap( const FontCharMapRef& rxFontCharMap )
return;
// remove subsets that are not matched in any range
- SubsetList::iterator it = maSubsets.begin();
+ auto it = maSubsets.begin();
while(it != maSubsets.end())
{
const Subset& rSubset = *it;
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index f09305dd9939..a90040b10a86 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -99,7 +99,7 @@ private:
bool mbNotificationsDisabled; // prevent EditEngine/Outliner notifications (e.g. when setting up forwarder)
bool mbNotifyEditOutlinerSet;
- SvxUnoTextRangeBaseList maTextRanges;
+ SvxUnoTextRangeBaseVec mvTextRanges;
SvxTextForwarder* GetBackgroundTextForwarder();
SvxTextForwarder* GetEditModeTextForwarder();
@@ -132,7 +132,7 @@ public:
void addRange( SvxUnoTextRangeBase* pNewRange );
void removeRange( SvxUnoTextRangeBase* pOldRange );
- const SvxUnoTextRangeBaseList& getRanges() const { return maTextRanges;}
+ const SvxUnoTextRangeBaseVec& getRanges() const { return mvTextRanges;}
void lock();
void unlock();
@@ -238,15 +238,15 @@ SvxTextEditSourceImpl::~SvxTextEditSourceImpl()
void SvxTextEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange )
{
if( pNewRange )
- if( std::find( maTextRanges.begin(), maTextRanges.end(), pNewRange ) == maTextRanges.end() )
- maTextRanges.push_back( pNewRange );
+ if( std::find( mvTextRanges.begin(), mvTextRanges.end(), pNewRange ) == mvTextRanges.end() )
+ mvTextRanges.push_back( pNewRange );
}
void SvxTextEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange )
{
if( pOldRange )
- maTextRanges.remove( pOldRange );
+ mvTextRanges.erase( std::remove(mvTextRanges.begin(), mvTextRanges.end(), pOldRange), mvTextRanges.end() );
}
@@ -1050,7 +1050,7 @@ void SvxTextEditSource::removeRange( SvxUnoTextRangeBase* pOldRange )
mpImpl->removeRange( pOldRange );
}
-const SvxUnoTextRangeBaseList& SvxTextEditSource::getRanges() const
+const SvxUnoTextRangeBaseVec& SvxTextEditSource::getRanges() const
{
return mpImpl->getRanges();
}
commit e463ab92c3be84c603fe855464c213efb93b2120
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Sat Apr 7 21:26:29 2018 +0200
std::list->std::vector in sw::WriterMultiListener
for small objects like pointers, much more cache-friendly
Change-Id: I37a77c437fd53f5774e9752565f463f764f29c9a
Reviewed-on: https://gerrit.libreoffice.org/52562
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index cdf1e9b612dc..8843f2a45838 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -26,7 +26,7 @@
#include "ring.hxx"
#include "hintids.hxx"
#include <type_traits>
-#include <list>
+#include <vector>
#include <memory>
@@ -265,7 +265,7 @@ namespace sw
typedef std::unique_ptr<SwDepend> pointer_t;
#endif
SwClient& m_rToTell;
- std::list<pointer_t> m_vDepends;
+ std::vector<pointer_t> m_vDepends;
public:
WriterMultiListener(SwClient& rToTell)
: m_rToTell(rToTell) {}
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 8f97761e38fe..ca75f06904df 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -314,10 +314,13 @@ bool sw::WriterMultiListener::IsListeningTo(const SwModify* const pBroadcaster)
void sw::WriterMultiListener::EndListening(SwModify* pBroadcaster)
{
- m_vDepends.remove_if( [&pBroadcaster](const pointer_t& pListener)
- {
- return pListener->GetRegisteredIn() == nullptr || pListener->GetRegisteredIn() == pBroadcaster;
- });
+ m_vDepends.erase(
+ std::remove_if( m_vDepends.begin(), m_vDepends.end(),
+ [&pBroadcaster](const pointer_t& pListener)
+ {
+ return pListener->GetRegisteredIn() == nullptr || pListener->GetRegisteredIn() == pBroadcaster;
+ }),
+ m_vDepends.end());
}
void sw::WriterMultiListener::EndListeningAll()
More information about the Libreoffice-commits
mailing list