diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-08-27 16:27:33 -0400 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-30 12:55:17 +0000 |
commit | c1a9d0139112d7489ca6dd29b18f9418c6da3085 (patch) | |
tree | 0794adc048b5d2cacd04c9a896f9b295b5ebabf9 /include/tools | |
parent | d11715c4c67be4a991cc9fee72ae1c015eac3745 (diff) |
tdf#62525: use cow_wrapper for SvGlobalName
Convert the pimpled copy-on-write SvGlobalName class to use the
::o3tl::cow_wrapper using the default reference counting policy.
Change-Id: I7bceb06ddfb31ca5901e5e7d5d93dda494db945f
Reviewed-on: https://gerrit.libreoffice.org/18070
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'include/tools')
-rw-r--r-- | include/tools/globname.hxx | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/include/tools/globname.hxx b/include/tools/globname.hxx index 6796c3b74824..42ff4f49776e 100644 --- a/include/tools/globname.hxx +++ b/include/tools/globname.hxx @@ -23,6 +23,7 @@ #include <tools/toolsdllapi.h> #include <com/sun/star/uno/Sequence.hxx> +#include <o3tl/cow_wrapper.hxx> struct SvGUID { @@ -35,20 +36,16 @@ struct SvGUID struct ImpSvGlobalName { struct SvGUID szData; - sal_uInt16 nRefCount; - enum Empty { EMPTY }; - - ImpSvGlobalName(const SvGUID &rData) - : szData(rData) - , nRefCount(0) - { - } - ImpSvGlobalName(sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, - sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, - sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15); - ImpSvGlobalName( const ImpSvGlobalName & rObj ); - ImpSvGlobalName( Empty ); + ImpSvGlobalName(const SvGUID &rData) + : szData(rData) + { + } + ImpSvGlobalName(sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, + sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, + sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15); + ImpSvGlobalName( const ImpSvGlobalName & rObj ); + ImpSvGlobalName(); bool operator == ( const ImpSvGlobalName & rObj ) const; }; @@ -57,30 +54,26 @@ class SvStream; class TOOLS_DLLPUBLIC SvGlobalName { - ImpSvGlobalName * pImp; - void NewImp(); + ::o3tl::cow_wrapper< ImpSvGlobalName > pImp; public: - SvGlobalName(); - SvGlobalName( const SvGlobalName & rObj ) - { - pImp = rObj.pImp; - pImp->nRefCount++; - } - SvGlobalName( ImpSvGlobalName * pImpP ) - { - pImp = pImpP; - pImp->nRefCount++; - } - SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, - sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, - sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ); - - // create SvGlobalName from a platform independent representation - SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq ); + SvGlobalName(); + SvGlobalName( const SvGlobalName & rObj ) : + pImp( rObj.pImp ) + { + } + + SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, + sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, + sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ); + + // create SvGlobalName from a platform independent representation + SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq ); + + SvGlobalName( const SvGUID & rId ); SvGlobalName & operator = ( const SvGlobalName & rObj ); - ~SvGlobalName(); + ~SvGlobalName(); TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & ); TOOLS_DLLPUBLIC friend SvStream & WriteSvGlobalName( SvStream &, const SvGlobalName & ); @@ -97,7 +90,6 @@ public: bool MakeId( const OUString & rId ); OUString GetHexName() const; - SvGlobalName( const SvGUID & rId ); const SvGUID& GetCLSID() const { return pImp->szData; } // platform independent representation of a "GlobalName" |