Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef SERVICEBACKEND_H
00023 #define SERVICEBACKEND_H
00024
00025 #include <QObject>
00026 #include <QString>
00027 #include <QStringList>
00028 #include <QDBusConnection>
00029 #include <QHash>
00030 #include <QVariant>
00031 #include <QSet>
00032
00033 class ServiceBackendUnitTest;
00034
00035 namespace ContextProvider {
00036
00037 class PropertyAdaptor;
00038 class PropertyPrivate;
00039
00040 class ServiceBackend : public QObject
00041 {
00042 Q_OBJECT
00043
00044 public:
00045 explicit ServiceBackend(QDBusConnection connection);
00046 ServiceBackend(QDBusConnection connection, const QString &busName);
00047 virtual ~ServiceBackend();
00048
00049 bool sharedConnection();
00050 bool start();
00051 void stop();
00052
00053 void addProperty(const QString& key, PropertyPrivate* property);
00054
00055 void setAsDefault();
00056 void setValue(const QString &key, const QVariant &val);
00057
00058 void ref();
00059 void unref();
00060
00061 static ServiceBackend* instance(QDBusConnection connection);
00062 static ServiceBackend* instance(QDBusConnection::BusType busType,
00063 const QString &busName,
00064 bool autoStart);
00065 static ServiceBackend *defaultServiceBackend;
00066 friend class ::ServiceBackendUnitTest;
00067 friend class Service;
00068
00069 private:
00070 bool registerProperty(const QString& key, PropertyPrivate* property);
00071
00072 int refCount;
00073
00076 QDBusConnection connection;
00077
00080 QString busName;
00081
00083 static QHash <QString, ServiceBackend*> instances;
00084
00086 QHash<QString, PropertyPrivate*> properties;
00087
00090 QHash<QString, PropertyAdaptor*> createdAdaptors;
00091 };
00092
00093 }
00094
00095 #endif