3 /// Conversion routines for vcards
7 Copyright (C) 2006-2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_SYNC_VCARD_H__
23 #define __BARRY_SYNC_VCARD_H__
26 #include "r_contact.h"
30 namespace Barry
{ namespace Sync
{
35 /// Class for converting between RFC 2425/2426 vCard data format,
36 /// and the Barry::Contact class.
38 class vCard
: public vBase
40 // data to pass to external requests
41 char *m_gCardData
; // dynamic memory returned by vformat()... can
42 // be used directly by the plugin, without
43 // overmuch allocation and freeing (see Extract())
44 std::string m_vCardData
;// copy of m_gCardData, for C++ use
45 Barry::Contact m_BarryContact
;
48 void AddAddress(const char *rfc_type
, const Barry::PostalAddress
&addr
);
49 void AddCategories(const Barry::CategoryList
&categories
);
50 void AddPhoneCond(const std::string
&phone
);
51 void AddPhoneCond(const char *rfc_type
, const std::string
&phone
);
53 void ParseAddress(vAttr
&adr
, Barry::PostalAddress
&address
);
54 void ParseCategories(vAttr
&cat
, Barry::CategoryList
&cats
);
60 const std::string
& ToVCard(const Barry::Contact
&con
);
61 const Barry::Contact
& ToBarry(const char *vcal
, uint32_t RecordId
);
63 const std::string
& GetVCard() const { return m_vCardData
; }
64 const Barry::Contact
& GetBarryContact() const { return m_BarryContact
; }
71 }} // namespace Barry::Sync