File indexing completed on 2025-02-09 04:21:25
0001 /* 0002 This file is part of the KContacts framework. 0003 SPDX-FileCopyrightText: 2015-2019 Laurent Montel <montel@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef LANG_H 0009 #define LANG_H 0010 0011 #include "kcontacts_export.h" 0012 0013 #include <QMap> 0014 #include <QSharedDataPointer> 0015 #include <QString> 0016 0017 class LangTest; 0018 0019 namespace KContacts 0020 { 0021 class ParameterMap; 0022 0023 /** @short Class that holds a Language for a contact. 0024 * @since 4.14.5 0025 */ 0026 class KCONTACTS_EXPORT Lang 0027 { 0028 friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Lang &); 0029 friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Lang &); 0030 friend class Addressee; 0031 friend class VCardTool; 0032 friend class ::LangTest; 0033 0034 public: 0035 Lang(); 0036 Lang(const Lang &other); 0037 Lang(const QString &language); 0038 0039 ~Lang(); 0040 0041 typedef QList<Lang> List; 0042 0043 void setLanguage(const QString &lang); 0044 Q_REQUIRED_RESULT QString language() const; 0045 0046 Q_REQUIRED_RESULT bool isValid() const; 0047 0048 Q_REQUIRED_RESULT bool operator==(const Lang &other) const; 0049 Q_REQUIRED_RESULT bool operator!=(const Lang &other) const; 0050 0051 Lang &operator=(const Lang &other); 0052 0053 Q_REQUIRED_RESULT QString toString() const; 0054 0055 private: 0056 // exported for LangTest 0057 void setParams(const ParameterMap ¶ms); 0058 Q_REQUIRED_RESULT ParameterMap params() const; 0059 0060 class Private; 0061 QSharedDataPointer<Private> d; 0062 }; 0063 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Lang &object); 0064 0065 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Lang &object); 0066 } 0067 Q_DECLARE_TYPEINFO(KContacts::Lang, Q_RELOCATABLE_TYPE); 0068 #endif // LANG_H