File indexing completed on 2024-12-08 12:16:59

0001 /*
0002     This file is part of the KContacts framework.
0003     SPDX-FileCopyrightText: 2016-2019 Laurent Montel <montel@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef FIELDGROUP_H
0009 #define FIELDGROUP_H
0010 
0011 #include "kcontacts_export.h"
0012 
0013 #include <QMap>
0014 #include <QSharedDataPointer>
0015 #include <QString>
0016 
0017 class FieldGroupTest;
0018 
0019 namespace KContacts
0020 {
0021 class ParameterMap;
0022 
0023 /** @short Class that holds a FieldGroup for a contact.
0024  *  @since 5.3
0025  */
0026 class KCONTACTS_EXPORT FieldGroup
0027 {
0028     friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const FieldGroup &);
0029     friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, FieldGroup &);
0030     friend class VCardTool;
0031     friend class ::FieldGroupTest;
0032 
0033 public:
0034     FieldGroup();
0035     FieldGroup(const FieldGroup &other);
0036     FieldGroup(const QString &fieldGroupName);
0037 
0038     ~FieldGroup();
0039 
0040     typedef QVector<FieldGroup> List;
0041 
0042     void setFieldGroupName(const QString &fieldGroup);
0043     Q_REQUIRED_RESULT QString fieldGroupName() const;
0044 
0045     Q_REQUIRED_RESULT bool isValid() const;
0046 
0047     void setValue(const QString &value);
0048     Q_REQUIRED_RESULT QString value() const;
0049 
0050 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
0051     /**
0052      * @deprecated Since 5.88 for lack of usage
0053      */
0054     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
0055     void setParameters(const QMap<QString, QStringList> &params);
0056 #endif
0057 
0058 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
0059     /**
0060      * @deprecated Since 5.88 for lack of usage
0061      */
0062     Q_REQUIRED_RESULT
0063     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
0064     QMap<QString, QStringList> parameters() const;
0065 #endif
0066 
0067     Q_REQUIRED_RESULT bool operator==(const FieldGroup &other) const;
0068     Q_REQUIRED_RESULT bool operator!=(const FieldGroup &other) const;
0069 
0070     FieldGroup &operator=(const FieldGroup &other);
0071 
0072     Q_REQUIRED_RESULT QString toString() const;
0073 
0074 private:
0075     void setParams(const ParameterMap &params);
0076     Q_REQUIRED_RESULT ParameterMap params() const;
0077 
0078     class Private;
0079     QSharedDataPointer<Private> d;
0080 };
0081 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const FieldGroup &object);
0082 
0083 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, FieldGroup &object);
0084 }
0085 Q_DECLARE_TYPEINFO(KContacts::FieldGroup, Q_MOVABLE_TYPE);
0086 #endif // FIELDGROUP_H