Public Member Functions | Static Public Member Functions | Public Attributes

ctkServices Class Reference

#include <Libs/PluginFramework/ctkServices_p.h>

Collaboration diagram for ctkServices:
Collaboration graph

List of all members.

Public Member Functions

bool checkServiceClass (QObject *service, const QString &cls) const
void clear ()
 ctkServices (ctkPluginFrameworkContext *fwCtx)
QList< ctkServiceRegistration * > get (const QString &clazz) const
ctkServiceReferenceget (ctkPluginPrivate *plugin, const QString &clazz) const
QList< ctkServiceReference * > get (const QString &clazz, const QString &filter) const
QString getQServiceManagerErrorString (QtMobility::QServiceManager::Error error)
QList< ctkServiceRegistration * > getRegisteredByPlugin (ctkPluginPrivate *p) const
QList< ctkServiceRegistration * > getUsedByPlugin (ctkPlugin *p) const
ctkServiceRegistrationregisterService (ctkPluginPrivate *plugin, const QStringList &classes, QObject *service, const ServiceProperties &properties)
void registerService (ctkPluginPrivate *plugin, QByteArray serviceDescription)
void removeServiceRegistration (ctkServiceRegistration *sr)
void updateServiceRegistrationOrder (ctkServiceRegistration *sr, const QStringList &classes)
 ~ctkServices ()

Static Public Member Functions

static ServiceProperties createServiceProperties (const ServiceProperties &in, const QStringList &classes=QStringList(), long sid=-1)

Public Attributes

QHash< QString, QList
< ctkServiceRegistration * > > 
QMutex mutex
QtMobility::QServiceManager qServiceManager
QHash< ctkServiceRegistration
*, QStringList > 

Detailed Description

Here we handle all the services that are registered in the framework.

Definition at line 40 of file ctkServices_p.h.

Constructor & Destructor Documentation

ctkServices::ctkServices ( ctkPluginFrameworkContext fwCtx  ) 

Definition at line 85 of file ctkServices.cpp.

ctkServices::~ctkServices (  ) 

Definition at line 91 of file ctkServices.cpp.

Member Function Documentation

bool ctkServices::checkServiceClass ( QObject *  service,
const QString &  cls 
) const

Checks that a given service object is an instance of the given class name.

service The service object to check.
cls The class name to check for.

Definition at line 279 of file ctkServices.cpp.

void ctkServices::clear (  ) 

Definition at line 96 of file ctkServices.cpp.

ServiceProperties ctkServices::createServiceProperties ( const ServiceProperties in,
const QStringList &  classes = QStringList(),
long  sid = -1 
) [static]

Creates a new ServiceProperties object containing in with the keys converted to lower case.

classes A list of class names which will be added to the created ServiceProperties object under the key PluginConstants::OBJECTCLASS.
sid A service id which will be used instead of a default one.

Definition at line 49 of file ctkServices.cpp.

ctkServiceReference * ctkServices::get ( ctkPluginPrivate plugin,
const QString &  clazz 
) const

Get a service implementing a certain class.

plugin The plugin requesting reference
clazz The class name of the requested service.
A ctkServiceReference object.

Definition at line 292 of file ctkServices.cpp.

QList< ctkServiceReference * > ctkServices::get ( const QString &  clazz,
const QString &  filter 
) const

Get all services implementing a certain class and then filter these with a property filter.

clazz The class name of requested service.
filter The property filter.
plugin The plugin requesting reference.
A list of ctkServiceReference object.

Definition at line 311 of file ctkServices.cpp.

QList< ctkServiceRegistration * > ctkServices::get ( const QString &  clazz  )  const

Get all services implementing a certain class. Only used internally by the framework.

clazz The class name of the requested service.
A sorted list of ctkServiceRegistrationPrivate objects.

Definition at line 285 of file ctkServices.cpp.

QString ctkServices::getQServiceManagerErrorString ( QtMobility::QServiceManager::Error  error  ) 
QList< ctkServiceRegistration * > ctkServices::getRegisteredByPlugin ( ctkPluginPrivate p  )  const

Get all services that a plugin has registered.

p The plugin
A set of ctkServiceRegistration objects

Definition at line 415 of file ctkServices.cpp.

QList< ctkServiceRegistration * > ctkServices::getUsedByPlugin ( ctkPlugin p  )  const

Get all services that a plugin uses.

p The plugin
A set of ctkServiceRegistration objects

Definition at line 432 of file ctkServices.cpp.

void ctkServices::registerService ( ctkPluginPrivate plugin,
QByteArray  serviceDescription 

Definition at line 158 of file ctkServices.cpp.

ctkServiceRegistration * ctkServices::registerService ( ctkPluginPrivate plugin,
const QStringList &  classes,
QObject *  service,
const ServiceProperties properties 

Register a service in the framework wide register.

plugin The plugin registering the service.
classes The class names under which the service can be located.
service The service object.
properties The properties for this service.
A ctkServiceRegistration object.
std::invalid_argument If one of the following is true:

  • The service object is 0.
  • The service parameter is not a ctkServiceFactory or an instance of all the named classes in the classes parameter.

Definition at line 105 of file ctkServices.cpp.

void ctkServices::removeServiceRegistration ( ctkServiceRegistration sr  ) 

Remove a registered service.

sr The ctkServiceRegistration object that is registered.

Definition at line 393 of file ctkServices.cpp.

void ctkServices::updateServiceRegistrationOrder ( ctkServiceRegistration sr,
const QStringList &  classes 

Service ranking changed, reorder registered services according to ranking.

serviceRegistration The ctkServiceRegistrationPrivate object.
rank New rank of object.

Definition at line 267 of file ctkServices.cpp.

Member Data Documentation

Mapping of classname to registered service. The List of registered services are ordered with the highest ranked service first.

Definition at line 73 of file ctkServices_p.h.

Definition at line 76 of file ctkServices_p.h.

QMutex ctkServices::mutex [mutable]

Definition at line 44 of file ctkServices_p.h.

QtMobility::QServiceManager ctkServices::qServiceManager

Definition at line 46 of file ctkServices_p.h.

All registered services in the current framework. Mapping of registered service to class names under which the service is registerd.

Definition at line 66 of file ctkServices_p.h.

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines