/usr/include/ptclib/vcard.h is in libpt-dev 2.10.11~dfsg-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | /*
* vcard.h
*
* Class to represent and parse a vCard as per RFC2426
*
* Portable Windows Library
*
* Copyright (c) 2010 Vox Lucida Pty Ltd
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Tools Library.
*
* The Initial Developer of the Original Code is Vox Lucida Pty Ltd
*
* Contributor(s): ______________________________________.
*
* $Revision: 26015 $
* $Author: rjongbloed $
* $Date: 2011-06-14 02:31:10 -0500 (Tue, 14 Jun 2011) $
*/
#ifndef PTLIB_VCARD_H
#define PTLIB_VCARD_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptclib/url.h>
/**Class to represent a vCard as per RFC2426.
*/
class PvCard : public PObject
{
PCLASSINFO(PvCard, PObject);
public:
PvCard();
bool IsValid() const;
virtual void PrintOn(
ostream & strm
) const;
virtual void ReadFrom(
istream & strm
);
bool Parse(
const PString & str
);
/** Output string formats.
If operator<< or PrintOn() is used the stream width() parameter
may be set to this to indicate the output format. e.g.
<CODE>
stream << setw(PvCard::e_XML_XMPP) << card;
</CODE>
*/
enum Format {
e_Standard, ///< As per RFC2425
e_XML_XMPP, ///< Jabber XML
e_XML_RDF, ///< W3C version
e_XML_RFC ///< Draft RFC
};
PString AsString(
Format fmt = e_Standard
);
/// Representation of token (EBNF group, name, iana-token or x-name)
class Token : public PCaselessString
{
public:
Token(const char * str = NULL) : PCaselessString(str) { Validate(); }
Token(const PString & str) : PCaselessString(str) { Validate(); }
Token & operator=(const char * str) { PCaselessString::operator=(str); Validate(); return *this; }
Token & operator=(const PString & str) { PCaselessString::operator=(str); Validate(); return *this; }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
private:
void Validate();
};
class Separator : public PObject
{
public:
Separator(char c = '\0') : m_separator(c) { }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
bool operator==(char c) const { return m_separator == c; }
bool operator!=(char c) const { return m_separator != c; }
char m_separator;
};
/// Representation of EBNF param-value
class ParamValue : public PString
{
public:
ParamValue(const char * str = NULL) : PString(str) { }
ParamValue(const PString & str) : PString(str) { }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
};
/// Comma separated list of param-value's
class ParamValues : public PArray<ParamValue>
{
public:
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
};
typedef std::map<Token, ParamValues> ParamMap;
class TypeValues : public ParamValues
{
public:
TypeValues() { }
TypeValues(const ParamValues & values) : ParamValues(values) { }
virtual void PrintOn(ostream & strm) const;
};
/// Representation of EBNF text-value
class TextValue : public PString
{
public:
TextValue(const char * str = NULL) : PString(str) { }
TextValue(const PString & str) : PString(str) { }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
};
/// Comma separated list of text-value's
class TextValues : public PArray<TextValue>
{
public:
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
};
class URIValue : public PURL
{
public:
URIValue(const char * str = NULL) : PURL(str) { }
URIValue(const PString & str) : PURL(str) { }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
};
/// Representation of EBNF img-inline-value/snd-inline-value
class InlineValue : public URIValue
{
public:
InlineValue(const char * str = NULL) : URIValue(str), m_params(NULL) { }
InlineValue(const PString & str) : URIValue(str), m_params(NULL) { }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
InlineValue & ReadFromParam(const ParamMap & params);
private:
const ParamMap * m_params;
};
Token m_group;
TextValue m_fullName; // Mandatory
TextValue m_version; // Mandatory
TextValue m_familyName;
TextValue m_givenName;
TextValues m_additionalNames;
TextValue m_honorificPrefixes;
TextValue m_honorificSuffixes;
TextValues m_nickNames;
TextValue m_sortString; // Form of name for sorting, e.g. family name;
PTime m_birthday;
URIValue m_url;
InlineValue m_photo; // Possibly embedded via data: scheme
InlineValue m_sound; // Possibly embedded via data: scheme
TextValue m_timeZone;
double m_latitude;
double m_longitude;
TextValue m_title;
TextValue m_role;
InlineValue m_logo; // Possibly embedded via data: scheme
TextValue m_agent;
TextValue m_organisationName;
TextValue m_organisationUnit;
TextValue m_mailer;
TextValues m_categories;
TextValue m_note;
TextValue m_productId;
TextValue m_guid;
TextValue m_revision;
TextValue m_class;
TextValue m_publicKey;
struct MultiValue : public PObject {
MultiValue() { }
MultiValue(const PString & type) { m_types.Append(new ParamValue(type)); }
TypeValues m_types; // e.g. "home", "work", "pref" etc
void SetTypes(const ParamMap & params);
};
struct Address : public MultiValue {
Address(bool label = false) : m_label(label) { }
virtual void PrintOn(ostream & strm) const;
virtual void ReadFrom(istream & strm);
bool m_label;
TextValue m_postOfficeBox;
TextValue m_extendedAddress;
TextValue m_street; // Including number "123 Main Street"
TextValue m_locality; // Suburb/city
TextValue m_region; // State/province
TextValue m_postCode;
TextValue m_country;
};
PArray<Address> m_addresses;
PArray<Address> m_labels;
struct Telephone : public MultiValue {
Telephone() { }
Telephone(const PString & number, const PString & type = PString::Empty())
: MultiValue(type)
, m_number(number)
{ }
virtual void PrintOn(ostream & strm) const;
TextValue m_number;
};
PArray<Telephone> m_telephoneNumbers;
struct EMail : public MultiValue {
EMail() { }
EMail(const PString & address, const PString & type = PString::Empty())
: MultiValue(type)
, m_address(address)
{ }
virtual void PrintOn(ostream & strm) const;
TextValue m_address;
};
PArray<EMail> m_emailAddresses;
struct ExtendedType {
ParamMap m_parameters;
TextValue m_value;
};
typedef std::map<Token, ExtendedType> ExtendedTypeMap;
ExtendedTypeMap m_extensions;
};
#endif // PTLIB_VCARD_H
// End of File ///////////////////////////////////////////////////////////////
|