File indexing completed on 2024-10-13 04:14:43
0001 /* This file is part of the KDE project 0002 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr> 0003 Copyright (C) 2004 Alexander Dymo <cloudtemple@mskat.net> 0004 Copyright (C) 2004-2017 Jarosław Staniek <staniek@kde.org> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KPROPERTY_PROPERTYLISTDATA_H 0023 #define KPROPERTY_PROPERTYLISTDATA_H 0024 0025 #include "kpropertycore_export.h" 0026 0027 #include <QVariantList> 0028 0029 /** 0030 * @brief A data container for properties of list type. 0031 * 0032 * @since 3.1 0033 */ 0034 class KPROPERTYCORE_EXPORT KPropertyListData 0035 { 0036 public: 0037 KPropertyListData(); 0038 0039 KPropertyListData(const KPropertyListData &other); 0040 0041 KPropertyListData(const QStringList& keys, const QStringList& names); 0042 0043 KPropertyListData(const QVariantList &keys, const QVariantList &names); 0044 0045 KPropertyListData(const QVariantList &keys, const QStringList &names); 0046 0047 ~KPropertyListData(); 0048 0049 //! Assigns @a other to this KPropertyListData 0050 KPropertyListData& operator=(const KPropertyListData &other); 0051 0052 //! @return true if this KPropertyListData equals to @a other 0053 bool operator==(const KPropertyListData &other) const; 0054 0055 //! @return true if this KPropertyListData does not equal to @a other 0056 inline bool operator!=(const KPropertyListData &other) const { return !operator==(other); } 0057 0058 /** 0059 * @brief A list containing all possible keys for a property 0060 * 0061 * Items of this list are ordered, so the first key element is associated with first element 0062 * from the 'names' list, and so on. 0063 */ 0064 QVariantList keys() const; 0065 0066 /** 0067 * @brief A list containing all possible keys for a property converted to strings 0068 */ 0069 QStringList keysAsStringList() const; 0070 0071 /** 0072 * Sets a list containing all possible keys for a property 0073 * 0074 * @note each key on the list should be unique 0075 */ 0076 void setKeys(const QVariantList &keys); 0077 0078 /** 0079 * Sets a list containing all possible keys for a property as strings 0080 * 0081 * @note each key on the list should be unique 0082 */ 0083 void setKeysAsStringList(const QStringList &keys); 0084 0085 /** 0086 * @brief The list of user-visible translated name elements 0087 * 0088 * First value is referenced by first key, and so on. 0089 */ 0090 QVariantList names() const; 0091 0092 /** 0093 * @brief The list of user-visible translated name elements as strings 0094 */ 0095 QStringList namesAsStringList() const; 0096 0097 /** 0098 * Sets a list containing all possible keys for a property 0099 * 0100 * @note each key on the list should be unique 0101 */ 0102 void setNames(const QVariantList &names); 0103 0104 /** 0105 * Sets a list containing all possible keys for a property as strings 0106 * 0107 * @note each key on the list should be unique 0108 */ 0109 void setNamesAsStringList(const QStringList &names); 0110 0111 private: 0112 class Private; 0113 Private * const d; 0114 }; 0115 0116 #endif