LibreOffice Module cppuhelper (master) 1
Public Member Functions | List of all members
com::sun::star::uno::WeakReferenceHelper Class Reference

The WeakReferenceHelper holds a weak reference to an object. More...

#include <weakref.hxx>

Inheritance diagram for com::sun::star::uno::WeakReferenceHelper:
[legend]

Public Member Functions

 WeakReferenceHelper ()
 Default ctor. More...
 
 WeakReferenceHelper (const WeakReferenceHelper &rWeakRef)
 Copy ctor. More...
 
 WeakReferenceHelper (const css::uno::Reference< css::uno::XInterface > &xInt)
 Initialize this reference with the hard interface reference xInt. More...
 
 ~WeakReferenceHelper ()
 Releases this reference. More...
 
WeakReferenceHelper &SAL_CALL operator= (const WeakReferenceHelper &rWeakRef)
 Releases this reference and takes over rWeakRef. More...
 
WeakReferenceHelper &SAL_CALL operator= (const css::uno::Reference< css::uno::XInterface > &xInt)
 Releases this reference and takes over hard reference xInt. More...
 
bool SAL_CALL operator== (const WeakReferenceHelper &rObj) const
 Returns true if both weak refs reference to the same object. More...
 
css::uno::Reference< css::uno::XInterface > SAL_CALL get () const
 Gets a hard reference to the object. More...
 
SAL_CALL operator Reference< XInterface > () const
 Gets a hard reference to the object. More...
 
void SAL_CALL clear ()
 Releases this reference. More...
 

Detailed Description

The WeakReferenceHelper holds a weak reference to an object.

That object must implement the css::uno::XWeak interface.

The WeakReferenceHelper itself is not thread safe, just as Reference itself isn't, but the implementation of the listeners etc. behind it is thread-safe, so multiple threads can have their own WeakReferences to the same XWeak object.

Definition at line 56 of file weakref.hxx.

Constructor & Destructor Documentation

◆ WeakReferenceHelper() [1/3]

com::sun::star::uno::WeakReferenceHelper::WeakReferenceHelper ( )
inline

Default ctor.

Creates an empty weak reference.

Definition at line 61 of file weakref.hxx.

References m_pImpl, and NULL.

◆ WeakReferenceHelper() [2/3]

com::sun::star::uno::WeakReferenceHelper::WeakReferenceHelper ( const WeakReferenceHelper rWeakRef)

Copy ctor.

Initialize this reference with the same interface as in rWeakRef.

Parameters
rWeakRefanother weak ref

Definition at line 460 of file weak.cxx.

References get(), and m_pImpl.

◆ WeakReferenceHelper() [3/3]

com::sun::star::uno::WeakReferenceHelper::WeakReferenceHelper ( const css::uno::Reference< css::uno::XInterface > &  xInt)

Initialize this reference with the hard interface reference xInt.

If the implementation behind xInt does not support XWeak or xInt is null then this reference will be null.

Parameters
xIntanother hard interface reference

◆ ~WeakReferenceHelper()

com::sun::star::uno::WeakReferenceHelper::~WeakReferenceHelper ( )

Releases this reference.

Definition at line 531 of file weak.cxx.

References clear().

Member Function Documentation

◆ clear()

void com::sun::star::uno::WeakReferenceHelper::clear ( )

Releases this reference.

Available since: \n UDK 3.2.12

Definition at line 471 of file weak.cxx.

References m_pImpl.

Referenced by ~WeakReferenceHelper().

◆ get()

Reference< XInterface > com::sun::star::uno::WeakReferenceHelper::get ( ) const

Gets a hard reference to the object.

Returns
hard reference or null, if the weakly referenced interface has gone

Definition at line 536 of file weak.cxx.

References cppu::gpWeakMutex, and m_pImpl.

Referenced by operator=(), operator==(), and WeakReferenceHelper().

◆ operator Reference< XInterface >()

SAL_CALL com::sun::star::uno::WeakReferenceHelper::operator Reference< XInterface > ( ) const
inline

Gets a hard reference to the object.

Returns
hard reference or null, if the weakly referenced interface has gone

Definition at line 145 of file weakref.hxx.

References get().

◆ operator=() [1/2]

WeakReferenceHelper &SAL_CALL com::sun::star::uno::WeakReferenceHelper::operator= ( const css::uno::Reference< css::uno::XInterface > &  xInt)

Releases this reference and takes over hard reference xInt.

If the implementation behind xInt does not support XWeak or XInt is null, then this reference is null.

Parameters
xIntanother hard reference

◆ operator=() [2/2]

WeakReferenceHelper & com::sun::star::uno::WeakReferenceHelper::operator= ( const WeakReferenceHelper rWeakRef)

Releases this reference and takes over rWeakRef.

Parameters
rWeakRefanother weak ref

Definition at line 485 of file weak.cxx.

References get(), and operator=().

Referenced by operator=().

◆ operator==()

bool SAL_CALL com::sun::star::uno::WeakReferenceHelper::operator== ( const WeakReferenceHelper rObj) const
inline

Returns true if both weak refs reference to the same object.

Parameters
rObjanother weak ref
Returns
true, if both weak refs reference to the same object.

Definition at line 132 of file weakref.hxx.

References get(), and get().


The documentation for this class was generated from the following files: