Kaydet (Commit) bf211635 authored tarafından Michael Stahl's avatar Michael Stahl

sw: replace boost::ptr_vector with std::vector<std::unique_ptr>

Change-Id: I4abd8fcbbe8ef439097eed7c2b20584450182cd5
üst 0a601a0c
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <redline.hxx> #include <redline.hxx>
#include <boost/ptr_container/ptr_vector.hpp> #include <memory>
#include <vector>
class SfxItemSet; class SfxItemSet;
class SwFormatColl; class SwFormatColl;
...@@ -65,17 +66,17 @@ public: ...@@ -65,17 +66,17 @@ public:
class SwRedlineSaveDatas { class SwRedlineSaveDatas {
private: private:
boost::ptr_vector<SwRedlineSaveData> mvData; std::vector<std::unique_ptr<SwRedlineSaveData>> m_Data;
public: public:
SwRedlineSaveDatas() : mvData() {} SwRedlineSaveDatas() : m_Data() {}
void clear() { mvData.clear(); } void clear() { m_Data.clear(); }
bool empty() const { return mvData.empty(); } bool empty() const { return m_Data.empty(); }
size_t size() const { return mvData.size(); } size_t size() const { return m_Data.size(); }
void push_back (SwRedlineSaveData* value) { mvData.push_back(value); } void push_back(std::unique_ptr<SwRedlineSaveData> pNew) { m_Data.push_back(std::move(pNew)); }
const SwRedlineSaveData& operator[]( size_t nIdx ) const { return mvData[ nIdx ]; } const SwRedlineSaveData& operator[](size_t const nIdx) const { return *m_Data[ nIdx ]; }
SwRedlineSaveData& operator[]( size_t nIdx ) { return mvData[ nIdx ]; } SwRedlineSaveData& operator[](size_t const nIdx) { return *m_Data[ nIdx ]; }
}; };
namespace sw { namespace sw {
......
...@@ -979,7 +979,6 @@ bool SwUndo::FillSaveData( ...@@ -979,7 +979,6 @@ bool SwUndo::FillSaveData(
{ {
rSData.clear(); rSData.clear();
SwRedlineSaveData* pNewData;
const SwPosition* pStt = rRange.Start(); const SwPosition* pStt = rRange.Start();
const SwPosition* pEnd = rRange.End(); const SwPosition* pEnd = rRange.End();
const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
...@@ -996,8 +995,9 @@ bool SwUndo::FillSaveData( ...@@ -996,8 +995,9 @@ bool SwUndo::FillSaveData(
&& eCmpPos != POS_COLLIDE_END && eCmpPos != POS_COLLIDE_END
&& eCmpPos != POS_COLLIDE_START ) && eCmpPos != POS_COLLIDE_START )
{ {
pNewData = new SwRedlineSaveData( eCmpPos, *pStt, *pEnd, *pRedl, bCopyNext ); std::unique_ptr<SwRedlineSaveData> pNewData(
rSData.push_back( pNewData ); new SwRedlineSaveData(eCmpPos, *pStt, *pEnd, *pRedl, bCopyNext));
rSData.push_back(std::move(pNewData));
} }
} }
if( !rSData.empty() && bDelRange ) if( !rSData.empty() && bDelRange )
...@@ -1013,7 +1013,6 @@ bool SwUndo::FillSaveDataForFormat( ...@@ -1013,7 +1013,6 @@ bool SwUndo::FillSaveDataForFormat(
{ {
rSData.clear(); rSData.clear();
SwRedlineSaveData* pNewData;
const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End(); const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
sal_uInt16 n = 0; sal_uInt16 n = 0;
...@@ -1029,8 +1028,9 @@ bool SwUndo::FillSaveDataForFormat( ...@@ -1029,8 +1028,9 @@ bool SwUndo::FillSaveDataForFormat(
&& eCmpPos != POS_COLLIDE_END && eCmpPos != POS_COLLIDE_END
&& eCmpPos != POS_COLLIDE_START ) && eCmpPos != POS_COLLIDE_START )
{ {
pNewData = new SwRedlineSaveData( eCmpPos, *pStt, *pEnd, *pRedl, true ); std::unique_ptr<SwRedlineSaveData> pNewData(
rSData.push_back( pNewData ); new SwRedlineSaveData(eCmpPos, *pStt, *pEnd, *pRedl, true));
rSData.push_back(std::move(pNewData));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment