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 TITLE_H |
9 | #define TITLE_H |
10 | |
11 | #include "kcontacts_export.h" |
12 | |
13 | #include <QMap> |
14 | #include <QSharedDataPointer> |
15 | #include <QString> |
16 | |
17 | class TitleTest; |
18 | |
19 | namespace KContacts |
20 | { |
21 | class ParameterMap; |
22 | |
23 | /*! |
24 | * \class KContacts::Title |
25 | * \inheaderfile KContacts/Title |
26 | * \inmodule KContacts |
27 | * |
28 | * \brief Class that holds a Title for a contact. |
29 | * \since 5.3 |
30 | */ |
31 | class KCONTACTS_EXPORT Title |
32 | { |
33 | friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Title &); |
34 | friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Title &); |
35 | friend class VCardTool; |
36 | friend class ::TitleTest; |
37 | |
38 | public: |
39 | /*! |
40 | */ |
41 | Title(); |
42 | |
43 | Title(const Title &other); |
44 | |
45 | /*! |
46 | */ |
47 | Title(const QString &title); |
48 | |
49 | ~Title(); |
50 | |
51 | /*! |
52 | */ |
53 | typedef QList<Title> List; |
54 | |
55 | /*! |
56 | */ |
57 | void setTitle(const QString &title); |
58 | |
59 | /*! |
60 | */ |
61 | Q_REQUIRED_RESULT QString title() const; |
62 | |
63 | /*! |
64 | */ |
65 | Q_REQUIRED_RESULT bool isValid() const; |
66 | |
67 | /*! |
68 | */ |
69 | Q_REQUIRED_RESULT bool operator==(const Title &other) const; |
70 | |
71 | /*! |
72 | */ |
73 | Q_REQUIRED_RESULT bool operator!=(const Title &other) const; |
74 | |
75 | Title &operator=(const Title &other); |
76 | |
77 | /*! |
78 | */ |
79 | Q_REQUIRED_RESULT QString toString() const; |
80 | |
81 | private: |
82 | // exported for TitleTest |
83 | void setParams(const ParameterMap ¶ms); |
84 | Q_REQUIRED_RESULT ParameterMap params() const; |
85 | |
86 | class Private; |
87 | QSharedDataPointer<Private> d; |
88 | }; |
89 | |
90 | /*! |
91 | * \relates KContacts::Title |
92 | */ |
93 | KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Title &object); |
94 | |
95 | /*! |
96 | * \relates KContacts::Title |
97 | */ |
98 | KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Title &object); |
99 | } |
100 | Q_DECLARE_TYPEINFO(KContacts::Title, Q_RELOCATABLE_TYPE); |
101 | #endif // TITLE_H |
102 | |