X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fc2ab478989fb4effc14c06aa56fdb29d3143b35..8fda69892284144a8aea3845d2aad844021c99d2:/src/kitemviews/kitemset.h diff --git a/src/kitemviews/kitemset.h b/src/kitemviews/kitemset.h index 385010f7d..2d0137e0f 100644 --- a/src/kitemviews/kitemset.h +++ b/src/kitemviews/kitemset.h @@ -1,26 +1,15 @@ -/*************************************************************************** - * Copyright (C) 2013 by Frank Reininghaus * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2013 Frank Reininghaus + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + #ifndef KITEMSET_H #define KITEMSET_H -#include +#include "dolphin_export.h" +#include "kitemviews/kitemrange.h" /** * @brief Stores a set of integer numbers in a space-efficient way. @@ -40,11 +29,13 @@ * The complexity of most operations depends on the number of ranges. */ -class KItemSet +class DOLPHIN_EXPORT KItemSet { public: KItemSet(); KItemSet(const KItemSet& other); + ~KItemSet(); + KItemSet& operator=(const KItemSet& other); /** * Returns the number of items in the set. @@ -80,6 +71,8 @@ public: return *this; } + ~iterator() = default; + int operator*() const { return m_rangeIt->index + m_offset; @@ -157,7 +150,7 @@ public: { } - const_iterator(const iterator& other) : + explicit const_iterator(const iterator& other) : m_rangeIt(other.m_rangeIt), m_offset(other.m_offset) { @@ -170,6 +163,8 @@ public: return *this; } + ~const_iterator() = default; + int operator*() const { return m_rangeIt->index + m_offset; @@ -297,10 +292,18 @@ inline KItemSet::KItemSet(const KItemSet& other) : { } +inline KItemSet::~KItemSet() = default; + +inline KItemSet& KItemSet::operator=(const KItemSet& other) +{ + m_itemRanges=other.m_itemRanges; + return *this; +} + inline int KItemSet::count() const { int result = 0; - foreach (const KItemRange& range, m_itemRanges) { + for (const KItemRange& range : qAsConst(m_itemRanges)) { result += range.count; } return result;