Home · All Classes · All Namespaces · Modules · Functions · Files
Public Types | Public Member Functions | Protected Member Functions | List of all members
Tp::OptionalInterfaceFactory< DBusProxySubclass > Class Template Reference

The OptionalInterfaceFactory class is a helper class for high-level D-Bus proxy classes willing to offer access to shared instances of interface proxies for optional interfaces. More...

#include <TelepathyQt/OptionalInterfaceFactory>

Public Types

enum  InterfaceSupportedChecking { CheckInterfaceSupported, BypassInterfaceCheck }
 

Public Member Functions

 OptionalInterfaceFactory (DBusProxySubclass *this_)
 
 ~OptionalInterfaceFactory ()
 
QStringList interfaces () const
 
bool hasInterface (const QString &name) const
 
template<class Interface >
Interface * optionalInterface (InterfaceSupportedChecking check=CheckInterfaceSupported) const
 
template<typename Interface >
Interface * interface () const
 

Protected Member Functions

void setInterfaces (const QStringList &interfaces)
 

Detailed Description

template<typename DBusProxySubclass>
class Tp::OptionalInterfaceFactory< DBusProxySubclass >

The OptionalInterfaceFactory class is a helper class for high-level D-Bus proxy classes willing to offer access to shared instances of interface proxies for optional interfaces.

To use this helper in a subclass of DBusProxy (say, ExampleObject), ExampleObject should inherit from OptionalInterfaceFactory<ExampleObject>, and call OptionalInterfaceFactory(this) in its constructor's initialization list.

Template Parameters
DBusProxySubclassA subclass of DBusProxy

Member Enumeration Documentation

template<typename DBusProxySubclass>
enum Tp::OptionalInterfaceFactory::InterfaceSupportedChecking

Specifies if the interface being supported by the remote object should be checked by optionalInterface() and the convenience functions for it.

See also
optionalInterface()
Enumerator
CheckInterfaceSupported 

Don't return an interface instance unless it can be guaranteed that the remote object actually implements the interface.

BypassInterfaceCheck 

Return an interface instance even if it can't be verified that the remote object supports the interface.

Constructor & Destructor Documentation

template<typename DBusProxySubclass>
Tp::OptionalInterfaceFactory< DBusProxySubclass >::OptionalInterfaceFactory ( DBusProxySubclass *  this_)
inline

Class constructor.

Parameters
this_The class to which this OptionalInterfaceFactory is attached
template<typename DBusProxySubclass>
Tp::OptionalInterfaceFactory< DBusProxySubclass >::~OptionalInterfaceFactory ( )
inline

Class destructor.

Frees all interface instances constructed by this factory.

Member Function Documentation

template<typename DBusProxySubclass>
Tp::OptionalInterfaceFactory< DBusProxySubclass >::interfaces ( ) const
inline

Return a list of interfaces supported by this object.

Returns
List of supported interfaces.
template<typename DBusProxySubclass>
bool Tp::OptionalInterfaceFactory< DBusProxySubclass >::hasInterface ( const QString &  name) const
inline
template<typename DBusProxySubclass>
template<class Interface >
Interface* Tp::OptionalInterfaceFactory< DBusProxySubclass >::optionalInterface ( InterfaceSupportedChecking  check = CheckInterfaceSupported) const
inline
template<typename DBusProxySubclass>
template<typename Interface >
template< typename Interface > inline Interface * Tp::OptionalInterfaceFactory< DBusProxySubclass >::interface ( ) const
inline

Return a pointer to a valid instance of a interface class, associated with the same remote object as the given main interface instance. The given main interface must be of the class the optional interface is generated for (for eg. ChannelInterfaceGroupInterface this means ChannelInterface) or a subclass.

First invocation of this method for a particular optional interface class will construct the instance; subsequent calls will return a pointer to the same instance.

The returned instance is freed when the factory is destroyed; using it after destroying the factory will likely produce a crash. As the instance is shared, it should not be freed directly.

Template Parameters
InterfaceClass of the interface instance to get.
Returns
A pointer to an optional interface instance.
template<typename DBusProxySubclass>
void Tp::OptionalInterfaceFactory< DBusProxySubclass >::setInterfaces ( const QStringList &  interfaces)
inlineprotected


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.7