File indexing completed on 2025-02-16 09:56:44
0001 /* 0002 This file is part of the KContacts framework. 0003 SPDX-FileCopyrightText: 2008 Tobias Koenig <tokoe@kde.org> 0004 SPDX-FileCopyrightText: 2008 Kevin Krammer <kevin.krammer@gmx.at> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KCONTACTS_CONTACTGROUPTOOL_H 0010 #define KCONTACTS_CONTACTGROUPTOOL_H 0011 0012 #include "kcontacts_export.h" 0013 #include <QString> 0014 class QIODevice; 0015 0016 template<class T> 0017 class QList; 0018 0019 namespace KContacts 0020 { 0021 class ContactGroup; 0022 0023 /** 0024 * Static methods for converting ContactGroup to XML format and vice versa. 0025 * 0026 * @author Kevin Krammer <kevin.krammer@gmx.at> 0027 * @since 4.3 0028 */ 0029 namespace ContactGroupTool 0030 { 0031 /** 0032 * Converts XML data coming from a @p device into a contact @p group. 0033 * If an error occurs, @c false is returned and @p errorMessage is set. 0034 */ 0035 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertFromXml(QIODevice *device, ContactGroup &group, QString *errorMessage = nullptr); 0036 0037 /** 0038 * Converts a contact @p group into XML data and writes them to a @p device. 0039 * If an error occurs, @c false is returned and @p errorMessage is set. 0040 */ 0041 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertToXml(const ContactGroup &group, QIODevice *device, QString *errorMessage = nullptr); 0042 0043 /** 0044 * Converts XML data coming from a @p device into a @p list of contact groups. 0045 * If an error occurs, @c false is returned and @p errorMessage is set. 0046 */ 0047 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertFromXml(QIODevice *device, QVector<ContactGroup> &list, QString *errorMessage = nullptr); 0048 0049 /** 0050 * Converts a @p list of contact groups into XML data and writes them to a @p device. 0051 * If an error occurs, @c false is returned and @p errorMessage is set. 0052 */ 0053 Q_REQUIRED_RESULT KCONTACTS_EXPORT bool convertToXml(const QVector<ContactGroup> &list, QIODevice *device, QString *errorMessage = nullptr); 0054 } 0055 } 0056 0057 #endif