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