LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
com::sun::star::uno::Reference< typename > Class Template Reference

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

#include <unotype.hxx>

Inheritance diagram for com::sun::star::uno::Reference< typename >:
com::sun::star::uno::BaseReference

Public Member Functions

 ~Reference ()
 Destructor: Releases interface if set. More...
 
 Reference ()
 Default Constructor: Sets null reference. More...
 
 Reference (const Reference< interface_type > &rRef)
 Copy constructor: Copies interface reference. More...
 
template<class derived_type >
 Reference (const Reference< derived_type > &rRef, typename detail::UpCast< interface_type, derived_type >::t=0)
 Up-casting conversion constructor: Copies interface reference. More...
 
 Reference (interface_type *pInterface)
 Constructor: Sets given interface pointer. More...
 
 Reference (interface_type *pInterface, __sal_NoAcquire dummy)
 Constructor: Sets given interface pointer without acquiring it. More...
 
 Reference (interface_type *pInterface, UnoReference_NoAcquire dummy)
 Constructor: Sets given interface pointer without acquiring it. More...
 
 Reference (const BaseReference &rRef, UnoReference_Query dummy)
 Constructor: Queries given interface for reference interface type (interface_type). More...
 
 Reference (XInterface *pInterface, UnoReference_Query dummy)
 Constructor: Queries given interface for reference interface type (interface_type). More...
 
 Reference (const Any &rAny, UnoReference_Query dummy)
 Constructor: Queries given any for reference interface type (interface_type). More...
 
 Reference (const BaseReference &rRef, UnoReference_QueryThrow dummy)
 Constructor: Queries given interface for reference interface type (interface_type). More...
 
 Reference (XInterface *pInterface, UnoReference_QueryThrow dummy)
 Constructor: Queries given interface for reference interface type (interface_type). More...
 
 Reference (const Any &rAny, UnoReference_QueryThrow dummy)
 Constructor: Queries given any for reference interface type (interface_type). More...
 
 Reference (const Reference< interface_type > &rRef, UnoReference_SetThrow dummy)
 Constructor: assigns from the given interface of the same type. More...
 
 Reference (interface_type *pInterface, UnoReference_SetThrow dummy)
 Constructor: assigns from the given interface of the same type. More...
 
 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. More...
 
interface_type * operator-> () const
 Dereference operator: Used to call interface methods. More...
 
interface_type * get () const
 Gets interface pointer. More...
 
void clear ()
 Clears reference, i.e. More...
 
bool set (const Reference< interface_type > &rRef)
 Sets the given interface. More...
 
bool set (interface_type *pInterface)
 Sets the given interface. More...
 
bool set (interface_type *pInterface, __sal_NoAcquire dummy)
 Sets interface pointer without acquiring it. More...
 
bool set (interface_type *pInterface, UnoReference_NoAcquire dummy)
 Sets interface pointer without acquiring it. More...
 
bool set (XInterface *pInterface, UnoReference_Query dummy)
 Queries given interface for reference interface type (interface_type) and sets it. More...
 
bool set (const BaseReference &rRef, UnoReference_Query dummy)
 Queries given interface for reference interface type (interface_type) and sets it. More...
 
bool set (Any const &rAny, UnoReference_Query dummy)
 Queries given any for reference interface type (interface_type) and sets it. More...
 
void set (XInterface *pInterface, UnoReference_QueryThrow dummy)
 Queries given interface for reference interface type (interface_type) and sets it. More...
 
void set (const BaseReference &rRef, UnoReference_QueryThrow dummy)
 Queries given interface for reference interface type (interface_type) and sets it. More...
 
void set (Any const &rAny, UnoReference_QueryThrow dummy)
 Queries given any for reference interface type (interface_type) and sets it. More...
 
void set (interface_type *pInterface, UnoReference_SetThrow dummy)
 sets the given interface An interface already set will be released. More...
 
void set (const Reference< interface_type > &rRef, UnoReference_SetThrow dummy)
 sets the given interface An interface already set will be released. More...
 
Reference< interface_type > & operator= (interface_type *pInterface)
 Assignment operator: Acquires given interface pointer and sets reference. More...
 
Reference< interface_type > & operator= (const Reference< interface_type > &rRef)
 Assignment operator: Acquires given interface reference and sets reference. More...
 
- Public Member Functions inherited from com::sun::star::uno::BaseReference
XInterface * get () const
 Gets interface pointer. More...
 
bool is () const
 Checks if reference is null. More...
 
bool operator== (XInterface *pInterface) const
 Equality operator: compares two interfaces Checks if both references are null or refer to the same object. More...
 
bool operator!= (XInterface *pInterface) const
 Unequality operator: compares two interfaces Checks if both references are null or refer to the same object. More...
 
bool operator== (const BaseReference &rRef) const
 Equality operator: compares two interfaces Checks if both references are null or refer to the same object. More...
 
bool operator!= (const BaseReference &rRef) const
 Unequality operator: compares two interfaces Checks if both references are null or refer to the same object. More...
 
bool operator< (const BaseReference &rRef) const
 Needed by some STL containers. More...
 

Static Public Member Functions

static SAL_WARN_UNUSED_RESULT
Reference< interface_type > 
query (const BaseReference &rRef)
 Queries given interface reference for type interface_type. More...
 
static SAL_WARN_UNUSED_RESULT
Reference< interface_type > 
query (XInterface *pInterface)
 Queries given interface for type interface_type. More...
 

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. More...
 
static XInterface * iquery_throw (XInterface *pInterface, const Type &rType)
 Queries given interface for type rType. More...
 
- Protected Attributes inherited from com::sun::star::uno::BaseReference
XInterface * _pInterface
 the interface pointer More...
 

Detailed Description

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

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

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

Destructor: Releases interface if set.

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

Default Constructor: Sets null reference.

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

Copy constructor: Copies interface reference.

Parameters
rRefanother reference
template<class interface_type >
template<class derived_type >
com::sun::star::uno::Reference< interface_type >::Reference ( const Reference< derived_type > &  rRef,
typename detail::UpCast< interface_type, derived_type >::t  = 0 
)
inline

Up-casting conversion constructor: Copies interface reference.

Does not work for up-casts to ambiguous bases. For the special case of up-casting to Reference< XInterface >, see the corresponding conversion operator.

Parameters
rRefanother reference
template<class interface_type >
com::sun::star::uno::Reference< interface_type >::Reference ( interface_type *  pInterface)
inline

Constructor: Sets given interface pointer.

Parameters
pInterfacean interface pointer
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
pInterfaceanother reference
dummySAL_NO_ACQUIRE to force obvious distinction to other constructors
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
pInterfaceanother reference
dummyUNO_REF_NO_ACQUIRE to force obvious distinction to other constructors
template<class interface_type >
com::sun::star::uno::Reference< interface_type >::Reference ( const BaseReference< typename > &  rRef,
UnoReference_Query  dummy 
)
inline

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

Parameters
rRefanother reference
dummyUNO_QUERY to force obvious distinction to other constructors
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
pInterfacean interface pointer
dummyUNO_QUERY to force obvious distinction to other constructors
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
rAnyan any
dummyUNO_QUERY to force obvious distinction to other constructors
template<class interface_type >
com::sun::star::uno::Reference< interface_type >::Reference ( const BaseReference< typename > &  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
rRefanother reference
dummyUNO_QUERY_THROW to force obvious distinction to other constructors
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
pInterfacean interface pointer
dummyUNO_QUERY_THROW to force obvious distinction to other constructors
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
rAnyan any
dummyUNO_QUERY_THROW to force obvious distinction to other constructors
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
rRefanother interface reference of the same type
dummyUNO_SET_THROW to distinguish from default copy constructor
Since
UDK 3.2.8
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
pInterfacean interface pointer
dummyUNO_SET_THROW to distinguish from default assignment constructor
Since
UDK 3.2.8

Member Function Documentation

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.

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

Gets interface pointer.

This call does not acquire the interface.

Returns
UNacquired interface pointer
template<typename >
com::sun::star::uno::Reference< typename >::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.

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

Dereference operator: Used to call interface methods.

Returns
UNacquired interface pointer
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
pInterfacean interface pointer
Returns
this reference
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
rRefan interface reference
Returns
this reference
template<class interface_type >
Reference< interface_type > com::sun::star::uno::Reference< interface_type >::query ( const BaseReference< typename > &  rRef)
inlinestatic

Queries given interface reference for type interface_type.

Parameters
rRefinterface reference
Returns
interface reference of demanded type (may be null)
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
pInterfaceinterface pointer
Returns
interface reference of demanded type (may be null)
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
rRefanother reference
Returns
true, if non-null interface was set
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
pInterfaceanother interface
Returns
true, if non-null interface was set
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
pInterfacean interface pointer
dummySAL_NO_ACQUIRE to force obvious distinction to set methods
Returns
true, if non-null interface was set
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
pInterfacean interface pointer
dummyUNO_REF_NO_ACQUIRE to force obvious distinction to set methods
Returns
true, if non-null interface was set
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
pInterfacean interface pointer
dummyUNO_QUERY to force obvious distinction to set methods
Returns
true, if non-null interface was set
template<class interface_type >
bool com::sun::star::uno::Reference< interface_type >::set ( const BaseReference< typename > &  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
rRefanother reference
dummyUNO_QUERY to force obvious distinction to set methods
Returns
true, if non-null interface was set
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
rAnyan Any containing an interface
dummyUNO_QUERY to force obvious distinction to set methods
Returns
true, if non-null interface was set
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
pInterfacean interface pointer
dummyUNO_QUERY_THROW to force obvious distinction to set methods
template<class interface_type >
void com::sun::star::uno::Reference< interface_type >::set ( const BaseReference< typename > &  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
rRefanother reference
dummyUNO_QUERY_THROW to force obvious distinction to set methods
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
rAnyan Any containing an interface
dummyUNO_QUERY_THROW to force obvious distinction to set methods
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
pInterfacean interface pointer
dummyUNO_SET_THROW to force obvious distinction to other set methods
Since
UDK 3.2.8
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
rRefan interface reference
dummyUNO_SET_THROW to force obvious distinction to other set methods
Since
UDK 3.2.8

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