LibreOffice LibreOffice 5.3 SDK C/C++ API Reference

Public Member Functions | List of all members
com::sun::star::uno::WeakReference< interface_type > Class Template Reference

The WeakReference<> holds a weak reference to an object. More...

`#include <weakref.hxx>`

Inheritance diagram for com::sun::star::uno::WeakReference< interface_type >:

## Public Member Functions
| WeakReference ()
| Default ctor. More...
| WeakReference (const Reference< interface_type > &rRef)
| Copy ctor. More...
WeakReference & | operator= (const css::uno::Reference< interface_type > &xInt)
| Releases this reference and takes over hard reference xInt. More...
| operator Reference< interface_type > () const
| Gets a hard reference to the object. More...
Public Member Functions inherited from com::sun::star::uno::WeakReferenceHelper
| 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 & | operator= (const WeakReferenceHelper &rWeakRef)
| Releases this reference and takes over rWeakRef. More...
WeakReferenceHelper & | operator= (const css::uno::Reference< css::uno::XInterface > &xInt)
| Releases this reference and takes over hard reference xInt. More...
bool | operator== (const WeakReferenceHelper &rObj) const
| Returns true if both weak refs reference to the same object. More...
css::uno::Reference< css::uno::XInterface > | get () const
| Gets a hard reference to the object. More...
| operator Reference< XInterface > () const
| Gets a hard reference to the object. More...
void | clear ()
| Releases this reference. More...

## Detailed Description

### template<class interface_type>
class com::sun::star::uno::WeakReference< interface_type >

The WeakReference<> holds a weak reference to an object.

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

The WeakReference 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.

Template Parameters

  interface_type | type of interface

## Constructor & Destructor Documentation

## ◆ WeakReference() [1/2]

template<class interface_type >

com::sun::star::uno::WeakReference< interface_type >::WeakReference | ( |  | ) |
| inline

Default ctor.

Creates an empty weak reference.

## ◆ WeakReference() [2/2]

template<class interface_type >

com::sun::star::uno::WeakReference< interface_type >::WeakReference | ( | const Reference< interface_type > & | rRef | ) |
| inline

Copy ctor.

Initialize this reference with a hard reference.

Parameters

  rRef | another hard ref

## Member Function Documentation

## ◆ operator Reference< interface_type >()

template<class interface_type >

com::sun::star::uno::WeakReference< interface_type >::operator Reference< interface_type > | ( |  | ) | const
| inline

Gets a hard reference to the object.

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

## ◆ operator=()

template<class interface_type >

WeakReference& com::sun::star::uno::WeakReference< interface_type >::operator= | ( | const css::uno::Reference< interface_type > & | xInt | ) |
| inline

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

  xInt | another hard reference

Since
  UDK 3.2.12

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

- cppuhelper/weakref.hxx