diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-12-28 00:35:41 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-29 08:03:16 +0100 |
commit | db8085636aec89205fdc944ec55ef11645705a97 (patch) | |
tree | 73ad65fcd48fda0aea69f1ca3682959de36be04a /sc | |
parent | e0eb09405b2f4d95532d37bc37054a51e5a0177b (diff) |
simplify copy of ScQueryParam
define copy assignment for ScQueryParamBase and use
default copy implementations for other structs.
Change-Id: Ie384a4f9a3647e8492b4921055df0f2c6bff708e
Reviewed-on: https://gerrit.libreoffice.org/47141
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/queryparam.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/queryparam.cxx | 58 |
2 files changed, 24 insertions, 40 deletions
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx index 0c704789e004..cde359ec7a72 100644 --- a/sc/inc/queryparam.hxx +++ b/sc/inc/queryparam.hxx @@ -77,6 +77,7 @@ public: protected: ScQueryParamBase(); ScQueryParamBase(const ScQueryParamBase& r); + ScQueryParamBase& operator=(const ScQueryParamBase& r); EntriesType m_Entries; }; @@ -107,7 +108,6 @@ struct ScQueryParamTable SCTAB nTab; ScQueryParamTable(); - ScQueryParamTable(const ScQueryParamTable& r); virtual ~ScQueryParamTable(); }; @@ -134,11 +134,11 @@ struct SC_DLLPUBLIC ScQueryParam : public ScQueryParamBase, public ScQueryParamT SCROW nDestRow; ScQueryParam(); - ScQueryParam( const ScQueryParam& r ); + ScQueryParam( const ScQueryParam& ); ScQueryParam( const ScDBQueryParamInternal& r ); virtual ~ScQueryParam() override; - ScQueryParam& operator= ( const ScQueryParam& r ); + ScQueryParam& operator= ( const ScQueryParam& ); bool operator== ( const ScQueryParam& rOther ) const; void Clear(); void ClearDestParams(); diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx index 60bf01366886..269eb700bb83 100644 --- a/sc/source/core/tool/queryparam.cxx +++ b/sc/source/core/tool/queryparam.cxx @@ -87,6 +87,25 @@ ScQueryParamBase::ScQueryParamBase(const ScQueryParamBase& r) : } } +ScQueryParamBase& ScQueryParamBase::operator=(const ScQueryParamBase& r) +{ + eSearchType = r.eSearchType; + bHasHeader = r.bHasHeader; + bByRow = r.bByRow; + bInplace = r.bInplace; + bCaseSens = r.bCaseSens; + bDuplicate = r.bDuplicate; + mbRangeLookup = r.mbRangeLookup; + + m_Entries.clear(); + for (auto const& it : r.m_Entries) + { + m_Entries.push_back(o3tl::make_unique<ScQueryEntry>(*it)); + } + + return *this; +} + ScQueryParamBase::~ScQueryParamBase() { } @@ -283,11 +302,6 @@ ScQueryParamTable::ScQueryParamTable() : { } -ScQueryParamTable::ScQueryParamTable(const ScQueryParamTable& r) : - nCol1(r.nCol1),nRow1(r.nRow1),nCol2(r.nCol2),nRow2(r.nRow2),nTab(r.nTab) -{ -} - ScQueryParamTable::~ScQueryParamTable() { } @@ -303,12 +317,7 @@ ScQueryParam::ScQueryParam() : Clear(); } -ScQueryParam::ScQueryParam( const ScQueryParam& r ) : - ScQueryParamBase(r), - ScQueryParamTable(r), - bDestPers(r.bDestPers), nDestTab(r.nDestTab), nDestCol(r.nDestCol), nDestRow(r.nDestRow) -{ -} +ScQueryParam::ScQueryParam( const ScQueryParam& ) = default; ScQueryParam::ScQueryParam( const ScDBQueryParamInternal& r ) : ScQueryParamBase(r), @@ -349,32 +358,7 @@ void ScQueryParam::ClearDestParams() nDestRow = 0; } -ScQueryParam& ScQueryParam::operator=( const ScQueryParam& r ) -{ - nCol1 = r.nCol1; - nRow1 = r.nRow1; - nCol2 = r.nCol2; - nRow2 = r.nRow2; - nTab = r.nTab; - nDestTab = r.nDestTab; - nDestCol = r.nDestCol; - nDestRow = r.nDestRow; - bHasHeader = r.bHasHeader; - bInplace = r.bInplace; - bCaseSens = r.bCaseSens; - eSearchType = r.eSearchType; - bDuplicate = r.bDuplicate; - bByRow = r.bByRow; - bDestPers = r.bDestPers; - - m_Entries.clear(); - for (auto const& it : r.m_Entries) - { - m_Entries.push_back(o3tl::make_unique<ScQueryEntry>(*it)); - } - - return *this; -} +ScQueryParam& ScQueryParam::operator=( const ScQueryParam& ) = default; bool ScQueryParam::operator==( const ScQueryParam& rOther ) const { |