diff options
author | Noel Grandin <noel@peralex.com> | 2014-07-08 16:49:46 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-07-10 11:04:11 +0200 |
commit | ea8f32b61a51b6d9cef72bbd5ac701bef2975a39 (patch) | |
tree | 6250080d36c729f91e7307ab580eef409c26a4a6 /dbaccess | |
parent | a7470048bd5be5c1668bafc02d58dba97ff5a558 (diff) |
use SimpleReferenceObject in dbaccess module
to replace hand-rolled version
Change-Id: Ie7b98c284d157521482b0f98915146133f32748e
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSetRow.hxx | 18 | ||||
-rw-r--r-- | dbaccess/source/core/recovery/settingsimport.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/core/recovery/settingsimport.hxx | 10 |
3 files changed, 7 insertions, 35 deletions
diff --git a/dbaccess/source/core/api/RowSetRow.hxx b/dbaccess/source/core/api/RowSetRow.hxx index 38b27f4650b9..920d4f9211e5 100644 --- a/dbaccess/source/core/api/RowSetRow.hxx +++ b/dbaccess/source/core/api/RowSetRow.hxx @@ -23,6 +23,7 @@ #include <connectivity/CommonTools.hxx> #include "connectivity/FValue.hxx" #include <comphelper/types.hxx> +#include <salhelper/simplereferenceobject.hxx> namespace dbaccess { @@ -30,29 +31,18 @@ namespace dbaccess typedef ::rtl::Reference< ORowSetValueVector > ORowSetRow; typedef ::std::vector< ORowSetRow > ORowSetMatrix; - class ORowSetOldRowHelper + class ORowSetOldRowHelper : public salhelper::SimpleReferenceObject { - oslInterlockedCount m_refCount; ORowSetRow m_aRow; ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH); ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh); public: - ORowSetOldRowHelper() : m_refCount(0){} + ORowSetOldRowHelper(){} ORowSetOldRowHelper(const ORowSetRow& _rRow) - : m_refCount(0) - , m_aRow(_rRow) + : m_aRow(_rRow) {} - void acquire() - { - osl_atomic_increment( &m_refCount ); - } - void release() - { - if (! osl_atomic_decrement( &m_refCount )) - delete this; - } inline ORowSetRow getRow() const { return m_aRow; } inline void clearRow() { m_aRow = NULL; } inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; } diff --git a/dbaccess/source/core/recovery/settingsimport.cxx b/dbaccess/source/core/recovery/settingsimport.cxx index fc5cdc6bafea..eda7eecd38d5 100644 --- a/dbaccess/source/core/recovery/settingsimport.cxx +++ b/dbaccess/source/core/recovery/settingsimport.cxx @@ -41,7 +41,6 @@ namespace dbaccess // SettingsImport SettingsImport::SettingsImport() - :m_refCount( 0 ) { } @@ -49,19 +48,6 @@ namespace dbaccess { } - oslInterlockedCount SAL_CALL SettingsImport::acquire() - { - return osl_atomic_increment( &m_refCount ); - } - - oslInterlockedCount SAL_CALL SettingsImport::release() - { - oslInterlockedCount newCount = osl_atomic_decrement( &m_refCount ); - if ( newCount == 0 ) - delete this; - return newCount; - } - void SettingsImport::startElement( const Reference< XAttributeList >& i_rAttributes ) { // find the name of the setting diff --git a/dbaccess/source/core/recovery/settingsimport.hxx b/dbaccess/source/core/recovery/settingsimport.hxx index 8ea1c2d078d5..01089abb6241 100644 --- a/dbaccess/source/core/recovery/settingsimport.hxx +++ b/dbaccess/source/core/recovery/settingsimport.hxx @@ -25,6 +25,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> +#include <salhelper/simplereferenceobject.hxx> namespace dbaccess { @@ -35,16 +36,12 @@ namespace dbaccess It would be nice if the DocumentSettingsContext would not be that tightly interwoven with the SvXMLImport class, so we could re-use it here ... */ - class SettingsImport : public ::rtl::IReference + class SettingsImport : public salhelper::SimpleReferenceObject { public: SettingsImport(); - // IReference - virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; - virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE; - - // own overriables + // own overridables virtual ::rtl::Reference< SettingsImport > nextState( const OUString& i_rElementName ) = 0; @@ -66,7 +63,6 @@ namespace dbaccess const OUStringBuffer& getAccumulatedCharacters() const { return m_aCharacters; } private: - oslInterlockedCount m_refCount; // value of the config:name attribute, if any OUString m_sItemName; // value of the config:type attribute, if any |