diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-30 10:20:00 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-30 10:20:00 +0200 |
commit | 3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed (patch) | |
tree | bdfd28afe5a452060e3d985c5f01b45f4b7bc2cd /include/svl | |
parent | 57d254d42b6e1d836bd21e6fb2e968af2b511c7d (diff) |
Gradually typed Link
Turn the Link class into a template abstracting over the link's argument and
return types, but provide default template arguments that keep the generic,
unsafe "void* in, sal_IntPtr out" behvior. That way, individual uses of the
Link class can be updated over time.
All the related macros are duplicated with ..._TYPED counterparts, that
additionally take the RetType (except for LINK_TYPED, which manages to infer the
relevant types from the supplied Member).
(It would have been attractive to change the "untyped" LinkStubs from taking a
void* to a properly typed ArgType parameter, too, but that would cause
-fsanitize=function to flag uses of "untyped" Link::Call.)
Change-Id: I3b0140378bad99abbf240140ebb4a46a05d2d2f8
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/svdde.hxx | 48 | ||||
-rw-r--r-- | include/svl/urihelper.hxx | 6 | ||||
-rw-r--r-- | include/svl/zforlist.hxx | 4 |
3 files changed, 29 insertions, 29 deletions
diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx index f272b72b72ca..598aa3d7c384 100644 --- a/include/svl/svdde.hxx +++ b/include/svl/svdde.hxx @@ -98,8 +98,8 @@ protected: short nType; sal_IntPtr nId; sal_IntPtr nTime; - Link aData; - Link aDone; + Link<> aData; + Link<> aDone; bool bBusy; DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER long = 0 ); @@ -112,11 +112,11 @@ public: void Execute(); - void SetDataHdl( const Link& rLink ) { aData = rLink; } - const Link& GetDataHdl() const { return aData; } + void SetDataHdl( const Link<>& rLink ) { aData = rLink; } + const Link<>& GetDataHdl() const { return aData; } - void SetDoneHdl( const Link& rLink ) { aDone = rLink; } - const Link& GetDoneHdl() const { return aDone; } + void SetDoneHdl( const Link<>& rLink ) { aDone = rLink; } + const Link<>& GetDoneHdl() const { return aDone; } void SetFormat( SotClipboardFormatId nFmt ) { aDdeData.SetFormat( nFmt ); } SotClipboardFormatId GetFormat() const { return aDdeData.GetFormat(); } @@ -138,14 +138,14 @@ private: class SVL_DLLPUBLIC DdeLink : public DdeTransaction { - Link aNotify; + Link<> aNotify; public: DdeLink( DdeConnection&, const OUString&, long = 0 ); virtual ~DdeLink(); - void SetNotifyHdl( const Link& rLink ) { aNotify = rLink; } - const Link& GetNotifyHdl() const { return aNotify; } + void SetNotifyHdl( const Link<>& rLink ) { aNotify = rLink; } + const Link<>& GetNotifyHdl() const { return aNotify; } virtual void Notify(); }; @@ -310,11 +310,11 @@ private: DdeString* pName; OUString aItem; std::vector<DdeItem*> aItems; - Link aConnectLink; - Link aDisconnectLink; - Link aGetLink; - Link aPutLink; - Link aExecLink; + Link<> aConnectLink; + Link<> aDisconnectLink; + Link<> aGetLink; + Link<> aPutLink; + Link<> aExecLink; public: DdeTopic( SAL_UNUSED_PARAMETER const OUString& ); @@ -323,16 +323,16 @@ public: const OUString GetName() const; long GetConvId(); - void SetConnectHdl( const Link& rLink ) { aConnectLink = rLink; } - const Link& GetConnectHdl() const { return aConnectLink; } - void SetDisconnectHdl( const Link& rLink ) { aDisconnectLink = rLink; } - const Link& GetDisconnectHdl() const { return aDisconnectLink; } - void SetGetHdl( const Link& rLink ) { aGetLink = rLink; } - const Link& GetGetHdl() const { return aGetLink; } - void SetPutHdl( const Link& rLink ) { aPutLink = rLink; } - const Link& GetPutHdl() const { return aPutLink; } - void SetExecuteHdl( const Link& rLink ) { aExecLink = rLink; } - const Link& GetExecuteHdl() const { return aExecLink; } + void SetConnectHdl( const Link<>& rLink ) { aConnectLink = rLink; } + const Link<>& GetConnectHdl() const { return aConnectLink; } + void SetDisconnectHdl( const Link<>& rLink ) { aDisconnectLink = rLink; } + const Link<>& GetDisconnectHdl() const { return aDisconnectLink; } + void SetGetHdl( const Link<>& rLink ) { aGetLink = rLink; } + const Link<>& GetGetHdl() const { return aGetLink; } + void SetPutHdl( const Link<>& rLink ) { aPutLink = rLink; } + const Link<>& GetPutHdl() const { return aPutLink; } + void SetExecuteHdl( const Link<>& rLink ) { aExecLink = rLink; } + const Link<>& GetExecuteHdl() const { return aExecLink; } void NotifyClient( const OUString& ); bool IsSystemTopic(); diff --git a/include/svl/urihelper.hxx b/include/svl/urihelper.hxx index 7bfee23f6638..125234ea9921 100644 --- a/include/svl/urihelper.hxx +++ b/include/svl/urihelper.hxx @@ -51,7 +51,7 @@ namespace URIHelper { */ SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, OUString const & rTheRelURIRef, - Link const & rMaybeFileHdl = Link(), + Link<> const & rMaybeFileHdl = Link<>(), bool bCheckFileExists = true, bool bIgnoreFragment = false, INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::WAS_ENCODED, @@ -60,9 +60,9 @@ SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, bool bRelativeNonURIs = false, INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); -SVL_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); +SVL_DLLPUBLIC void SetMaybeFileHdl(Link<> const & rTheMaybeFileHdl); -SVL_DLLPUBLIC Link GetMaybeFileHdl(); +SVL_DLLPUBLIC Link<> GetMaybeFileHdl(); /** Converts a URI reference to a relative one, ignoring certain differences (for diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index f9a116b26f70..f4888015d6bd 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -338,7 +338,7 @@ public: ~SvNumberFormatter(); /// Set CallBack to ColorTable - void SetColorLink( const Link& rColorTableCallBack ); + void SetColorLink( const Link<>& rColorTableCallBack ); /// Do the CallBack to ColorTable Color* GetUserDefColor(sal_uInt16 nIndex); @@ -789,7 +789,7 @@ private: OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand ImpSvNumberInputScan* pStringScanner; // Input string scanner ImpSvNumberformatScan* pFormatScanner; // Format code string scanner - Link aColorLink; // User defined color table CallBack + Link<> aColorLink; // User defined color table CallBack sal_uInt32 MaxCLOffset; // Max language/country offset used sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale LanguageType IniLnge; // Initialized setting language/country |