You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.8 KiB
C

#ifndef ADDRESSBOOKDATA_H
#define ADDRESSBOOKDATA_H
#include <QObject>
#include <QString>
#include <QDate>
#include <odb/core.hxx>
#include <QtCore/qglobal.h>
#include <QSharedPointer>
#include <data/comboitem.h>
#include <countrydata.h>
#if defined(ADDRESSBOOK_LIBRARY)
# define ADDRESSBOOKSHARED_EXPORT Q_DECL_EXPORT
#else
# define ADDRESSBOOKSHARED_EXPORT Q_DECL_IMPORT
#endif
#pragma db object
class ADDRESSBOOKSHARED_EXPORT AddressbookData : public ComboItem
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle)
Q_PROPERTY(QString firstName READ firstName WRITE setFirstName)
Q_PROPERTY(QString lastName READ lastName WRITE setLastName)
Q_PROPERTY(QDate birthDate READ birthDate WRITE setBirthDate)
Q_PROPERTY(QString idCardNumber READ idCardNumber WRITE setIdCardNumber)
Q_PROPERTY(bool ztp READ ztp WRITE setZtp)
Q_PROPERTY(QString addressCity READ addressCity WRITE setAddressCity)
Q_PROPERTY(QString addressStreet READ addressStreet WRITE setAddressStreet)
Q_PROPERTY(QString addressHouseNumber READ addressHouseNumber WRITE setAddressHouseNumber)
Q_PROPERTY(QString addressZipCode READ addressZipCode WRITE setAddressZipCode)
Q_PROPERTY(QSharedPointer<QObject> country READ country WRITE setCountry)
public:
AddressbookData(QObject *parent = 0);
QString title() const;
void setTitle(const QString &title);
QString firstName() const;
void setFirstName(const QString &firstName);
QString lastName() const;
void setLastName(const QString &lastName);
QDate birthDate() const;
void setBirthDate(const QDate &birthDate);
QString idCardNumber() const;
void setIdCardNumber(const QString &idCardNumber);
bool ztp() const;
void setZtp(bool ztp);
QString addressCity() const;
void setAddressCity(const QString &addressCity);
QString addressStreet() const;
void setAddressStreet(const QString &addressStreet);
QString addressHouseNumber() const;
void setAddressHouseNumber(const QString &addressHouseNumber);
QString addressZipCode() const;
void setAddressZipCode(const QString &addressZipCode);
int id() const;
void setId(int id);
QSharedPointer<QObject> country() const;
void setCountry(const QSharedPointer<QObject> &country);
private:
friend class odb::access;
#pragma db id auto
int m_id;
QString m_title;
QString m_firstName;
QString m_lastName;
QDate m_birthDate;
QString m_idCardNumber;
bool m_ztp;
QString m_addressCity;
QString m_addressStreet;
QString m_addressHouseNumber;
QString m_addressZipCode;
CountryDataPtr m_country;
// ComboItem interface
public:
virtual bool eq(ComboItem *other);
virtual QString toString();
};
typedef QSharedPointer<AddressbookData> AddressbookDataPtr;
#endif // ADDRESSBOOKDATA_H