1 | /* |
2 | This file is part of libkabc. |
3 | Copyright (c) 2008 Tobias Koenig <tokoe@kde.org> |
4 | Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at> |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef KABC_CONTACTGROUPTOOL_H |
23 | #define KABC_CONTACTGROUPTOOL_H |
24 | |
25 | #include "kabc_export.h" |
26 | |
27 | class QIODevice; |
28 | class QString; |
29 | |
30 | template <class T> class QList; |
31 | |
32 | namespace KABC { |
33 | |
34 | class ContactGroup; |
35 | |
36 | /** |
37 | * Static methods for converting ContactGroup to XML format and vice versa. |
38 | * |
39 | * @author Kevin Krammer <kevin.krammer@gmx.at> |
40 | * @since 4.3 |
41 | */ |
42 | namespace ContactGroupTool { |
43 | |
44 | /** |
45 | * Converts XML data coming from a @p device into a contact @p group. |
46 | * If an error occurs, @c false is returned and @p errorMessage is set. |
47 | */ |
48 | KABC_EXPORT bool convertFromXml( QIODevice *device, ContactGroup &group, |
49 | QString *errorMessage = 0 ); |
50 | |
51 | /** |
52 | * Converts a contact @p group into XML data and writes them to a @p device. |
53 | * If an error occurs, @c false is returned and @p errorMessage is set. |
54 | */ |
55 | KABC_EXPORT bool convertToXml( const ContactGroup &group, QIODevice *device, |
56 | QString *errorMessage = 0 ); |
57 | |
58 | /** |
59 | * Converts XML data coming from a @p device into a @p list of contact groups. |
60 | * If an error occurs, @c false is returned and @p errorMessage is set. |
61 | */ |
62 | KABC_EXPORT bool convertFromXml( QIODevice *device, |
63 | QList<ContactGroup> &list, |
64 | QString *errorMessage = 0 ); |
65 | |
66 | /** |
67 | * Converts a @p list of contact groups into XML data and writes them to a @p device. |
68 | * If an error occurs, @c false is returned and @p errorMessage is set. |
69 | */ |
70 | KABC_EXPORT bool convertToXml( const QList<ContactGroup> &list, |
71 | QIODevice *device, QString *errorMessage = 0 ); |
72 | } |
73 | |
74 | } |
75 | |
76 | #endif |
77 | |