oopapidocs  2.0
address.h
00001 #ifndef ADDRESS_H
00002 #define ADDRESS_H
00003 
00004 #include <QString>
00005 
00006 
00007 #include "country.h"
00008 class ObjectFactory;
00009 
00010 //start id=address
00011 
00013 class DOBJS_EXPORT Address : public QObject {
00014     Q_OBJECT
00015   public:
00016   //end
00017     Q_PROPERTY( QString Line1 READ getLine1 WRITE setLine1 );
00018     Q_PROPERTY( QString Line2 READ getLine2 WRITE setLine2 );
00019     Q_PROPERTY( QString City READ getCity WRITE setCity );
00020     Q_PROPERTY( QString Phone READ getPhone WRITE setPhone);
00021 //start id="address"
00022 
00023     explicit Address(QString addressName = QString(), QObject* parent=0)
00024         : QObject(parent) { /* protected constructor */
00025         setObjectName(addressName);
00026     }
00027   public:
00028     virtual Country::CountryType getCountry() const = 0;
00029 //end
00030     QString getLine1() const {
00031         return m_Line1;
00032     }
00033     QString getLine2() const {
00034         return m_Line2;
00035     }
00036     QString getCity() const {
00037         return m_City;
00038     }
00039     QString getPhone() const {
00040         return m_Phone;
00041     }
00042 
00043   public slots:
00044     void setLine1(QString nl1) {
00045         m_Line1 = nl1;
00046     }
00047     void setLine2(QString nl2) {
00048         m_Line2=nl2;
00049     }
00050     void setCity(QString city) {
00051         m_City = city;
00052     }
00053     void setPhone(QString phone) {
00054         m_Phone = phone;
00055     }
00056 //start id=address
00057 private:
00058     QString m_Line1, m_Line2, m_City, m_Phone;
00059 };
00060 //end
00061 
00062 //start id=usaddress
00063 class DOBJS_EXPORT UsAddress : public Address {
00064     Q_OBJECT
00065   public:
00066     Q_PROPERTY( QString State READ getState WRITE setState );
00067     Q_PROPERTY( QString Zip READ getZip WRITE setZip );
00068     explicit Q_INVOKABLE UsAddress(QString name=QString(), QObject* parent=0) 
00069                                   : Address(name, parent) {}
00070   protected:
00071     static QString getPhoneFormat();
00072   public:
00073 //end
00074     Country::CountryType getCountry() const {
00075         return Country::USA;
00076     }
00077     QString getState() const {
00078         return m_State;
00079     }
00080     QString getZip() const {
00081         return m_Zip;
00082     }
00083   public slots:
00084     void setState(QString state) {
00085         m_State = state;
00086     }
00087     void setZip (QString zip) {
00088         m_Zip = zip;
00089     }
00090 //start id=usaddress
00091   private:
00092     QString m_State, m_Zip;
00093 };
00094 //end
00095 class DOBJS_EXPORT CanadaAddress : public Address {
00096     Q_OBJECT
00097   public:
00098     explicit Q_INVOKABLE CanadaAddress(QString name=QString(), QObject* parent=0)
00099                                       : Address(name, parent) {}
00100     static QString getPhoneFormat();
00101 
00102     Q_PROPERTY( QString Province READ getProvince
00103                 WRITE setProvince );
00104     Q_PROPERTY( QString PostalCode READ getPostalCode
00105                 WRITE setPostalCode );
00106   public:
00107 //end
00108     Country::CountryType getCountry() const {
00109         return Country::Canada;
00110     }
00111     QString getProvince() const {
00112         return m_Province;
00113     }
00114     QString getPostalCode() const {
00115         return m_PostalCode;
00116     }
00117   public slots:
00118     void setProvince(QString province) {
00119         m_Province = province;
00120     }
00121     void setPostalCode (QString postalcode) {
00122         m_PostalCode = postalcode;
00123     }
00124 //start id=subclass
00125   private:
00126     QString m_Province, m_PostalCode;
00127 };
00128 //end
00129 #endif
00130 
 All Classes Namespaces Functions Enumerations