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

use SimpleReferenceObject in dbaccess module

to replace hand-rolled version

Change-Id: Ie7b98c284d157521482b0f98915146133f32748e
üst a7470048
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <connectivity/CommonTools.hxx> #include <connectivity/CommonTools.hxx>
#include "connectivity/FValue.hxx" #include "connectivity/FValue.hxx"
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <salhelper/simplereferenceobject.hxx>
namespace dbaccess namespace dbaccess
{ {
...@@ -30,29 +31,18 @@ namespace dbaccess ...@@ -30,29 +31,18 @@ namespace dbaccess
typedef ::rtl::Reference< ORowSetValueVector > ORowSetRow; typedef ::rtl::Reference< ORowSetValueVector > ORowSetRow;
typedef ::std::vector< ORowSetRow > ORowSetMatrix; typedef ::std::vector< ORowSetRow > ORowSetMatrix;
class ORowSetOldRowHelper class ORowSetOldRowHelper : public salhelper::SimpleReferenceObject
{ {
oslInterlockedCount m_refCount;
ORowSetRow m_aRow; ORowSetRow m_aRow;
ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH); ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH);
ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh); ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh);
public: public:
ORowSetOldRowHelper() : m_refCount(0){} ORowSetOldRowHelper(){}
ORowSetOldRowHelper(const ORowSetRow& _rRow) 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 ORowSetRow getRow() const { return m_aRow; }
inline void clearRow() { m_aRow = NULL; } inline void clearRow() { m_aRow = NULL; }
inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; } inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; }
......
...@@ -41,7 +41,6 @@ namespace dbaccess ...@@ -41,7 +41,6 @@ namespace dbaccess
// SettingsImport // SettingsImport
SettingsImport::SettingsImport() SettingsImport::SettingsImport()
:m_refCount( 0 )
{ {
} }
...@@ -49,19 +48,6 @@ namespace dbaccess ...@@ -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 ) void SettingsImport::startElement( const Reference< XAttributeList >& i_rAttributes )
{ {
// find the name of the setting // find the name of the setting
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <comphelper/namedvaluecollection.hxx> #include <comphelper/namedvaluecollection.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <salhelper/simplereferenceobject.hxx>
namespace dbaccess namespace dbaccess
{ {
...@@ -35,16 +36,12 @@ namespace dbaccess ...@@ -35,16 +36,12 @@ namespace dbaccess
It would be nice if the DocumentSettingsContext would not be that tightly interwoven with the SvXMLImport 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, so we could re-use it here ...
*/ */
class SettingsImport : public ::rtl::IReference class SettingsImport : public salhelper::SimpleReferenceObject
{ {
public: public:
SettingsImport(); SettingsImport();
// IReference // own overridables
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
// own overriables
virtual ::rtl::Reference< SettingsImport > nextState( virtual ::rtl::Reference< SettingsImport > nextState(
const OUString& i_rElementName const OUString& i_rElementName
) = 0; ) = 0;
...@@ -66,7 +63,6 @@ namespace dbaccess ...@@ -66,7 +63,6 @@ namespace dbaccess
const OUStringBuffer& getAccumulatedCharacters() const { return m_aCharacters; } const OUStringBuffer& getAccumulatedCharacters() const { return m_aCharacters; }
private: private:
oslInterlockedCount m_refCount;
// value of the config:name attribute, if any // value of the config:name attribute, if any
OUString m_sItemName; OUString m_sItemName;
// value of the config:type attribute, if any // value of the config:type attribute, if any
......
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