3 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H
4 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H
11 #if defined LIBO_INTERNAL_ONLY
12 #include <type_traits>
26 class RuntimeException;
59 inline static XInterface * SAL_CALL
iquery( XInterface * pInterface,
const Type & rType );
67 inline static XInterface * SAL_CALL
iquery_throw( XInterface * pInterface,
const Type & rType );
74 XInterface * SAL_CALL
get()
const
81 bool SAL_CALL
is()
const
84 #if defined LIBO_INTERNAL_ONLY
89 explicit operator bool()
const
99 inline bool SAL_CALL
operator == ( XInterface * pInterface )
const;
106 inline bool SAL_CALL
operator != ( XInterface * pInterface )
const;
114 inline bool SAL_CALL
operator == (
const BaseReference & rRef )
const;
121 inline bool SAL_CALL
operator != (
const BaseReference & rRef )
const;
128 inline bool SAL_CALL
operator < (
const BaseReference & rRef )
const;
162 template<
class interface_type >
163 class SAL_DLLPUBLIC_RTTI Reference :
public BaseReference
170 inline static XInterface * SAL_CALL iquery( XInterface * pInterface );
177 inline static XInterface * SAL_CALL iquery_throw( XInterface * pInterface );
183 inline static interface_type * SAL_CALL iset_throw( interface_type * pInterface );
196 static interface_type * castFromXInterface(XInterface * p) {
197 return static_cast< interface_type *
>(
static_cast< void *
>(p));
211 static XInterface * castToXInterface(interface_type * p) {
212 return static_cast< XInterface *
>(
static_cast< void *
>(p));
218 static void * SAL_CALL
operator new ( ::size_t nSize )
220 static void SAL_CALL
operator delete (
void * pMem )
222 static void * SAL_CALL
operator new ( ::size_t,
void * pMem )
224 static void SAL_CALL
operator delete (
void *,
void * )
240 inline Reference( const Reference< interface_type > & rRef );
242 #if defined LIBO_INTERNAL_ONLY
247 inline Reference( Reference< interface_type > && rRef ) noexcept;
257 template< class derived_type >
259 const Reference< derived_type > & rRef,
261 std::is_base_of_v<interface_type, derived_type>
262 && !std::is_same_v<interface_type, XInterface>,
void *> =
nullptr);
269 inline Reference( interface_type * pInterface );
312 #ifdef LIBO_INTERNAL_ONLY
364 interface_type * SAL_CALL operator -> ()
const {
365 assert(_pInterface != NULL);
366 return castFromXInterface(_pInterface);
374 interface_type & SAL_CALL operator * ()
const {
375 assert(_pInterface != NULL);
376 return *castFromXInterface(_pInterface);
383 interface_type * SAL_CALL
get()
const
384 {
return castFromXInterface(_pInterface); }
388 inline void SAL_CALL clear();
401 inline bool SAL_CALL set( interface_type * pInterface );
409 inline bool SAL_CALL set( interface_type * pInterface,
__sal_NoAcquire dummy);
468 #ifdef LIBO_INTERNAL_ONLY
521 #if defined LIBO_INTERNAL_ONLY
bool is() const
Checks if reference is null.
Definition: Reference.h:81
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
__sal_NoAcquire
Definition: types.h:332
C++ class representing an IDL any.
Definition: Any.h:36
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:142
This enum value can be used for implicit interface query.
Definition: Reference.h:146
#define COVERITY_NOEXCEPT_FALSE
To markup destructors that coverity warns might throw exceptions which won't throw in practice...
Definition: types.h:329
This enum value can be used for implicit interface query.
Definition: Reference.h:137
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:133
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:454
This enum value can be used for creating a reference granting a given interface, i.e.
Definition: Reference.h:40
C++ class representing an IDL meta type.
Definition: Type.h:38
bool operator==(XInterface *pInterface) const
Equality operator: compares two interfaces Checks if both references are null or refer to the same ob...
Definition: Reference.hxx:369
bool operator!=(XInterface *pInterface) const
Inequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:406
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:264
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:23
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:153
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:35
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:46
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:34
Definition: Reference.h:155
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:387
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:57
XInterface * _pInterface
the interface pointer
Definition: Reference.h:51