File indexing completed on 2024-11-03 09:51:38

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