LibreOffice: com::sun::star::uno::Reference< interface_type > Class Template Reference

LibreOffice LibreOffice 24.2 SDK C/C++ API Reference

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
com::sun::star::uno::Reference< interface_type > Class Template Reference

Template reference class for interface type derived from BaseReference. More...

`#include <Reference.h>`

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

## Public Member Functions
| ~Reference () COVERITY_NOEXCEPT_FALSE
| Destructor: Releases interface if set.
| Reference ()
| Default Constructor: Sets null reference.
| Reference (const Reference< interface_type > &rRef)
| Copy constructor: Copies interface reference.
| Reference (interface_type *pInterface)
| Constructor: Sets given interface pointer.
| Reference (interface_type *pInterface, __sal_NoAcquire dummy)
| Constructor: Sets given interface pointer without acquiring it.
| Reference (interface_type *pInterface, UnoReference_NoAcquire dummy)
| Constructor: Sets given interface pointer without acquiring it.
| Reference (const BaseReference &rRef, UnoReference_Query dummy)
| Constructor: Queries given interface for reference interface type (interface_type).
| Reference (XInterface *pInterface, UnoReference_Query dummy)
| Constructor: Queries given interface for reference interface type (interface_type).
| Reference (const Any &rAny, UnoReference_Query dummy)
| Constructor: Queries given any for reference interface type (interface_type).
| Reference (const BaseReference &rRef, UnoReference_QueryThrow dummy)
| Constructor: Queries given interface for reference interface type (interface_type).
| Reference (XInterface *pInterface, UnoReference_QueryThrow dummy)
| Constructor: Queries given interface for reference interface type (interface_type).
| Reference (const Any &rAny, UnoReference_QueryThrow dummy)
| Constructor: Queries given any for reference interface type (interface_type).
| Reference (const Reference< interface_type > &rRef, UnoReference_SetThrow dummy)
| Constructor: assigns from the given interface of the same type.
| Reference (interface_type *pInterface, UnoReference_SetThrow dummy)
| Constructor: assigns from the given interface of the same type.
| operator const Reference< XInterface > & () const
| Cast operator to Reference< XInterface >: Reference objects are binary compatible and any interface must be derived from com.sun.star.uno.XInterface.
interface_type * | operator-> () const
| Dereference operator: Used to call interface methods.
interface_type & | operator* () const
| Indirection operator.
interface_type * | get () const
| Gets interface pointer.
void | clear ()
| Clears reference, i.e.
bool | set (const Reference< interface_type > &rRef)
| Sets the given interface.
bool | set (interface_type *pInterface)
| Sets the given interface.
bool | set (interface_type *pInterface, __sal_NoAcquire dummy)
| Sets interface pointer without acquiring it.
bool | set (interface_type *pInterface, UnoReference_NoAcquire dummy)
| Sets interface pointer without acquiring it.
bool | set (XInterface *pInterface, UnoReference_Query dummy)
| Queries given interface for reference interface type (interface_type) and sets it.
bool | set (const BaseReference &rRef, UnoReference_Query dummy)
| Queries given interface for reference interface type (interface_type) and sets it.
bool | set (Any const &rAny, UnoReference_Query dummy)
| Queries given any for reference interface type (interface_type) and sets it.
void | set (XInterface *pInterface, UnoReference_QueryThrow dummy)
| Queries given interface for reference interface type (interface_type) and sets it.
void | set (const BaseReference &rRef, UnoReference_QueryThrow dummy)
| Queries given interface for reference interface type (interface_type) and sets it.
void | set (Any const &rAny, UnoReference_QueryThrow dummy)
| Queries given any for reference interface type (interface_type) and sets it.
void | set (interface_type *pInterface, UnoReference_SetThrow dummy)
| sets the given interface An interface already set will be released.
void | set (const Reference< interface_type > &rRef, UnoReference_SetThrow dummy)
| sets the given interface An interface already set will be released.
Reference< interface_type > & | operator= (interface_type *pInterface)
| Assignment operator: Acquires given interface pointer and sets reference.
Reference< interface_type > & | operator= (const Reference< interface_type > &rRef)
| Assignment operator: Acquires given interface reference and sets reference.
Public Member Functions inherited from com::sun::star::uno::BaseReference
XInterface * | get () const
| Gets interface pointer.
bool | is () const
| Checks if reference is null.
bool | operator== (XInterface *pInterface) const
| Equality operator: compares two interfaces Checks if both references are null or refer to the same object.
bool | operator!= (XInterface *pInterface) const
| Inequality operator: compares two interfaces Checks if both references are null or refer to the same object.
bool | operator== (const BaseReference &rRef) const
| Equality operator: compares two interfaces Checks if both references are null or refer to the same object.
bool | operator!= (const BaseReference &rRef) const
| Inequality operator: compares two interfaces Checks if both references are null or refer to the same object.
bool | operator< (const BaseReference &rRef) const
| Needed by some STL containers.

## Static Public Member Functions
static SAL_WARN_UNUSED_RESULT Reference< interface_type > | query (const BaseReference &rRef)
| Queries given interface reference for type interface_type.
static SAL_WARN_UNUSED_RESULT Reference< interface_type > | query (XInterface *pInterface)
| Queries given interface for type interface_type.

## Additional Inherited Members
Static Protected Member Functions inherited from com::sun::star::uno::BaseReference
static XInterface * | iquery (XInterface *pInterface, const Type &rType)
| Queries given interface for type rType.
static XInterface * | iquery_throw (XInterface *pInterface, const Type &rType)
| Queries given interface for type rType.
Protected Attributes inherited from com::sun::star::uno::BaseReference
XInterface * | _pInterface
| the interface pointer

## Detailed Description

template<class interface_type>
class com::sun::star::uno::Reference< interface_type >

Template reference class for interface type derived from BaseReference.

A special constructor given the UNO_QUERY identifier queries interfaces for reference type.

## Constructor & Destructor Documentation

## ◆ ~Reference()

template<class interface_type >

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

Destructor: Releases interface if set.

## ◆ Reference() [1/13]

template<class interface_type >

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

Default Constructor: Sets null reference.

## ◆ Reference() [2/13]

template<class interface_type >

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

Copy constructor: Copies interface reference.

Parameters

  rRef | another reference

## ◆ Reference() [3/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | interface_type * | pInterface | ) |
| inline

Constructor: Sets given interface pointer.

Parameters

  pInterface | an interface pointer

## ◆ Reference() [4/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | interface_type * | pInterface,
|  | __sal_NoAcquire | dummy )
| inline

Constructor: Sets given interface pointer without acquiring it.

Parameters

  pInterface | another reference
  dummy | SAL_NO_ACQUIRE to force obvious distinction to other constructors

## ◆ Reference() [5/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | interface_type * | pInterface,
|  | UnoReference_NoAcquire | dummy )
| inline

Constructor: Sets given interface pointer without acquiring it.

Deprecated, please use SAL_NO_ACQUIRE version.

Deprecated

Parameters

  pInterface | another reference
  dummy | UNO_REF_NO_ACQUIRE to force obvious distinction to other constructors

## ◆ Reference() [6/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | const BaseReference< interface_type > & | rRef,
|  | UnoReference_Query | dummy )
| inline

Constructor: Queries given interface for reference interface type (interface_type).

Parameters

  rRef | another reference
  dummy | UNO_QUERY to force obvious distinction to other constructors

## ◆ Reference() [7/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | XInterface * | pInterface,
|  | UnoReference_Query | dummy )
| inline

Constructor: Queries given interface for reference interface type (interface_type).

Parameters

  pInterface | an interface pointer
  dummy | UNO_QUERY to force obvious distinction to other constructors

## ◆ Reference() [8/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | const Any & | rAny,
|  | UnoReference_Query | dummy )
| inline

Constructor: Queries given any for reference interface type (interface_type).

Parameters

  rAny | an any
  dummy | UNO_QUERY to force obvious distinction to other constructors

## ◆ Reference() [9/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | const BaseReference< interface_type > & | rRef,
|  | UnoReference_QueryThrow | dummy )
| inline

Constructor: Queries given interface for reference interface type (interface_type).

Throws a RuntimeException if the demanded interface cannot be queried.

Parameters

  rRef | another reference
  dummy | UNO_QUERY_THROW to force obvious distinction to other constructors

## ◆ Reference() [10/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | XInterface * | pInterface,
|  | UnoReference_QueryThrow | dummy )
| inline

Constructor: Queries given interface for reference interface type (interface_type).

Throws a RuntimeException if the demanded interface cannot be queried.

Parameters

  pInterface | an interface pointer
  dummy | UNO_QUERY_THROW to force obvious distinction to other constructors

## ◆ Reference() [11/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | const Any & | rAny,
|  | UnoReference_QueryThrow | dummy )
| inline

Constructor: Queries given any for reference interface type (interface_type).

Throws a RuntimeException if the demanded interface cannot be queried.

Parameters

  rAny | an any
  dummy | UNO_QUERY_THROW to force obvious distinction to other constructors

## ◆ Reference() [12/13]

template<class interface_type >

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

Constructor: assigns from the given interface of the same type.

Throws a RuntimeException if the source interface is NULL.

Parameters

  rRef | another interface reference of the same type
  dummy | UNO_SET_THROW to distinguish from default copy constructor

Since
  UDK 3.2.8

## ◆ Reference() [13/13]

template<class interface_type >

com::sun::star::uno::Reference< interface_type >::Reference | ( | interface_type * | pInterface,
|  | UnoReference_SetThrow | dummy )
| inline

Constructor: assigns from the given interface of the same type.

Throws a RuntimeException if the source interface is NULL.

Parameters

  pInterface | an interface pointer
  dummy | UNO_SET_THROW to distinguish from default assignment constructor

Since
  UDK 3.2.8

## Member Function Documentation

## ◆ clear()

template<class interface_type >

void com::sun::star::uno::Reference< interface_type >::clear | ( |  | ) |
| inline

Clears reference, i.e.

releases interface. Reference is null after clear() call.

## ◆ get()

template<class interface_type >

interface_type * com::sun::star::uno::Reference< interface_type >::get | ( |  | ) | const
| inline

Gets interface pointer.

This call does not acquire the interface.

Returns
  UNacquired interface pointer

## ◆ operator const Reference< XInterface > &()

template<class interface_type >

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

Cast operator to Reference< XInterface >: Reference objects are binary compatible and any interface must be derived from com.sun.star.uno.XInterface.

This a useful direct cast possibility.

## ◆ operator*()

template<class interface_type >

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

Indirection operator.

Since
  LibreOffice 6.3

Returns
  UNacquired interface reference

## ◆ operator->()

template<class interface_type >

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

Dereference operator: Used to call interface methods.

Returns
  UNacquired interface pointer

## ◆ operator=() [1/2]

template<class interface_type >

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

Assignment operator: Acquires given interface reference and sets reference.

An interface already set will be released.

Parameters

  rRef | an interface reference

Returns
  this reference

## ◆ operator=() [2/2]

template<class interface_type >

Reference< interface_type > & com::sun::star::uno::Reference< interface_type >::operator= | ( | interface_type * | pInterface | ) |
| inline

Assignment operator: Acquires given interface pointer and sets reference.

An interface already set will be released.

Parameters

  pInterface | an interface pointer

Returns
  this reference

## ◆ query() [1/2]

template<class interface_type >

Reference< interface_type > com::sun::star::uno::Reference< interface_type >::query | ( | const BaseReference< interface_type > & | rRef | ) |
| inlinestatic

Queries given interface reference for type interface_type.

Parameters

  rRef | interface reference

Returns
  interface reference of demanded type (may be null)

## ◆ query() [2/2]

template<class interface_type >

Reference< interface_type > com::sun::star::uno::Reference< interface_type >::query | ( | XInterface * | pInterface | ) |
| inlinestatic

Queries given interface for type interface_type.

Parameters

  pInterface | interface pointer

Returns
  interface reference of demanded type (may be null)

## ◆ set() [1/12]

template<class interface_type >

bool com::sun::star::uno::Reference< interface_type >::set | ( | Any const & | rAny,
|  | UnoReference_Query | dummy )
| inline

Queries given any for reference interface type (interface_type) and sets it.

An interface already set will be released.

Parameters

  rAny | an Any containing an interface
  dummy | UNO_QUERY to force obvious distinction to set methods

Returns
  true, if non-null interface was set

## ◆ set() [2/12]

template<class interface_type >

void com::sun::star::uno::Reference< interface_type >::set | ( | Any const & | rAny,
|  | UnoReference_QueryThrow | dummy )
| inline

Queries given any for reference interface type (interface_type) and sets it.

An interface already set will be released. Throws a RuntimeException if the demanded interface cannot be set.

Parameters

  rAny | an Any containing an interface
  dummy | UNO_QUERY_THROW to force obvious distinction to set methods

## ◆ set() [3/12]

template<class interface_type >

bool com::sun::star::uno::Reference< interface_type >::set | ( | const BaseReference< interface_type > & | rRef,
|  | UnoReference_Query | dummy )
| inline

Queries given interface for reference interface type (interface_type) and sets it.

An interface already set will be released.

Parameters

  rRef | another reference
  dummy | UNO_QUERY to force obvious distinction to set methods

Returns
  true, if non-null interface was set

## ◆ set() [4/12]

template<class interface_type >

void com::sun::star::uno::Reference< interface_type >::set | ( | const BaseReference< interface_type > & | rRef,
|  | UnoReference_QueryThrow | dummy )
| inline

Queries given interface for reference interface type (interface_type) and sets it.

An interface already set will be released. Throws a RuntimeException if the demanded interface cannot be set.

Parameters

  rRef | another reference
  dummy | UNO_QUERY_THROW to force obvious distinction to set methods

## ◆ set() [5/12]

template<class interface_type >

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

Sets the given interface.

An interface already set will be released.

Parameters

  rRef | another reference

Returns
  true, if non-null interface was set

## ◆ set() [6/12]

template<class interface_type >

void com::sun::star::uno::Reference< interface_type >::set | ( | const Reference< interface_type > & | rRef,
|  | UnoReference_SetThrow | dummy )
| inline

sets the given interface An interface already set will be released.

Throws a RuntimeException if the source interface is NULL.

Parameters

  rRef | an interface reference
  dummy | UNO_SET_THROW to force obvious distinction to other set methods

Since
  UDK 3.2.8

## ◆ set() [7/12]

template<class interface_type >

bool com::sun::star::uno::Reference< interface_type >::set | ( | interface_type * | pInterface | ) |
| inline

Sets the given interface.

An interface already set will be released.

Parameters

  pInterface | another interface

Returns
  true, if non-null interface was set

## ◆ set() [8/12]

template<class interface_type >

bool com::sun::star::uno::Reference< interface_type >::set | ( | interface_type * | pInterface,
|  | __sal_NoAcquire | dummy )
| inline

Sets interface pointer without acquiring it.

An interface already set will be released.

Parameters

  pInterface | an interface pointer
  dummy | SAL_NO_ACQUIRE to force obvious distinction to set methods

Returns
  true, if non-null interface was set

## ◆ set() [9/12]

template<class interface_type >

bool com::sun::star::uno::Reference< interface_type >::set | ( | interface_type * | pInterface,
|  | UnoReference_NoAcquire | dummy )
| inline

Sets interface pointer without acquiring it.

An interface already set will be released. Deprecated, please use SAL_NO_ACQUIRE version.

Deprecated

Parameters

  pInterface | an interface pointer
  dummy | UNO_REF_NO_ACQUIRE to force obvious distinction to set methods

Returns
  true, if non-null interface was set

## ◆ set() [10/12]

template<class interface_type >

void com::sun::star::uno::Reference< interface_type >::set | ( | interface_type * | pInterface,
|  | UnoReference_SetThrow | dummy )
| inline

sets the given interface An interface already set will be released.

Throws a RuntimeException if the source interface is NULL.

Parameters

  pInterface | an interface pointer
  dummy | UNO_SET_THROW to force obvious distinction to other set methods

Since
  UDK 3.2.8

## ◆ set() [11/12]

template<class interface_type >

bool com::sun::star::uno::Reference< interface_type >::set | ( | XInterface * | pInterface,
|  | UnoReference_Query | dummy )
| inline

Queries given interface for reference interface type (interface_type) and sets it.

An interface already set will be released.

Parameters

  pInterface | an interface pointer
  dummy | UNO_QUERY to force obvious distinction to set methods

Returns
  true, if non-null interface was set

## ◆ set() [12/12]

template<class interface_type >

void com::sun::star::uno::Reference< interface_type >::set | ( | XInterface * | pInterface,
|  | UnoReference_QueryThrow | dummy )
| inline

Queries given interface for reference interface type (interface_type) and sets it.

An interface already set will be released. Throws a RuntimeException if the demanded interface cannot be set.

Parameters

  pInterface | an interface pointer
  dummy | UNO_QUERY_THROW to force obvious distinction to set methods

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

- cppu/unotype.hxx
- com/sun/star/uno/Reference.h
- com/sun/star/uno/Reference.hxx