Go to the documentation of this file.00001
00004 #ifndef BPSPROPERTYOBJECT_H
00005 #define BPSPROPERTYOBJECT_H
00006
00007 #include "bpscore_global.h"
00008 #include <QObject>
00009 #include <QStringList>
00010 #include <QVariant>
00011
00020 class BPSCORE_EXPORT BpsPropertyObject : public QObject
00021 {
00022 Q_OBJECT
00023 BPS_PRIVATE(BpsPropertyObject)
00024
00025 public:
00026
00031 BpsPropertyObject(QObject *aParent = 0);
00032
00038 BpsPropertyObject(const QString& aName, QObject *aParent = 0);
00039
00044 BpsPropertyObject(const BpsPropertyObject& aOther);
00045
00046 virtual ~BpsPropertyObject();
00047
00052 void clear();
00053
00059 BpsPropertyObject& operator=(const BpsPropertyObject& aOther);
00060
00069 void addProperty(const char* aName, const QVariant& aValue);
00070
00090 void addAttribute(const char* aProperty, const char* aAttribute, const QVariant& aValue = true);
00091
00098 QVariant attribute(const char* aProperty, const char* aAttribute) const;
00099
00105 QList<QByteArray> attributeNames(const char* aProperty) const;
00106
00111 BpsPropertyObject* parent() const;
00112
00116 QList<BpsPropertyObject*> children() const;
00117
00121 int childCount() const;
00122
00128 BpsPropertyObject* childAt(int aIndex) const;
00129
00135 int childIndex(BpsPropertyObject* aChild) const;
00136
00142 void insertChild(int aIndex, BpsPropertyObject* aChild);
00143
00148 void appendChild(BpsPropertyObject* aChild);
00149
00155 BpsPropertyObject* removeChild(int aIndex);
00156
00162 void moveChild(int aOldIndex, int aNewIndex);
00163
00167 void emitValues();
00168
00186 QString propertyAsString(const char* aName) const;
00187
00191 bool isModified() const;
00192
00197 bool isValid(BpsPropertyObject* aObject) const;
00198
00205 QString makeXml(const QString& aDocType, bool aFormat = false) const;
00206
00212 void loadXml(const QString& aDocType, const QString& aXml);
00213
00214 public slots:
00215
00226 virtual bool setProperty(const char* aName, const QVariant& aValue);
00227
00240 bool setPropertyAsString(const char* aName, const QString& aValue);
00241
00246 void setModified(bool aModified = true);
00247
00248 signals:
00249
00255 void objectChanged();
00256
00263 void propertyChanged(const QByteArray& aName, const QVariant& aNewValue, const QVariant& aOldValue);
00264
00269 void modifiedChanged(bool aModified);
00270
00276 void childInserted(int aIndex, BpsPropertyObject* aChild);
00277
00284 void childRemoved(int aIndex, BpsPropertyObject* aChild);
00285
00291 void childMoved(int aOldIndex, int aNewIndex);
00292
00293 protected:
00294
00302 virtual BpsPropertyObject* xmlCreateObject(const QString& aTagName, int aLevel) const;
00303
00309 virtual QString xmlTagName(int aLevel) const;
00310
00311 };
00312
00313 #endif // BPSPROPERTYOBJECT_H