File indexing completed on 2024-04-28 03:53:33
0001 /* 0002 This file is part of the KContacts framework. 0003 SPDX-FileCopyrightText: 2003 Tobias Koenig <tokoe@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef VCARDLINE_H 0009 #define VCARDLINE_H 0010 0011 #include <QString> 0012 #include <QStringList> 0013 #include <QVariant> 0014 0015 #include "kcontacts_export.h" 0016 0017 #include "../parametermap_p.h" 0018 0019 namespace KContacts 0020 { 0021 class KCONTACTS_EXPORT VCardLine 0022 { 0023 public: 0024 typedef QList<VCardLine> List; 0025 0026 VCardLine(); 0027 VCardLine(const QString &identifier); 0028 VCardLine(const QString &identifier, const QVariant &value); 0029 VCardLine(const VCardLine &line); 0030 0031 ~VCardLine(); 0032 0033 VCardLine &operator=(const VCardLine &line); 0034 0035 /** 0036 * Equality operator. 0037 * 0038 */ 0039 Q_REQUIRED_RESULT bool operator==(const VCardLine &other) const; 0040 0041 /** 0042 * Sets the identifier of this line e.g. UID, FN, CLASS 0043 * 0044 * @param identifier The VCard identifier of this line 0045 */ 0046 void setIdentifier(const QString &identifier); 0047 0048 /** 0049 * Returns the identifier of this line. 0050 */ 0051 Q_REQUIRED_RESULT QString identifier() const; 0052 0053 /** 0054 * Sets the value of this line. 0055 */ 0056 void setValue(const QVariant &value); 0057 0058 /** 0059 * Returns the value of this line. 0060 */ 0061 Q_REQUIRED_RESULT QVariant value() const; 0062 0063 /** 0064 * Sets the group the line belongs to. 0065 */ 0066 void setGroup(const QString &group); 0067 0068 /** 0069 * Returns the group the line belongs to. 0070 */ 0071 Q_REQUIRED_RESULT QString group() const; 0072 0073 /** 0074 * Returns whether the line belongs to a group. 0075 */ 0076 Q_REQUIRED_RESULT bool hasGroup() const; 0077 0078 /** 0079 * Returns all parameters. 0080 */ 0081 Q_REQUIRED_RESULT QStringList parameterList() const; 0082 0083 /** 0084 * Add a new parameter to the line. 0085 * 0086 * @param param Name of the parameter to insert 0087 * @param value Value of the parameter to insert 0088 */ 0089 void addParameter(const QString ¶m, const QString &value); 0090 0091 void addParameters(const ParameterMap ¶ms); 0092 0093 /** 0094 * Returns the values of a special parameter. 0095 * You can get a list of all parameters with paramList(). 0096 * 0097 * @param param Name of the parameter to look for 0098 */ 0099 Q_REQUIRED_RESULT QStringList parameters(const QString ¶m) const; 0100 0101 /** 0102 * Returns only the first value of a special parameter. 0103 * You can get a list of all parameters with paramList(). 0104 * 0105 * @param param Name of the parameter to look for 0106 */ 0107 Q_REQUIRED_RESULT QString parameter(const QString ¶m) const; 0108 0109 /** 0110 * Returns all parameters 0111 */ 0112 Q_REQUIRED_RESULT ParameterMap parameterMap() const; 0113 0114 private: 0115 ParameterMap mParamMap; 0116 QString mIdentifier; 0117 QString mGroup; 0118 QVariant mValue; 0119 }; 0120 } 0121 0122 #endif