QXmpp
Version:0.9.3
|
00001 /* 00002 * Copyright (C) 2008-2014 The QXmpp developers 00003 * 00004 * Author: 00005 * Manjeet Dahiya 00006 * 00007 * Source: 00008 * https://github.com/qxmpp-project/qxmpp 00009 * 00010 * This file is a part of QXmpp library. 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2.1 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 */ 00023 00024 00025 #ifndef QXMPPVCARDIQ_H 00026 #define QXMPPVCARDIQ_H 00027 00028 #include "QXmppIq.h" 00029 #include <QDate> 00030 #include <QMap> 00031 #include <QDomElement> 00032 00033 class QXmppVCardAddressPrivate; 00034 class QXmppVCardEmailPrivate; 00035 class QXmppVCardPhonePrivate; 00036 class QXmppVCardOrganizationPrivate; 00037 class QXmppVCardIqPrivate; 00038 00040 00041 class QXMPP_EXPORT QXmppVCardAddress 00042 { 00043 public: 00045 enum TypeFlag { 00046 None = 0x0, 00047 Home = 0x1, 00048 Work = 0x2, 00049 Postal = 0x4, 00050 Preferred = 0x8 00051 }; 00052 Q_DECLARE_FLAGS(Type, TypeFlag) 00053 00054 QXmppVCardAddress(); 00055 QXmppVCardAddress(const QXmppVCardAddress &other); 00056 ~QXmppVCardAddress(); 00057 00058 QXmppVCardAddress& operator=(const QXmppVCardAddress &other); 00059 00060 QString country() const; 00061 void setCountry(const QString &country); 00062 00063 QString locality() const; 00064 void setLocality(const QString &locality); 00065 00066 QString postcode() const; 00067 void setPostcode(const QString &postcode); 00068 00069 QString region() const; 00070 void setRegion(const QString ®ion); 00071 00072 QString street() const; 00073 void setStreet(const QString &street); 00074 00075 Type type() const; 00076 void setType(Type type); 00077 00079 void parse(const QDomElement &element); 00080 void toXml(QXmlStreamWriter *stream) const; 00082 00083 private: 00084 QSharedDataPointer<QXmppVCardAddressPrivate> d; 00085 }; 00086 00087 QXMPP_EXPORT bool operator==(const QXmppVCardAddress&, const QXmppVCardAddress&); 00088 QXMPP_EXPORT bool operator!=(const QXmppVCardAddress&, const QXmppVCardAddress&); 00089 00091 00092 class QXMPP_EXPORT QXmppVCardEmail 00093 { 00094 public: 00096 enum TypeFlag { 00097 None = 0x0, 00098 Home = 0x1, 00099 Work = 0x2, 00100 Internet = 0x4, 00101 Preferred = 0x8, 00102 X400 = 0x10 00103 }; 00104 Q_DECLARE_FLAGS(Type, TypeFlag) 00105 00106 QXmppVCardEmail(); 00107 QXmppVCardEmail(const QXmppVCardEmail &other); 00108 ~QXmppVCardEmail(); 00109 00110 QXmppVCardEmail& operator=(const QXmppVCardEmail &other); 00111 00112 QString address() const; 00113 void setAddress(const QString &address); 00114 00115 Type type() const; 00116 void setType(Type type); 00117 00119 void parse(const QDomElement &element); 00120 void toXml(QXmlStreamWriter *stream) const; 00122 00123 private: 00124 QSharedDataPointer<QXmppVCardEmailPrivate> d; 00125 }; 00126 00127 QXMPP_EXPORT bool operator==(const QXmppVCardEmail&, const QXmppVCardEmail&); 00128 QXMPP_EXPORT bool operator!=(const QXmppVCardEmail&, const QXmppVCardEmail&); 00129 00131 00132 class QXMPP_EXPORT QXmppVCardPhone 00133 { 00134 public: 00136 enum TypeFlag { 00137 None = 0x0, 00138 Home = 0x1, 00139 Work = 0x2, 00140 Voice = 0x4, 00141 Fax = 0x8, 00142 Pager = 0x10, 00143 Messaging = 0x20, 00144 Cell = 0x40, 00145 Video = 0x80, 00146 BBS = 0x100, 00147 Modem = 0x200, 00148 ISDN = 0x400, 00149 PCS = 0x800, 00150 Preferred = 0x1000 00151 }; 00152 Q_DECLARE_FLAGS(Type, TypeFlag) 00153 00154 QXmppVCardPhone(); 00155 QXmppVCardPhone(const QXmppVCardPhone &other); 00156 ~QXmppVCardPhone(); 00157 00158 QXmppVCardPhone& operator=(const QXmppVCardPhone &other); 00159 00160 QString number() const; 00161 void setNumber(const QString &number); 00162 00163 Type type() const; 00164 void setType(Type type); 00165 00167 void parse(const QDomElement &element); 00168 void toXml(QXmlStreamWriter *stream) const; 00170 00171 private: 00172 QSharedDataPointer<QXmppVCardPhonePrivate> d; 00173 }; 00174 00175 QXMPP_EXPORT bool operator==(const QXmppVCardPhone&, const QXmppVCardPhone&); 00176 QXMPP_EXPORT bool operator!=(const QXmppVCardPhone&, const QXmppVCardPhone&); 00177 00182 00183 class QXMPP_EXPORT QXmppVCardOrganization 00184 { 00185 public: 00186 QXmppVCardOrganization(); 00187 QXmppVCardOrganization(const QXmppVCardOrganization &other); 00188 ~QXmppVCardOrganization(); 00189 00190 QXmppVCardOrganization& operator=(const QXmppVCardOrganization &other); 00191 00192 QString organization() const; 00193 void setOrganization(const QString&); 00194 00195 QString unit() const; 00196 void setUnit(const QString&); 00197 00198 QString title() const; 00199 void setTitle(const QString&); 00200 00201 QString role() const; 00202 void setRole(const QString&); 00203 00205 void parse(const QDomElement &element); 00206 void toXml(QXmlStreamWriter *stream) const; 00208 00209 private: 00210 QSharedDataPointer<QXmppVCardOrganizationPrivate> d; 00211 }; 00212 00213 QXMPP_EXPORT bool operator==(const QXmppVCardOrganization&, const QXmppVCardOrganization&); 00214 QXMPP_EXPORT bool operator!=(const QXmppVCardOrganization&, const QXmppVCardOrganization&); 00215 00225 00226 class QXMPP_EXPORT QXmppVCardIq : public QXmppIq 00227 { 00228 public: 00229 QXmppVCardIq(const QString& bareJid = QString()); 00230 QXmppVCardIq(const QXmppVCardIq &other); 00231 ~QXmppVCardIq(); 00232 00233 QXmppVCardIq& operator=(const QXmppVCardIq &other); 00234 00235 QDate birthday() const; 00236 void setBirthday(const QDate &birthday); 00237 00238 QString description() const; 00239 void setDescription(const QString &description); 00240 00241 QString email() const; 00242 void setEmail(const QString&); 00243 00244 QString firstName() const; 00245 void setFirstName(const QString&); 00246 00247 QString fullName() const; 00248 void setFullName(const QString&); 00249 00250 QString lastName() const; 00251 void setLastName(const QString&); 00252 00253 QString middleName() const; 00254 void setMiddleName(const QString&); 00255 00256 QString nickName() const; 00257 void setNickName(const QString&); 00258 00259 QByteArray photo() const; 00260 void setPhoto(const QByteArray&); 00261 00262 QString photoType() const; 00263 void setPhotoType(const QString &type); 00264 00265 QString url() const; 00266 void setUrl(const QString&); 00267 00268 QList<QXmppVCardAddress> addresses() const; 00269 void setAddresses(const QList<QXmppVCardAddress> &addresses); 00270 00271 QList<QXmppVCardEmail> emails() const; 00272 void setEmails(const QList<QXmppVCardEmail> &emails); 00273 00274 QList<QXmppVCardPhone> phones() const; 00275 void setPhones(const QList<QXmppVCardPhone> &phones); 00276 00277 QXmppVCardOrganization organization() const; 00278 void setOrganization(const QXmppVCardOrganization&); 00279 00281 static bool isVCard(const QDomElement &element); 00283 00284 protected: 00286 void parseElementFromChild(const QDomElement&); 00287 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00289 00290 private: 00291 QSharedDataPointer<QXmppVCardIqPrivate> d; 00292 }; 00293 00294 QXMPP_EXPORT bool operator==(const QXmppVCardIq&, const QXmppVCardIq&); 00295 QXMPP_EXPORT bool operator!=(const QXmppVCardIq&, const QXmppVCardIq&); 00296 00297 #endif // QXMPPVCARDIQ_H