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

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

Change-Id: I1f77947b6f9fde4c949d32d524740be0951572af
üst 6e3188ef
...@@ -90,6 +90,8 @@ ...@@ -90,6 +90,8 @@
#include <unomid.h> #include <unomid.h>
#include <IDocumentMarkAccess.hxx> #include <IDocumentMarkAccess.hxx>
#include <o3tl/make_unique.hxx>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <memory> #include <memory>
#include <swuiexp.hxx> #include <swuiexp.hxx>
...@@ -856,23 +858,19 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, HeaderHdl, Button*, pButton, void ) ...@@ -856,23 +858,19 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, HeaderHdl, Button*, pButton, void )
static void lcl_InsTextInArr( const OUString& rText, DB_Columns& rColArr ) static void lcl_InsTextInArr( const OUString& rText, DB_Columns& rColArr )
{ {
DB_Column* pNew;
sal_Int32 nSttPos = 0, nFndPos; sal_Int32 nSttPos = 0, nFndPos;
while( -1 != ( nFndPos = rText.indexOf( '\x0A', nSttPos )) ) while( -1 != ( nFndPos = rText.indexOf( '\x0A', nSttPos )) )
{ {
if( 1 < nFndPos ) if( 1 < nFndPos )
{ {
pNew = new DB_Column( rText.copy( nSttPos, nFndPos -1 ) ); rColArr.push_back(o3tl::make_unique<DB_Column>(rText.copy(nSttPos, nFndPos -1)));
rColArr.push_back( pNew );
} }
pNew = new DB_Column; rColArr.push_back(o3tl::make_unique<DB_Column>());
rColArr.push_back( pNew );
nSttPos = nFndPos + 1; nSttPos = nFndPos + 1;
} }
if( nSttPos < rText.getLength() ) if( nSttPos < rText.getLength() )
{ {
pNew = new DB_Column( rText.copy( nSttPos ) ); rColArr.push_back(o3tl::make_unique<DB_Column>(rText.copy(nSttPos)));
rColArr.push_back( pNew );
} }
} }
...@@ -940,7 +938,7 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText, ...@@ -940,7 +938,7 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText,
else else
pNew = new DB_Column( rFndCol, nFormat ); pNew = new DB_Column( rFndCol, nFormat );
rColArr.push_back( pNew ); rColArr.push_back( std::unique_ptr<DB_Column>(pNew) );
} }
} }
} }
...@@ -1276,7 +1274,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, ...@@ -1276,7 +1274,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
for( size_t n = 0; n < nCols; ++n ) for( size_t n = 0; n < nCols; ++n )
{ {
DB_Column* pDBCol = &aColArr[ n ]; DB_Column* pDBCol = aColArr[ n ].get();
OUString sIns; OUString sIns;
switch( pDBCol->eColType ) switch( pDBCol->eColType )
{ {
......
...@@ -33,9 +33,11 @@ ...@@ -33,9 +33,11 @@
#include <swdbdata.hxx> #include <swdbdata.hxx>
#include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Sequence.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <o3tl/sorted_vector.hxx> #include <o3tl/sorted_vector.hxx>
#include <memory>
#include <vector>
namespace com{namespace sun{namespace star{ namespace com{namespace sun{namespace star{
namespace sdbcx{ namespace sdbcx{
class XColumnsSupplier; class XColumnsSupplier;
...@@ -52,7 +54,8 @@ class SwView; ...@@ -52,7 +54,8 @@ class SwView;
class SfxItemSet; class SfxItemSet;
class SwTableRep; class SwTableRep;
struct DB_Column; struct DB_Column;
typedef boost::ptr_vector<DB_Column> DB_Columns;
typedef std::vector<std::unique_ptr<DB_Column>> DB_Columns;
struct SwInsDBColumn struct SwInsDBColumn
{ {
......
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