not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / solid / networkmanager-0.7 / nmpropertyhelper.h
blobf0c8d38b39c069af779a7895085076403ccf7395
1 // class that can extract values out of a properties map into a QObject's properties
3 #ifndef NM07_PROPERTY_HELPER_H
4 #define NM07_PROPERTY_HELPER_H
6 #include <QPair>
8 #include "generic-types.h"
10 class NMPropertyDeserializer
12 public:
13 virtual ~NMPropertyDeserializer();
14 virtual void deserialize(const QString& propertyName, const QVariant& value, QObject * recipient) = 0;
17 // deserializer for extracting a plain qvariant
18 struct GenericDeserializer : public NMPropertyDeserializer
20 public:
21 virtual void deserialize(const QString& propertyName, const QVariant& value, QObject * recipient);
24 typedef QPair<char*, char*> PropertySignalPair;
26 struct NMPropertySpec
28 public:
29 char * propertyName;
30 char * signalName;
33 class NMPropertyHelper
35 public:
36 NMPropertyHelper();
37 NMPropertyHelper(QObject * master);
38 ~NMPropertyHelper();
39 void registerProperty(const QString &nmPropertyName, QPair<char*,char*> spec);
40 void deserializeProperties(const QVariantMap &);
41 private:
42 QObject * mMaster;
43 QMap<QString, QPair<char*,char*> > mRegisteredProperties;
46 class FrobObject : public QObject
48 Q_OBJECT
49 Q_PROPERTY(QString frobozz READ frobozz WRITE setFrobozz)
50 public:
51 FrobObject();
52 ~FrobObject();
53 QString frobozz() const;
54 void setFrobozz(const QString& frob);
55 signals:
56 void frobozzChanged();
57 private:
58 QString mFrobozz;
61 #endif