1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #include "person.h" |
10 | |
11 | using namespace Attica; |
12 | |
13 | class Q_DECL_HIDDEN Person::Private : public QSharedData |
14 | { |
15 | public: |
16 | QString m_id; |
17 | QString m_firstName; |
18 | QString m_lastName; |
19 | QDate m_birthday; |
20 | QString m_country; |
21 | qreal m_latitude; |
22 | qreal m_longitude; |
23 | QUrl m_avatarUrl; |
24 | QString m_homepage; |
25 | QString m_city; |
26 | |
27 | QMap<QString, QString> m_extendedAttributes; |
28 | |
29 | Private() |
30 | : m_latitude(0) |
31 | , m_longitude(0) |
32 | { |
33 | } |
34 | }; |
35 | |
36 | Person::Person() |
37 | : d(new Private) |
38 | { |
39 | } |
40 | |
41 | Person::Person(const Person &other) |
42 | : d(other.d) |
43 | { |
44 | } |
45 | |
46 | Person &Person::operator=(const Attica::Person &other) |
47 | { |
48 | d = other.d; |
49 | return *this; |
50 | } |
51 | |
52 | Person::~Person() |
53 | { |
54 | } |
55 | |
56 | void Person::setId(const QString &u) |
57 | { |
58 | d->m_id = u; |
59 | } |
60 | |
61 | QString Person::id() const |
62 | { |
63 | return d->m_id; |
64 | } |
65 | |
66 | void Person::setFirstName(const QString &name) |
67 | { |
68 | d->m_firstName = name; |
69 | } |
70 | |
71 | QString Person::firstName() const |
72 | { |
73 | return d->m_firstName; |
74 | } |
75 | |
76 | void Person::setLastName(const QString &name) |
77 | { |
78 | d->m_lastName = name; |
79 | } |
80 | |
81 | QString Person::lastName() const |
82 | { |
83 | return d->m_lastName; |
84 | } |
85 | |
86 | void Person::setBirthday(const QDate &date) |
87 | { |
88 | d->m_birthday = date; |
89 | } |
90 | |
91 | QDate Person::birthday() const |
92 | { |
93 | return d->m_birthday; |
94 | } |
95 | |
96 | void Person::setCountry(const QString &c) |
97 | { |
98 | d->m_country = c; |
99 | } |
100 | |
101 | QString Person::country() const |
102 | { |
103 | return d->m_country; |
104 | } |
105 | |
106 | void Person::setLatitude(qreal l) |
107 | { |
108 | d->m_latitude = l; |
109 | } |
110 | |
111 | qreal Person::latitude() const |
112 | { |
113 | return d->m_latitude; |
114 | } |
115 | |
116 | void Person::setLongitude(qreal l) |
117 | { |
118 | d->m_longitude = l; |
119 | } |
120 | |
121 | qreal Person::longitude() const |
122 | { |
123 | return d->m_longitude; |
124 | } |
125 | |
126 | void Person::setAvatarUrl(const QUrl &url) |
127 | { |
128 | d->m_avatarUrl = url; |
129 | } |
130 | |
131 | QUrl Person::avatarUrl() const |
132 | { |
133 | return d->m_avatarUrl; |
134 | } |
135 | |
136 | void Person::setHomepage(const QString &h) |
137 | { |
138 | d->m_homepage = h; |
139 | } |
140 | |
141 | QString Person::homepage() const |
142 | { |
143 | return d->m_homepage; |
144 | } |
145 | |
146 | void Person::setCity(const QString &h) |
147 | { |
148 | d->m_city = h; |
149 | } |
150 | |
151 | QString Person::city() const |
152 | { |
153 | return d->m_city; |
154 | } |
155 | void Person::addExtendedAttribute(const QString &key, const QString &value) |
156 | { |
157 | d->m_extendedAttributes.insert(key, value); |
158 | } |
159 | |
160 | QString Person::extendedAttribute(const QString &key) const |
161 | { |
162 | return d->m_extendedAttributes.value(key); |
163 | } |
164 | |
165 | QMap<QString, QString> Person::extendedAttributes() const |
166 | { |
167 | return d->m_extendedAttributes; |
168 | } |
169 | |
170 | bool Person::isValid() const |
171 | { |
172 | return !(d->m_id.isEmpty()); |
173 | } |
174 | |