QXmpp: QXmppVCardIq.h Source File

QXmpp Version: 1.14.4

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
14namespace QXmpp::Private {
15struct VCardData;
16}
17
18class QXmppVCardAddressPrivate;
19class QXmppVCardEmailPrivate;
20class QXmppVCardPhonePrivate;
21class QXmppVCardOrganizationPrivate;
22class QXmppVCardIqPrivate;
23
25
26 class 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
39 QXmppVCardAddress();
40 QXmppVCardAddress(const QXmppVCardAddress &other);
41 QXmppVCardAddress(QXmppVCardAddress &&);
42 ~QXmppVCardAddress();
43
44 QXmppVCardAddress &operator=(const QXmppVCardAddress &other);
45 QXmppVCardAddress &operator=(QXmppVCardAddress &&);
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 static constexpr std::tuple XmlTag = { u"ADR", QXmpp::Private::ns_vcard };
67 void parse(const QDomElement &element);
68 void toXml(QXmlStreamWriter *stream) const;
70
71private:
72 QSharedDataPointer<QXmppVCardAddressPrivate> d;
73};
74
75QXMPP_EXPORT bool operator==(const QXmppVCardAddress &, const QXmppVCardAddress &);
76QXMPP_EXPORT bool operator!=(const QXmppVCardAddress &, const QXmppVCardAddress &);
77
79
80 class QXMPP_EXPORT QXmppVCardEmail
81{
82public:
84 enum TypeFlag {
85 None = 0x0,
86 Home = 0x1,
87 Work = 0x2,
88 Internet = 0x4,
89 Preferred = 0x8,
90 X400 = 0x10
91 };
92 Q_DECLARE_FLAGS(Type, TypeFlag)
93
94 QXmppVCardEmail();
95 QXmppVCardEmail(const QXmppVCardEmail &other);
96 ~QXmppVCardEmail();
97
98 QXmppVCardEmail &operator=(const QXmppVCardEmail &other);
99
100 QString address() const;
101 void setAddress(const QString &address);
102
103 Type type() const;
104 void setType(Type type);
105
107 static constexpr std::tuple XmlTag = { u"EMAIL", QXmpp::Private::ns_vcard };
108 void parse(const QDomElement &element);
109 void toXml(QXmlStreamWriter *stream) const;
111
112private:
113 QSharedDataPointer<QXmppVCardEmailPrivate> d;
114};
115
116QXMPP_EXPORT bool operator==(const QXmppVCardEmail &, const QXmppVCardEmail &);
117QXMPP_EXPORT bool operator!=(const QXmppVCardEmail &, const QXmppVCardEmail &);
118
120
121 class QXMPP_EXPORT QXmppVCardPhone
122{
123public:
125 enum TypeFlag {
126 None = 0x0,
127 Home = 0x1,
128 Work = 0x2,
129 Voice = 0x4,
130 Fax = 0x8,
131 Pager = 0x10,
132 Messaging = 0x20,
133 Cell = 0x40,
134 Video = 0x80,
135 BBS = 0x100,
136 Modem = 0x200,
137 ISDN = 0x400,
138 PCS = 0x800,
139 Preferred = 0x1000
140 };
141 Q_DECLARE_FLAGS(Type, TypeFlag)
142
143 QXmppVCardPhone();
144 QXmppVCardPhone(const QXmppVCardPhone &other);
145 ~QXmppVCardPhone();
146
147 QXmppVCardPhone &operator=(const QXmppVCardPhone &other);
148
149 QString number() const;
150 void setNumber(const QString &number);
151
152 Type type() const;
153 void setType(Type type);
154
156 static constexpr std::tuple XmlTag = { u"TEL", QXmpp::Private::ns_vcard };
157 void parse(const QDomElement &element);
158 void toXml(QXmlStreamWriter *stream) const;
160
161private:
162 QSharedDataPointer<QXmppVCardPhonePrivate> d;
163};
164
165QXMPP_EXPORT bool operator==(const QXmppVCardPhone &, const QXmppVCardPhone &);
166QXMPP_EXPORT bool operator!=(const QXmppVCardPhone &, const QXmppVCardPhone &);
167
172
173 class QXMPP_EXPORT QXmppVCardOrganization
174{
175public:
176 QXmppVCardOrganization();
177 QXmppVCardOrganization(const QXmppVCardOrganization &other);
178 ~QXmppVCardOrganization();
179
180 QXmppVCardOrganization &operator=(const QXmppVCardOrganization &other);
181
182 QString organization() const;
183 void setOrganization(const QString &);
184
185 QString unit() const;
186 void setUnit(const QString &);
187
188 QString title() const;
189 void setTitle(const QString &);
190
191 QString role() const;
192 void setRole(const QString &);
193
195 void parse(const QDomElement &element);
196 void toXml(QXmlStreamWriter *stream) const;
198
199private:
200 QSharedDataPointer<QXmppVCardOrganizationPrivate> d;
201};
202
203QXMPP_EXPORT bool operator==(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
204QXMPP_EXPORT bool operator!=(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
205
215
216 class QXMPP_EXPORT QXmppVCardIq : public QXmppIq
217{
218public:
219 QXmppVCardIq(const QString &bareJid = QString());
220 QXmppVCardIq(const QXmppVCardIq &other);
221 ~QXmppVCardIq() override;
222
223 QXmppVCardIq &operator=(const QXmppVCardIq &other);
224
225 QDate birthday() const;
226 void setBirthday(const QDate &birthday);
227
228 QString description() const;
229 void setDescription(const QString &description);
230
231 QString email() const;
232 void setEmail(const QString &);
233
234 QString firstName() const;
235 void setFirstName(const QString &);
236
237 QString fullName() const;
238 void setFullName(const QString &);
239
240 QString lastName() const;
241 void setLastName(const QString &);
242
243 QString middleName() const;
244 void setMiddleName(const QString &);
245
246 QString nickName() const;
247 void setNickName(const QString &);
248
249 QByteArray photo() const;
250 void setPhoto(const QByteArray &);
251
252 QString photoType() const;
253 void setPhotoType(const QString &type);
254
255 QString url() const;
256 void setUrl(const QString &);
257
258 QList<QXmppVCardAddress> addresses() const;
259 void setAddresses(const QList<QXmppVCardAddress> &addresses);
260
261 QList<QXmppVCardEmail> emails() const;
262 void setEmails(const QList<QXmppVCardEmail> &emails);
263
264 QList<QXmppVCardPhone> phones() const;
265 void setPhones(const QList<QXmppVCardPhone> &phones);
266
267 QXmppVCardOrganization organization() const;
268 void setOrganization(const QXmppVCardOrganization &);
269
271 static constexpr std::tuple PayloadXmlTag = { u"vCard", QXmpp::Private::ns_vcard };
272 [[deprecated("Use QXmpp::isIqElement()")]]
273 static bool isVCard(const QDomElement &element);
274 [[deprecated]]
275 static bool checkIqType(const QString &tagName, const QString &xmlNamespace);
277
278protected:
279 friend struct QXmpp::Private::VCardData;
280
282 void parseElementFromChild(const QDomElement &) override;
283 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
285
286private:
287 QSharedDataPointer<QXmppVCardIqPrivate> d;
288};
289
290QXMPP_EXPORT bool operator==(const QXmppVCardIq &, const QXmppVCardIq &);
291QXMPP_EXPORT bool operator!=(const QXmppVCardIq &, const QXmppVCardIq &);
292
293#endif // QXMPPVCARDIQ_H
QXmppIq::QXmppIq
QXmppIq(QXmppIq::Type type=QXmppIq::Get)
Definition QXmppIq.cpp:39
QXmppIq::type
QXmppIq::Type type() const
Definition QXmppIq.cpp:60
QXmppVCardAddress
Represent a vCard address.
Definition QXmppVCardIq.h:27
QXmppVCardAddress::TypeFlag
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:30
QXmppVCardAddress::setPostcode
void setPostcode(const QString &postcode)
Sets the postcode.
Definition QXmppVCardIq.cpp:141
QXmppVCardAddress::QXmppVCardAddress
QXmppVCardAddress(const QXmppVCardAddress &other)
Copy-constructor.
QXmppVCardAddress::setRegion
void setRegion(const QString &region)
Sets the region.
Definition QXmppVCardIq.cpp:153
QXmppVCardAddress::setType
void setType(Type type)
Sets the address type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:177
QXmppVCardAddress::QXmppVCardAddress
QXmppVCardAddress(QXmppVCardAddress &&)
Move-constructor.
QXmppVCardAddress::type
Type type() const
Returns the address type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:171
QXmppVCardAddress::region
QString region() const
Returns the region.
Definition QXmppVCardIq.cpp:147
QXmppVCardAddress::operator=
QXmppVCardAddress & operator=(const QXmppVCardAddress &other)
Assignment operator.
QXmppVCardAddress::setLocality
void setLocality(const QString &locality)
Sets the locality.
Definition QXmppVCardIq.cpp:128
QXmppVCardAddress::street
QString street() const
Returns the street address.
Definition QXmppVCardIq.cpp:159
QXmppVCardAddress::setStreet
void setStreet(const QString &street)
Sets the street address.
Definition QXmppVCardIq.cpp:165
QXmppVCardAddress::QXmppVCardAddress
QXmppVCardAddress()
Constructs an empty address.
Definition QXmppVCardIq.cpp:77
QXmppVCardAddress::postcode
QString postcode() const
Returns the postcode.
Definition QXmppVCardIq.cpp:135
QXmppVCardAddress::country
QString country() const
Returns the country.
Definition QXmppVCardIq.cpp:110
QXmppVCardAddress::locality
QString locality() const
Returns the locality.
Definition QXmppVCardIq.cpp:122
QXmppVCardAddress::operator=
QXmppVCardAddress & operator=(QXmppVCardAddress &&)
Move-assignment operator.
QXmppVCardAddress::setCountry
void setCountry(const QString &country)
Sets the country.
Definition QXmppVCardIq.cpp:116
QXmppVCardEmail
Represents a vCard e-mail address.
Definition QXmppVCardIq.h:81
QXmppVCardEmail::TypeFlag
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:84
QXmppVCardEmail::setAddress
void setAddress(const QString &address)
Sets the e-mail address.
Definition QXmppVCardIq.cpp:264
QXmppVCardEmail::QXmppVCardEmail
QXmppVCardEmail(const QXmppVCardEmail &other)
Copy-constructor.
QXmppVCardEmail::address
QString address() const
Returns the e-mail address.
Definition QXmppVCardIq.cpp:258
QXmppVCardEmail::operator=
QXmppVCardEmail & operator=(const QXmppVCardEmail &other)
Copy-assignment operator.
QXmppVCardEmail::QXmppVCardEmail
QXmppVCardEmail()
Constructs an empty e-mail address.
Definition QXmppVCardIq.cpp:231
QXmppVCardEmail::setType
void setType(Type type)
Sets the e-mail type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:276
QXmppVCardEmail::type
Type type() const
Returns the e-mail type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:270
QXmppVCardIq
Represents the XMPP vCard.
Definition QXmppVCardIq.h:217
QXmppVCardIq::setPhoto
void setPhoto(const QByteArray &)
Sets the photo's binary contents.
Definition QXmppVCardIq.cpp:778
QXmppVCardIq::operator=
QXmppVCardIq & operator=(const QXmppVCardIq &other)
Assigns other to this vCard IQ.
Definition QXmppVCardIq.cpp:604
QXmppVCardIq::photo
QByteArray photo() const
Definition QXmppVCardIq.cpp:772
QXmppVCardIq::lastName
QString lastName() const
Returns the last name.
Definition QXmppVCardIq.cpp:704
QXmppVCardIq::nickName
QString nickName() const
Returns the nickname.
Definition QXmppVCardIq.cpp:728
QXmppVCardIq::birthday
QDate birthday() const
Returns the date of birth of the individual associated with the vCard.
Definition QXmppVCardIq.cpp:637
QXmppVCardIq::email
QString email() const
Returns the email address.
Definition QXmppVCardIq.cpp:661
QXmppVCardIq::photoType
QString photoType() const
Returns the photo's MIME type.
Definition QXmppVCardIq.cpp:784
QXmppVCardIq::setOrganization
void setOrganization(const QXmppVCardOrganization &)
Sets the organization info.
Definition QXmppVCardIq.cpp:838
QXmppVCardIq::setFullName
void setFullName(const QString &)
Sets the full name.
Definition QXmppVCardIq.cpp:698
QXmppVCardIq::fullName
QString fullName() const
Returns the full name.
Definition QXmppVCardIq.cpp:692
QXmppVCardIq::firstName
QString firstName() const
Returns the first name.
Definition QXmppVCardIq.cpp:680
QXmppVCardIq::middleName
QString middleName() const
Returns the middle name.
Definition QXmppVCardIq.cpp:716
QXmppVCardIq::setUrl
void setUrl(const QString &)
Definition QXmppVCardIq.cpp:754
QXmppVCardIq::organization
QXmppVCardOrganization organization() const
Returns the organization info.
Definition QXmppVCardIq.cpp:832
QXmppVCardIq::QXmppVCardIq
QXmppVCardIq(const QString &bareJid=QString())
Constructs a QXmppVCardIq for the specified recipient.
Definition QXmppVCardIq.cpp:586
QXmppVCardIq::emails
QList< QXmppVCardEmail > emails() const
Returns the e-mail addresses.
Definition QXmppVCardIq.cpp:808
QXmppVCardIq::url
QString url() const
Definition QXmppVCardIq.cpp:744
QXmppVCardIq::setFirstName
void setFirstName(const QString &)
Sets the first name.
Definition QXmppVCardIq.cpp:686
QXmppVCardIq::setDescription
void setDescription(const QString &description)
Sets the free-form descriptive text.
Definition QXmppVCardIq.cpp:655
QXmppVCardIq::setNickName
void setNickName(const QString &)
Sets the nickname.
Definition QXmppVCardIq.cpp:734
QXmppVCardIq::setMiddleName
void setMiddleName(const QString &)
Sets the middle name.
Definition QXmppVCardIq.cpp:722
QXmppVCardIq::setEmail
void setEmail(const QString &)
Sets the email address.
Definition QXmppVCardIq.cpp:671
QXmppVCardIq::phones
QList< QXmppVCardPhone > phones() const
Returns the phone numbers.
Definition QXmppVCardIq.cpp:820
QXmppVCardIq::setBirthday
void setBirthday(const QDate &birthday)
Sets the date of birth of the individual associated with the vCard.
Definition QXmppVCardIq.cpp:643
QXmppVCardIq::setPhotoType
void setPhotoType(const QString &type)
Sets the photo's MIME type.
Definition QXmppVCardIq.cpp:790
QXmppVCardIq::description
QString description() const
Returns the free-form descriptive text.
Definition QXmppVCardIq.cpp:649
QXmppVCardIq::setAddresses
void setAddresses(const QList< QXmppVCardAddress > &addresses)
Sets the addresses.
Definition QXmppVCardIq.cpp:802
QXmppVCardIq::setLastName
void setLastName(const QString &)
Sets the last name.
Definition QXmppVCardIq.cpp:710
QXmppVCardIq::addresses
QList< QXmppVCardAddress > addresses() const
Returns the addresses.
Definition QXmppVCardIq.cpp:796
QXmppVCardIq::setEmails
void setEmails(const QList< QXmppVCardEmail > &emails)
Sets the e-mail addresses.
Definition QXmppVCardIq.cpp:814
QXmppVCardIq::setPhones
void setPhones(const QList< QXmppVCardPhone > &phones)
Sets the phone numbers.
Definition QXmppVCardIq.cpp:826
QXmppVCardOrganization
Represents organization information in XMPP vCards.
Definition QXmppVCardIq.h:174
QXmppVCardOrganization::title
QString title() const
Returns the job title within the organization.
Definition QXmppVCardIq.cpp:524
QXmppVCardOrganization::role
QString role() const
Returns the job role within the organization.
Definition QXmppVCardIq.cpp:512
QXmppVCardOrganization::unit
QString unit() const
Returns the organization unit (also known as department).
Definition QXmppVCardIq.cpp:500
QXmppVCardOrganization::setRole
void setRole(const QString &)
Sets the job role within the organization.
Definition QXmppVCardIq.cpp:518
QXmppVCardOrganization::setTitle
void setTitle(const QString &)
Sets the job title within the organization.
Definition QXmppVCardIq.cpp:530
QXmppVCardOrganization::setUnit
void setUnit(const QString &)
Sets the unit within the organization.
Definition QXmppVCardIq.cpp:506
QXmppVCardOrganization::organization
QString organization() const
Returns the name of the organization.
Definition QXmppVCardIq.cpp:488
QXmppVCardOrganization::setOrganization
void setOrganization(const QString &)
Sets the organization name.
Definition QXmppVCardIq.cpp:494
QXmppVCardOrganization::operator=
QXmppVCardOrganization & operator=(const QXmppVCardOrganization &other)
Assigns other to this organization info.
Definition QXmppVCardIq.cpp:466
QXmppVCardOrganization::QXmppVCardOrganization
QXmppVCardOrganization()
Constructs an empty organization information.
Definition QXmppVCardIq.cpp:452
QXmppVCardPhone
Represents a vCard phone number.
Definition QXmppVCardIq.h:122
QXmppVCardPhone::setNumber
void setNumber(const QString &number)
Sets the phone number.
Definition QXmppVCardIq.cpp:358
QXmppVCardPhone::TypeFlag
TypeFlag
Describes phone number types.
Definition QXmppVCardIq.h:125
QXmppVCardPhone::type
Type type() const
Returns the phone number type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:364
QXmppVCardPhone::operator=
QXmppVCardPhone & operator=(const QXmppVCardPhone &other)
Copy-assignment operator.
QXmppVCardPhone::number
QString number() const
Returns the phone number.
Definition QXmppVCardIq.cpp:339
QXmppVCardPhone::QXmppVCardPhone
QXmppVCardPhone()
Constructs an empty phone number.
Definition QXmppVCardIq.cpp:325
QXmppVCardPhone::QXmppVCardPhone
QXmppVCardPhone(const QXmppVCardPhone &other)
Copy-constructor.
QXmppVCardPhone::setType
void setType(Type type)
Sets the phone number type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:370