📄 vcard.h
字号:
/* Copyright (c) 2006-2008 by Jakob Schroeter <js@camaya.net> This file is part of the gloox library. http://camaya.net/gloox This software is distributed under a license. The full license agreement can be found in the file LICENSE in this distribution. This software may not be copied, modified, sold or distributed other than expressed in the named license agreement. This software is distributed without any warranty.*/#ifndef VCARD_H__#define VCARD_H__#include "gloox.h"namespace gloox{ class Tag; /** * @brief A VCard abstraction. * * See @link gloox::VCardManager VCardManager @endlink for info on how to * fetch VCards. * * @author Jakob Schroeter <js@camaya.net> * @since 0.8 */ class GLOOX_API VCard { public: /** * Addressing type indicators. * @note @c AddrTypeDom and @c AddrTypeIntl are mutually exclusive. If both are present, * @c AddrTypeDom takes precendence. * @note Also note that not all adress types are applicable everywhere. For example, * @c AddrTypeIsdn does not make sense for a postal address. Check XEP-0054 * for details. */ enum AddressType { AddrTypeHome = 1, /**< Home address. */ AddrTypeWork = 2, /**< Work address. */ AddrTypePref = 4, /**< Preferred address. */ AddrTypeX400 = 8, /**< X.400 address. */ AddrTypeInet = 16, /**< Internet address. */ AddrTypeParcel = 32, /**< Parcel address. */ AddrTypePostal = 64, /**< Postal address. */ AddrTypeDom = 128, /**< Domestic(?) address. */ AddrTypeIntl = 256, /**< International(?) address. */ AddrTypeVoice = 512, /**< Voice number. */ AddrTypeFax = 1024, /**< Fax number. */ AddrTypePager = 2048, /**< Pager. */ AddrTypeMsg = 4096, /**< MSG(?) */ AddrTypeCell = 8192, /**< Cell phone number. */ AddrTypeVideo = 16384, /**< Video chat(?). */ AddrTypeBbs = 32768, /**< BBS. */ AddrTypeModem = 65536, /**< Modem. */ AddrTypeIsdn = 131072, /**< ISDN. */ AddrTypePcs = 262144 /**< PCS. */ }; /** * A person's full name. */ struct Name { std::string family; /**< Family name. */ std::string given; /**< Given name. */ std::string middle; /**< Middle name. */ std::string prefix; /**< Name prefix. */ std::string suffix; /**< Name suffix. */ }; /** * Classifies the VCard. */ enum VCardClassification { ClassNone = 0, /**< Not classified. */ ClassPublic = 1, /**< Public. */ ClassPrivate = 2, /**< Private. */ ClassConfidential = 4 /**< Confidential. */ }; /** * Describes an email field. */ struct Email { std::string userid; /**< Email address. */ bool home; /**< Whether this is a personal address. */ bool work; /**< Whether this is a work address. */ bool internet; /**< Whether this is an internet address(?). */ bool pref; /**< Whether this is the preferred address. */ bool x400; /**< Whether this is an X.400 address. */ }; /** * A list of email fields. */ typedef std::list<Email> EmailList; /** * Describes a telephone number entry. */ struct Telephone { std::string number; /**< The phone number. */ bool home; /**< Whether this is a personal number. */ bool work; /**< Whether this is a work number. */ bool voice; /**< Whether this is a voice number. */ bool fax; /**< Whether this is a fax number. */ bool pager; /**< Whether this is a pager. */ bool msg; /**< MSG(?) */ bool cell; /**< Whether this is a cell phone. */ bool video; /**< Whether this is a video chat(?). */ bool bbs; /**< Whether this is a BBS. */ bool modem; /**< Whether this is a modem. */ bool isdn; /**< Whether this is a ISDN line(?) */ bool pcs; /**< PCS(?) */ bool pref; /**< Whether this is the preferred number. */ }; /** * A list of telephone entries. */ typedef std::list<Telephone> TelephoneList; /** * Describes an address entry. */ struct Address { std::string pobox; /**< Pobox. */ std::string extadd; /**< Extended address. */ std::string street; /**< Street. */ std::string locality; /**< Locality. */ std::string region; /**< Region. */ std::string pcode; /**< Postal code. */ std::string ctry; /**< Country. */ bool home; /**< Whether this is a personal address. */ bool work; /**< Whether this is a work address. */ bool postal; /**< Whether this is a postal address(?). */ bool parcel; /**< Whether this is a arcel address(?). */ bool pref; /**< Whether this is the preferred address. */ bool dom; /**< Whether this is a domestic(?) address. */ bool intl; /**< Whether this is an international(?) address. */ }; /** * Describes an address label. */ struct Label { StringList lines; /**< A list of lines. */ bool home; /**< Whether this is a personal address. */ bool work; /**< Whether this is a work address. */ bool postal; /**< Whether this is a postal address(?). */ bool parcel; /**< Whether this is a arcel address(?). */ bool pref; /**< Whether this is the preferred address. */ bool dom; /**< Whether this is a domestic(?) address. */ bool intl; /**< Whether this is an international(?) address. */ }; /** * Describes geo information. */ struct Geo { std::string latitude; /**< Longitude. */ std::string longitude; /**< Latitude. */ }; /** * Describes organization information. */ struct Org { std::string name; /**< The organizations name. */ StringList units; /**< A list of units in the organization * (the VCard's owner belongs to?). */ }; /** * Describes photo/logo information. */ struct Photo { std::string extval; /**< The photo is not stored inside the VCard. This is a hint (URL?) * where to look for it. */ std::string binval; /**< This is the photo (binary). */ std::string type; /**< This is a hint at the mime-type. May be forged! */ }; /** * A list of address entries. */ typedef std::list<Address> AddressList; /** * A list of address labels. */ typedef std::list<Label> LabelList; /** * Constructor. */ VCard(); /** * Constructs a new VCard from a given Tag containing appropriate fields. * @param vcard The VCard-Tag. */ VCard( Tag* vcard ); /** * Virtual destructor. */ virtual ~VCard() {} /** * Returns a Tag representation of the VCard. The caller becomes the owner of the Tag. * @return A Tag containing the VCard, or @b 0 if the VCard data is invalid. */ Tag* tag() const; /** * Sets the formatted name. * @param name The formatted name. */ void setFormattedname( const std::string& name ) { m_formattedname = name; } /** * Returns the formatted name. * @return The formatted name. */ const std::string& formattedname() const { return m_formattedname; } /** * Sets the individual name parts. Unused parts can be left empty. * @param family The family name. * @param given The given name. * @param middle The middle name(s) * @param prefix A name prefix. * @param suffix A name suffix. */ void setName( const std::string& family, const std::string& given, const std::string& middle = "", const std::string& prefix = "", const std::string& suffix = "" ); /** * Returns a full name. * @return A full name. */ const Name& name() const { return m_name; } /** * Sets a nickname. * @param nickname The nickname. */ void setNickname( const std::string& nickname ) { m_nickname = nickname; } /** * Returns the nickname. * @return The nickname. */ const std::string& nickname() const { return m_nickname; } /** * Sets a URL (homepage, etc.). * @param url The URL. */ void setUrl( const std::string& url ) { m_url = url; } /** * Returns the url. * @return The url. */ const std::string& url() const { return m_url; } /** * Sets the birthday. * @param bday The birthday, ISO 8601 formatted. */ void setBday( const std::string& bday ) { m_bday = bday; } /** * Returns the birthday. * @return The birthday. */ const std::string& bday() const { return m_bday; } /** * Sets a Jabber ID. * @param jabberid The (bare) Jabber ID (node\@host). */ void setJabberid( const std::string& jabberid ) { m_jabberid = jabberid; } /** * Returns the Jabber ID. * @return The Jabber ID. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -