1 | /* |
2 | This file is part of the KContacts framework. |
3 | SPDX-FileCopyrightText: 2015-2019 Laurent Montel <montel@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef RELATED_H |
9 | #define RELATED_H |
10 | |
11 | #include "kcontacts_export.h" |
12 | |
13 | #include <QMap> |
14 | #include <QSharedDataPointer> |
15 | #include <QString> |
16 | |
17 | class RelatedTest; |
18 | |
19 | namespace KContacts |
20 | { |
21 | class ParameterMap; |
22 | |
23 | /** Describes a relationship of an Addressee. */ |
24 | class KCONTACTS_EXPORT Related |
25 | { |
26 | friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Related &); |
27 | friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Related &); |
28 | friend class VCardTool; |
29 | friend class ::RelatedTest; |
30 | |
31 | public: |
32 | Related(); |
33 | Related(const Related &other); |
34 | Related(const QString &related); |
35 | |
36 | ~Related(); |
37 | |
38 | typedef QList<Related> List; |
39 | |
40 | void setRelated(const QString &relatedTo); |
41 | Q_REQUIRED_RESULT QString related() const; |
42 | |
43 | Q_REQUIRED_RESULT bool isValid() const; |
44 | |
45 | Q_REQUIRED_RESULT bool operator==(const Related &other) const; |
46 | Q_REQUIRED_RESULT bool operator!=(const Related &other) const; |
47 | |
48 | Related &operator=(const Related &other); |
49 | |
50 | Q_REQUIRED_RESULT QString toString() const; |
51 | |
52 | private: |
53 | // exported for RelatedTest |
54 | void setParams(const ParameterMap ¶ms); |
55 | Q_REQUIRED_RESULT ParameterMap params() const; |
56 | |
57 | class Private; |
58 | QSharedDataPointer<Private> d; |
59 | }; |
60 | KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Related &object); |
61 | |
62 | KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Related &object); |
63 | } |
64 | Q_DECLARE_TYPEINFO(KContacts::Related, Q_RELOCATABLE_TYPE); |
65 | #endif // LANG_H |
66 | |