19 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H 20 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H 38 class RuntimeException;
71 inline static XInterface * SAL_CALL
iquery( XInterface * pInterface,
const Type & rType );
79 inline static XInterface * SAL_CALL
iquery_throw( XInterface * pInterface,
const Type & rType );
86 XInterface * SAL_CALL
get()
const 93 bool SAL_CALL
is()
const 94 {
return (NULL != _pInterface); }
96 #if defined LIBO_INTERNAL_ONLY 101 explicit operator bool()
const 111 inline bool SAL_CALL
operator == ( XInterface * pInterface )
const;
118 inline bool SAL_CALL
operator != ( XInterface * pInterface )
const;
184 template<
typename T1,
typename T2 >
struct UpCast {
186 template<
bool,
typename U1,
typename >
struct C
189 template<
typename U1,
typename U2 >
struct C< false, U1, U2 >
192 struct S {
char c[2]; };
194 #if defined _MSC_VER && _MSC_VER < 1800 195 static char f(T2 *,
long);
196 static S f(T1 *
const &,
int);
198 template<
typename U >
static char f(T2 *, U);
199 static S f(T1 *,
int);
204 #if defined _MSC_VER && _MSC_VER < 1800 205 operator T1 *
const & ()
const;
207 operator T1 * ()
const;
213 typedef typename C< sizeof (f(H(), 0)) == 1, void *, void >::t t;
216 template<
typename T2 >
struct UpCast< XInterface, T2 > {};
225 template<
class interface_type >
233 inline static XInterface * SAL_CALL
iquery( XInterface * pInterface );
240 inline static XInterface * SAL_CALL
iquery_throw( XInterface * pInterface );
246 inline static interface_type * SAL_CALL iset_throw( interface_type * pInterface );
259 static interface_type * castFromXInterface(XInterface * p) {
260 return static_cast< interface_type *
>(
static_cast< void *
>(p));
274 static XInterface * castToXInterface(interface_type * p) {
275 return static_cast< XInterface *
>(
static_cast< void *
>(p));
281 static void * SAL_CALL
operator new ( ::size_t nSize )
283 static void SAL_CALL
operator delete (
void * pMem )
285 static void * SAL_CALL
operator new ( ::size_t,
void * pMem )
287 static void SAL_CALL
operator delete (
void *,
void * )
305 #if defined LIBO_INTERNAL_ONLY 321 template<
class derived_type >
324 typename detail::UpCast< interface_type, derived_type >::t = 0 );
330 inline Reference( interface_type * pInterface );
419 interface_type * SAL_CALL operator -> ()
const {
428 interface_type * SAL_CALL
get()
const 433 inline void SAL_CALL clear();
446 inline bool SAL_CALL
set( interface_type * pInterface );
454 inline bool SAL_CALL
set( interface_type * pInterface,
__sal_NoAcquire dummy);
560 #if defined LIBO_INTERNAL_ONLY bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:402
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:145
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:154
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:50
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:165
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:483
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:73
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:39
XInterface * _pInterface
the interface pointer
Definition: Reference.h:63
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
__sal_NoAcquire
Definition: types.h:366
bool is() const
Checks if reference is null.
Definition: Reference.h:93
This enum value can be used for creating a reference granting a given interface, i.e.
Definition: Reference.h:52
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:47
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:58
This enum value can be used for implicit interface query.
Definition: Reference.h:149
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:307
This enum value can be used for implicit interface query.
Definition: Reference.h:158
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
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:384
Definition: Reference.h:167
C++ class representing an IDL meta type.
Definition: Type.h:54
C++ class representing an IDL any.
Definition: Any.h:52
bool operator!=(XInterface *pInterface) const
Unequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:421