Kaydet (Commit) 1480a2d0 authored tarafından Noel Grandin's avatar Noel Grandin

add 'explicit operator bool' to our reference classes

Change-Id: I91cfbe2646dcc55b98d2b809c49c9ea073f54f58
Reviewed-on: https://gerrit.libreoffice.org/33517Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b41186a2
......@@ -93,6 +93,15 @@ public:
inline bool SAL_CALL is() const
{ return (NULL != _pInterface); }
#if defined LIBO_INTERNAL_ONLY
/** Checks if reference is null.
@return true if reference acquires an interface, i.e. true if it is not null
*/
inline explicit operator bool() const
{ return is(); }
#endif
/** Equality operator: compares two interfaces
Checks if both references are null or refer to the same object.
......
......@@ -195,6 +195,14 @@ public:
return (m_pBody != NULL);
}
#if defined LIBO_INTERNAL_ONLY
/** Returns True if the handle does point to a valid body.
*/
inline explicit operator bool() const
{
return is();
}
#endif
/** Returns True if this points to pBody.
*/
......
......@@ -90,6 +90,8 @@ public:
bool Is() const { return pObj != nullptr; }
explicit operator bool() const { return Is(); }
T * get() const { return pObj; }
T * operator ->() const { assert(pObj != nullptr); return pObj; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment