Home · Modules · All Classes · All Namespaces
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Tp::ConnectionFactory Class Reference

The ConnectionFactory class is responsible for constructing Connection objects according to application-defined settings. More...

#include <TelepathyQt/ConnectionFactory>

Inherits Tp::FixedFeatureFactory.

Public Member Functions

virtual ~ConnectionFactory ()
 
PendingReadyproxy (const QString &busName, const QString &objectPath, const ChannelFactoryConstPtr &chanFactory, const ContactFactoryConstPtr &contactFactory) const
 
- Public Member Functions inherited from Tp::FixedFeatureFactory
virtual ~FixedFeatureFactory ()
 
Features features () const
 
void addFeature (const Feature &feature)
 
void addFeatures (const Features &features)
 
- Public Member Functions inherited from Tp::DBusProxyFactory
virtual ~DBusProxyFactory ()
 
const QDBusConnection & dbusConnection () const
 
- Public Member Functions inherited from Tp::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 

Static Public Member Functions

static ConnectionFactoryPtr create (const QDBusConnection &bus, const Features &features=Features())
 

Protected Member Functions

 ConnectionFactory (const QDBusConnection &bus, const Features &features)
 
virtual ConnectionPtr construct (const QString &busName, const QString &objectPath, const ChannelFactoryConstPtr &chanFactory, const ContactFactoryConstPtr &contactFactory) const
 
virtual QString finalBusNameFrom (const QString &uniqueOrWellKnown) const
 
- Protected Member Functions inherited from Tp::FixedFeatureFactory
 FixedFeatureFactory (const QDBusConnection &bus)
 
virtual Features featuresFor (const DBusProxyPtr &proxy) const
 
- Protected Member Functions inherited from Tp::DBusProxyFactory
 DBusProxyFactory (const QDBusConnection &bus)
 
DBusProxyPtr cachedProxy (const QString &busName, const QString &objectPath) const
 
PendingReadynowHaveProxy (const DBusProxyPtr &proxy) const
 
virtual PendingOperationinitialPrepare (const DBusProxyPtr &proxy) const
 
virtual PendingOperationreadyPrepare (const DBusProxyPtr &proxy) const
 

Detailed Description

The ConnectionFactory class is responsible for constructing Connection objects according to application-defined settings.

The class is used by Account and other classes which construct Connection proxy instances to enable sharing instances of application-defined Connection subclasses with certain features always ready.

Constructor & Destructor Documentation

◆ ~ConnectionFactory()

Tp::ConnectionFactory::~ConnectionFactory ( )
virtual

Class destructor.

◆ ConnectionFactory()

Tp::ConnectionFactory::ConnectionFactory ( const QDBusConnection &  bus,
const Features features 
)
protected

Construct a new ConnectionFactory object.

As in create(), it should be noted that unlike Connection::becomeReady(), FeatureCore isn't assumed. If no features are specified, no Connection::becomeReady() call is made at all and the proxy won't be Connection::isReady().

Parameters
busThe QDBusConnection for proxies constructed using this factory to use.
featuresThe features to make ready on constructed Connections.

Member Function Documentation

◆ create()

ConnectionFactoryPtr Tp::ConnectionFactory::create ( const QDBusConnection &  bus,
const Features features = Features() 
)
static

Create a new ConnectionFactory object.

Optionally, the features to make ready on all constructed proxies can be specified. The default is to make no features ready. It should be noted that unlike Connection::becomeReady(), FeatureCore isn't assumed. If no features are specified, which is the default behavior, no Connection::becomeReady() call is made at all and the proxy won't be Connection::isReady().

Parameters
busThe QDBusConnection for proxies constructed using this factory to use.
featuresThe features to make ready on constructed Connections.
Returns
A ConnectionFactoryPtr object pointing to the newly created ConnectionFactory object.

◆ proxy()

PendingReady * Tp::ConnectionFactory::proxy ( const QString &  busName,
const QString &  objectPath,
const ChannelFactoryConstPtr &  chanFactory,
const ContactFactoryConstPtr &  contactFactory 
) const

Constructs a Connection proxy and begins making it ready.

If a valid proxy already exists in the factory cache for the given combination of busName and objectPath, it is returned instead. All newly created proxies are automatically cached until they're either DBusProxy::invalidated() or the last reference to them outside the factory has been dropped.

The proxy can be accessed immediately after this function returns using PendingReady::proxy(). The ready operation only finishes, however, when the features specified by features(), if any, are made ready as much as possible. If the service doesn't support a given feature, they won't obviously be ready even if the operation finished successfully, as is the case for Connection::becomeReady().

Parameters
busNameThe bus/service name of the D-Bus connection object the proxy is constructed for.
objectPathThe object path of the connection.
chanFactoryThe channel factory to use for the Connection.
contactFactoryThe channel factory to use for the Connection.
Returns
A PendingReady operation with the proxy in PendingReady::proxy().

◆ construct()

ConnectionPtr Tp::ConnectionFactory::construct ( const QString &  busName,
const QString &  objectPath,
const ChannelFactoryConstPtr &  chanFactory,
const ContactFactoryConstPtr &  contactFactory 
) const
protectedvirtual

Can be used by subclasses to override the Connection subclass constructed by the factory.

This is automatically called by proxy() to construct proxy instances if no valid cached proxy is found.

The default implementation constructs Tp::Connection objects.

Parameters
busNameThe bus/service name of the D-Bus Connection object the proxy is constructed for.
objectPathThe object path of the connection.
chanFactoryThe channel factory to use for the Connection.
contactFactoryThe channel factory to use for the Connection.
Returns
A pointer to the constructed Connection object.

◆ finalBusNameFrom()

QString Tp::ConnectionFactory::finalBusNameFrom ( const QString &  uniqueOrWellKnown) const
protectedvirtual

Transforms well-known names to the corresponding unique names, as is appropriate for Connection

Parameters
uniqueOrWellKnownThe name to transform.
Returns
The unique name corresponding to uniqueOrWellKnown (which may be it itself).

Implements Tp::DBusProxyFactory.