summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-03-19 11:22:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-03-19 11:03:42 +0100
commit34ea5c21a752364caef9727850ef34943ad5c752 (patch)
treecfda8f313f8cc1b574c54caf104306319c2ac13f /include
parent5ac6f02fdc6015a5d78071570dee310febf95fc6 (diff)
add operator* to tools::WeakReference
which fixes warnings from commit ef37ab245b8095895f715217236e8e2fb90613c6 Date: Thu Mar 19 09:21:45 2020 +0200 loplugin:redundantpointerops add some more smart pointer types which I pushed earlier, where I added tools::WeakReference to the list of smart pointer types, but of course the conversion it recommended is not possible without an operator* Change-Id: I9433b7aba46a3a15f9d833847ae3659367388109 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90735 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/tools/weakbase.h3
-rw-r--r--include/tools/weakbase.hxx6
2 files changed, 9 insertions, 0 deletions
diff --git a/include/tools/weakbase.h b/include/tools/weakbase.h
index 458381e47fff..e614efcc4111 100644
--- a/include/tools/weakbase.h
+++ b/include/tools/weakbase.h
@@ -97,6 +97,9 @@ public:
/** returns the pointer to the reference object or null */
inline reference_type * operator->() const;
+ /** returns a ref to the reference object */
+ inline reference_type& operator*() const;
+
/** returns true if this instance references pReferenceObject */
inline bool operator== (const reference_type * pReferenceObject) const;
diff --git a/include/tools/weakbase.hxx b/include/tools/weakbase.hxx
index fa16edd2f147..5c1645e69cf1 100644
--- a/include/tools/weakbase.hxx
+++ b/include/tools/weakbase.hxx
@@ -83,6 +83,12 @@ inline reference_type * WeakReference< reference_type >::operator->() const
}
template< class reference_type >
+inline reference_type& WeakReference< reference_type >::operator*() const
+{
+ return *get();
+}
+
+template< class reference_type >
inline bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const
{
return mpWeakConnection->mpReference == pReferenceObject;