QXmpp Version: 1.10.3
 
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
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
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
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
QXmppIq(QXmppIq::Type type=QXmppIq::Get)
Definition QXmppIq.cpp:34
QXmppIq::Type type() const
Definition QXmppIq.cpp:55
Represent a vCard address.
Definition QXmppVCardIq.h:27
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:30
void setPostcode(const QString &postcode)
Sets the postcode.
Definition QXmppVCardIq.cpp:114
QXmppVCardAddress(const QXmppVCardAddress &other)
Copy-constructor.
void setRegion(const QString &region)
Sets the region.
Definition QXmppVCardIq.cpp:126
void setType(Type type)
Sets the address type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:150
QXmppVCardAddress(QXmppVCardAddress &&)
Move-constructor.
Type type() const
Returns the address type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:144
QString region() const
Returns the region.
Definition QXmppVCardIq.cpp:120
QXmppVCardAddress & operator=(const QXmppVCardAddress &other)
Assignment operator.
void setLocality(const QString &locality)
Sets the locality.
Definition QXmppVCardIq.cpp:101
QString street() const
Returns the street address.
Definition QXmppVCardIq.cpp:132
void setStreet(const QString &street)
Sets the street address.
Definition QXmppVCardIq.cpp:138
QXmppVCardAddress()
Constructs an empty address.
Definition QXmppVCardIq.cpp:50
QString postcode() const
Returns the postcode.
Definition QXmppVCardIq.cpp:108
QString country() const
Returns the country.
Definition QXmppVCardIq.cpp:83
QString locality() const
Returns the locality.
Definition QXmppVCardIq.cpp:95
QXmppVCardAddress & operator=(QXmppVCardAddress &&)
Move-assignment operator.
void setCountry(const QString &country)
Sets the country.
Definition QXmppVCardIq.cpp:89
Represents a vCard e-mail address.
Definition QXmppVCardIq.h:80
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:83
void setAddress(const QString &address)
Sets the e-mail address.
Definition QXmppVCardIq.cpp:256
QXmppVCardEmail(const QXmppVCardEmail &other)
Copy-constructor.
QString address() const
Returns the e-mail address.
Definition QXmppVCardIq.cpp:250
QXmppVCardEmail & operator=(const QXmppVCardEmail &other)
Copy-assignment operator.
QXmppVCardEmail()
Constructs an empty e-mail address.
Definition QXmppVCardIq.cpp:223
void setType(Type type)
Sets the e-mail type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:268
Type type() const
Returns the e-mail type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:262
Represents the XMPP vCard.
Definition QXmppVCardIq.h:214
void setPhoto(const QByteArray &)
Sets the photo's binary contents.
Definition QXmppVCardIq.cpp:801
QXmppVCardIq & operator=(const QXmppVCardIq &other)
Assigns other to this vCard IQ.
Definition QXmppVCardIq.cpp:627
QByteArray photo() const
Definition QXmppVCardIq.cpp:795
QString lastName() const
Returns the last name.
Definition QXmppVCardIq.cpp:727
QString nickName() const
Returns the nickname.
Definition QXmppVCardIq.cpp:751
QDate birthday() const
Returns the date of birth of the individual associated with the vCard.
Definition QXmppVCardIq.cpp:660
QString email() const
Returns the email address.
Definition QXmppVCardIq.cpp:684
QString photoType() const
Returns the photo's MIME type.
Definition QXmppVCardIq.cpp:807
void setOrganization(const QXmppVCardOrganization &)
Sets the organization info.
Definition QXmppVCardIq.cpp:861
void setFullName(const QString &)
Sets the full name.
Definition QXmppVCardIq.cpp:721
QString fullName() const
Returns the full name.
Definition QXmppVCardIq.cpp:715
QString firstName() const
Returns the first name.
Definition QXmppVCardIq.cpp:703
QString middleName() const
Returns the middle name.
Definition QXmppVCardIq.cpp:739
void setUrl(const QString &)
Definition QXmppVCardIq.cpp:777
QXmppVCardOrganization organization() const
Returns the organization info.
Definition QXmppVCardIq.cpp:855
QXmppVCardIq(const QString &bareJid=QString())
Constructs a QXmppVCardIq for the specified recipient.
Definition QXmppVCardIq.cpp:609
QList< QXmppVCardEmail > emails() const
Returns the e-mail addresses.
Definition QXmppVCardIq.cpp:831
QString url() const
Definition QXmppVCardIq.cpp:767
void setFirstName(const QString &)
Sets the first name.
Definition QXmppVCardIq.cpp:709
void setDescription(const QString &description)
Sets the free-form descriptive text.
Definition QXmppVCardIq.cpp:678
void setNickName(const QString &)
Sets the nickname.
Definition QXmppVCardIq.cpp:757
void setMiddleName(const QString &)
Sets the middle name.
Definition QXmppVCardIq.cpp:745
void setEmail(const QString &)
Sets the email address.
Definition QXmppVCardIq.cpp:694
QList< QXmppVCardPhone > phones() const
Returns the phone numbers.
Definition QXmppVCardIq.cpp:843
void setBirthday(const QDate &birthday)
Sets the date of birth of the individual associated with the vCard.
Definition QXmppVCardIq.cpp:666
void setPhotoType(const QString &type)
Sets the photo's MIME type.
Definition QXmppVCardIq.cpp:813
QString description() const
Returns the free-form descriptive text.
Definition QXmppVCardIq.cpp:672
void setAddresses(const QList< QXmppVCardAddress > &addresses)
Sets the addresses.
Definition QXmppVCardIq.cpp:825
void setLastName(const QString &)
Sets the last name.
Definition QXmppVCardIq.cpp:733
QList< QXmppVCardAddress > addresses() const
Returns the addresses.
Definition QXmppVCardIq.cpp:819
void setEmails(const QList< QXmppVCardEmail > &emails)
Sets the e-mail addresses.
Definition QXmppVCardIq.cpp:837
void setPhones(const QList< QXmppVCardPhone > &phones)
Sets the phone numbers.
Definition QXmppVCardIq.cpp:849
Represents organization information in XMPP vCards.
Definition QXmppVCardIq.h:171
QString title() const
Returns the job title within the organization.
Definition QXmppVCardIq.cpp:550
QString role() const
Returns the job role within the organization.
Definition QXmppVCardIq.cpp:538
QString unit() const
Returns the organization unit (also known as department).
Definition QXmppVCardIq.cpp:526
void setRole(const QString &)
Sets the job role within the organization.
Definition QXmppVCardIq.cpp:544
void setTitle(const QString &)
Sets the job title within the organization.
Definition QXmppVCardIq.cpp:556
void setUnit(const QString &)
Sets the unit within the organization.
Definition QXmppVCardIq.cpp:532
QString organization() const
Returns the name of the organization.
Definition QXmppVCardIq.cpp:514
void setOrganization(const QString &)
Sets the organization name.
Definition QXmppVCardIq.cpp:520
QXmppVCardOrganization & operator=(const QXmppVCardOrganization &other)
Assigns other to this organization info.
Definition QXmppVCardIq.cpp:492
QXmppVCardOrganization()
Constructs an empty organization information.
Definition QXmppVCardIq.cpp:478
Represents a vCard phone number.
Definition QXmppVCardIq.h:120
void setNumber(const QString &number)
Sets the phone number.
Definition QXmppVCardIq.cpp:359
TypeFlag
Describes phone number types.
Definition QXmppVCardIq.h:123
Type type() const
Returns the phone number type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:365
QXmppVCardPhone & operator=(const QXmppVCardPhone &other)
Copy-assignment operator.
QString number() const
Returns the phone number.
Definition QXmppVCardIq.cpp:340
QXmppVCardPhone()
Constructs an empty phone number.
Definition QXmppVCardIq.cpp:326
QXmppVCardPhone(const QXmppVCardPhone &other)
Copy-constructor.
void setType(Type type)
Sets the phone number type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:371