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 PROPERTYPRIVATE_H
00023 #define PROPERTYPRIVATE_H
00024
00025 #include <QObject>
00026 #include <QString>
00027 #include <QVariant>
00028 #include <QPair>
00029
00030 namespace ContextProvider {
00031
00032 class ServiceBackend;
00033 class Property;
00034
00035 class PropertyPrivate : public QObject
00036 {
00037 Q_OBJECT
00038
00039 public:
00040 explicit PropertyPrivate(ServiceBackend* serviceBackend, const QString &key, QObject *parent = 0);
00041
00042 void setValue(const QVariant& v);
00043 void updateOverheardValue(const QVariantList&, const quint64&);
00044 void setSubscribed();
00045 void setUnsubscribed();
00046
00047 Q_SIGNALS:
00048 void valueChanged(const QVariantList& values, const quint64& timestamp);
00049 void firstSubscriberAppeared(const QString& key);
00050 void lastSubscriberDisappeared(const QString& key);
00051
00052 private:
00053 static quint64 currentTimestamp();
00054 void emitValue();
00055
00056 int refCount;
00057 ServiceBackend* serviceBackend;
00058 QString key;
00059 QVariant value;
00060 quint64 timestamp;
00061
00062 bool subscribed;
00063 QVariant emittedValue;
00064 quint64 emittedTimestamp;
00065 bool overheard;
00066
00068 static QHash<QPair<ServiceBackend*, QString>, PropertyPrivate*> propertyPrivateMap;
00069
00070 friend class Property;
00071 friend class PropertyAdaptor;
00072 };
00073
00074 }
00075
00076 #endif