QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
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
14class QXmppVCardAddressPrivate;
15class QXmppVCardEmailPrivate;
16class QXmppVCardPhonePrivate;
17class QXmppVCardOrganizationPrivate;
18class QXmppVCardIqPrivate;
19
21
22class QXMPP_EXPORT QXmppVCardAddress
23{
24public:
26 enum TypeFlag {
27 None = 0x0,
28 Home = 0x1,
29 Work = 0x2,
30 Postal = 0x4,
31 Preferred = 0x8
32 };
33 Q_DECLARE_FLAGS(Type, TypeFlag)
34
39
42
43 QString country() const;
44 void setCountry(const QString &country);
45
46 QString locality() const;
47 void setLocality(const QString &locality);
48
49 QString postcode() const;
50 void setPostcode(const QString &postcode);
51
52 QString region() const;
53 void setRegion(const QString &region);
54
55 QString street() const;
56 void setStreet(const QString &street);
57
58 Type type() const;
59 void setType(Type type);
60
62 void parse(const QDomElement &element);
63 void toXml(QXmlStreamWriter *stream) const;
65
66private:
67 QSharedDataPointer<QXmppVCardAddressPrivate> d;
68};
69
70QXMPP_EXPORT bool operator==(const QXmppVCardAddress &, const QXmppVCardAddress &);
71QXMPP_EXPORT bool operator!=(const QXmppVCardAddress &, const QXmppVCardAddress &);
72
74
75class QXMPP_EXPORT QXmppVCardEmail
76{
77public:
79 enum TypeFlag {
80 None = 0x0,
81 Home = 0x1,
82 Work = 0x2,
83 Internet = 0x4,
84 Preferred = 0x8,
85 X400 = 0x10
86 };
87 Q_DECLARE_FLAGS(Type, TypeFlag)
88
90 QXmppVCardEmail(const QXmppVCardEmail &other);
92
93 QXmppVCardEmail &operator=(const QXmppVCardEmail &other);
94
95 QString address() const;
96 void setAddress(const QString &address);
97
98 Type type() const;
99 void setType(Type type);
100
102 void parse(const QDomElement &element);
103 void toXml(QXmlStreamWriter *stream) const;
105
106private:
107 QSharedDataPointer<QXmppVCardEmailPrivate> d;
108};
109
110QXMPP_EXPORT bool operator==(const QXmppVCardEmail &, const QXmppVCardEmail &);
111QXMPP_EXPORT bool operator!=(const QXmppVCardEmail &, const QXmppVCardEmail &);
112
114
115class QXMPP_EXPORT QXmppVCardPhone
116{
117public:
119 enum TypeFlag {
120 None = 0x0,
121 Home = 0x1,
122 Work = 0x2,
123 Voice = 0x4,
124 Fax = 0x8,
125 Pager = 0x10,
126 Messaging = 0x20,
127 Cell = 0x40,
128 Video = 0x80,
129 BBS = 0x100,
130 Modem = 0x200,
131 ISDN = 0x400,
132 PCS = 0x800,
133 Preferred = 0x1000
134 };
135 Q_DECLARE_FLAGS(Type, TypeFlag)
136
138 QXmppVCardPhone(const QXmppVCardPhone &other);
140
141 QXmppVCardPhone &operator=(const QXmppVCardPhone &other);
142
143 QString number() const;
144 void setNumber(const QString &number);
145
146 Type type() const;
147 void setType(Type type);
148
150 void parse(const QDomElement &element);
151 void toXml(QXmlStreamWriter *stream) const;
153
154private:
155 QSharedDataPointer<QXmppVCardPhonePrivate> d;
156};
157
158QXMPP_EXPORT bool operator==(const QXmppVCardPhone &, const QXmppVCardPhone &);
159QXMPP_EXPORT bool operator!=(const QXmppVCardPhone &, const QXmppVCardPhone &);
160
165
166class QXMPP_EXPORT QXmppVCardOrganization
167{
168public:
172
173 QXmppVCardOrganization &operator=(const QXmppVCardOrganization &other);
174
175 QString organization() const;
176 void setOrganization(const QString &);
177
178 QString unit() const;
179 void setUnit(const QString &);
180
181 QString title() const;
182 void setTitle(const QString &);
183
184 QString role() const;
185 void setRole(const QString &);
186
188 void parse(const QDomElement &element);
189 void toXml(QXmlStreamWriter *stream) const;
191
192private:
193 QSharedDataPointer<QXmppVCardOrganizationPrivate> d;
194};
195
196QXMPP_EXPORT bool operator==(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
197QXMPP_EXPORT bool operator!=(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
198
208
209class QXMPP_EXPORT QXmppVCardIq : public QXmppIq
210{
211public:
212 QXmppVCardIq(const QString &bareJid = QString());
213 QXmppVCardIq(const QXmppVCardIq &other);
214 ~QXmppVCardIq() override;
215
216 QXmppVCardIq &operator=(const QXmppVCardIq &other);
217
218 QDate birthday() const;
219 void setBirthday(const QDate &birthday);
220
221 QString description() const;
222 void setDescription(const QString &description);
223
224 QString email() const;
225 void setEmail(const QString &);
226
227 QString firstName() const;
228 void setFirstName(const QString &);
229
230 QString fullName() const;
231 void setFullName(const QString &);
232
233 QString lastName() const;
234 void setLastName(const QString &);
235
236 QString middleName() const;
237 void setMiddleName(const QString &);
238
239 QString nickName() const;
240 void setNickName(const QString &);
241
242 QByteArray photo() const;
243 void setPhoto(const QByteArray &);
244
245 QString photoType() const;
246 void setPhotoType(const QString &type);
247
248 QString url() const;
249 void setUrl(const QString &);
250
251 QList<QXmppVCardAddress> addresses() const;
252 void setAddresses(const QList<QXmppVCardAddress> &addresses);
253
254 QList<QXmppVCardEmail> emails() const;
255 void setEmails(const QList<QXmppVCardEmail> &emails);
256
257 QList<QXmppVCardPhone> phones() const;
258 void setPhones(const QList<QXmppVCardPhone> &phones);
259
260 QXmppVCardOrganization organization() const;
261 void setOrganization(const QXmppVCardOrganization &);
262
264 static bool isVCard(const QDomElement &element);
265 static bool checkIqType(const QString &tagName, const QString &xmlNamespace);
267
268protected:
270 void parseElementFromChild(const QDomElement &) override;
271 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
273
274private:
275 QSharedDataPointer<QXmppVCardIqPrivate> d;
276};
277
278QXMPP_EXPORT bool operator==(const QXmppVCardIq &, const QXmppVCardIq &);
279QXMPP_EXPORT bool operator!=(const QXmppVCardIq &, const QXmppVCardIq &);
280
281#endif // QXMPPVCARDIQ_H
The QXmppIq class is the base class for all IQs.
Definition QXmppIq.h:23
Represent a vCard address.
Definition QXmppVCardIq.h:23
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:26
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:76
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:79
Represents the XMPP vCard.
Definition QXmppVCardIq.h:210
Represents organization information in XMPP vCards.
Definition QXmppVCardIq.h:167
Represents a vCard phone number.
Definition QXmppVCardIq.h:116
TypeFlag
Describes phone number types.
Definition QXmppVCardIq.h:119