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
17class LangTest;
18
19namespace KContacts
20{
21class ParameterMap;
22
23/** @short Class that holds a Language for a contact.
24 * @since 4.14.5
25 */
26class KCONTACTS_EXPORT Lang
27{
28 friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Lang &);
29 friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Lang &);
30 friend class Addressee;
31 friend class VCardTool;
32 friend class ::LangTest;
33
34public:
35 Lang();
36 Lang(const Lang &other);
37 Lang(const QString &language);
38
39 ~Lang();
40
41 typedef QList<Lang> List;
42
43 void setLanguage(const QString &lang);
44 Q_REQUIRED_RESULT QString language() const;
45
46 Q_REQUIRED_RESULT bool isValid() const;
47
48 Q_REQUIRED_RESULT bool operator==(const Lang &other) const;
49 Q_REQUIRED_RESULT bool operator!=(const Lang &other) const;
50
51 Lang &operator=(const Lang &other);
52
53 Q_REQUIRED_RESULT QString toString() const;
54
55private:
56 // exported for LangTest
57 void setParams(const ParameterMap &params);
58 Q_REQUIRED_RESULT ParameterMap params() const;
59
60 class Private;
61 QSharedDataPointer<Private> d;
62};
63KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Lang &object);
64
65KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Lang &object);
66}
67Q_DECLARE_TYPEINFO(KContacts::Lang, Q_RELOCATABLE_TYPE);
68#endif // LANG_H
69

source code of kcontacts/src/lang.h