summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-04-07 12:31:09 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-04-07 12:38:27 +0200
commit8f6c55a839d790c9268c1d0686f3eaf2f23484cb (patch)
tree1b10a5e10b66c3c8dcf0a8bf295167563e0f6828 /include
parentcppcheck: "else if" condition matches previous condition (diff)
downloadcore-8f6c55a839d790c9268c1d0686f3eaf2f23484cb.tar.gz
core-8f6c55a839d790c9268c1d0686f3eaf2f23484cb.zip
Replace SV_DECL/IMPL_REF macros with SvRef template
Change-Id: I0ef2e67f6d61e0ce118c0f5e926b8194ef9d8058
Diffstat (limited to 'include')
-rw-r--r--include/basic/sbmeth.hxx2
-rw-r--r--include/basic/sbmod.hxx2
-rw-r--r--include/basic/sbstar.hxx2
-rw-r--r--include/basic/sbx.hxx14
-rw-r--r--include/basic/sbxcore.hxx2
-rw-r--r--include/basic/sbxobj.hxx3
-rw-r--r--include/basic/sbxprop.hxx3
-rw-r--r--include/basic/sbxvar.hxx6
-rw-r--r--include/editeng/svxacorr.hxx3
-rw-r--r--include/filter/msfilter/msdffimp.hxx1
-rw-r--r--include/sfx2/app.hxx2
-rw-r--r--include/sfx2/docfile.hxx2
-rw-r--r--include/sfx2/doctempl.hxx4
-rw-r--r--include/sfx2/hintpost.hxx2
-rw-r--r--include/sfx2/linkmgr.hxx4
-rw-r--r--include/sfx2/linksrc.hxx2
-rw-r--r--include/sfx2/lnkbase.hxx2
-rw-r--r--include/sfx2/objsh.hxx4
-rw-r--r--include/sfx2/viewfrm.hxx2
-rw-r--r--include/sot/object.hxx2
-rw-r--r--include/sot/storage.hxx6
-rw-r--r--include/svtools/editbrowsebox.hxx9
-rw-r--r--include/svtools/svparser.hxx9
-rw-r--r--include/svtools/transfer.hxx2
-rw-r--r--include/svx/gridctrl.hxx6
-rw-r--r--include/svx/svdmodel.hxx1
-rw-r--r--include/tools/pstm.hxx4
-rw-r--r--include/tools/ref.hxx100
-rw-r--r--include/tools/stream.hxx6
-rw-r--r--include/unotools/ucblockbytes.hxx7
-rw-r--r--include/xmloff/xmlictxt.hxx4
31 files changed, 88 insertions, 130 deletions
diff --git a/include/basic/sbmeth.hxx b/include/basic/sbmeth.hxx
index d38e652e1e1a..5ca27f676b94 100644
--- a/include/basic/sbmeth.hxx
+++ b/include/basic/sbmeth.hxx
@@ -67,7 +67,7 @@ public:
virtual void Broadcast( sal_uIntPtr nHintId ) SAL_OVERRIDE;
};
-SV_DECL_IMPL_REF(SbMethod)
+typedef tools::SvRef<SbMethod> SbMethodRef;
class BASIC_DLLPUBLIC SbIfaceMapperMethod : public SbMethod
{
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index c5acf1594b0c..c65f05588ba7 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -139,7 +139,7 @@ public:
OUString GetKeywordCase( const OUString& sKeyword ) const;
};
-SV_DECL_IMPL_REF(SbModule)
+typedef tools::SvRef<SbModule> SbModuleRef;
// Object class for instances of class modules
class BASIC_DLLPUBLIC SbClassModuleObject : public SbModule
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
index 5078c200d1f7..2eec72bae613 100644
--- a/include/basic/sbstar.hxx
+++ b/include/basic/sbstar.hxx
@@ -176,7 +176,7 @@ public:
GetModelFromBasic( SbxObject* pBasic );
};
-SV_DECL_IMPL_REF(StarBASIC)
+typedef tools::SvRef<StarBASIC> StarBASICRef;
#endif
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index a904bf3e6d25..1ab7ed3deabc 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -116,7 +116,6 @@ public:
// declared datatype, if they are not SbxVARIANT.
class SbxVarRefs;
-class SbxVariableRef;
class BASIC_DLLPUBLIC SbxArray : public SbxBase
{
@@ -256,24 +255,17 @@ public:
const OUString& GetElementClass() const { return aElemClass; }
};
-SV_IMPL_REF(SbxBase)
-
-SV_IMPL_REF(SbxVariable)
-
#ifndef SBX_ARRAY_DECL_DEFINED
#define SBX_ARRAY_DECL_DEFINED
-SV_DECL_REF(SbxArray)
+typedef tools::SvRef<SbxArray> SbxArrayRef;
#endif
-SV_IMPL_REF(SbxArray)
#ifndef SBX_INFO_DECL_DEFINED
#define SBX_INFO_DECL_DEFINED
-SV_DECL_REF(SbxInfo)
+typedef tools::SvRef<SbxInfo> SbxInfoRef;
#endif
-SV_IMPL_REF(SbxInfo)
-SV_DECL_REF(SbxDimArray)
-SV_IMPL_REF(SbxDimArray)
+typedef tools::SvRef<SbxDimArray> SbxDimArrayRef;
#endif
diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
index 5bf2b2ec61db..079b9618f529 100644
--- a/include/basic/sbxcore.hxx
+++ b/include/basic/sbxcore.hxx
@@ -106,7 +106,7 @@ public:
static SbxObject* CreateObject( const OUString& );
};
-SV_DECL_REF(SbxBase)
+typedef tools::SvRef<SbxBase> SbxBaseRef;
inline void SbxBase::SetFlags( sal_uInt16 n )
{ nFlags = n; }
diff --git a/include/basic/sbxobj.hxx b/include/basic/sbxobj.hxx
index 586af9f4ff32..c6c09cf5ffe8 100644
--- a/include/basic/sbxobj.hxx
+++ b/include/basic/sbxobj.hxx
@@ -88,8 +88,7 @@ public:
void Dump( SvStream&, bool bDumpAll=false );
};
-SV_DECL_REF(SbxObject)
-SV_IMPL_REF(SbxObject)
+typedef tools::SvRef<SbxObject> SbxObjectRef;
#endif // INCLUDED_BASIC_SBXOBJ_HXX
diff --git a/include/basic/sbxprop.hxx b/include/basic/sbxprop.hxx
index 3a9cd23c2545..6587b7f64759 100644
--- a/include/basic/sbxprop.hxx
+++ b/include/basic/sbxprop.hxx
@@ -36,8 +36,7 @@ public:
virtual SbxClassType GetClass() const SAL_OVERRIDE;
};
-SV_DECL_REF(SbxProperty)
-SV_IMPL_REF(SbxProperty)
+typedef tools::SvRef<SbxProperty> SbxPropertyRef;
#endif
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 789cec6cd55d..1204df24546e 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -270,12 +270,12 @@ class SbxInfo;
#ifndef SBX_ARRAY_DECL_DEFINED
#define SBX_ARRAY_DECL_DEFINED
-SV_DECL_REF(SbxArray)
+typedef tools::SvRef<SbxArray> SbxArrayRef;
#endif
#ifndef SBX_INFO_DECL_DEFINED
#define SBX_INFO_DECL_DEFINED
-SV_DECL_REF(SbxInfo)
+typedef tools::SvRef<SbxInfo> SbxInfoRef;
#endif
class SfxBroadcaster;
@@ -349,7 +349,7 @@ public:
static sal_uInt16 MakeHashCode( const OUString& rName );
};
-SV_DECL_REF(SbxVariable)
+typedef tools::SvRef<SbxVariable> SbxVariableRef;
#endif // INCLUDED_BASIC_SBXVAR_HXX
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 72015b5cd92c..d4529a51623e 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <o3tl/sorted_vector.hxx>
+#include <sot/storage.hxx>
#include <tools/rtti.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <tools/time.hxx>
@@ -39,8 +40,6 @@ class CharClass;
class SfxPoolItem;
class SvxAutoCorrect;
class SfxObjectShell;
-class SotStorageRef;
-class SotStorage;
class Window;
struct CompareSvStringsISortDtor
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index add42ee86fa1..c290948e94ec 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -53,7 +53,6 @@ class Graphic;
class SvStream;
class SdrObject;
class SdrOle2Obj;
-class SotStorageRef;
class Polygon;
class PolyPolygon;
class FmFormModel;
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index f3b72cd54c98..b628e95e9ccd 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -116,7 +116,7 @@ DECL_OBJHINT( SfxStringHint, OUString );
#ifndef SFX_DECL_OBJECTSHELL_DEFINED
#define SFX_DECL_OBJECTSHELL_DEFINED
-SV_DECL_REF(SfxObjectShell)
+typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
#endif
class SfxObjectShellLock;
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 2ed484a0e17c..ab8562727a01 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -272,7 +272,7 @@ public:
static sal_uInt32 CreatePasswordToModifyHash( const OUString& aPasswd, bool bWriter );
};
-SV_DECL_IMPL_REF( SfxMedium )
+typedef tools::SvRef<SfxMedium> SfxMediumRef;
typedef ::std::vector< SfxMedium* > SfxMediumList;
diff --git a/include/sfx2/doctempl.hxx b/include/sfx2/doctempl.hxx
index 36008bce373f..6ba3a180d871 100644
--- a/include/sfx2/doctempl.hxx
+++ b/include/sfx2/doctempl.hxx
@@ -31,14 +31,14 @@ class SfxObjectShell;
#ifndef SFX_DECL_OBJECTSHELL_DEFINED
#define SFX_DECL_OBJECTSHELL_DEFINED
-SV_DECL_REF(SfxObjectShell)
+typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
#endif
class SfxDocTemplate_Impl;
#ifndef SFX_DECL_DOCTEMPLATES_DEFINED
#define SFX_DECL_DOCTEMPLATES_DEFINED
-SV_DECL_REF(SfxDocTemplate_Impl)
+typedef tools::SvRef<SfxDocTemplate_Impl> SfxDocTemplate_ImplRef;
#endif
// class SfxDocumentTemplates --------------------------------------------
diff --git a/include/sfx2/hintpost.hxx b/include/sfx2/hintpost.hxx
index f840f9619b23..6b562a715a41 100644
--- a/include/sfx2/hintpost.hxx
+++ b/include/sfx2/hintpost.hxx
@@ -61,7 +61,7 @@ public:
-SV_DECL_IMPL_REF(SfxHintPoster);
+typedef tools::SvRef<SfxHintPoster> SfxHintPosterRef;
#endif
diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx
index 3865594c49a2..37e0a0b50ab8 100644
--- a/include/sfx2/linkmgr.hxx
+++ b/include/sfx2/linkmgr.hxx
@@ -23,6 +23,7 @@
#include <sal/config.h>
#include <sfx2/dllapi.h>
#include <sfx2/linksrc.hxx>
+#include <sfx2/lnkbase.hxx>
#include <set>
#include <vector>
@@ -43,9 +44,6 @@ namespace sfx2
// FormatID "RegisterStatusInfoId" and a string as the data container.
// This contains the following enum.
-class SvBaseLink;
-class SvBaseLinkRef;
-
typedef std::vector<SvBaseLinkRef*> SvBaseLinks;
typedef std::set<SvLinkSource*> SvLinkSources;
diff --git a/include/sfx2/linksrc.hxx b/include/sfx2/linksrc.hxx
index e9d5c9a58701..19ad30e8a81c 100644
--- a/include/sfx2/linksrc.hxx
+++ b/include/sfx2/linksrc.hxx
@@ -113,7 +113,7 @@ public:
void clearStreamToLoadFrom();
};
-SV_DECL_IMPL_REF(SvLinkSource);
+typedef tools::SvRef<SvLinkSource> SvLinkSourceRef;
}
#endif
diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx
index c83adaa1419e..cd97ee341a88 100644
--- a/include/sfx2/lnkbase.hxx
+++ b/include/sfx2/lnkbase.hxx
@@ -168,7 +168,7 @@ public:
FileDialogHelper & GetInsertFileDialog(const OUString& rFactory) const;
};
-SV_DECL_IMPL_REF(SvBaseLink);
+typedef tools::SvRef<SvBaseLink> SvBaseLinkRef;
}
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index e35c618bd2df..84757d495015 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -717,7 +717,7 @@ public:
#ifndef SFX_DECL_OBJECTSHELL_DEFINED
#define SFX_DECL_OBJECTSHELL_DEFINED
-SV_DECL_REF(SfxObjectShell)
+typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
#endif
class SfxObjectShellLock
@@ -765,8 +765,6 @@ inline SfxObjectShellLock & SfxObjectShellLock::
inline SfxObjectShellLock & SfxObjectShellLock::operator = ( SfxObjectShell * pObjP )
{ return *this = SfxObjectShellLock( pObjP ); }
-SV_IMPL_REF(SfxObjectShell)
-
class AutoReloadTimer_Impl : public Timer
{
OUString aUrl;
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 289d11b073f2..86e6f0c5fd0a 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -59,7 +59,7 @@ namespace svtools
#ifndef SFX_DECL_OBJECTSHELL_DEFINED
#define SFX_DECL_OBJECTSHELL_DEFINED
-SV_DECL_REF(SfxObjectShell)
+typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
#endif
class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener
diff --git a/include/sot/object.hxx b/include/sot/object.hxx
index fb3484624adc..164402b5bc49 100644
--- a/include/sot/object.hxx
+++ b/include/sot/object.hxx
@@ -138,7 +138,7 @@ private:
};
//==================class SotObjectRef======================================
-SV_DECL_IMPL_REF(SotObject)
+typedef tools::SvRef<SotObject> SotObjectRef;
#endif // _IFACE_HXX
diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx
index a82efb1307ae..8a31d7f4eb0a 100644
--- a/include/sot/storage.hxx
+++ b/include/sot/storage.hxx
@@ -88,9 +88,8 @@ public:
#ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED
#define SOT_DECL_SOTSTORAGESTREAM_DEFINED
-SV_DECL_REF(SotStorageStream)
+typedef tools::SvRef<SotStorageStream> SotStorageStreamRef;
#endif
-SV_IMPL_REF(SotStorageStream)
namespace ucbhelper
{
@@ -224,9 +223,8 @@ public:
#ifndef SOT_DECL_SOTSTORAGE_DEFINED
#define SOT_DECL_SOTSTORAGE_DEFINED
-SV_DECL_REF(SotStorage)
+typedef tools::SvRef<SotStorage> SotStorageRef;
#endif
-SV_IMPL_REF(SotStorage)
#define SvStorage SotStorage
#define SvStorageRef SotStorageRef
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 74b59041ea13..4ea02f9e5169 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -74,13 +74,6 @@ class FormattedField;
namespace svt
{
-
-
- class CellControllerRef;
-
-
- //= CellController
-
class SVT_DLLPUBLIC CellController : public SvRefBase
{
friend class EditBrowseBox;
@@ -116,7 +109,7 @@ namespace svt
virtual bool WantMouseEvent() const;
};
- SV_DECL_IMPL_REF(CellController);
+ typedef tools::SvRef<CellController> CellControllerRef;
//= IEditImplementation
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
index c85d6d6cb983..3e21473e2f65 100644
--- a/include/svtools/svparser.hxx
+++ b/include/svtools/svparser.hxx
@@ -174,11 +174,8 @@ public:
#ifndef GOODIES_DECL_SVPARSER_DEFINED
#define GOODIES_DECL_SVPARSER_DEFINED
-SV_DECL_REF(SvParser)
+typedef tools::SvRef<SvParser> SvParserRef;
#endif
-SV_IMPL_REF(SvParser)
-
-
inline sal_uLong SvParser::SetLineNr( sal_uLong nlNum )
{ sal_uLong nlOld = nlLineNr; nlLineNr = nlNum; return nlOld; }
@@ -201,8 +198,6 @@ inline sal_uInt16 SvParser::GetCharSize() const
*
*======================================================================*/
-SV_DECL_REF(SvKeyValueIterator)
-
class SvKeyValue
{
/** Representation.
@@ -271,7 +266,7 @@ public:
virtual void Append (const SvKeyValue &rKeyVal);
};
-SV_IMPL_REF(SvKeyValueIterator);
+typedef tools::SvRef<SvKeyValueIterator> SvKeyValueIteratorRef;
#endif // INCLUDED_SVTOOLS_SVPARSER_HXX
diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
index 49019eb27cdc..62e9a130e22c 100644
--- a/include/svtools/transfer.hxx
+++ b/include/svtools/transfer.hxx
@@ -24,6 +24,7 @@
#include <tools/globname.hxx>
#include <tools/gen.hxx>
#include <sot/formats.hxx>
+#include <sot/storage.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase4.hxx>
#include <com/sun/star/frame/XTerminateListener.hpp>
@@ -44,7 +45,6 @@ class BitmapEx;
class GDIMetaFile;
class Graphic;
class ImageMap;
-class SotStorageStreamRef;
class INetBookmark;
class INetImage;
class FileList;
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index d42cfa3fdf95..e222f0475c82 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -90,7 +90,7 @@ public:
bool IsModified() const { return m_eStatus == GRS_MODIFIED; }
};
-SV_DECL_REF(DbGridRow)
+typedef tools::SvRef<DbGridRow> DbGridRowRef;
// DbGridControl
@@ -597,10 +597,6 @@ private:
using BrowseBox::InsertHandleColumn;
};
-
-SV_IMPL_REF(DbGridRow);
-
-
#endif // INCLUDED_SVX_GRIDCTRL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 049e2f099f3f..3c1e6e598991 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -73,7 +73,6 @@ class SvxForbiddenCharactersTable;
class SvNumberFormatter;
class SotStorage;
class SdrOutlinerCache;
-class SotStorageRef;
class SdrUndoFactory;
class ImageMap;
namespace comphelper
diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx
index adfa1fb77510..fc5f65995bdf 100644
--- a/include/tools/pstm.hxx
+++ b/include/tools/pstm.hxx
@@ -51,7 +51,7 @@ class TOOLS_DLLPUBLIC SvRttiBase : public SvRefBase
public:
TYPEINFO();
};
-SV_DECL_IMPL_REF(SvRttiBase)
+typedef tools::SvRef<SvRttiBase> SvRttiBaseRef;
#define SV_DECL_PERSIST( Class, CLASS_ID ) \
TYPEINFO_OVERRIDE(); \
@@ -98,7 +98,7 @@ public:
TOOLS_DLLPUBLIC friend SvPersistStream& operator >> ( SvPersistStream & rStm,
SvPersistBase *& rpObj );
};
-SV_DECL_IMPL_REF(SvPersistBase)
+typedef tools::SvRef<SvPersistBase> SvPersistBaseRef;
class SvPersistListWriteable
{
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index e66fbb4acec2..0bf519ecc094 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -22,58 +22,54 @@
#include <tools/toolsdllapi.h>
#include <vector>
-#define SV_DECL_REF( ClassName ) \
-class ClassName; \
-class ClassName##Ref \
-{ \
-protected: \
- ClassName * pObj; \
-public: \
- inline ClassName##Ref() { pObj = 0; } \
- inline ClassName##Ref( const ClassName##Ref & rObj ); \
- inline ClassName##Ref( ClassName * pObjP ); \
- inline void Clear(); \
- inline ~ClassName##Ref(); \
- inline ClassName##Ref & operator = ( const ClassName##Ref & rObj ); \
- inline ClassName##Ref & operator = ( ClassName * pObj ); \
- inline bool Is() const { return pObj != NULL; } \
- inline ClassName * operator & () const { return pObj; } \
- inline ClassName * operator -> () const { return pObj; } \
- inline ClassName & operator * () const { return *pObj; } \
- inline operator ClassName * () const { return pObj; } \
+namespace tools {
+
+template<typename T> class SvRef {
+public:
+ SvRef(): pObj(0) {}
+
+ SvRef(SvRef const & rObj): pObj(rObj.pObj)
+ { if (pObj != 0) pObj->AddNextRef(); }
+
+ SvRef(T * pObjP): pObj(pObjP) { if (pObj != 0) pObj->AddRef(); }
+
+ ~SvRef() { if (pObj != 0) pObj->ReleaseReference(); }
+
+ void Clear() {
+ if (pObj != 0) {
+ T * pRefObj = pObj;
+ pObj = 0;
+ pRefObj->ReleaseReference();
+ }
+ }
+
+ SvRef & operator =(SvRef const & rObj) {
+ if (rObj.pObj != 0) {
+ rObj.pObj->AddNextRef();
+ }
+ T * pRefObj = pObj;
+ pObj = rObj.pObj;
+ if (pRefObj != 0) {
+ pRefObj->ReleaseReference();
+ }
+ return *this;
+ }
+
+ bool Is() const { return pObj != 0; }
+
+ T * operator &() const { return pObj; }
+
+ T * operator ->() const { return pObj; }
+
+ T & operator *() const { return *pObj; }
+
+ operator T *() const { return pObj; }
+
+protected:
+ T * pObj;
};
-#define SV_IMPL_REF( ClassName ) \
-inline ClassName##Ref::ClassName##Ref( const ClassName##Ref & rObj ) \
- { pObj = rObj.pObj; if( pObj ) { pObj->AddNextRef(); } } \
-inline ClassName##Ref::ClassName##Ref( ClassName * pObjP ) \
-{ pObj = pObjP; if( pObj ) { pObj->AddRef(); } } \
-inline void ClassName##Ref::Clear() \
-{ \
- if( pObj ) \
- { \
- ClassName* const pRefObj = pObj; \
- pObj = 0; \
- pRefObj->ReleaseReference(); \
- } \
-} \
-inline ClassName##Ref::~ClassName##Ref() \
-{ if( pObj ) { pObj->ReleaseReference(); } } \
-inline ClassName##Ref & ClassName##Ref:: \
- operator = ( const ClassName##Ref & rObj ) \
-{ \
- if( rObj.pObj ) rObj.pObj->AddNextRef(); \
- ClassName* const pRefObj = pObj; \
- pObj = rObj.pObj; \
- if( pRefObj ) { pRefObj->ReleaseReference(); } \
- return *this; \
-} \
-inline ClassName##Ref & ClassName##Ref::operator = ( ClassName * pObjP ) \
-{ return *this = ClassName##Ref( pObjP ); }
-
-#define SV_DECL_IMPL_REF(ClassName) \
- SV_DECL_REF(ClassName) \
- SV_IMPL_REF(ClassName)
+}
template<typename T>
class SvRefMemberList : private std::vector<T>
@@ -174,7 +170,7 @@ public:
sal_uIntPtr GetRefCount() const { return nRefCount; }
};
-SV_DECL_IMPL_REF(SvRefBase)
+typedef tools::SvRef<SvRefBase> SvRefBaseRef;
class SvCompatWeakHdl : public SvRefBase
{
@@ -187,7 +183,7 @@ public:
void* GetObj() { return _pObj; }
};
-SV_DECL_IMPL_REF( SvCompatWeakHdl )
+typedef tools::SvRef<SvCompatWeakHdl> SvCompatWeakHdlRef;
class SvCompatWeakBase
{
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index bb0b392023b8..c823739670ae 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -134,7 +134,7 @@ public:
virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
};
-SV_DECL_IMPL_REF(SvLockBytes);
+typedef tools::SvRef<SvLockBytes> SvLockBytesRef;
// SvOpenLockBytes
@@ -157,7 +157,7 @@ public:
virtual void Terminate() = 0;
};
-SV_DECL_IMPL_REF(SvOpenLockBytes);
+typedef tools::SvRef<SvOpenLockBytes> SvOpenLockBytesRef;
// SvAsyncLockBytes
@@ -187,7 +187,7 @@ public:
virtual void Terminate() SAL_OVERRIDE { m_bTerminated = true; }
};
-SV_DECL_IMPL_REF(SvAsyncLockBytes);
+typedef tools::SvRef<SvAsyncLockBytes> SvAsyncLockBytesRef;
// SvStream
diff --git a/include/unotools/ucblockbytes.hxx b/include/unotools/ucblockbytes.hxx
index 8ebac8663d0a..a5a08751b20a 100644
--- a/include/unotools/ucblockbytes.hxx
+++ b/include/unotools/ucblockbytes.hxx
@@ -65,7 +65,8 @@ namespace com
namespace utl
{
-SV_DECL_REF( UcbLockBytes )
+class UcbLockBytes;
+typedef tools::SvRef<UcbLockBytes> UcbLockBytesRef;
class UcbLockBytesHandler : public SvRefBase
{
@@ -87,7 +88,7 @@ public:
bool IsActive() const { return m_bActive; }
};
-SV_DECL_IMPL_REF( UcbLockBytesHandler )
+typedef tools::SvRef<UcbLockBytesHandler> UcbLockBytesHandlerRef;
class UNOTOOLS_DLLPUBLIC UcbLockBytes : public virtual SvLockBytes
{
@@ -188,8 +189,6 @@ public:
void SetStreamValid_Impl();
};
-SV_IMPL_REF( UcbLockBytes );
-
}
#endif
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index afa9698a2be6..bd21e95436f6 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -96,9 +96,7 @@ public:
virtual void onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& rCandidate );
};
-SV_DECL_REF( SvXMLImportContext )
-SV_IMPL_REF( SvXMLImportContext )
-
+typedef tools::SvRef<SvXMLImportContext> SvXMLImportContextRef;
#endif // INCLUDED_XMLOFF_XMLICTXT_HXX