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 NICKNAME_H |
9 | #define NICKNAME_H |
10 | |
11 | #include "kcontacts_export.h" |
12 | |
13 | #include <QMap> |
14 | #include <QSharedDataPointer> |
15 | #include <QString> |
16 | |
17 | class NickNameTest; |
18 | |
19 | namespace KContacts |
20 | { |
21 | class ParameterMap; |
22 | |
23 | /** @short Class that holds a NickName for a contact. |
24 | * @since 5.3 |
25 | */ |
26 | class KCONTACTS_EXPORT NickName |
27 | { |
28 | friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const NickName &); |
29 | friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, NickName &); |
30 | friend class VCardTool; |
31 | friend class ::NickNameTest; |
32 | |
33 | public: |
34 | NickName(); |
35 | NickName(const NickName &other); |
36 | NickName(const QString &nickname); |
37 | |
38 | ~NickName(); |
39 | |
40 | typedef QList<NickName> List; |
41 | |
42 | void setNickName(const QString &nickname); |
43 | Q_REQUIRED_RESULT QString nickname() const; |
44 | |
45 | Q_REQUIRED_RESULT bool isValid() const; |
46 | |
47 | Q_REQUIRED_RESULT bool operator==(const NickName &other) const; |
48 | Q_REQUIRED_RESULT bool operator!=(const NickName &other) const; |
49 | |
50 | NickName &operator=(const NickName &other); |
51 | |
52 | Q_REQUIRED_RESULT QString toString() const; |
53 | |
54 | private: |
55 | // exported for NickNameTest |
56 | void setParams(const ParameterMap ¶ms); |
57 | Q_REQUIRED_RESULT ParameterMap params() const; |
58 | |
59 | class Private; |
60 | QSharedDataPointer<Private> d; |
61 | }; |
62 | KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const NickName &object); |
63 | |
64 | KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, NickName &object); |
65 | } |
66 | Q_DECLARE_TYPEINFO(KContacts::NickName, Q_RELOCATABLE_TYPE); |
67 | #endif // NICKNAME_H |
68 | |