3 #ifndef INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX 4 #define INCLUDED_COM_SUN_STAR_UNO_REFERENCE_HXX 12 #include "com/sun/star/uno/RuntimeException.hpp" 13 #include "com/sun/star/uno/XInterface.hpp" 35 XInterface * pInterface,
const Type & rType )
39 Any aRet( pInterface->queryInterface( rType ) );
42 XInterface * pRet =
static_cast< XInterface *
>( aRet.pReserved );
43 aRet.pReserved = NULL;
50 template<
class interface_type >
52 XInterface * pInterface )
58 XInterface * pInterface,
const Type & rType )
60 XInterface * pQueried =
iquery( pInterface, rType );
63 throw RuntimeException(
68 template<
class interface_type >
70 XInterface * pInterface )
73 pInterface, interface_type::static_type());
76 template<
class interface_type >
78 interface_type * pInterface )
82 castToXInterface(pInterface)->acquire();
85 throw RuntimeException(
90 template<
class interface_type >
97 template<
class interface_type >
103 template<
class interface_type >
111 #if defined LIBO_INTERNAL_ONLY 112 template<
class interface_type >
116 rRef._pInterface =
nullptr;
119 template<
class interface_type >
template<
class derived_type >
123 std::is_base_of_v<interface_type, derived_type>
124 && !std::is_same_v<interface_type, XInterface>,
void *>)
126 interface_type * p = rRef.
get();
133 template<
class interface_type >
141 template<
class interface_type >
147 template<
class interface_type >
153 template<
class interface_type >
159 template<
class interface_type >
165 template<
class interface_type >
169 ?
iquery( static_cast< XInterface * >( rAny.pReserved ) ) : NULL);
172 template<
class interface_type >
178 template<
class interface_type >
184 template<
class interface_type >
188 ? static_cast< XInterface * >( rAny.pReserved ) : NULL );
191 template<
class interface_type >
197 template<
class interface_type >
200 _pInterface = castToXInterface( iset_throw( pInterface ) );
204 template<
class interface_type >
215 template<
class interface_type >
217 interface_type * pInterface )
220 castToXInterface(pInterface)->acquire();
225 return (NULL != pInterface);
228 template<
class interface_type >
236 return (NULL != pInterface);
239 template<
class interface_type >
247 template<
class interface_type >
251 return set( castFromXInterface( rRef.
_pInterface ) );
254 template<
class interface_type >
261 template<
class interface_type >
269 template<
class interface_type >
277 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
282 template<
class interface_type >
289 template<
class interface_type >
297 template<
class interface_type >
301 set( castFromXInterface(
304 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
308 template<
class interface_type >
315 template<
class interface_type >
323 template<
class interface_type >
325 interface_type * pInterface )
331 template<
class interface_type >
339 #if defined LIBO_INTERNAL_ONLY 340 template<
class interface_type >
352 template<
class interface_type >
360 template<
class interface_type >
362 XInterface * pInterface )
368 #if defined LIBO_INTERNAL_ONLY 369 template<
class interface_type >
template<
class other_type >
375 template<
class interface_type >
template<
class other_type >
381 template<
class interface_type >
387 template<
class interface_type >
406 catch (RuntimeException &)
425 catch (RuntimeException &)
434 return (!
operator == ( pInterface ));
447 #if defined LIBO_INTERNAL_ONLY 454 template<
typename charT,
typename traits> std::basic_ostream<charT, traits> &
456 std::basic_ostream<charT, traits> & stream,
BaseReference const & ref)
457 {
return stream << ref.
get(); }
465 #if defined LIBO_INTERNAL_ONLY 475 struct hash<::css::uno::Reference<T>>
477 std::size_t operator()(::css::uno::Reference<T>
const & s)
const 478 {
return size_t(s.get()); }
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:314
UnoReference_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:35
bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:248
static SAL_WARN_UNUSED_RESULT Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:353
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iset_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
#define COVERITY_NOEXCEPT_FALSE
To markup destructors that coverity warns might throw exceptions which won't throw in practice...
Definition: types.h:329
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:142
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:57
~Reference() COVERITY_NOEXCEPT_FALSE
Destructor: Releases interface if set.
Definition: Reference.hxx:91
bool operator!=(XInterface *pInterface) const
Inequality operator: compares two interfaces Checks if both references are null or refer to the same ...
Definition: Reference.hxx:432
This enum value can be used for implicit interface query.
Definition: Reference.h:137
This enum value can be used for implicit interface query.
Definition: Reference.h:146
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:413
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:395
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
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:684
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:324
C++ class representing an IDL any.
Definition: Any.h:37
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:11
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:133
Definition: Reference.h:155
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:23
interface_type * get() const
Gets interface pointer.
Definition: Reference.h:383
__sal_NoAcquire
Definition: types.h:332
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iquery_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
void clear()
Clears reference, i.e.
Definition: Reference.hxx:205
type class of interface
Definition: typeclass.h:62
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:183
definition of a no acquire enum for ctors
Definition: types.h:336
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:142
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:46
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:34
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:153
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:98
C++ class representing an IDL meta type.
Definition: Type.h:38
XInterface * get() const
Gets interface pointer.
Definition: Reference.h:74
XInterface * _pInterface
the interface pointer
Definition: Reference.h:51