19 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H
20 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_H
34 class RuntimeException;
67 inline static XInterface * SAL_CALL
iquery( XInterface * pInterface,
const Type & rType )
76 inline static XInterface * SAL_CALL
iquery_throw( XInterface * pInterface,
const Type & rType )
84 inline XInterface * SAL_CALL
get()
const SAL_THROW(())
173 template<
typename T1,
typename T2 >
struct UpCast {
175 template<
bool,
typename U1,
typename >
struct C
178 template<
typename U1,
typename U2 >
struct C< false, U1, U2 >
181 struct S {
char c[2]; };
184 static char f(T2 *,
long);
185 static S f(T1 *
const &,
int);
187 template<
typename U >
static char f(T2 *, U);
188 static S f(T1 *,
int);
194 operator T1 *
const & ()
const;
196 operator T1 * ()
const;
202 typedef typename C< sizeof (f(H(), 0)) == 1, void *, void >::t t;
205 template<
typename T2 >
struct UpCast< XInterface, T2 > {};
214 template<
class interface_type >
215 class Reference :
public BaseReference
222 inline static XInterface * SAL_CALL iquery( XInterface * pInterface )
230 inline static XInterface * SAL_CALL iquery_throw( XInterface * pInterface )
237 inline static interface_type * SAL_CALL iset_throw( interface_type * pInterface )
251 static inline interface_type * castFromXInterface(XInterface * p) {
252 return static_cast< interface_type *
>(
static_cast< void *
>(p));
266 static inline XInterface * castToXInterface(interface_type * p) {
267 return static_cast< XInterface *
>(
static_cast< void *
>(p));
273 inline static void * SAL_CALL
operator new ( ::size_t nSize )
SAL_THROW(())
275 inline static void SAL_CALL
operator delete (
void * pMem )
SAL_THROW(())
277 inline static void * SAL_CALL
operator new ( ::size_t,
void * pMem )
SAL_THROW(())
279 inline static void SAL_CALL
operator delete (
void *,
void * )
SAL_THROW(())
305 template< class derived_type >
308 typename detail::UpCast< interface_type, derived_type >::t = 0 )
315 inline
Reference( interface_type * pInterface ) SAL_THROW(());
397 inline SAL_CALL operator const
Reference< XInterface > & () const SAL_THROW(())
411 inline interface_type * SAL_CALL
get()
const SAL_THROW(())
429 inline
sal_Bool SAL_CALL
set( interface_type * pInterface ) SAL_THROW(());
516 inline
void SAL_CALL
set( interface_type * pInterface,
UnoReference_SetThrow dummy) SAL_THROW( (RuntimeException) );
535 inline
Reference< interface_type > & SAL_CALL operator = ( interface_type * pInterface ) SAL_THROW(());
542 inline
Reference< interface_type > & SAL_CALL operator = ( const
Reference< interface_type > & rRef ) SAL_THROW(());
555 inline static
Reference< interface_type > SAL_CALL
query( XInterface * pInterface ) SAL_THROW( (RuntimeException) );
561 template <typename T>
562 inline T * get_pointer(
Reference<T> const& r )
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:110
C++ class representing an IDL meta type.
Definition: Type.h:55
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
static Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:343
sal_Bool operator!=(XInterface *pInterface) const
Unequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:398
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:54
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:134
sal_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:361
~Reference()
Destructor: Releases interface if set.
Definition: Reference.hxx:103
sal_Bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:250
sal_Bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:379
Definition: Reference.h:156
sal_Bool is() const
Checks if reference is null.
Definition: Reference.h:91
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:43
This enum value can be used for implicit interface query.
Definition: Reference.h:147
C++ class representing an IDL any.
Definition: Any.h:46
This enum value can be used for implicit interface query.
Definition: Reference.h:138
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:143
void clear()
Clears reference, i.e.
Definition: Reference.hxx:207
unsigned char sal_Bool
Definition: types.h:46
__sal_NoAcquire
Definition: types.h:372
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:37
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:154
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:67
XInterface * _pInterface
the interface pointer
Definition: Reference.h:59
This enum value can be used for creating a reference granting a given interface, i.e.
Definition: Reference.h:48
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
interface_type * operator->() const
Dereference operator: Used to call interface methods.
Definition: Reference.h:404
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:358