diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-19 09:11:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-19 11:58:42 +0200 |
commit | e750c1f35bb2f6dcd9824a9a4d6adbaf72c44a34 (patch) | |
tree | 3b42247fc4e575fd82d07a4bf11097f74b7d6620 /xmloff | |
parent | 80761fd7cd574a2d71b5b0aeead5d6920db56707 (diff) |
convert XMLTextListAutoStylePool_Impl to sorted_vector<unique_ptr<>>
Change-Id: Ic40e4034b30ec527a3a3dbb0d74506478d2dd0a5
Reviewed-on: https://gerrit.libreoffice.org/60740
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLTextListAutoStylePool.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index a2bd595bd969..3736a201ca74 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -118,8 +118,8 @@ XMLTextListAutoStylePoolEntry_Impl::XMLTextListAutoStylePoolEntry_Impl( struct XMLTextListAutoStylePoolEntryCmp_Impl { bool operator()( - XMLTextListAutoStylePoolEntry_Impl* const& r1, - XMLTextListAutoStylePoolEntry_Impl* const& r2 ) const + std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> const& r1, + std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> const& r2 ) const { if( r1->IsNamed() ) { @@ -137,7 +137,7 @@ struct XMLTextListAutoStylePoolEntryCmp_Impl } } }; -class XMLTextListAutoStylePool_Impl : public o3tl::sorted_vector<XMLTextListAutoStylePoolEntry_Impl*, XMLTextListAutoStylePoolEntryCmp_Impl> {}; +class XMLTextListAutoStylePool_Impl : public o3tl::sorted_vector<std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl>, XMLTextListAutoStylePoolEntryCmp_Impl> {}; XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : rExport( rExp ), @@ -157,8 +157,6 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : XMLTextListAutoStylePool::~XMLTextListAutoStylePool() { - // The XMLTextListAutoStylePoolEntry_Impl object in the pool need delete explicitly in dtor. - pPool->DeleteAndDestroyAll(); } void XMLTextListAutoStylePool::RegisterName( const OUString& rName ) @@ -206,12 +204,12 @@ OUString XMLTextListAutoStylePool::Add( } else { - XMLTextListAutoStylePoolEntry_Impl *pEntry = + std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> pEntry( new XMLTextListAutoStylePoolEntry_Impl( pPool->size(), rNumRules, m_aNames, sPrefix, - nName ); - pPool->insert( pEntry ); + nName )); sName = pEntry->GetName(); + pPool->insert( std::move(pEntry) ); } return sName; @@ -253,7 +251,7 @@ void XMLTextListAutoStylePool::exportXML() const sal_uInt32 i; for( i=0; i < nCount; i++ ) { - XMLTextListAutoStylePoolEntry_Impl *pEntry = (*pPool)[i]; + XMLTextListAutoStylePoolEntry_Impl *pEntry = (*pPool)[i].get(); SAL_WARN_IF( pEntry->GetPos() >= nCount, "xmloff", "Illegal pos" ); aExpEntries[pEntry->GetPos()] = pEntry; } |