19 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX 20 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX 28 #include <com/sun/star/uno/RuntimeException.hpp> 29 #include <com/sun/star/uno/XInterface.hpp> 51 XInterface * pInterface,
const Type & rType )
55 Any aRet( pInterface->queryInterface( rType ) );
58 XInterface * pRet =
static_cast< XInterface *
>( aRet.pReserved );
59 aRet.pReserved = NULL;
66 template<
class interface_type >
68 XInterface * pInterface )
74 XInterface * pInterface,
const Type & rType )
76 XInterface * pQueried =
iquery( pInterface, rType );
79 throw RuntimeException(
84 template<
class interface_type >
86 XInterface * pInterface )
89 pInterface, interface_type::static_type());
92 template<
class interface_type >
94 interface_type * pInterface )
98 castToXInterface(pInterface)->acquire();
101 throw RuntimeException(
107 template<
class interface_type >
114 template<
class interface_type >
120 template<
class interface_type >
128 #if defined LIBO_INTERNAL_ONLY 129 template<
class interface_type >
133 rRef._pInterface =
nullptr;
137 template<
class interface_type >
template<
class derived_type >
140 typename detail::UpCast< interface_type, derived_type >::t )
142 interface_type * p = rRef.
get();
148 template<
class interface_type >
156 template<
class interface_type >
162 template<
class interface_type >
168 template<
class interface_type >
174 template<
class interface_type >
180 template<
class interface_type >
184 ?
iquery( static_cast< XInterface * >( rAny.pReserved ) ) : NULL);
187 template<
class interface_type >
193 template<
class interface_type >
199 template<
class interface_type >
203 ? static_cast< XInterface * >( rAny.pReserved ) : NULL );
206 template<
class interface_type >
212 template<
class interface_type >
215 _pInterface = castToXInterface( iset_throw( pInterface ) );
219 template<
class interface_type >
230 template<
class interface_type >
232 interface_type * pInterface )
235 castToXInterface(pInterface)->acquire();
240 return (NULL != pInterface);
243 template<
class interface_type >
251 return (NULL != pInterface);
254 template<
class interface_type >
262 template<
class interface_type >
266 return set( castFromXInterface( rRef.
_pInterface ) );
269 template<
class interface_type >
276 template<
class interface_type >
284 template<
class interface_type >
292 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
297 template<
class interface_type >
304 template<
class interface_type >
312 template<
class interface_type >
316 set( castFromXInterface(
319 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
323 template<
class interface_type >
330 template<
class interface_type >
338 template<
class interface_type >
340 interface_type * pInterface )
346 template<
class interface_type >
354 #if defined LIBO_INTERNAL_ONLY 355 template<
class interface_type >
362 rRef._pInterface =
nullptr;
367 template<
class interface_type >
375 template<
class interface_type >
377 XInterface * pInterface )
395 catch (RuntimeException &)
414 catch (RuntimeException &)
423 return (!
operator == ( pInterface ));
436 #if defined LIBO_INTERNAL_ONLY 443 template<
typename charT,
typename traits> std::basic_ostream<charT, traits> &
445 std::basic_ostream<charT, traits> & stream,
BaseReference const & ref)
446 {
return stream << ref.
get(); }
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:10
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:402
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:352
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:145
type class of interface
Definition: typeclass.h:79
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:115
interface_type * get() const
Gets interface pointer.
Definition: Reference.h:428
XInterface * get() const
Gets interface pointer.
Definition: Reference.h:86
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:154
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:50
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:165
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:73
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:39
XInterface * _pInterface
the interface pointer
Definition: Reference.h:63
__sal_NoAcquire
Definition: types.h:366
static SAL_WARN_UNUSED_RESULT Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:368
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:47
definition of a no acquire enum for ctors
Definition: types.h:370
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:58
This enum value can be used for implicit interface query.
Definition: Reference.h:149
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:120
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iset_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &o, Any const &any)
Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example)...
Definition: Any.hxx:664
void clear()
Clears reference, i.e.
Definition: Reference.hxx:220
~Reference()
Destructor: Releases interface if set.
Definition: Reference.hxx:108
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:384
Definition: Reference.h:167
bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:263
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:339
C++ class representing an IDL meta type.
Definition: Type.h:54
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iquery_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
C++ class representing an IDL any.
Definition: Any.h:52
bool operator!=(XInterface *pInterface) const
Unequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:421