Kaydet (Commit) 6203c2b7 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SwInsDBColumns

Change-Id: Idd159cfd29d487773e478a0cca352fcb77f88a33
Reviewed-on: https://gerrit.libreoffice.org/61340
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 55f78bcb
......@@ -256,7 +256,7 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
sal_Int32 nCount = aColNames.getLength();
for (sal_Int32 n = 0; n < nCount; ++n)
{
SwInsDBColumn* pNew = new SwInsDBColumn( pColNames[n] );
std::unique_ptr<SwInsDBColumn> pNew(new SwInsDBColumn( pColNames[n] ));
Any aCol = xCols->getByName(pColNames[n]);
Reference <XPropertySet> xCol;
aCol >>= xCol;
......@@ -319,10 +319,9 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
}
break;
}
if( !aDBColumns.insert( pNew ).second )
if( !aDBColumns.insert( std::move(pNew) ).second )
{
OSL_ENSURE( false, "Spaltenname mehrfach vergeben?" );
delete pNew;
}
}
}
......@@ -1013,7 +1012,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
SwInsDBColumn aSrch( m_pLbTableCol->GetEntry( n ) );
SwInsDBColumns::const_iterator it = aDBColumns.find( &aSrch );
if (it != aDBColumns.end())
aColFields.push_back(*it);
aColFields.push_back(it->get());
else {
OSL_ENSURE( false, "database column not found" );
}
......@@ -1603,7 +1602,7 @@ void SwInsertDBColAutoPilot::ImplCommit()
SvNumberFormatter& rNFormatr = *pView->GetWrtShell().GetNumberFormatter();
for(size_t nCol = 0; nCol < aDBColumns.size(); nCol++)
{
SwInsDBColumn* pColumn = aDBColumns[nCol];
SwInsDBColumn* pColumn = aDBColumns[nCol].get();
OUString sColumnInsertNode(sNewNode + "/__");
if( nCol < 10 )
sColumnInsertNode += "00";
......@@ -1711,7 +1710,7 @@ void SwInsertDBColAutoPilot::Load()
continue;
sal_Int16 nIndex = 0;
pSubProps[1] >>= nIndex;
SwInsDBColumn* pInsDBColumn = new SwInsDBColumn(sColumn);
std::unique_ptr<SwInsDBColumn> pInsDBColumn(new SwInsDBColumn(sColumn));
if(pSubProps[2].hasValue())
pInsDBColumn->bHasFormat = *o3tl::doAccess<bool>(pSubProps[2]);
if(pSubProps[3].hasValue())
......@@ -1734,7 +1733,7 @@ void SwInsertDBColAutoPilot::Load()
pInsDBColumn->nUsrNumFormat = rNFormatr.GetEntryKey( pInsDBColumn->sUsrNumFormat,
pInsDBColumn->eUsrNumFormatLng );
pNewData->aDBColumns.insert(pInsDBColumn);
pNewData->aDBColumns.insert(std::move(pInsDBColumn));
}
OUString sTmp( pNewData->sTableList );
if( !sTmp.isEmpty() )
......
......@@ -78,10 +78,8 @@ struct SwInsDBColumn
bool operator<( const SwInsDBColumn& rCmp ) const;
};
class SwInsDBColumns : public o3tl::sorted_vector<SwInsDBColumn*, o3tl::less_ptr_to<SwInsDBColumn> >
class SwInsDBColumns : public o3tl::sorted_vector<std::unique_ptr<SwInsDBColumn>, o3tl::less_uniqueptr_to<SwInsDBColumn> >
{
public:
~SwInsDBColumns() { DeleteAndDestroyAll(); }
};
class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
......
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