File indexing completed on 2024-09-15 11:55:31
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 QVector<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 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88) 0049 /** 0050 * @deprecated Since 5.88 for lack of usage 0051 */ 0052 KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.") 0053 void setParameters(const QMap<QString, QStringList> ¶ms); 0054 #endif 0055 0056 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88) 0057 /** 0058 * @deprecated Since 5.88 for lack of usage 0059 */ 0060 Q_REQUIRED_RESULT 0061 KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.") 0062 QMap<QString, QStringList> parameters() const; 0063 #endif 0064 0065 Q_REQUIRED_RESULT bool operator==(const Lang &other) const; 0066 Q_REQUIRED_RESULT bool operator!=(const Lang &other) const; 0067 0068 Lang &operator=(const Lang &other); 0069 0070 Q_REQUIRED_RESULT QString toString() const; 0071 0072 private: 0073 // exported for LangTest 0074 void setParams(const ParameterMap ¶ms); 0075 Q_REQUIRED_RESULT ParameterMap params() const; 0076 0077 class Private; 0078 QSharedDataPointer<Private> d; 0079 }; 0080 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Lang &object); 0081 0082 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Lang &object); 0083 } 0084 Q_DECLARE_TYPEINFO(KContacts::Lang, Q_MOVABLE_TYPE); 0085 #endif // LANG_H