4 #ifndef INCLUDED_RTL_REF_HXX
5 #define INCLUDED_RTL_REF_HXX
12 #ifdef LIBO_INTERNAL_ONLY
13 #include <type_traits>
24 template <
class reference_type>
29 reference_type * m_pBody;
59 : m_pBody (handle.m_pBody)
65 #ifdef LIBO_INTERNAL_ONLY
69 : m_pBody (handle.m_pBody)
71 handle.m_pBody =
nullptr;
75 #if defined LIBO_INTERNAL_ONLY
82 template<
class derived_type >
84 const Reference< derived_type > & rRef,
85 std::enable_if_t<std::is_base_of_v<reference_type, derived_type>,
int> = 0 )
86 : m_pBody (rRef.
get())
96 template<
class super_type,
97 std::enable_if_t<std::is_base_of_v<super_type, reference_type>,
int> = 0 >
98 inline operator css::uno::Reference<super_type>()
const
100 return css::uno::Reference<super_type>(m_pBody);
116 SAL_CALL
set (reference_type * pBody)
120 reference_type *
const pOld = m_pBody;
134 return set( handle.m_pBody );
137 #ifdef LIBO_INTERNAL_ONLY
149 m_pBody = handle.m_pBody;
150 handle.m_pBody =
nullptr;
157 Reference<reference_type> &
174 reference_type *
const pOld = m_pBody;
186 reference_type * SAL_CALL
get()
const
196 assert(m_pBody != NULL);
205 assert(m_pBody != NULL);
212 bool SAL_CALL
is()
const
214 return (m_pBody != NULL);
217 #if defined LIBO_INTERNAL_ONLY
220 explicit operator bool()
const
228 bool SAL_CALL
operator== (
const reference_type * pBody)
const
230 return (m_pBody == pBody);
239 return (m_pBody == handle.m_pBody);
248 return (m_pBody != handle.m_pBody);
255 SAL_CALL operator< (const Reference<reference_type> & handle)
const
257 return (m_pBody < handle.m_pBody);
266 return (m_pBody > handle.m_pBody);
272 #if defined LIBO_INTERNAL_ONLY
286 {
return std::size_t(s.
get()); }
~Reference() COVERITY_NOEXCEPT_FALSE
Destructor...
Definition: ref.hxx:106
Template reference class for reference type.
Definition: ref.hxx:25
bool operator==(const reference_type *pBody) const
Returns True if this points to pBody.
Definition: ref.hxx:228
Reference< reference_type > & set(reference_type *pBody)
Set...
Definition: ref.hxx:116
__sal_NoAcquire
Definition: types.h:332
#define COVERITY_NOEXCEPT_FALSE
To markup destructors that coverity warns might throw exceptions which won't throw in practice...
Definition: types.h:329
bool is() const
Returns True if the handle does point to a valid body.
Definition: ref.hxx:212
Reference< reference_type > & clear()
Unbind the body from this handle.
Definition: ref.hxx:170
Reference(reference_type *pBody)
Constructor...
Definition: ref.hxx:49
reference_type & operator*() const
Allows (*handle).someBodyOp().
Definition: ref.hxx:203
bool operator>(const Reference< reference_type > &handle) const
Needed to place References into STL collection.
Definition: ref.hxx:264
reference_type * operator->() const
Probably most common used: handle->someBodyOp().
Definition: ref.hxx:194
reference_type * get() const
Get the body.
Definition: ref.hxx:186
Reference(const Reference< reference_type > &handle)
Copy constructor...
Definition: ref.hxx:58
Reference< reference_type > & operator=(const Reference< reference_type > &handle)
Assignment.
Definition: ref.hxx:132
Reference()
Constructor...
Definition: ref.hxx:35
bool operator!=(const Reference< reference_type > &handle) const
Needed to place References into STL collection.
Definition: ref.hxx:246
Reference(reference_type *pBody, __sal_NoAcquire)
Constructor...
Definition: ref.hxx:42