1 | /* |
2 | This file is part of the KContacts framework. |
3 | SPDX-FileCopyrightText: 2008 Tobias Koenig <tokoe@kde.org> |
4 | SPDX-FileCopyrightText: 2008 Kevin Krammer <kevin.krammer@gmx.at> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef KCONTACTS_CONTACTGROUPTOOL_H |
10 | #define KCONTACTS_CONTACTGROUPTOOL_H |
11 | |
12 | #include "kcontacts_export.h" |
13 | #include <QString> |
14 | class QIODevice; |
15 | |
16 | template<class T> |
17 | class QList; |
18 | |
19 | namespace KContacts |
20 | { |
21 | class ContactGroup; |
22 | |
23 | /*! |
24 | * \namespace KContacts::ContactGroupTool |
25 | * \inheaderfile KContacts/ContactGroupTool |
26 | * \inmodule KContacts |
27 | * |
28 | * \brief Static methods for converting ContactGroup to XML format and vice versa. |
29 | * |
30 | * \since 4.3 |
31 | */ |
32 | namespace ContactGroupTool |
33 | { |
34 | /*! |
35 | * Converts XML data coming from a \a device into a contact \a group. |
36 | * If an error occurs, \c false is returned and \a errorMessage is set. |
37 | */ |
38 | Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertFromXml(QIODevice *device, ContactGroup &group, QString *errorMessage = nullptr); |
39 | |
40 | /*! |
41 | * Converts a contact \a group into XML data and writes them to a \a device. |
42 | * If an error occurs, \c false is returned and \a errorMessage is set. |
43 | */ |
44 | Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertToXml(const ContactGroup &group, QIODevice *device, QString *errorMessage = nullptr); |
45 | |
46 | /*! |
47 | * Converts XML data coming from a \a device into a \a list of contact groups. |
48 | * If an error occurs, \c false is returned and \a errorMessage is set. |
49 | */ |
50 | Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertFromXml(QIODevice *device, QList<ContactGroup> &list, QString *errorMessage = nullptr); |
51 | |
52 | /*! |
53 | * Converts a \a list of contact groups into XML data and writes them to a \a device. |
54 | * If an error occurs, \c false is returned and \a errorMessage is set. |
55 | */ |
56 | Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertToXml(const QList<ContactGroup> &list, QIODevice *device, QString *errorMessage = nullptr); |
57 | } |
58 | } |
59 | |
60 | #endif |
61 | |