diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-05 14:29:59 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 19:56:31 +0100 |
commit | 99ff2fcfb546e4a85042e4222677aac617bdc19b (patch) | |
tree | e5cb65babf493f0e7fa14a9ffa33ce1b3e5a229e /include/vcl | |
parent | d904316d3da61fdaedf68ebfb6d75abda49600f1 (diff) |
vcl: add cast operator to VclReference to convert to pointer
so we don't have to call .get() everywhere
Change-Id: If6ccd7dcf1a492b1e7703956ecbe8e5ac2dd0fb7
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/dialog.hxx | 4 | ||||
-rw-r--r-- | include/vcl/edit.hxx | 4 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 4 | ||||
-rw-r--r-- | include/vcl/vclref.hxx | 20 |
4 files changed, 21 insertions, 11 deletions
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index e937c81824b2..8dad86385b34 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -89,8 +89,8 @@ public: virtual void queue_resize(StateChangedType eReason = StateChangedType::LAYOUT) SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; - VclButtonBox* get_action_area() { return mpActionArea.get(); } - VclBox* get_content_area() { return mpContentArea.get(); } + VclButtonBox* get_action_area() { return mpActionArea; } + VclBox* get_content_area() { return mpContentArea; } virtual bool Close() SAL_OVERRIDE; diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index 5a28ecb58360..959a8555095e 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -188,7 +188,7 @@ public: virtual void SetModifyFlag(); virtual void ClearModifyFlag(); - virtual bool IsModified() const { return mpSubEdit.get() ? mpSubEdit->mbModified : mbModified; } + virtual bool IsModified() const { return mpSubEdit ? mpSubEdit->mbModified : mbModified; } virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT ); virtual void DisableUpdateData() { delete mpUpdateDataTimer; mpUpdateDataTimer = NULL; } @@ -238,7 +238,7 @@ public: virtual void SetUpdateDataHdl( const Link& rLink ) { maUpdateDataHdl = rLink; } void SetSubEdit( VclReference<Edit> pEdit ); - Edit* GetSubEdit() const { return mpSubEdit.get(); } + Edit* GetSubEdit() const { return mpSubEdit; } boost::signals2::signal< void ( Edit* ) > autocompleteSignal; AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; } diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index f67717218390..c0d8c505f581 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -572,8 +572,8 @@ public: virtual vcl::Window *get_child() SAL_OVERRIDE; virtual const vcl::Window *get_child() const SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; - ScrollBar& getVertScrollBar() { return *m_pVScroll.get(); } - ScrollBar& getHorzScrollBar() { return *m_pHScroll.get(); } + ScrollBar& getVertScrollBar() { return *m_pVScroll; } + ScrollBar& getHorzScrollBar() { return *m_pHScroll; } Size getVisibleChildSize() const; //set to true to disable the built-in scrolling callbacks to allow the user //to override it diff --git a/include/vcl/vclref.hxx b/include/vcl/vclref.hxx index b8c15eaea804..0827af66bdd2 100644 --- a/include/vcl/vclref.hxx +++ b/include/vcl/vclref.hxx @@ -111,26 +111,36 @@ public: inline VclReference( const VclReference< derived_type > & rRef, typename ::vcl::detail::UpCast< reference_type, derived_type >::t = 0 ) - : m_rInnerRef( static_cast<reference_type*>(rRef.get()) ) + : m_rInnerRef( static_cast<reference_type*>(rRef) ) { } + /** Probably most common used: handle->someBodyOp(). + */ + inline reference_type * SAL_CALL operator->() const + { + return m_rInnerRef.get(); + } + /** Get the body. Can be used instead of operator->(). I.e. handle->someBodyOp() and handle.get()->someBodyOp() are the same. - */ + */ inline reference_type * SAL_CALL get() const { return m_rInnerRef.get(); } - /** Probably most common used: handle->someBodyOp(). - */ - inline reference_type * SAL_CALL operator->() const + inline SAL_CALL operator reference_type * () const { return m_rInnerRef.get(); } + inline SAL_CALL operator bool () const + { + return m_rInnerRef.get() != NULL; + } + inline void disposeAndClear() { // hold it alive for the lifetime of this method |