QXmpp Version:0.7.6

- Main Page
- Modules
- Classes
- Files

- File List

All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppVCardIq.h
1 /*
2 * Copyright (C) 2008-2012 The QXmpp developers
3 *
4 * Author:
5 * Manjeet Dahiya
6 *
7 * Source:
8 * http://code.google.com/p/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24
25 #ifndef QXMPPVCARDIQ_H
26 #define QXMPPVCARDIQ_H
27
28 #include "QXmppIq.h"
29 #include <QDate>
30 #include <QMap>
31 #include <QDomElement>
32
33 class QXmppVCardAddressPrivate;
34 class QXmppVCardEmailPrivate;
35 class QXmppVCardPhonePrivate;
36 class QXmppVCardIqPrivate;
37
39
40 class QXMPP_EXPORT QXmppVCardAddress
41 {
42 public:
44 enum TypeFlag {
45 None = 0x0,
46 Home = 0x1,
47 Work = 0x2,
48 Postal = 0x4,
49 Preferred = 0x8
50 };
51 Q_DECLARE_FLAGS(Type, TypeFlag)
52
53 QXmppVCardAddress();
54 QXmppVCardAddress(const QXmppVCardAddress &other);
55 ~QXmppVCardAddress();
56
57 QXmppVCardAddress& operator=(const QXmppVCardAddress &other);
58
59 QString country() const;
60 void setCountry(const QString &country);
61
62 QString locality() const;
63 void setLocality(const QString &locality);
64
65 QString postcode() const;
66 void setPostcode(const QString &postcode);
67
68 QString region() const;
69 void setRegion(const QString &region);
70
71 QString street() const;
72 void setStreet(const QString &street);
73
74 Type type() const;
75 void setType(Type type);
76
78 void parse(const QDomElement &element);
79 void toXml(QXmlStreamWriter *stream) const;
81
82 private:
83 QSharedDataPointer<QXmppVCardAddressPrivate> d;
84 };
85
87
88 class QXMPP_EXPORT QXmppVCardEmail
89 {
90 public:
92 enum TypeFlag {
93 None = 0x0,
94 Home = 0x1,
95 Work = 0x2,
96 Internet = 0x4,
97 Preferred = 0x8,
98 X400 = 0x10
99 };
100 Q_DECLARE_FLAGS(Type, TypeFlag)
101
102 QXmppVCardEmail();
103 QXmppVCardEmail(const QXmppVCardEmail &other);
104 ~QXmppVCardEmail();
105
106 QXmppVCardEmail& operator=(const QXmppVCardEmail &other);
107
108 QString address() const;
109 void setAddress(const QString &address);
110
111 Type type() const;
112 void setType(Type type);
113
115 void parse(const QDomElement &element);
116 void toXml(QXmlStreamWriter *stream) const;
118
119 private:
120 QSharedDataPointer<QXmppVCardEmailPrivate> d;
121 };
122
124
125 class QXMPP_EXPORT QXmppVCardPhone
126 {
127 public:
129 enum TypeFlag {
130 None = 0x0,
131 Home = 0x1,
132 Work = 0x2,
133 Voice = 0x4,
134 Fax = 0x8,
135 Pager = 0x10,
136 Messaging = 0x20,
137 Cell = 0x40,
138 Video = 0x80,
139 BBS = 0x100,
140 Modem = 0x200,
141 ISDN = 0x400,
142 PCS = 0x800,
143 Preferred = 0x1000
144 };
145 Q_DECLARE_FLAGS(Type, TypeFlag)
146
147 QXmppVCardPhone();
148 QXmppVCardPhone(const QXmppVCardPhone &other);
149 ~QXmppVCardPhone();
150
151 QXmppVCardPhone& operator=(const QXmppVCardPhone &other);
152
153 QString number() const;
154 void setNumber(const QString &number);
155
156 Type type() const;
157 void setType(Type type);
158
160 void parse(const QDomElement &element);
161 void toXml(QXmlStreamWriter *stream) const;
163
164 private:
165 QSharedDataPointer<QXmppVCardPhonePrivate> d;
166 };
167
177
178 class QXMPP_EXPORT QXmppVCardIq : public QXmppIq
179 {
180 public:
181 QXmppVCardIq(const QString& bareJid = "");
182 QXmppVCardIq(const QXmppVCardIq &other);
183 ~QXmppVCardIq();
184
185 QXmppVCardIq& operator=(const QXmppVCardIq &other);
186
187 QDate birthday() const;
188 void setBirthday(const QDate &birthday);
189
190 QString description() const;
191 void setDescription(const QString &description);
192
193 QString email() const;
194 void setEmail(const QString&);
195
196 QString firstName() const;
197 void setFirstName(const QString&);
198
199 QString fullName() const;
200 void setFullName(const QString&);
201
202 QString lastName() const;
203 void setLastName(const QString&);
204
205 QString middleName() const;
206 void setMiddleName(const QString&);
207
208 QString nickName() const;
209 void setNickName(const QString&);
210
211 QByteArray photo() const;
212 void setPhoto(const QByteArray&);
213
214 QString photoType() const;
215 void setPhotoType(const QString &type);
216
217 QString url() const;
218 void setUrl(const QString&);
219
220 QList<QXmppVCardAddress> addresses() const;
221 void setAddresses(const QList<QXmppVCardAddress> &addresses);
222
223 QList<QXmppVCardEmail> emails() const;
224 void setEmails(const QList<QXmppVCardEmail> &emails);
225
226 QList<QXmppVCardPhone> phones() const;
227 void setPhones(const QList<QXmppVCardPhone> &phones);
228
230 static bool isVCard(const QDomElement &element);
232
233 protected:
235 void parseElementFromChild(const QDomElement&);
236 void toXmlElementFromChild(QXmlStreamWriter *writer) const;
238
239 private:
240 QSharedDataPointer<QXmppVCardIqPrivate> d;
241 };
242
243 #endif // QXMPPVCARDIQ_H