File indexing completed on 2024-04-21 03:53:34

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 QList<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     Q_REQUIRED_RESULT bool operator==(const Related &other) const;
0046     Q_REQUIRED_RESULT bool operator!=(const Related &other) const;
0047 
0048     Related &operator=(const Related &other);
0049 
0050     Q_REQUIRED_RESULT QString toString() const;
0051 
0052 private:
0053     // exported for RelatedTest
0054     void setParams(const ParameterMap &params);
0055     Q_REQUIRED_RESULT ParameterMap params() const;
0056 
0057     class Private;
0058     QSharedDataPointer<Private> d;
0059 };
0060 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Related &object);
0061 
0062 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Related &object);
0063 }
0064 Q_DECLARE_TYPEINFO(KContacts::Related, Q_RELOCATABLE_TYPE);
0065 #endif // LANG_H