19 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
20 #define _COM_SUN_STAR_UNO_REFERENCE_H_
34 class RuntimeException;
67 inline static XInterface * SAL_CALL
iquery( XInterface * pInterface,
const Type & rType )
69 #ifndef EXCEPTIONS_OFF
77 inline static XInterface * SAL_CALL
iquery_throw( XInterface * pInterface,
const Type & rType )
86 inline XInterface * SAL_CALL
get()
const SAL_THROW(())
142 #ifndef EXCEPTIONS_OFF
177 template<
typename T1,
typename T2 >
struct UpCast {
179 template<
bool,
typename U1,
typename >
struct C
182 template<
typename U1,
typename U2 >
struct C< false, U1, U2 >
185 struct S {
char c[2]; };
188 static char f(T2 *,
long);
189 static S f(T1 *
const &,
int);
191 template<
typename U >
static char f(T2 *, U);
192 static S f(T1 *,
int);
198 operator T1 *
const & ()
const;
200 operator T1 * ()
const;
206 typedef typename C< sizeof (f(H(), 0)) == 1, void *, void >::t t;
209 template<
typename T2 >
struct UpCast< XInterface, T2 > {};
218 template<
class interface_type >
219 class Reference :
public BaseReference
226 inline static XInterface * SAL_CALL iquery( XInterface * pInterface )
228 #ifndef EXCEPTIONS_OFF
235 inline static XInterface * SAL_CALL iquery_throw( XInterface * pInterface )
242 inline static interface_type * SAL_CALL iset_throw( interface_type * pInterface )
257 static inline interface_type * castFromXInterface(XInterface * p) {
258 return static_cast< interface_type *
>(
static_cast< void *
>(p));
272 static inline XInterface * castToXInterface(interface_type * p) {
273 return static_cast< XInterface *
>(
static_cast< void *
>(p));
279 inline static void * SAL_CALL
operator new ( ::size_t nSize )
SAL_THROW(())
281 inline static void SAL_CALL
operator delete (
void * pMem )
SAL_THROW(())
283 inline static void * SAL_CALL
operator new ( ::size_t,
void * pMem )
SAL_THROW(())
285 inline static void SAL_CALL
operator delete (
void *,
void * )
SAL_THROW(())
311 template< class derived_type >
314 typename detail::UpCast< interface_type, derived_type >::t = 0 )
321 inline
Reference( interface_type * pInterface ) SAL_THROW(());
356 #ifndef EXCEPTIONS_OFF
412 inline interface_type * SAL_CALL
operator -> () const SAL_THROW(())
419 inline interface_type * SAL_CALL
get()
const SAL_THROW(())
424 inline void SAL_CALL
clear() SAL_THROW(());
437 inline
sal_Bool SAL_CALL
set( interface_type * pInterface ) SAL_THROW(());
486 #ifndef EXCEPTIONS_OFF
571 template <
typename T>
572 inline T * get_pointer( Reference<T>
const& r )
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:112
C++ class representing an IDL meta type.
Definition: Type.h:55
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:356
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:350
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:413
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:136
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:368
~Reference()
Destructor: Releases interface if set.
Definition: Reference.hxx:105
sal_Bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:254
sal_Bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:390
Definition: Reference.h:159
sal_Bool is() const
Checks if reference is null.
Definition: Reference.h:93
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:150
C++ class representing an IDL any.
Definition: Any.h:46
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
This enum value can be used for implicit interface query.
Definition: Reference.h:140
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:146
void clear()
Clears reference, i.e.
Definition: Reference.hxx:211
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:157
unsigned char sal_Bool
Definition: types.h:37
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:68
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
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:333
interface_type * operator->() const
Dereference operator: Used to call interface methods.
Definition: Reference.h:412
__sal_NoAcquire
Definition: types.h:370