oopapidocs
2.0
|
00001 #ifndef _CUSTOMER_H_ 00002 #define _CUSTOMER_H_ 00003 00004 #include <QObject> 00005 #include <QDateTime> 00006 #include <QString> 00007 #include <QVariant> 00008 00009 #include <dataobject.h> 00010 #include "cexport.h" 00011 #include "custType.h" 00012 class Address; 00013 //start 00014 class CUSTOMER_EXPORT Customer : public DataObject { 00015 Q_OBJECT 00016 public: 00017 Q_INVOKABLE explicit Customer(QString name=QString(), QObject* parent=0) 00018 : DataObject(parent) { 00019 setObjectName(name); 00020 } 00021 Q_INVOKABLE Customer(QString name, QString id, CustomerType type); 00022 Q_PROPERTY( QString Name READ objectName WRITE setObjectName); 00023 Q_PROPERTY( QString Id READ getId WRITE setId ); 00024 Q_PROPERTY( QDate DateEstablished READ getDateEstablished 00025 WRITE setDateEstablished ); 00026 Q_PROPERTY( QString Type READ getTypeString WRITE setTypeString ); 00027 protected: 00030 //end 00031 public: 00032 Address* getAddress(QString name="default") const; 00033 QString getName() const { 00034 return objectName(); 00035 } 00036 QString getId() const { 00037 return m_Id; 00038 } 00039 QDate getDateEstablished() const { 00040 return m_DateEstablished; 00041 } 00042 CustomerType getType() const { 00043 return m_Type; 00044 } 00045 QString getTypeString() const { 00046 return m_Type.toString(); 00047 } 00048 static void test(); 00049 00050 public slots: 00051 void setName(const QString& newName); 00052 void setId(const QString& newId); 00053 void setDateEstablished(const QDate& newDate); 00054 void setAddress(Address* address, QString name="default"); 00055 void setType(CustomerType newType); 00056 void setTypeString(QString newType); 00057 private: 00058 QString m_Id; 00059 QDate m_DateEstablished; 00060 CustomerType m_Type; 00061 }; 00062 #endif 00063