19 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX
20 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX
27 #include <com/sun/star/uno/RuntimeException.hpp>
28 #include <com/sun/star/uno/XInterface.hpp>
50 XInterface * pInterface,
const Type & rType )
54 Any aRet( pInterface->queryInterface( rType ) );
57 XInterface * pRet =
static_cast< XInterface *
>( aRet.pReserved );
58 aRet.pReserved = NULL;
65 template<
class interface_type >
67 XInterface * pInterface )
73 XInterface * pInterface,
const Type & rType )
75 XInterface * pQueried =
iquery( pInterface, rType );
78 throw RuntimeException(
83 template<
class interface_type >
85 XInterface * pInterface )
88 pInterface, interface_type::static_type());
91 template<
class interface_type >
92 inline interface_type * Reference< interface_type >::iset_throw(
93 interface_type * pInterface )
97 castToXInterface(pInterface)->acquire();
100 throw RuntimeException(
106 template<
class interface_type >
110 _pInterface->release();
113 template<
class interface_type >
119 template<
class interface_type >
124 _pInterface->acquire();
127 #if defined LIBO_INTERNAL_ONLY
128 template<
class interface_type >
131 _pInterface = rRef._pInterface;
132 rRef._pInterface =
nullptr;
136 template<
class interface_type >
template<
class derived_type >
139 typename detail::UpCast< interface_type, derived_type >::t )
141 interface_type * p = rRef.
get();
144 _pInterface->acquire();
147 template<
class interface_type >
150 _pInterface = castToXInterface(pInterface);
152 _pInterface->acquire();
155 template<
class interface_type >
158 _pInterface = castToXInterface(pInterface);
161 template<
class interface_type >
164 _pInterface = castToXInterface(pInterface);
167 template<
class interface_type >
170 _pInterface = iquery( rRef.
get() );
173 template<
class interface_type >
176 _pInterface = iquery( pInterface );
179 template<
class interface_type >
183 ? iquery( static_cast< XInterface * >( rAny.pReserved ) ) : NULL);
186 template<
class interface_type >
189 _pInterface = iquery_throw( rRef.
get() );
192 template<
class interface_type >
195 _pInterface = iquery_throw( pInterface );
198 template<
class interface_type >
202 ? static_cast< XInterface * >( rAny.pReserved ) : NULL );
205 template<
class interface_type >
208 _pInterface = castToXInterface( iset_throw( rRef.
get() ) );
211 template<
class interface_type >
214 _pInterface = castToXInterface( iset_throw( pInterface ) );
218 template<
class interface_type >
223 XInterface *
const pOld = _pInterface;
229 template<
class interface_type >
231 interface_type * pInterface )
234 castToXInterface(pInterface)->acquire();
235 XInterface *
const pOld = _pInterface;
236 _pInterface = castToXInterface(pInterface);
239 return (NULL != pInterface);
242 template<
class interface_type >
246 XInterface *
const pOld = _pInterface;
247 _pInterface = castToXInterface(pInterface);
250 return (NULL != pInterface);
253 template<
class interface_type >
261 template<
class interface_type >
265 return set( castFromXInterface( rRef.
_pInterface ) );
268 template<
class interface_type >
272 return set( castFromXInterface(iquery( pInterface )),
SAL_NO_ACQUIRE );
275 template<
class interface_type >
283 template<
class interface_type >
291 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
296 template<
class interface_type >
300 set( castFromXInterface(iquery_throw( pInterface )),
SAL_NO_ACQUIRE );
303 template<
class interface_type >
311 template<
class interface_type >
315 set( castFromXInterface(
318 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
322 template<
class interface_type >
329 template<
class interface_type >
337 template<
class interface_type >
339 interface_type * pInterface )
345 template<
class interface_type >
353 #if defined LIBO_INTERNAL_ONLY
354 template<
class interface_type >
359 _pInterface->release();
360 _pInterface = rRef._pInterface;
361 rRef._pInterface =
nullptr;
366 template<
class interface_type >
374 template<
class interface_type >
376 XInterface * pInterface )
394 catch (RuntimeException &)
413 catch (RuntimeException &)
422 return (!
operator == ( pInterface ));
This enum value can be used for implicit interface query.
Definition: Reference.h:140
~Reference()
Destructor: Releases interface if set.
Definition: Reference.hxx:107
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:10
type class of interface
Definition: typeclass.h:79
C++ class representing an IDL any.
Definition: Any.h:52
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:145
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:114
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iquery_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
XInterface * get() const
Gets interface pointer.
Definition: Reference.h:86
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:136
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:338
interface_type * get() const
Gets interface pointer.
Definition: Reference.h:419
static SAL_WARN_UNUSED_RESULT Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:367
__sal_NoAcquire
Definition: types.h:384
C++ class representing an IDL meta type.
Definition: Type.h:54
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:383
bool operator!=(XInterface *pInterface) const
Unequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:420
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:156
Definition: Reference.h:158
CPPU_DLLPUBLIC void SAL_THROW_EXTERN_C()
This method is called to wait for a reply of a previously sent request.
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:106
definition of a no acquire enum for ctors
Definition: types.h:388
void clear()
Clears reference, i.e.
Definition: Reference.hxx:219
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:39
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:262
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:58
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iset_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:49
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:47
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:401
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:72
XInterface * _pInterface
the interface pointer
Definition: Reference.h:63