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 >
87 interface_type * pInterface )
91 castToXInterface(pInterface)->acquire();
94 throw RuntimeException(
100 template<
class interface_type >
107 template<
class interface_type >
113 template<
class interface_type >
121 template<
class interface_type >
template<
class derived_type >
124 typename detail::UpCast< interface_type, derived_type >::t )
126 interface_type * p = rRef.
get();
132 template<
class interface_type >
140 template<
class interface_type >
146 template<
class interface_type >
152 template<
class interface_type >
158 template<
class interface_type >
164 template<
class interface_type >
171 template<
class interface_type >
177 template<
class interface_type >
183 template<
class interface_type >
187 ? static_cast< XInterface * >( rAny.
pReserved ) : 0 );
190 template<
class interface_type >
196 template<
class interface_type >
199 _pInterface = castToXInterface( iset_throw( pInterface ) );
203 template<
class interface_type >
214 template<
class interface_type >
216 interface_type * pInterface )
219 castToXInterface(pInterface)->acquire();
224 return (0 != pInterface);
227 template<
class interface_type >
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 >
260 template<
class interface_type >
268 template<
class interface_type >
276 ? static_cast< XInterface * >( rAny.
pReserved ) : 0 )),
281 template<
class interface_type >
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 ));
Holds a weak reference to a type description.
Definition: typedescription.h:40
C++ class representing an IDL meta type.
Definition: Type.h:54
~Reference()
Destructor: Releases interface if set.
Definition: Reference.hxx:101
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:46
C++ class representing an IDL any.
Definition: Any.h:49
rtl_uString * cppu_unsatisfied_iset_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
This enum value can be used for implicit interface query.
Definition: Reference.h:139
interface_type * get() const
Gets interface pointer.
Definition: Reference.h:410
struct _typelib_TypeDescriptionReference * pType
type of value
Definition: any2.h:44
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
XInterface * get() const
Gets interface pointer.
Definition: Reference.h:85
type class of interface
Definition: typeclass.h:79
void * pReserved
reserved space for storing value
Definition: any2.h:52
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:323
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:354
__sal_NoAcquire
Definition: types.h:368
static SAL_WARN_UNUSED_RESULT Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:340
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
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
definition of a no acquire enum for ctors
Definition: types.h:372
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:144
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
typelib_TypeClass eTypeClass
type class of type
Definition: typedescription.h:52
void clear()
Clears reference, i.e.
Definition: Reference.hxx:204
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:247
rtl_uString * cppu_unsatisfied_iquery_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
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
Definition: Reference.h:157
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:37
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:376
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:66
XInterface * _pInterface
the interface pointer
Definition: Reference.h:62