File indexing completed on 2024-03-24 05:55:59
0001 /* 0002 This file is part of the Okteta Core library, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2007, 2009 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef OKTETA_BOOKMARKLIST_HPP 0010 #define OKTETA_BOOKMARKLIST_HPP 0011 0012 // lib 0013 #include "bookmark.hpp" 0014 // Qt 0015 #include <QLinkedList> 0016 0017 template <class T> class QVector; 0018 0019 namespace Okteta { 0020 0021 /** 0022 @author Friedrich W. H. Kossebau 0023 */ 0024 class BookmarkList : public QLinkedList<Bookmark> 0025 { 0026 public: 0027 BookmarkList(); 0028 BookmarkList(const BookmarkList&) = default; 0029 0030 ~BookmarkList(); 0031 0032 BookmarkList& operator=(const BookmarkList&) = delete; 0033 0034 public: 0035 void addBookmark(const Bookmark& bookmark); 0036 void addBookmarks(const QVector<Okteta::Bookmark>& bookmarks); 0037 void removeBookmark(const Bookmark& bookmark); 0038 void removeBookmarks(const QVector<Okteta::Bookmark>& bookmarks); 0039 void setBookmark(unsigned int index, const Bookmark& bookmark); 0040 0041 bool adjustToReplaced(Address offset, Size removedLength, Size insertedLength); 0042 bool adjustToSwapped(Address firstPartStart, Address secondPartStart, Size secondPartLength); 0043 0044 public: 0045 // TODO: this function needs to be called with a valid offset, will return a reference to a zero pointer else 0046 // want a reference for speed, perhaps need a global static dummy invalid bookmark 0047 const Bookmark& bookmark(Address offset) const; 0048 bool contains(Address offset) const; 0049 using QLinkedList<Bookmark>::contains; 0050 const Bookmark& at(unsigned int index) const; 0051 QVector<Okteta::Bookmark> list() const; 0052 }; 0053 0054 } 0055 0056 #endif