|
1 /* This file is part of qjson |
|
2 * |
|
3 * Copyright (C) 2009 Till Adam <adam@kde.org> |
|
4 * |
|
5 * This library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Library General Public |
|
7 * License as published by the Free Software Foundation; either |
|
8 * version 2 of the License, or (at your option) any later version. |
|
9 * |
|
10 * This library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Library General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Library General Public License |
|
16 * along with this library; see the file COPYING.LIB. If not, write to |
|
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 * Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #ifndef PERSON_H |
|
22 #define PERSON_H |
|
23 |
|
24 #include <QtCore/QDate> |
|
25 #include <QtCore/QObject> |
|
26 |
|
27 class Person : public QObject |
|
28 { |
|
29 Q_OBJECT |
|
30 |
|
31 Q_PROPERTY(QString name READ name WRITE setName) |
|
32 Q_PROPERTY(int phoneNumber READ phoneNumber WRITE setPhoneNumber) |
|
33 Q_PROPERTY(Gender gender READ gender WRITE setGender) |
|
34 Q_PROPERTY(QDate dob READ dob WRITE setDob) |
|
35 Q_ENUMS(Gender) |
|
36 |
|
37 public: |
|
38 Person(QObject* parent = 0); |
|
39 ~Person(); |
|
40 |
|
41 QString name() const; |
|
42 void setName(const QString& name); |
|
43 |
|
44 int phoneNumber() const; |
|
45 void setPhoneNumber(const int phoneNumber); |
|
46 |
|
47 enum Gender {Male, Female}; |
|
48 void setGender(Gender gender); |
|
49 Gender gender() const; |
|
50 |
|
51 QDate dob() const; |
|
52 void setDob(const QDate& dob); |
|
53 |
|
54 private: |
|
55 QString m_name; |
|
56 int m_phoneNumber; |
|
57 Gender m_gender; |
|
58 QDate m_dob; |
|
59 }; |
|
60 |
|
61 #endif |