1/*
2 This file is part of the KContacts framework.
3 SPDX-FileCopyrightText: 2016-2019 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef ROLE_H
9#define ROLE_H
10
11#include "kcontacts_export.h"
12
13#include <QMap>
14#include <QSharedDataPointer>
15#include <QString>
16
17class RoleTest;
18
19namespace KContacts
20{
21class ParameterMap;
22
23/*!
24 * \class KContacts::Role
25 * \inheaderfile KContacts/Role
26 * \inmodule KContacts
27 *
28 * \brief Class that holds a Role for a contact.
29 * \since 5.3
30 */
31class KCONTACTS_EXPORT Role
32{
33 friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Role &);
34 friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Role &);
35 friend class VCardTool;
36 friend class ::RoleTest;
37
38public:
39 /*!
40 */
41 Role();
42
43 Role(const Role &other);
44
45 /*!
46 */
47 Role(const QString &role);
48
49 ~Role();
50
51 /*!
52 */
53 typedef QList<Role> List;
54
55 /*!
56 */
57 void setRole(const QString &role);
58
59 /*!
60 */
61 Q_REQUIRED_RESULT QString role() const;
62
63 /*!
64 */
65 Q_REQUIRED_RESULT bool isValid() const;
66
67 /*!
68 */
69 Q_REQUIRED_RESULT bool operator==(const Role &other) const;
70
71 /*!
72 */
73 Q_REQUIRED_RESULT bool operator!=(const Role &other) const;
74
75 Role &operator=(const Role &other);
76
77 /*!
78 */
79 Q_REQUIRED_RESULT QString toString() const;
80
81private:
82 // exported for RoleTest
83 void setParams(const ParameterMap &params);
84 Q_REQUIRED_RESULT ParameterMap params() const;
85
86 class Private;
87 QSharedDataPointer<Private> d;
88};
89
90/*!
91 * \relates KContacts::Role
92 */
93KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Role &object);
94
95/*!
96 * \relates KContacts::Role
97 */
98KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Role &object);
99}
100Q_DECLARE_TYPEINFO(KContacts::Role, Q_RELOCATABLE_TYPE);
101#endif // ROLE_H
102

source code of kcontacts/src/role.h