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

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

Change-Id: Iabe9ccea6a5e9753348895cca4546c89fc6971cf
üst 07ecb171
...@@ -58,7 +58,8 @@ ...@@ -58,7 +58,8 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include "ndtxt.hxx" #include "ndtxt.hxx"
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
#include <limits.h> #include <limits.h>
...@@ -293,8 +294,7 @@ class SwXMLTableRow_Impl ...@@ -293,8 +294,7 @@ class SwXMLTableRow_Impl
OUString aStyleName; OUString aStyleName;
OUString aDfltCellStyleName; OUString aDfltCellStyleName;
OUString mXmlId; OUString mXmlId;
boost::ptr_vector<SwXMLTableCell_Impl> std::vector<std::unique_ptr<SwXMLTableCell_Impl>> m_Cells;
aCells;
bool bSplitable; bool bSplitable;
public: public:
...@@ -338,7 +338,7 @@ SwXMLTableRow_Impl::SwXMLTableRow_Impl( const OUString& rStyleName, ...@@ -338,7 +338,7 @@ SwXMLTableRow_Impl::SwXMLTableRow_Impl( const OUString& rStyleName,
for( sal_uInt32 i=0U; i<nCells; ++i ) for( sal_uInt32 i=0U; i<nCells; ++i )
{ {
aCells.push_back( new SwXMLTableCell_Impl ); m_Cells.push_back(std::unique_ptr<SwXMLTableCell_Impl>(new SwXMLTableCell_Impl));
} }
} }
...@@ -347,9 +347,9 @@ inline SwXMLTableCell_Impl *SwXMLTableRow_Impl::GetCell( sal_uInt32 nCol ) ...@@ -347,9 +347,9 @@ inline SwXMLTableCell_Impl *SwXMLTableRow_Impl::GetCell( sal_uInt32 nCol )
OSL_ENSURE( nCol < USHRT_MAX, OSL_ENSURE( nCol < USHRT_MAX,
"SwXMLTableRow_Impl::GetCell: column number is to big" ); "SwXMLTableRow_Impl::GetCell: column number is to big" );
// #i95726# - some fault tolerance // #i95726# - some fault tolerance
OSL_ENSURE( nCol < aCells.size(), OSL_ENSURE( nCol < m_Cells.size(),
"SwXMLTableRow_Impl::GetCell: column number is out of bound" ); "SwXMLTableRow_Impl::GetCell: column number is out of bound" );
return nCol < aCells.size() ? &aCells[nCol] : 0; return nCol < m_Cells.size() ? m_Cells[nCol].get() : nullptr;
} }
void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, bool bOneCell ) void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, bool bOneCell )
...@@ -359,15 +359,15 @@ void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, bool bOneCell ) ...@@ -359,15 +359,15 @@ void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, bool bOneCell )
if( nCells > USHRT_MAX ) if( nCells > USHRT_MAX )
nCells = USHRT_MAX; nCells = USHRT_MAX;
sal_uInt32 nColSpan = nCells - aCells.size(); sal_uInt32 nColSpan = nCells - m_Cells.size();
for( size_t i=aCells.size(); i<nCells; ++i ) for (size_t i = m_Cells.size(); i < nCells; ++i)
{ {
aCells.push_back( new SwXMLTableCell_Impl( 1UL, m_Cells.push_back(std::unique_ptr<SwXMLTableCell_Impl>(
bOneCell ? nColSpan : 1UL ) ); new SwXMLTableCell_Impl(1UL, (bOneCell) ? nColSpan : 1UL)));
nColSpan--; nColSpan--;
} }
OSL_ENSURE( nCells<=aCells.size(), OSL_ENSURE( nCells <= m_Cells.size(),
"SwXMLTableRow_Impl::Expand: wrong number of cells" ); "SwXMLTableRow_Impl::Expand: wrong number of cells" );
} }
...@@ -382,8 +382,10 @@ inline void SwXMLTableRow_Impl::Set( const OUString& rStyleName, ...@@ -382,8 +382,10 @@ inline void SwXMLTableRow_Impl::Set( const OUString& rStyleName,
void SwXMLTableRow_Impl::Dispose() void SwXMLTableRow_Impl::Dispose()
{ {
for( size_t i=0; i < aCells.size(); ++i ) for (auto & pCell : m_Cells)
aCells[i].Dispose(); {
pCell->Dispose();
}
} }
class SwXMLTableCellContext_Impl : public SvXMLImportContext class SwXMLTableCellContext_Impl : public SvXMLImportContext
......
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