summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-20 09:04:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-22 07:33:56 +0100
commitcc2c1d9525baa5746ee58bb4cb6b0b62eca20a51 (patch)
treef2b32f9a1181366d1531e399800cb13ad6b49499 /sc
parent00635fb32c09ab90bff713eb53333de045e301a6 (diff)
loplugin:useuniqueptr in ScDPResultMember
Change-Id: Icf8a52bcf233994bc49a5d9094196154f20602ea Reviewed-on: https://gerrit.libreoffice.org/51663 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/dptabres.hxx10
-rw-r--r--sc/source/core/data/dptabres.cxx14
2 files changed, 11 insertions, 13 deletions
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 97274c1d659b..3f2400cc9ed8 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -341,8 +341,8 @@ class ScDPResultMember
private:
const ScDPResultData* pResultData;
ScDPParentDimData aParentDimData;
- ScDPResultDimension* pChildDimension;
- ScDPDataMember* pDataRoot;
+ std::unique_ptr<ScDPResultDimension> pChildDimension;
+ std::unique_ptr<ScDPDataMember> pDataRoot;
bool bHasElements:1;
bool bForceSubTotal:1;
bool bHasHiddenDetails:1;
@@ -418,10 +418,10 @@ public:
#endif
//! this will be removed!
- const ScDPResultDimension* GetChildDimension() const { return pChildDimension; }
- ScDPResultDimension* GetChildDimension() { return pChildDimension; }
+ const ScDPResultDimension* GetChildDimension() const { return pChildDimension.get(); }
+ ScDPResultDimension* GetChildDimension() { return pChildDimension.get(); }
- ScDPDataMember* GetDataRoot() const { return pDataRoot; }
+ ScDPDataMember* GetDataRoot() const { return pDataRoot.get(); }
const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref
const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 2ceb4f70f91b..48f3c95f0156 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -968,8 +968,6 @@ ScDPResultMember::ScDPResultMember(
}
ScDPResultMember::~ScDPResultMember()
{
- delete pChildDimension;
- delete pDataRoot;
}
OUString ScDPResultMember::GetName() const
@@ -1056,7 +1054,7 @@ void ScDPResultMember::InitFrom( const vector<ScDPDimension*>& ppDim, const vect
if ( ppDim[nPos]->getIsDataLayoutDimension() )
{
if ( !pChildDimension )
- pChildDimension = new ScDPResultDimension( pResultData );
+ pChildDimension.reset( new ScDPResultDimension( pResultData ) );
pChildDimension->InitFrom( ppDim, ppLev, nPos, rInitState , false );
return;
}
@@ -1072,7 +1070,7 @@ void ScDPResultMember::InitFrom( const vector<ScDPDimension*>& ppDim, const vect
if ( bInitChild )
{
- pChildDimension = new ScDPResultDimension( pResultData );
+ pChildDimension.reset( new ScDPResultDimension( pResultData ) );
pChildDimension->InitFrom(ppDim, ppLev, nPos, rInitState);
}
}
@@ -1100,7 +1098,7 @@ void ScDPResultMember::LateInitFrom(
if ( rParams.GetDim( nPos )->getIsDataLayoutDimension() )
{
if ( !pChildDimension )
- pChildDimension = new ScDPResultDimension( pResultData );
+ pChildDimension.reset( new ScDPResultDimension( pResultData ) );
// #i111462# reset InitChild flag only for this child dimension's LateInitFrom call,
// not for following members of parent dimensions
@@ -1124,7 +1122,7 @@ void ScDPResultMember::LateInitFrom(
if ( rParams.GetInitChild() )
{
if ( !pChildDimension )
- pChildDimension = new ScDPResultDimension( pResultData );
+ pChildDimension.reset( new ScDPResultDimension( pResultData ) );
pChildDimension->LateInitFrom( rParams, pItemData, nPos, rInitState );
}
}
@@ -1261,7 +1259,7 @@ void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const
if ( !pDataRoot )
{
- pDataRoot = new ScDPDataMember( pResultData, nullptr );
+ pDataRoot.reset( new ScDPDataMember( pResultData, nullptr ) );
if ( pDataDim )
pDataRoot->InitFrom( pDataDim ); // recursive
}
@@ -1511,7 +1509,7 @@ void ScDPResultMember::FillMemberResults(
uno::Sequence<sheet::MemberResult>* pLayoutSeq = pSequences;
if (!bRoot)
++pLayoutSeq;
- ScDPResultDimension* pLayoutDim = pChildDimension;
+ ScDPResultDimension* pLayoutDim = pChildDimension.get();
while ( pLayoutDim && !pLayoutDim->IsDataLayout() )
{
pLayoutDim = pLayoutDim->GetFirstChildDimension();