19 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX
20 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX
23 #include <com/sun/star/uno/RuntimeException.hpp>
24 #include <com/sun/star/uno/XInterface.hpp>
38 XInterface * pInterface,
const Type & rType )
42 Any aRet( pInterface->queryInterface( rType ) );
45 XInterface * pRet =
static_cast< XInterface *
>( aRet.pReserved );
53 template<
class interface_type >
55 XInterface * pInterface )
67 XInterface * pInterface,
const Type & rType )
69 XInterface * pQueried =
iquery( pInterface, rType );
72 throw RuntimeException(
77 template<
class interface_type >
79 XInterface * pInterface )
82 pInterface, interface_type::static_type());
85 template<
class interface_type >
86 inline interface_type * Reference< interface_type >::iset_throw(
87 interface_type * pInterface )
91 castToXInterface(pInterface)->acquire();
94 throw RuntimeException(
100 template<
class interface_type >
104 _pInterface->release();
107 template<
class interface_type >
113 template<
class interface_type >
118 _pInterface->acquire();
121 template<
class interface_type >
template<
class derived_type >
124 typename detail::UpCast< interface_type, derived_type >::t )
126 interface_type * p = rRef.
get();
129 _pInterface->acquire();
132 template<
class interface_type >
135 _pInterface = castToXInterface(pInterface);
137 _pInterface->acquire();
140 template<
class interface_type >
143 _pInterface = castToXInterface(pInterface);
146 template<
class interface_type >
149 _pInterface = castToXInterface(pInterface);
152 template<
class interface_type >
155 _pInterface = iquery( rRef.
get() );
158 template<
class interface_type >
161 _pInterface = iquery( pInterface );
164 template<
class interface_type >
168 ? iquery( static_cast< XInterface * >( rAny.
pReserved ) ) : 0);
171 template<
class interface_type >
174 _pInterface = iquery_throw( rRef.
get() );
177 template<
class interface_type >
180 _pInterface = iquery_throw( pInterface );
183 template<
class interface_type >
187 ? static_cast< XInterface * >( rAny.
pReserved ) : 0 );
190 template<
class interface_type >
193 _pInterface = castToXInterface( iset_throw( rRef.
get() ) );
196 template<
class interface_type >
199 _pInterface = castToXInterface( iset_throw( pInterface ) );
203 template<
class interface_type >
208 XInterface *
const pOld = _pInterface;
214 template<
class interface_type >
216 interface_type * pInterface )
219 castToXInterface(pInterface)->acquire();
220 XInterface *
const pOld = _pInterface;
221 _pInterface = castToXInterface(pInterface);
224 return (0 != pInterface);
227 template<
class interface_type >
231 XInterface *
const pOld = _pInterface;
232 _pInterface = castToXInterface(pInterface);
235 return (0 != pInterface);
238 template<
class interface_type >
246 template<
class interface_type >
250 return set( castFromXInterface( rRef.
_pInterface ) );
253 template<
class interface_type >
257 return set( castFromXInterface(iquery( pInterface )),
SAL_NO_ACQUIRE );
260 template<
class interface_type >
268 template<
class interface_type >
276 ? static_cast< XInterface * >( rAny.
pReserved ) : 0 )),
281 template<
class interface_type >
285 set( castFromXInterface(iquery_throw( pInterface )),
SAL_NO_ACQUIRE );
288 template<
class interface_type >
296 template<
class interface_type >
300 set( castFromXInterface(
303 ? static_cast< XInterface * >( rAny.
pReserved ) : 0 )),
307 template<
class interface_type >
314 template<
class interface_type >
322 template<
class interface_type >
324 interface_type * pInterface )
330 template<
class interface_type >
339 template<
class interface_type >
347 template<
class interface_type >
349 XInterface * pInterface )
369 catch (RuntimeException &)
388 catch (RuntimeException &)
397 return (!
operator == ( pInterface ));
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:66
definition of a no acquire enum for ctors
Definition: types.h:372
static SAL_WARN_UNUSED_RESULT Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:340
This enum value can be used for implicit interface query.
Definition: Reference.h:139
bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:247
~Reference()
Destructor: Releases interface if set.
Definition: Reference.hxx:101
__sal_NoAcquire
Definition: types.h:368
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:37
type class of interface
Definition: typeclass.h:79
bool operator!=(XInterface *pInterface) const
Unequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:395
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:144
struct _typelib_TypeDescriptionReference * pType
type of value
Definition: any2.h:44
void * pReserved
reserved space for storing value
Definition: any2.h:52
Holds a weak reference to a type description.
Definition: typedescription.h:40
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:135
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:376
void clear()
Clears reference, i.e.
Definition: Reference.hxx:204
XInterface * _pInterface
the interface pointer
Definition: Reference.h:62
C++ class representing an IDL meta type.
Definition: Type.h:54
rtl_uString * cppu_unsatisfied_iset_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
C++ class representing an IDL any.
Definition: Any.h:49
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:155
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:108
Definition: Reference.h:157
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:57
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:81
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:323
interface_type * get() const
Gets interface pointer.
Definition: Reference.h:410
XInterface * get() const
Gets interface pointer.
Definition: Reference.h:85
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:358
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:354
rtl_uString * cppu_unsatisfied_iquery_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
typelib_TypeClass eTypeClass
type class of type
Definition: typedescription.h:52
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:46
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32