QXmpp Version: 1.10.0
QXmppVCardIq.h
1// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPVCARDIQ_H
6#define QXMPPVCARDIQ_H
7
8#include "QXmppIq.h"
9
10#include <QDate>
11#include <QDomElement>
12#include <QMap>
13
14namespace QXmpp::Private {
15struct VCardData;
16}
17
18class QXmppVCardAddressPrivate;
19class QXmppVCardEmailPrivate;
20class QXmppVCardPhonePrivate;
21class QXmppVCardOrganizationPrivate;
22class QXmppVCardIqPrivate;
23
25
26class QXMPP_EXPORT QXmppVCardAddress
27{
28public:
30 enum TypeFlag {
31 None = 0x0,
32 Home = 0x1,
33 Work = 0x2,
34 Postal = 0x4,
35 Preferred = 0x8
36 };
37 Q_DECLARE_FLAGS(Type, TypeFlag)
38
43
46
47 QString country() const;
48 void setCountry(const QString &country);
49
50 QString locality() const;
51 void setLocality(const QString &locality);
52
53 QString postcode() const;
54 void setPostcode(const QString &postcode);
55
56 QString region() const;
57 void setRegion(const QString &region);
58
59 QString street() const;
60 void setStreet(const QString &street);
61
62 Type type() const;
63 void setType(Type type);
64
66 void parse(const QDomElement &element);
67 void toXml(QXmlStreamWriter *stream) const;
69
70private:
71 QSharedDataPointer<QXmppVCardAddressPrivate> d;
72};
73
74QXMPP_EXPORT bool operator==(const QXmppVCardAddress &, const QXmppVCardAddress &);
75QXMPP_EXPORT bool operator!=(const QXmppVCardAddress &, const QXmppVCardAddress &);
76
78
79class QXMPP_EXPORT QXmppVCardEmail
80{
81public:
83 enum TypeFlag {
84 None = 0x0,
85 Home = 0x1,
86 Work = 0x2,
87 Internet = 0x4,
88 Preferred = 0x8,
89 X400 = 0x10
90 };
91 Q_DECLARE_FLAGS(Type, TypeFlag)
92
96
98
99 QString address() const;
100 void setAddress(const QString &address);
101
102 Type type() const;
103 void setType(Type type);
104
106 void parse(const QDomElement &element);
107 void toXml(QXmlStreamWriter *stream) const;
109
110private:
111 QSharedDataPointer<QXmppVCardEmailPrivate> d;
112};
113
114QXMPP_EXPORT bool operator==(const QXmppVCardEmail &, const QXmppVCardEmail &);
115QXMPP_EXPORT bool operator!=(const QXmppVCardEmail &, const QXmppVCardEmail &);
116
118
119class QXMPP_EXPORT QXmppVCardPhone
120{
121public:
123 enum TypeFlag {
124 None = 0x0,
125 Home = 0x1,
126 Work = 0x2,
127 Voice = 0x4,
128 Fax = 0x8,
129 Pager = 0x10,
130 Messaging = 0x20,
131 Cell = 0x40,
132 Video = 0x80,
133 BBS = 0x100,
134 Modem = 0x200,
135 ISDN = 0x400,
136 PCS = 0x800,
137 Preferred = 0x1000
138 };
139 Q_DECLARE_FLAGS(Type, TypeFlag)
140
144
146
147 QString number() const;
148 void setNumber(const QString &number);
149
150 Type type() const;
151 void setType(Type type);
152
154 void parse(const QDomElement &element);
155 void toXml(QXmlStreamWriter *stream) const;
157
158private:
159 QSharedDataPointer<QXmppVCardPhonePrivate> d;
160};
161
162QXMPP_EXPORT bool operator==(const QXmppVCardPhone &, const QXmppVCardPhone &);
163QXMPP_EXPORT bool operator!=(const QXmppVCardPhone &, const QXmppVCardPhone &);
164
169
170class QXMPP_EXPORT QXmppVCardOrganization
171{
172public:
176
177 QXmppVCardOrganization &operator=(const QXmppVCardOrganization &other);
178
179 QString organization() const;
180 void setOrganization(const QString &);
181
182 QString unit() const;
183 void setUnit(const QString &);
184
185 QString title() const;
186 void setTitle(const QString &);
187
188 QString role() const;
189 void setRole(const QString &);
190
192 void parse(const QDomElement &element);
193 void toXml(QXmlStreamWriter *stream) const;
195
196private:
197 QSharedDataPointer<QXmppVCardOrganizationPrivate> d;
198};
199
200QXMPP_EXPORT bool operator==(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
201QXMPP_EXPORT bool operator!=(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
202
212
213class QXMPP_EXPORT QXmppVCardIq : public QXmppIq
214{
215public:
216 QXmppVCardIq(const QString &bareJid = QString());
217 QXmppVCardIq(const QXmppVCardIq &other);
218 ~QXmppVCardIq() override;
219
220 QXmppVCardIq &operator=(const QXmppVCardIq &other);
221
222 QDate birthday() const;
223 void setBirthday(const QDate &birthday);
224
225 QString description() const;
226 void setDescription(const QString &description);
227
228 QString email() const;
229 void setEmail(const QString &);
230
231 QString firstName() const;
232 void setFirstName(const QString &);
233
234 QString fullName() const;
235 void setFullName(const QString &);
236
237 QString lastName() const;
238 void setLastName(const QString &);
239
240 QString middleName() const;
241 void setMiddleName(const QString &);
242
243 QString nickName() const;
244 void setNickName(const QString &);
245
246 QByteArray photo() const;
247 void setPhoto(const QByteArray &);
248
249 QString photoType() const;
250 void setPhotoType(const QString &type);
251
252 QString url() const;
253 void setUrl(const QString &);
254
255 QList<QXmppVCardAddress> addresses() const;
256 void setAddresses(const QList<QXmppVCardAddress> &addresses);
257
258 QList<QXmppVCardEmail> emails() const;
259 void setEmails(const QList<QXmppVCardEmail> &emails);
260
261 QList<QXmppVCardPhone> phones() const;
262 void setPhones(const QList<QXmppVCardPhone> &phones);
263
264 QXmppVCardOrganization organization() const;
265 void setOrganization(const QXmppVCardOrganization &);
266
268 static bool isVCard(const QDomElement &element);
269 static bool checkIqType(const QString &tagName, const QString &xmlNamespace);
271
272protected:
273 friend struct QXmpp::Private::VCardData;
274
276 void parseElementFromChild(const QDomElement &) override;
277 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
279
280private:
281 QSharedDataPointer<QXmppVCardIqPrivate> d;
282};
283
284QXMPP_EXPORT bool operator==(const QXmppVCardIq &, const QXmppVCardIq &);
285QXMPP_EXPORT bool operator!=(const QXmppVCardIq &, const QXmppVCardIq &);
286
287#endif // QXMPPVCARDIQ_H
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:23
Represent a vCard address.
Definition: QXmppVCardIq.h:27
TypeFlag
Describes e-mail address types.
Definition: QXmppVCardIq.h:30
QXmppVCardAddress(const QXmppVCardAddress &other)
Copy-constructor.
QXmppVCardAddress(QXmppVCardAddress &&)
Move-constructor.
QXmppVCardAddress & operator=(const QXmppVCardAddress &other)
Assignment operator.
QXmppVCardAddress & operator=(QXmppVCardAddress &&)
Move-assignment operator.
Represents a vCard e-mail address.
Definition: QXmppVCardIq.h:80
TypeFlag
Describes e-mail address types.
Definition: QXmppVCardIq.h:83
QXmppVCardEmail(const QXmppVCardEmail &other)
Copy-constructor.
QXmppVCardEmail & operator=(const QXmppVCardEmail &other)
Copy-assignment operator.
Represents the XMPP vCard.
Definition: QXmppVCardIq.h:214
Represents organization information in XMPP vCards.
Definition: QXmppVCardIq.h:171
Represents a vCard phone number.
Definition: QXmppVCardIq.h:120
TypeFlag
Describes phone number types.
Definition: QXmppVCardIq.h:123
QXmppVCardPhone & operator=(const QXmppVCardPhone &other)
Copy-assignment operator.
QXmppVCardPhone(const QXmppVCardPhone &other)
Copy-constructor.