summaryrefslogtreecommitdiffabout
path: root/kabc/vcardparser/vcardtool.h
Unidiff
Diffstat (limited to 'kabc/vcardparser/vcardtool.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcardparser/vcardtool.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/kabc/vcardparser/vcardtool.h b/kabc/vcardparser/vcardtool.h
new file mode 100644
index 0000000..40a3b82
--- a/dev/null
+++ b/kabc/vcardparser/vcardtool.h
@@ -0,0 +1,88 @@
1/*
2 This file is part of libkabc.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#ifndef KABC_VCARDTOOL_H
22#define KABC_VCARDTOOL_H
23
24#include "addressee.h"
25#include "vcardparser.h"
26
27class QDateTime;
28
29namespace KABC {
30
31class Agent;
32class Key;
33class Picture;
34class Secrecy;
35class Sound;
36
37class VCardTool
38{
39 public:
40 VCardTool();
41 ~VCardTool();
42
43 /**
44 Creates a string that contains the addressees from the list in
45 the vCard format.
46 */
47 QString createVCards( Addressee::List list, VCard::Version version = VCard::v3_0 );
48
49 /**
50 Parses the string and returns a list of addressee objects.
51 */
52 Addressee::List parseVCards( const QString& vcard );
53
54 private:
55 /**
56 Split a string and replaces escaped separators on the fly with
57 unescaped ones.
58 */
59 QStringList splitString( const QChar &sep, const QString &value );
60
61 QDateTime parseDateTime( const QString &str );
62 QString createDateTime( const QDateTime &dateTime );
63
64 Picture parsePicture( const VCardLine &line );
65 VCardLine createPicture( const QString &identifier, const Picture &pic );
66
67 Sound parseSound( const VCardLine &line );
68 VCardLine createSound( const Sound &snd );
69
70 Key parseKey( const VCardLine &line );
71 VCardLine createKey( const Key &key );
72
73 Secrecy parseSecrecy( const VCardLine &line );
74 VCardLine createSecrecy( const Secrecy &secrecy );
75
76 Agent parseAgent( const VCardLine &line );
77 VCardLine createAgent( VCard::Version version, const Agent &agent );
78
79 QMap<QString, int> mAddressTypeMap;
80 QMap<QString, int> mPhoneTypeMap;
81
82 class VCardToolPrivate;
83 VCardToolPrivate *d;
84};
85
86}
87
88#endif