20 #ifndef INCLUDED_RTL_REF_HXX
21 #define INCLUDED_RTL_REF_HXX
28 #ifdef LIBO_INTERNAL_ONLY
29 #include <type_traits>
39 template <
class reference_type>
44 reference_type * m_pBody;
74 : m_pBody (handle.m_pBody)
80 #ifdef LIBO_INTERNAL_ONLY
84 : m_pBody (handle.m_pBody)
86 handle.m_pBody =
nullptr;
90 #if defined LIBO_INTERNAL_ONLY
97 template<
class derived_type >
99 const Reference< derived_type > & rRef,
100 std::enable_if_t<std::is_base_of_v<reference_type, derived_type>,
int> = 0 )
101 : m_pBody (rRef.
get())
120 SAL_CALL
set (reference_type * pBody)
124 reference_type *
const pOld = m_pBody;
138 return set( handle.m_pBody );
141 #ifdef LIBO_INTERNAL_ONLY
153 m_pBody = handle.m_pBody;
154 handle.m_pBody =
nullptr;
161 Reference<reference_type> &
178 reference_type *
const pOld = m_pBody;
190 reference_type * SAL_CALL
get()
const
200 assert(m_pBody != NULL);
209 assert(m_pBody != NULL);
216 bool SAL_CALL
is()
const
218 return (m_pBody != NULL);
221 #if defined LIBO_INTERNAL_ONLY
224 explicit operator bool()
const
232 bool SAL_CALL
operator== (
const reference_type * pBody)
const
234 return (m_pBody == pBody);
243 return (m_pBody == handle.m_pBody);
252 return (m_pBody != handle.m_pBody);
261 return (m_pBody < handle.m_pBody);
270 return (m_pBody > handle.m_pBody);
276 #if defined LIBO_INTERNAL_ONLY
290 {
return std::size_t(s.
get()); }
__sal_NoAcquire
Definition: types.h:349
#define COVERITY_NOEXCEPT_FALSE
To markup destructors that coverity warns might throw exceptions which won't throw in practice,...
Definition: types.h:333
Definition: bootstrap.hxx:30
Template reference class for reference type.
Definition: ref.hxx:41
bool operator!=(const Reference< reference_type > &handle) const
Needed to place References into STL collection.
Definition: ref.hxx:250
reference_type * operator->() const
Probably most common used: handle->someBodyOp().
Definition: ref.hxx:198
Reference< reference_type > & clear()
Unbind the body from this handle.
Definition: ref.hxx:174
bool operator>(const Reference< reference_type > &handle) const
Needed to place References into STL collection.
Definition: ref.hxx:268
bool operator==(const reference_type *pBody) const
Returns True if this points to pBody.
Definition: ref.hxx:232
reference_type & operator*() const
Allows (*handle).someBodyOp().
Definition: ref.hxx:207
Reference< reference_type > & set(reference_type *pBody)
Set...
Definition: ref.hxx:120
bool is() const
Returns True if the handle does point to a valid body.
Definition: ref.hxx:216
~Reference() COVERITY_NOEXCEPT_FALSE
Destructor...
Definition: ref.hxx:110
Reference< reference_type > & operator=(const Reference< reference_type > &handle)
Assignment.
Definition: ref.hxx:136
Reference(const Reference< reference_type > &handle)
Copy constructor...
Definition: ref.hxx:73
Reference()
Constructor...
Definition: ref.hxx:50
reference_type * get() const
Get the body.
Definition: ref.hxx:190
bool operator<(const Reference< reference_type > &handle) const
Needed to place References into STL collection.
Definition: ref.hxx:259
Reference(reference_type *pBody, __sal_NoAcquire)
Constructor...
Definition: ref.hxx:57
Reference(reference_type *pBody)
Constructor...
Definition: ref.hxx:64