diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-18 11:48:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-18 11:49:15 +0000 |
commit | 97e61ba58c357564d8fbffea94c8aa56636480b9 (patch) | |
tree | cb4a192fd3eb60066fc30f87c9a1ae1a2fd5242e /connectivity/source | |
parent | 4034babeb51af323ff2a47642e3a1386fc1d6b46 (diff) |
sync ONDXPagePtr impl with current SvRef impl
Change-Id: I85e62a8c634a681e2e53745e3bed52731e8740e0
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/dbase/dindexnode.cxx | 37 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/dindexnode.hxx | 29 |
2 files changed, 40 insertions, 26 deletions
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 714ea8736781..064660b046a3 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -805,22 +805,31 @@ SvStream& connectivity::dbase::WriteONDXPagePtr(SvStream &rStream, const ONDXPag return rStream; } - // ONDXPagePtr +ONDXPagePtr::ONDXPagePtr() + : mpPage(nullptr) + , nPagePos(0) +{ +} +ONDXPagePtr::ONDXPagePtr(ONDXPagePtr&& rRef) +{ + mpPage = rRef.mpPage; + rRef.mpPage = nullptr; + nPagePos = rRef.nPagePos; +} -ONDXPagePtr::ONDXPagePtr(const ONDXPagePtr& rRef) - :mpPage(rRef.mpPage) - ,nPagePos(rRef.nPagePos) +ONDXPagePtr::ONDXPagePtr(ONDXPagePtr const & rRef) + : mpPage(rRef.mpPage) + , nPagePos(rRef.nPagePos) { if (mpPage != nullptr) mpPage->AddNextRef(); } - ONDXPagePtr::ONDXPagePtr(ONDXPage* pRefPage) - :mpPage(pRefPage) - ,nPagePos(0) + : mpPage(pRefPage) + , nPagePos(0) { if (mpPage != nullptr) mpPage->AddFirstRef(); @@ -828,6 +837,20 @@ ONDXPagePtr::ONDXPagePtr(ONDXPage* pRefPage) nPagePos = pRefPage->GetPagePos(); } +ONDXPagePtr::~ONDXPagePtr() +{ + if (mpPage != nullptr) mpPage->ReleaseRef(); +} + +void ONDXPagePtr::Clear() +{ + if (mpPage != nullptr) { + ONDXPage * pRefObj = mpPage; + mpPage = nullptr; + pRefObj->ReleaseRef(); + } +} + ONDXPagePtr& ONDXPagePtr::operator=(ONDXPagePtr const & rOther) { if (rOther.mpPage != nullptr) { diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index ff73ce700099..3a0e58dd9800 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -90,19 +90,20 @@ namespace connectivity sal_uInt32 nPagePos; // Position in the index file public: - ONDXPagePtr() : mpPage(nullptr), nPagePos(0) {} - ONDXPagePtr(const ONDXPagePtr& rRef); + ONDXPagePtr(); + ONDXPagePtr(ONDXPagePtr&& rObj); + ONDXPagePtr(ONDXPagePtr const & rRef); ONDXPagePtr(ONDXPage* pRefPage); - inline ~ONDXPagePtr(); + ~ONDXPagePtr(); + void Clear(); + ONDXPagePtr& operator=(ONDXPagePtr const & rRef); + bool Is() const { return mpPage != nullptr; } + + ONDXPage * operator ->() const { assert(mpPage != nullptr); return mpPage; } + operator ONDXPage *() const { return mpPage; } sal_uInt32 GetPagePos() const {return nPagePos;} bool HasPage() const {return nPagePos != 0;} - - operator ONDXPage *() const { return mpPage; } - ONDXPage * operator ->() const { assert(mpPage != nullptr); return mpPage; } - bool Is() const { return mpPage != nullptr; } - inline void Clear(); - ONDXPagePtr& operator=(const ONDXPagePtr& rRef); }; // Index Page @@ -202,16 +203,6 @@ namespace connectivity #endif }; - inline ONDXPagePtr::~ONDXPagePtr() { if (mpPage != nullptr) mpPage->ReleaseRef(); } - inline void ONDXPagePtr::Clear() - { - if (mpPage != nullptr) { - ONDXPage * pRefObj = mpPage; - mpPage = nullptr; - pRefObj->ReleaseRef(); - } - } - SvStream& WriteONDXPagePtr(SvStream &rStream, const ONDXPagePtr&); SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); |