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(
106 template<
class interface_type >
113 template<
class interface_type >
119 template<
class interface_type >
127 #if defined LIBO_INTERNAL_ONLY 128 template<
class interface_type >
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();
147 template<
class interface_type >
155 template<
class interface_type >
161 template<
class interface_type >
167 template<
class interface_type >
173 template<
class interface_type >
179 template<
class interface_type >
183 ?
iquery( static_cast< XInterface * >( rAny.pReserved ) ) : NULL);
186 template<
class interface_type >
192 template<
class interface_type >
198 template<
class interface_type >
202 ? static_cast< XInterface * >( rAny.pReserved ) : NULL );
205 template<
class interface_type >
211 template<
class interface_type >
214 _pInterface = castToXInterface( iset_throw( pInterface ) );
218 template<
class interface_type >
229 template<
class interface_type >
231 interface_type * pInterface )
234 castToXInterface(pInterface)->acquire();
239 return (NULL != pInterface);
242 template<
class interface_type >
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 >
275 template<
class interface_type >
283 template<
class interface_type >
291 ? static_cast< XInterface * >( rAny.pReserved ) : NULL )),
296 template<
class interface_type >
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 >
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 ));
435 #if defined LIBO_INTERNAL_ONLY 442 template<
typename charT,
typename traits> std::basic_ostream<charT, traits> &
444 std::basic_ostream<charT, traits> & stream,
BaseReference const & ref)
445 {
return stream << ref.
get(); }
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:10
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:352
Reference()
Default Constructor: Sets null reference.
Definition: Reference.hxx:114
type class of interface
Definition: typeclass.h:79
static SAL_WARN_UNUSED_RESULT Reference< interface_type > query(const BaseReference &rRef)
Queries given interface reference for type interface_type.
Definition: Reference.hxx:367
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_NoAcquire
Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface.
Definition: Reference.h:47
UnoReference_QueryThrow
Enum defining UNO_QUERY_THROW for implicit interface query.
Definition: Reference.h:154
#define COVERITY_NOEXCEPT_FALSE
To markup destructors that coverity warns might throw exceptions which won't throw in practice...
Definition: types.h:361
static XInterface * iquery(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:50
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:39
interface_type * get() const
Gets interface pointer.
Definition: Reference.h:428
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
static XInterface * iquery_throw(XInterface *pInterface, const Type &rType)
Queries given interface for type rType.
Definition: Reference.hxx:73
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:676
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
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:121
Reference< interface_type > & operator=(interface_type *pInterface)
Assignment operator: Acquires given interface pointer and sets reference.
Definition: Reference.hxx:338
UnoReference_SetThrow
Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface.
Definition: Reference.h:165
__sal_NoAcquire
Definition: types.h:376
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:58
bool operator<(const BaseReference &rRef) const
Needed by some STL containers.
Definition: Reference.hxx:401
This enum value can be used for implicit interface query.
Definition: Reference.h:149
XInterface * get() const
Gets interface pointer.
Definition: Reference.h:86
C++ class representing an IDL meta type.
Definition: Type.h:54
C++ class representing an IDL any.
Definition: Any.h:52
definition of a no acquire enum for ctors
Definition: types.h:380
void clear()
Clears reference, i.e.
Definition: Reference.hxx:219
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iset_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
Definition: Reference.h:167
XInterface * _pInterface
the interface pointer
Definition: Reference.h:63
UnoReference_Query
Enum defining UNO_QUERY for implicit interface query.
Definition: Reference.h:145
CPPU_DLLPUBLIC rtl_uString * cppu_unsatisfied_iquery_msg(typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
~Reference() COVERITY_NOEXCEPT_FALSE
Destructor: Releases interface if set.
Definition: Reference.hxx:107
bool set(const Reference< interface_type > &rRef)
Sets the given interface.
Definition: Reference.hxx:262