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>
14class QIODevice;
15
16template<class T>
17class QList;
18
19namespace KContacts
20{
21class ContactGroup;
22
23/**
24 * Static methods for converting ContactGroup to XML format and vice versa.
25 *
26 * @author Kevin Krammer <kevin.krammer@gmx.at>
27 * @since 4.3
28 */
29namespace ContactGroupTool
30{
31/**
32 * Converts XML data coming from a @p device into a contact @p group.
33 * If an error occurs, @c false is returned and @p errorMessage is set.
34 */
35Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertFromXml(QIODevice *device, ContactGroup &group, QString *errorMessage = nullptr);
36
37/**
38 * Converts a contact @p group into XML data and writes them to a @p device.
39 * If an error occurs, @c false is returned and @p errorMessage is set.
40 */
41Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertToXml(const ContactGroup &group, QIODevice *device, QString *errorMessage = nullptr);
42
43/**
44 * Converts XML data coming from a @p device into a @p list of contact groups.
45 * If an error occurs, @c false is returned and @p errorMessage is set.
46 */
47Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertFromXml(QIODevice *device, QList<ContactGroup> &list, QString *errorMessage = nullptr);
48
49/**
50 * Converts a @p list of contact groups into XML data and writes them to a @p device.
51 * If an error occurs, @c false is returned and @p errorMessage is set.
52 */
53Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertToXml(const QList<ContactGroup> &list, QIODevice *device, QString *errorMessage = nullptr);
54}
55}
56
57#endif
58

source code of kcontacts/src/contactgrouptool.h