diff --git a/src/App/DocumentObserver.cpp b/src/App/DocumentObserver.cpp index 4e8fa83035..dfc4eeac59 100644 --- a/src/App/DocumentObserver.cpp +++ b/src/App/DocumentObserver.cpp @@ -593,7 +593,12 @@ bool DocumentWeakPtrT::expired() const noexcept return (d->_document == nullptr); } -App::Document* DocumentWeakPtrT::operator->() noexcept +App::Document* DocumentWeakPtrT::operator*() const noexcept +{ + return d->_document; +} + +App::Document* DocumentWeakPtrT::operator->() const noexcept { return d->_document; } @@ -686,7 +691,12 @@ DocumentObjectWeakPtrT& DocumentObjectWeakPtrT::operator= (App::DocumentObject* return *this; } -App::DocumentObject* DocumentObjectWeakPtrT::operator->() noexcept +App::DocumentObject* DocumentObjectWeakPtrT::operator*() const noexcept +{ + return d->get(); +} + +App::DocumentObject* DocumentObjectWeakPtrT::operator->() const noexcept { return d->get(); } diff --git a/src/App/DocumentObserver.h b/src/App/DocumentObserver.h index 6630a497d3..2ac41a868f 100644 --- a/src/App/DocumentObserver.h +++ b/src/App/DocumentObserver.h @@ -294,11 +294,16 @@ public: * \return true if the managed object has already been deleted, false otherwise. */ bool expired() const noexcept; + /*! + * \brief operator * + * \return pointer to the document + */ + App::Document* operator*() const noexcept; /*! * \brief operator -> * \return pointer to the document */ - App::Document* operator->() noexcept; + App::Document* operator->() const noexcept; private: // disable @@ -334,10 +339,15 @@ public: */ DocumentObjectWeakPtrT& operator= (App::DocumentObject* p); /*! - * \brief operator -> - * \return pointer to the document + * \brief operator * + * \return pointer to the document object */ - App::DocumentObject* operator->() noexcept; + App::DocumentObject* operator*() const noexcept; + /*! + * \brief operator -> + * \return pointer to the document object + */ + App::DocumentObject* operator->() const noexcept; /*! * \brief operator == * \return true if both objects are equal, false otherwise @@ -400,6 +410,13 @@ public: ptr = p; return *this; } + /*! + * \brief operator -> + * \return pointer to the document object + */ + T* operator*() const { + return ptr.get(); + } /*! * \brief operator -> * \return pointer to the document object