File indexing completed on 2024-04-28 04:21:25
0001 /* 0002 SPDX-FileCopyrightText: 2006-2010 Tuomas Suutari <thsuut@utu.fi> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 0006 This program is distributed in the hope that it will be useful, but 0007 WITHOUT ANY WARRANTY; without even the implied warranty of 0008 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0009 General Public License for more details. 0010 0011 You should have received a copy of the GNU General Public License 0012 along with this program (see the file COPYING); if not, write to the 0013 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 0014 MA 02110-1301 USA. 0015 */ 0016 0017 #ifndef UTILITIES_LIST_H 0018 #define UTILITIES_LIST_H 0019 0020 #include <QList> 0021 #include <QVariant> 0022 0023 namespace Utilities 0024 { 0025 /** Merge two lists to one list without duplicating items. 0026 * 0027 * Returned list will have items of l1 in original order followed 0028 * by those items of l2 that are not in l1. 0029 */ 0030 template <class T> 0031 QList<T> mergeListsUniqly(const QList<T> &l1, const QList<T> &l2); 0032 0033 /** Shuffle a list. 0034 * 0035 * Returned list will have same items as the given list, but in 0036 * random order. 0037 */ 0038 template <class T> 0039 QList<T> shuffleList(const QList<T> &list); 0040 } 0041 0042 #endif /* UTILITIES_LIST_H */ 0043 // vi:expandtab:tabstop=4 shiftwidth=4: